GlMatrixTransformation


@UnstableApi
interface GlMatrixTransformation : GlEffect

Known direct subclasses
MatrixTransformation

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

Known indirect 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 4x4 transformation Matrix to apply in the vertex shader for each input frame.

The matrix is applied to points given in normalized device coordinates (-1 to 1 on x, y, and z 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 functions

Size!
configure(inputWidth: Int, inputHeight: Int)

Configures the input and output dimensions.

FloatArray<Float>!
getGlMatrixArray(presentationTimeUs: Long)

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

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

Returns a GlShaderProgram that applies the effect.

Inherited functions

From androidx.media3.common.Effect
Long

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

From androidx.media3.effect.GlEffect
Boolean
isNoOp(inputWidth: Int, inputHeight: Int)

Returns whether a GlEffect applies no change at every timestamp.

Public functions

configure

fun configure(inputWidth: Int, inputHeight: Int): Size!

Configures the input and output dimensions.

Must be called before getGlMatrixArray.

Parameters
inputWidth: Int

The input frame width, in pixels.

inputHeight: Int

The input frame height, in pixels.

Returns
Size!

The output frame width and height, in pixels.

getGlMatrixArray

fun getGlMatrixArray(presentationTimeUs: Long): FloatArray<Float>!

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

toGlShaderProgram

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

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 .