TimestampWrapper


@UnstableApi
public final class TimestampWrapper implements GlEffect


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

Summary

Public fields

final long
final GlEffect
final long

Public constructors

TimestampWrapper(
    GlEffect glEffect,
    @IntRange(from = 0) long startTimeUs,
    @IntRange(from = 0) long endTimeUs
)

Creates a new instance.

Public methods

boolean
isNoOp(int inputWidth, int inputHeight)

Returns whether a GlEffect applies no change at every timestamp.

GlShaderProgram
toGlShaderProgram(Context context, boolean useHdr)

Returns a GlShaderProgram that applies the effect.

Inherited methods

From androidx.media3.common.Effect
long

Returns the expected duration of the output stream when the effect is applied given a input durationUs.

Public fields

endTimeUs

public final long endTimeUs

glEffect

public final GlEffect glEffect

startTimeUs

public final long startTimeUs

Public constructors

TimestampWrapper

public TimestampWrapper(
    GlEffect glEffect,
    @IntRange(from = 0) long startTimeUs,
    @IntRange(from = 0) long endTimeUs
)

Creates a new instance.

Parameters
GlEffect glEffect

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

@IntRange(from = 0) long startTimeUs

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

@IntRange(from = 0) long endTimeUs

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

Public methods

isNoOp

public boolean isNoOp(int inputWidth, int inputHeight)

Returns whether a GlEffect applies no change at every timestamp.

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

Parameters
int inputWidth

The input frame width, in pixels.

int inputHeight

The input frame height, in pixels.

toGlShaderProgram

public GlShaderProgram toGlShaderProgram(Context context, boolean useHdr)

Returns a GlShaderProgram that applies the effect.

Parameters
Context context

A Context.

boolean useHdr

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 .