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(
    inputIndex: Int,
    textureProducer: GlTextureProducer!,
    inputTexture: GlTextureInfo!,
    colorInfo: ColorInfo!,
    presentationTimeUs: Long
)

Queues an input texture to be composited.

Unit
registerInputSource(inputIndex: Int)

Registers a new input source.

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(
    inputIndex: Int,
    textureProducer: GlTextureProducer!,
    inputTexture: GlTextureInfo!,
    colorInfo: ColorInfo!,
    presentationTimeUs: Long
): Unit

Queues an input texture to be composited.

Parameters
inputIndex: Int

The index of the input source, the same index used when registering the input source.

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(inputIndex: Int): Unit

Registers a new input source.

Parameters
inputIndex: Int

The index of the input source which could be used to determine the order of the input sources. The same index should to be used in queueInputTexture. All inputs must be registered before queueing textures.

release

fun release(): Unit

Releases all resources.

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

signalEndOfInputSource

fun signalEndOfInputSource(inputIndex: Int): Unit

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

Parameters
inputIndex: Int

The index of the input source.