ByteBufferGlEffect.Processor
interface ByteBufferGlEffect.Processor<T>
A processor that takes in ByteBuffers that represent input image data, and produces results of type <T>.
All methods are called on the GL thread.
| Parameters | |
|---|---|
<T> |
The result type of running the processor. |
Summary
Public functions |
|
|---|---|
Size! |
Configures the instance and returns the dimensions of the image required by |
Unit |
finishProcessingAndBlend(Finishes processing the frame at |
GlRect! |
getScaledRegion(presentationTimeUs: Long)Selects a region of the input texture that will be scaled to fill the image that is given to |
ListenableFuture<T!>! |
processImage(image: ByteBufferGlEffect.Image!, presentationTimeUs: Long)Processing the image data in the |
Unit |
release()Releases all resources. |
Public functions
configure
fun configure(inputWidth: Int, inputHeight: Int): Size!
Configures the instance and returns the dimensions of the image required by processImage.
When the returned dimensions differ from inputWidth and inputHeight, the image will be scaled based on getScaledRegion.
| Returns | |
|---|---|
Size! |
The size in pixels of the image data accepted by |
| Throws | |
|---|---|
androidx.media3.common.VideoFrameProcessingException |
On error. |
finishProcessingAndBlend
fun finishProcessingAndBlend(
outputFrame: GlTextureInfo!,
presentationTimeUs: Long,
result: T!
): Unit
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: GlTextureInfo! |
The texture info of the frame. |
presentationTimeUs: Long |
The presentation timestamp of the frame, in microseconds. |
result: T! |
The result of the asynchronous computation in |
getScaledRegion
fun getScaledRegion(presentationTimeUs: Long): GlRect!
Selects a region of the input texture that will be scaled to fill the image that is given to processImage.
Called once per input frame.
The contents are scaled to fit the image dimensions returned by configure.
| Parameters | |
|---|---|
presentationTimeUs: Long |
The presentation time in microseconds. |
| Returns | |
|---|---|
GlRect! |
The rectangular region of the input image that will be scaled to fill the effect input image. |
processImage
fun processImage(image: ByteBufferGlEffect.Image!, presentationTimeUs: Long): ListenableFuture<T!>!
Processing the image data in the image.
Accessing image after the returned future is done or cancelled can lead to undefined behaviour.
| Parameters | |
|---|---|
image: ByteBufferGlEffect.Image! |
The image data. |
presentationTimeUs: Long |
The presentation time in microseconds. |
| Returns | |
|---|---|
ListenableFuture<T!>! |
A |
release
fun release(): Unit
Releases all resources.
| Throws | |
|---|---|
androidx.media3.common.VideoFrameProcessingException |
If an error occurs while releasing resources. |