TimestampWrapper


@UnstableApi
class TimestampWrapper : GlEffect


Applies a GlEffect from startTimeUs to endTimeUs, and no change on all other timestamps.

This currently does not work with ExoPlayer#setVideoEffects.

Summary

Public constructors

TimestampWrapper(
    glEffect: GlEffect!,
    startTimeUs: @IntRange(from = 0) Long,
    endTimeUs: @IntRange(from = 0) Long
)

Creates a new instance.

Public functions

Boolean
isNoOp(inputWidth: Int, inputHeight: Int)

Returns whether a GlEffect applies no change at every timestamp.

GlShaderProgram!
toGlShaderProgram(context: Context!, useHdr: Boolean)

Returns a GlShaderProgram that applies the effect.

Public constructors

TimestampWrapper

TimestampWrapper(
    glEffect: GlEffect!,
    startTimeUs: @IntRange(from = 0) Long,
    endTimeUs: @IntRange(from = 0) Long
)

Creates a new instance.

Parameters
glEffect: GlEffect!

The GlEffect to apply, from startTimeUs to endTimeUs. This instance must not change the output dimensions.

startTimeUs: @IntRange(from = 0) Long

The time to begin applying glEffect on, in microseconds. Must be non-negative.

endTimeUs: @IntRange(from = 0) Long

The time to stop applying {code glEffect} on, in microseconds. Must be non-negative.

Public functions

isNoOp

fun isNoOp(inputWidth: Int, inputHeight: Int): Boolean

Returns whether a GlEffect applies no change at every timestamp.

This can be used as a hint to skip this instance.

Parameters
inputWidth: Int

The input frame width, in pixels.

inputHeight: Int

The input frame height, in pixels.

toGlShaderProgram

fun toGlShaderProgram(context: Context!, useHdr: Boolean): GlShaderProgram!

Returns a GlShaderProgram that applies the effect.

Parameters
context: Context!

A Context.

useHdr: Boolean

Whether input textures come from an HDR source. If true, colors will be in linear RGB BT.2020. If false, colors will be in linear RGB BT.709.

Throws
androidx.media3.common.VideoFrameProcessingException

If an error occurs while creating the .

Public properties

endTimeUs

val endTimeUsLong

glEffect

val glEffectGlEffect!

startTimeUs

val startTimeUsLong