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 inputId,
    GlTextureProducer textureProducer,
    GlTextureInfo inputTexture,
    ColorInfo colorInfo,
    long presentationTimeUs
)

Queues an input texture to be composited.

abstract int

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

abstract void

Releases all resources.

abstract void

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 inputId,
    GlTextureProducer textureProducer,
    GlTextureInfo inputTexture,
    ColorInfo colorInfo,
    long presentationTimeUs
)

Queues an input texture to be composited.

Parameters
int inputId

The identifier for an input source, returned from registerInputSource.

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 int registerInputSource()

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

release

abstract void release()

Releases all resources.

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

signalEndOfInputSource

abstract void signalEndOfInputSource(int inputId)

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

Parameters
int inputId

The identifier for an input source, returned from registerInputSource.