OverlayEffect


@UnstableApi
public final class OverlayEffect implements GlEffect


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

This effect assumes a non-linear working color space for SDR input and a linear working color space or HDR input.

Summary

Public constructors

Creates a new instance for the given list of TextureOverlays.

Public methods

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

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

Returns whether a GlEffect applies no change at every timestamp.

Public constructors

OverlayEffect

public OverlayEffect(ImmutableList<TextureOverlay> textureOverlays)

Creates a new instance for the given list of TextureOverlays.

Parameters
ImmutableList<TextureOverlay> textureOverlays

The TextureOverlays to be blended into the frame.

Public methods

toGlShaderProgram

public BaseGlShaderProgram 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 .