@UnstableApi
public interface GlEffect extends Effect

Known direct subclasses
AlphaScale

Scales the alpha value (i.e. the translucency) of a frame.

ByteBufferGlEffect

A GlEffect implementation that runs an asynchronous Processor on video frame data passed in as a ByteBufferGlEffect.Image.

ColorLut

Specifies color transformations using color lookup tables to apply to each frame in the fragment shader.

FrameCache

Caches the input frames.

FrameDropEffect

Drops frames to lower average frame rate to around targetFrameRate.

GlMatrixTransformation

Specifies a 4x4 transformation Matrix to apply in the vertex shader for each input frame.

HslAdjustment

Adjusts the HSL (Hue, Saturation, and Lightness) of a frame.

LanczosResample

A GlEffect that applies a Lanczos-windowed sinc function when resampling an image.

OverlayEffect

Applies a list of TextureOverlays to a frame in FIFO order (the last overlay in the list is displayed on top).

RgbMatrix

Specifies a 4x4 RGB color transformation matrix to apply to each frame in the fragment shader.

SeparableConvolution

A GlEffect for performing separable convolutions.

SpeedChangeEffect

Applies a speed change by updating the frame timestamps.

TimestampAdjustment

Changes the frame timestamps using the TimestampMap.

TimestampWrapper

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

Known indirect subclasses
Brightness

Modifies brightness of an input frame.

Contrast

A RgbMatrix to control the contrast of video frames.

Crop

Specifies a crop to apply in the vertex shader.

GaussianBlurWithFrameOverlaid

A SeparableConvolution to apply a Gaussian blur on image data.

GaussianBlur

A SeparableConvolution to apply a Gaussian blur on image data.

MatrixTransformation

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

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).

RgbAdjustment

Scales the red, green, and blue color channels of a frame.

RgbFilter

Provides common color filters.

ScaleAndRotateTransformation

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

SingleColorLut

Transforms the colors of a frame by applying the same color lookup table to each frame.


Interface for a video frame effect with a GlShaderProgram implementation.

Implementations contain information specifying the effect and can be converted to a GlShaderProgram which applies the effect.

Summary

Public methods

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.

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.

Public methods

isNoOp

default 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

abstract 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 .