ByteBufferGlEffect


@UnstableApi
class ByteBufferGlEffect<T> : 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.

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

Public constructors

Creates an instance.

Public functions

GlShaderProgram!
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 constructors

ByteBufferGlEffect

ByteBufferGlEffect(processor: ByteBufferGlEffect.Processor<T!>!)

Creates an instance.

Parameters
processor: ByteBufferGlEffect.Processor<T!>!

The effect to apply.

Public functions

toGlShaderProgram

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

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 .