VideoCompositor


@UnstableApi
public interface VideoCompositor extends 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

public interface VideoCompositor.Listener

Listener for errors.

Public methods

abstract void
queueInputTexture(
    int inputIndex,
    GlTextureProducer textureProducer,
    GlTextureInfo inputTexture,
    ColorInfo colorInfo,
    long presentationTimeUs
)

Queues an input texture to be composited.

abstract void
registerInputSource(int inputIndex)

Registers a new input source.

abstract void

Releases all resources.

abstract void
signalEndOfInputSource(int inputIndex)

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

Inherited methods

From androidx.media3.effect.GlTextureProducer
abstract void
releaseOutputTexture(long presentationTimeUs)

Releases the output texture at the given presentationTimeUs.

Public methods

queueInputTexture

abstract void queueInputTexture(
    int inputIndex,
    GlTextureProducer textureProducer,
    GlTextureInfo inputTexture,
    ColorInfo colorInfo,
    long presentationTimeUs
)

Queues an input texture to be composited.

Parameters
int inputIndex

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

GlTextureProducer textureProducer

The source from where the inputTexture is produced.

GlTextureInfo inputTexture

The GlTextureInfo to composite.

ColorInfo colorInfo

The ColorInfo of inputTexture.

long presentationTimeUs

The presentation time of inputTexture, in microseconds.

registerInputSource

abstract void registerInputSource(int inputIndex)

Registers a new input source.

Parameters
int inputIndex

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

abstract void release()

Releases all resources.

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

signalEndOfInputSource

abstract void signalEndOfInputSource(int inputIndex)

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

Parameters
int inputIndex

The index of the input source.