VideoCompositor


@UnstableApi
interface VideoCompositor : GlTextureProducer

Known direct subclasses
DefaultVideoCompositor

A basic VideoCompositor implementation that takes in frames from input sources' streams and combines them into one output stream.


Interface for a video compositor that combines frames from multiple input sources to produce output frames.

Input and output are provided via OpenGL textures.

Methods may be called from any thread.

Summary

Nested types

Listener for errors.

Public functions

Unit
queueInputTexture(
    inputId: Int,
    textureProducer: GlTextureProducer!,
    inputTexture: GlTextureInfo!,
    colorInfo: ColorInfo!,
    presentationTimeUs: Long
)

Queues an input texture to be composited.

Int

Registers a new input source, and returns a unique inputId corresponding to this source, to be used in queueInputTexture.

Unit

Releases all resources.

Unit

Signals that no more frames will come from the upstream GlTextureProducer.Listener.

Inherited functions

From androidx.media3.effect.GlTextureProducer
Unit
releaseOutputTexture(presentationTimeUs: Long)

Releases the output texture at the given presentationTimeUs.

Public functions

queueInputTexture

fun queueInputTexture(
    inputId: Int,
    textureProducer: GlTextureProducer!,
    inputTexture: GlTextureInfo!,
    colorInfo: ColorInfo!,
    presentationTimeUs: Long
): Unit

Queues an input texture to be composited.

Parameters
inputId: Int

The identifier for an input source, returned from registerInputSource.

textureProducer: GlTextureProducer!

The source from where the inputTexture is produced.

inputTexture: GlTextureInfo!

The GlTextureInfo to composite.

colorInfo: ColorInfo!

The ColorInfo of inputTexture.

presentationTimeUs: Long

The presentation time of inputTexture, in microseconds.

registerInputSource

fun registerInputSource(): Int

Registers a new input source, and returns a unique inputId corresponding to this source, to be used in queueInputTexture.

release

fun release(): Unit

Releases all resources.

This VideoCompositor instance must not be used after this method is called.

signalEndOfInputSource

fun signalEndOfInputSource(inputId: Int): Unit

Signals that no more frames will come from the upstream GlTextureProducer.Listener.

Parameters
inputId: Int

The identifier for an input source, returned from registerInputSource.