MatrixTransformation


@UnstableApi
public interface MatrixTransformation extends GlMatrixTransformation

Known direct subclasses
Crop

Specifies a crop to apply in the vertex shader.

Presentation

Controls how a frame is presented with options to set the output resolution and choose how to map the input pixels onto the output frame geometry (for example, by stretching the input frame to match the specified output frame, or fitting the input frame using letterboxing).

ScaleAndRotateTransformation

Specifies a simple rotation and/or scale to apply in the vertex shader.


Specifies a 3x3 transformation Matrix to apply in the vertex shader for each frame.

The matrix is applied to points given in normalized device coordinates (-1 to 1 on x and y axes). Transformed pixels that are moved outside of the normal device coordinate range are clipped.

Output frame pixels outside of the transformed input frame will be black, with alpha = 0 if applicable.

Summary

Public methods

default float[]
getGlMatrixArray(long presentationTimeUs)

Returns the 4x4 transformation Matrix to apply to the frame with the given timestamp.

abstract Matrix
getMatrix(long presentationTimeUs)

Returns the 3x3 transformation Matrix to apply to the frame with the given timestamp.

Inherited methods

From androidx.media3.common.Effect
default long

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

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

Returns whether a GlEffect applies no change at every timestamp.

abstract GlShaderProgram
toGlShaderProgram(Context context, boolean useHdr)

Returns a GlShaderProgram that applies the effect.

From androidx.media3.effect.GlMatrixTransformation
default Size
configure(int inputWidth, int inputHeight)

Configures the input and output dimensions.

default BaseGlShaderProgram
toGlShaderProgram(Context context, boolean useHdr)

Returns a GlShaderProgram that applies the effect.

Public methods

getGlMatrixArray

default float[] getGlMatrixArray(long presentationTimeUs)

Returns the 4x4 transformation Matrix to apply to the frame with the given timestamp.

getMatrix

abstract Matrix getMatrix(long presentationTimeUs)

Returns the 3x3 transformation Matrix to apply to the frame with the given timestamp.