# VideoCompositor

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/effect/VideoCompositor "View this page in Java")

<br />

```
@UnstableApi
interface VideoCompositor : GlTextureProducer
```

<br />

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

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

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [queueInputTexture](https://developer.android.com/reference/kotlin/androidx/media3/effect/VideoCompositor#queueInputTexture(int,androidx.media3.effect.GlTextureProducer,androidx.media3.common.GlTextureInfo,androidx.media3.common.ColorInfo,long))`(` ` inputIndex: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` textureProducer: `[GlTextureProducer](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureProducer)`!,` ` inputTexture: `[GlTextureInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/GlTextureInfo)`!,` ` colorInfo: `[ColorInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo)`!,` ` presentationTimeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) `)` Queues an input texture to be composited. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [registerInputSource](https://developer.android.com/reference/kotlin/androidx/media3/effect/VideoCompositor#registerInputSource(int))`(inputIndex: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Registers a new input source.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [release](https://developer.android.com/reference/kotlin/androidx/media3/effect/VideoCompositor#release())`()` Releases all resources.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [setVideoCompositorSettings](https://developer.android.com/reference/kotlin/androidx/media3/effect/VideoCompositor#setVideoCompositorSettings(androidx.media3.common.VideoCompositorSettings))`(` ` videoCompositorSettings: `[VideoCompositorSettings](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoCompositorSettings)`!` `)` Sets the[VideoCompositorSettings](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoCompositorSettings)to apply to inputs.                                                                                                                                                                                                                                                                                                                                                                       |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [signalEndOfInputSource](https://developer.android.com/reference/kotlin/androidx/media3/effect/VideoCompositor#signalEndOfInputSource(int))`(inputIndex: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Signals that no more frames will come from the upstream[GlTextureProducer.Listener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureProducer.Listener).                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                             ### Inherited functions                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[androidx.media3.effect.GlTextureProducer](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureProducer) |-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [releaseOutputTexture](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureProducer#releaseOutputTexture(long))`(presentationTimeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` 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](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                          | The index of the input source, the same index used when[registering the input source](https://developer.android.com/reference/kotlin/androidx/media3/effect/VideoCompositor#registerInputSource(int)). |
| `textureProducer: `[GlTextureProducer](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureProducer)`!` | The source from where the`inputTexture`is produced.                                                                                                                                                    |
| `inputTexture: `[GlTextureInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/GlTextureInfo)`!`            | The[GlTextureInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/GlTextureInfo)to composite.                                                                                   |
| `colorInfo: `[ColorInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo)`!`                       | The[ColorInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo)of`inputTexture`.                                                                                       |
| `presentationTimeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                                | The presentation time of`inputTexture`, in microseconds.                                                                                                                                               |

### registerInputSource

```
fun registerInputSource(inputIndex: Int): Unit
```

Registers a new input source.  

|                                        Parameters                                         |
|-------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `inputIndex: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | 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](https://developer.android.com/reference/kotlin/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[queueing](https://developer.android.com/reference/kotlin/androidx/media3/effect/VideoCompositor#queueInputTexture(int,androidx.media3.effect.GlTextureProducer,androidx.media3.common.GlTextureInfo,androidx.media3.common.ColorInfo,long))textures. |

### release

```
fun release(): Unit
```

Releases all resources.

This[VideoCompositor](https://developer.android.com/reference/kotlin/androidx/media3/effect/VideoCompositor)instance must not be used after this method is called.  

### setVideoCompositorSettings

```
fun setVideoCompositorSettings(
    videoCompositorSettings: VideoCompositorSettings!
): Unit
```

Sets the[VideoCompositorSettings](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoCompositorSettings)to apply to inputs.  

### signalEndOfInputSource

```
fun signalEndOfInputSource(inputIndex: Int): Unit
```

Signals that no more frames will come from the upstream[GlTextureProducer.Listener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlTextureProducer.Listener).  

|                                        Parameters                                         |
|-------------------------------------------------------------------------------------------|--------------------------------|
| `inputIndex: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The index of the input source. |