ByteBufferGlEffect


@UnstableApi
public class ByteBufferGlEffect<T> implements GlEffect


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

This effect can be used to apply CPU-based effects. Or the provided can be passed to other heterogeneous compute components that are available such as another GPU context, FPGAs, or NPUs.

Summary

Nested types

A class that represents image data is backed by a ByteBuffer.

public interface ByteBufferGlEffect.Processor<T>

A processor that takes in ByteBuffers that represent input image data, and produces results of type <T>.

Public constructors

Creates an instance.

Public methods

GlShaderProgram
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

ByteBufferGlEffect

public ByteBufferGlEffect(ByteBufferGlEffect.Processor<T> processor)

Creates an instance.

Parameters
ByteBufferGlEffect.Processor<T> processor

The effect to apply.

Public methods

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 .