# VideoCompositor

Artifact: [androidx.media3:media3-effect](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/effect/VideoCompositor.java+class:androidx.media3.effect.VideoCompositor)

*** ** * ** ***


```
@UnstableApi
public interface VideoCompositor extends GlTextureProducer
```

<br />

Known direct subclasses [DefaultVideoCompositor](https://developer.android.com/reference/androidx/media3/effect/DefaultVideoCompositor)

|---|---|
| `https://developer.android.com/reference/androidx/media3/effect/DefaultVideoCompositor` | A basic `https://developer.android.com/reference/androidx/media3/effect/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 https://developer.android.com/reference/androidx/media3/effect/VideoCompositor.Listener` Listener for errors. |

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/media3/effect/VideoCompositor#queueInputTexture(int,androidx.media3.effect.GlTextureProducer,androidx.media3.common.GlTextureInfo,androidx.media3.common.ColorInfo,long)( int inputIndex, https://developer.android.com/reference/androidx/media3/effect/GlTextureProducer textureProducer, https://developer.android.com/reference/androidx/media3/common/GlTextureInfo inputTexture, https://developer.android.com/reference/androidx/media3/common/ColorInfo colorInfo, long presentationTimeUs )` Queues an input texture to be composited. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/effect/VideoCompositor#registerInputSource(int)(int inputIndex)` Registers a new input source. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/effect/VideoCompositor#release()()` Releases all resources. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/effect/VideoCompositor#setVideoCompositorSettings(androidx.media3.common.VideoCompositorSettings)( https://developer.android.com/reference/androidx/media3/common/VideoCompositorSettings videoCompositorSettings )` Sets the `https://developer.android.com/reference/androidx/media3/common/VideoCompositorSettings` to apply to inputs. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/effect/VideoCompositor#signalEndOfInputSource(int)(int inputIndex)` Signals that no more frames will come from the upstream `https://developer.android.com/reference/androidx/media3/effect/GlTextureProducer.Listener`. |

| ### Inherited methods |
|---|
| From [androidx.media3.effect.GlTextureProducer](https://developer.android.com/reference/androidx/media3/effect/GlTextureProducer) |---|---| | `abstract void` | `https://developer.android.com/reference/androidx/media3/effect/GlTextureProducer#releaseOutputTexture(long)(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 `https://developer.android.com/reference/androidx/media3/effect/VideoCompositor#registerInputSource(int)`. |
| `https://developer.android.com/reference/androidx/media3/effect/GlTextureProducer textureProducer` | The source from where the `inputTexture` is produced. |
| `https://developer.android.com/reference/androidx/media3/common/GlTextureInfo inputTexture` | The `https://developer.android.com/reference/androidx/media3/common/GlTextureInfo` to composite. |
| `https://developer.android.com/reference/androidx/media3/common/ColorInfo colorInfo` | The `https://developer.android.com/reference/androidx/media3/common/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 `https://developer.android.com/reference/androidx/media3/effect/VideoCompositor#queueInputTexture(int,androidx.media3.effect.GlTextureProducer,androidx.media3.common.GlTextureInfo,androidx.media3.common.ColorInfo,long)`. All inputs must be registered before `https://developer.android.com/reference/androidx/media3/effect/VideoCompositor#queueInputTexture(int,androidx.media3.effect.GlTextureProducer,androidx.media3.common.GlTextureInfo,androidx.media3.common.ColorInfo,long)` textures. |

### release

```
abstract void release()
```

Releases all resources.

This `https://developer.android.com/reference/androidx/media3/effect/VideoCompositor` instance must not be used after this method is called.

### setVideoCompositorSettings

```
abstract void setVideoCompositorSettings(
    VideoCompositorSettings videoCompositorSettings
)
```

Sets the `https://developer.android.com/reference/androidx/media3/common/VideoCompositorSettings` to apply to inputs.

### signalEndOfInputSource

```
abstract void signalEndOfInputSource(int inputIndex)
```

Signals that no more frames will come from the upstream `https://developer.android.com/reference/androidx/media3/effect/GlTextureProducer.Listener`.

| Parameters |
|---|---|
| `int inputIndex` | The index of the input source. |