TimestampAdjustment


@UnstableApi
public final class TimestampAdjustment implements GlEffect


Changes the frame timestamps using the TimestampMap.

This effect doesn't drop any frames.

This effect is not supported for effects previewing.

Summary

Nested types

Maps input timestamps to output timestamps asynchronously.

Public constructors

TimestampAdjustment(
    TimestampAdjustment.TimestampMap timestampMap,
    SpeedProvider speedProvider
)

Creates an instance.

Public methods

long

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

GlShaderProgram
toGlShaderProgram(Context context, boolean useHdr)

Returns a GlShaderProgram that applies the effect.

Inherited methods

From androidx.media3.effect.GlEffect
boolean
isNoOp(int inputWidth, int inputHeight)

Returns whether a GlEffect applies no change at every timestamp.

Public fields

speedProvider

public final SpeedProvider speedProvider

timestampMap

public final TimestampAdjustment.TimestampMap timestampMap

Public constructors

TimestampAdjustment

public TimestampAdjustment(
    TimestampAdjustment.TimestampMap timestampMap,
    SpeedProvider speedProvider
)

Creates an instance.

Parameters
TimestampAdjustment.TimestampMap timestampMap

The TimestampMap

SpeedProvider speedProvider

The SpeedProvider specifying the approximate speed adjustments the TimestampMap should be applying.

Public methods

getDurationAfterEffectApplied

public long getDurationAfterEffectApplied(long durationUs)

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

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 .