SingleFrameGlShaderProgram


@UnstableApi
public abstract class SingleFrameGlShaderProgram extends BaseGlShaderProgram


Manages a GLSL shader program for processing a frame. Implementations generally copy input pixels into an output frame, with changes to pixels specific to the implementation.

SingleFrameGlShaderProgram implementations must produce exactly one output frame per input frame with the same presentation timestamp. For more flexibility, implement directly.

All methods in this class must be called on the thread that owns the OpenGL context.

Summary

Public constructors

SingleFrameGlShaderProgram(boolean useHighPrecisionColorComponents)

Creates a SingleFrameGlShaderProgram instance.

Inherited methods

From androidx.media3.effect.BaseGlShaderProgram
abstract Size
configure(int inputWidth, int inputHeight)

Configures the instance based on the input dimensions.

abstract void
drawFrame(int inputTexId, long presentationTimeUs)

Draws one frame.

void

Flushes the GlShaderProgram.

final GlShaderProgram.InputListener
final GlShaderProgram.OutputListener
final void
void
queueInputFrame(
    GlObjectsProvider glObjectsProvider,
    GlTextureInfo inputTexture,
    long presentationTimeUs
)

Processes an input frame if possible.

void

Releases all resources.

void

Notifies the GlShaderProgram that the frame on the given output texture is no longer used and can be overwritten.

void
setErrorListener(
    Executor errorListenerExecutor,
    GlShaderProgram.ErrorListener errorListener
)

Sets the ErrorListener.

void

Sets the InputListener.

void

Sets the OutputListener.

boolean

Returns true if the texture buffer should be cleared before calling drawFrame or false if it should retain the content of the last drawn frame.

void

Notifies the GlShaderProgram that no further input frames belonging to the current input stream will be queued.

From androidx.media3.effect.GlShaderProgram
abstract void
setErrorListener(
    Executor executor,
    GlShaderProgram.ErrorListener errorListener
)

Sets the ErrorListener.

Public constructors

SingleFrameGlShaderProgram

public SingleFrameGlShaderProgram(boolean useHighPrecisionColorComponents)

Creates a SingleFrameGlShaderProgram instance.

Parameters
boolean useHighPrecisionColorComponents

If false, uses colors with 8-bit unsigned bytes. If true, use 16-bit (half-precision) floating-point.