public interface

ByteBufferGlEffect.Processor<T>

 androidx.media3.effect.ByteBufferGlEffect.Processor<T>

Overview

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

All methods are called on the GL thread.

Summary

Methods
public Sizeconfigure(int inputWidth, int inputHeight)

Configures the instance and returns the dimensions of the image required by ByteBufferGlEffect.Processor.processImage(ByteBufferGlEffect.Image, long).

public voidfinishProcessingAndBlend(GlTextureInfo outputFrame, long presentationTimeUs, java.lang.Object result)

Finishes processing the frame at presentationTimeUs.

public GlRectgetScaledRegion(long presentationTimeUs)

Selects a region of the input texture that will be scaled to fill the image that is given to ByteBufferGlEffect.Processor.processImage(ByteBufferGlEffect.Image, long).

public <any>processImage(ByteBufferGlEffect.Image image, long presentationTimeUs)

Processing the image data in the image.

public voidrelease()

Releases all resources.

Methods

public Size configure(int inputWidth, int inputHeight)

Configures the instance and returns the dimensions of the image required by ByteBufferGlEffect.Processor.processImage(ByteBufferGlEffect.Image, long).

When the returned dimensions differ from inputWidth and inputHeight, the image will be scaled based on ByteBufferGlEffect.Processor.getScaledRegion(long).

Parameters:

inputWidth: The input width in pixels.
inputHeight: The input height in pixels.

Returns:

The size in pixels of the image data accepted by ByteBufferGlEffect.Processor.processImage(ByteBufferGlEffect.Image, long).

public GlRect getScaledRegion(long presentationTimeUs)

Selects a region of the input texture that will be scaled to fill the image that is given to ByteBufferGlEffect.Processor.processImage(ByteBufferGlEffect.Image, long).

Called once per input frame.

The contents are scaled to fit the image dimensions returned by ByteBufferGlEffect.Processor.configure(int, int).

Parameters:

presentationTimeUs: The presentation time in microseconds.

Returns:

The rectangular region of the input image that will be scaled to fill the effect input image.

public <any> processImage(ByteBufferGlEffect.Image image, long presentationTimeUs)

Processing the image data in the image.

Accessing image after the returned future is done or cancelled can lead to undefined behaviour.

Parameters:

image: The image data.
presentationTimeUs: The presentation time in microseconds.

Returns:

A of the result.

public void finishProcessingAndBlend(GlTextureInfo outputFrame, long presentationTimeUs, java.lang.Object result)

Finishes processing the frame at presentationTimeUs. Use this method to perform custom drawing on the output frame.

The outputFrame contains the image data corresponding to the frame at presentationTimeUs when this method is invoked.

Parameters:

outputFrame: The texture info of the frame.
presentationTimeUs: The presentation timestamp of the frame, in microseconds.
result: The result of the asynchronous computation in ByteBufferGlEffect.Processor.processImage(ByteBufferGlEffect.Image, long).

public void release()

Releases all resources.