# VideoFrameProcessor

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

*** ** * ** ***

<br />

```
@UnstableApi
interface VideoFrameProcessor
```

<br />

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

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultVideoFrameProcessor` | A `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor` implementation that applies `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlEffect` instances using OpenGL on a background thread. |

*** ** * ** ***

Interface for a video frame processor that applies changes to individual video frames.

The changes are specified by `https://developer.android.com/reference/kotlin/androidx/media3/common/Effect` instances passed to `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)`.

Manages its input `https://developer.android.com/reference/android/view/Surface.html`, which can be accessed via `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#getInputSurface()`. The output `https://developer.android.com/reference/android/view/Surface.html` must be set by the caller using `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#setOutputSurfaceInfo(androidx.media3.common.SurfaceInfo)`.

`VideoFrameProcessor` instances can be created from any thread, but instance methods for each `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` must be called from the same thread.

## Summary

| ### Nested types |
|---|
| `interface https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Factory` A factory for `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor` instances. |
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) @https://developer.android.com/reference/kotlin/androidx/annotation/IntDef(value = ) annotation https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.InputType` Specifies how the input frames are made available to the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor`. |
| `interface https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Listener` Listener for asynchronous frame processing events. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#DROP_OUTPUT_FRAME() = -2` Indicates the frame should be dropped after `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)` is invoked. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_BITMAP() = 2` Input frames come from a `https://developer.android.com/reference/android/graphics/Bitmap.html`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE() = 1` Input frames come from a `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#getInputSurface()`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE_AUTOMATIC_FRAME_REGISTRATION() = 4` Input frames come from the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#getInputSurface()` and don't need to be `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputFrame()` (unlike with `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_TEXTURE_ID() = 3` Input frames come from a `https://developer.android.com/reference/android/opengl/GLES10.html#GL_TEXTURE_2D`. |
| `const https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/kotlin/androidx/media3/common/Effect!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#REDRAW()` A marker for passing to `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` to signal a redraw. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#RENDER_OUTPUT_FRAME_IMMEDIATELY() = -1` **This property is deprecated.** Pass `https://developer.android.com/reference/kotlin/androidx/media3/common/util/SystemClock#nanoTime()` to `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)` to render an output frame immediately. <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#RENDER_OUTPUT_FRAME_WITH_PRESENTATION_TIME() = -3` Indicates the frame should preserve the input presentation time when `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)` is invoked. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#flush()()` Flushes the `VideoFrameProcessor`. |
| `https://developer.android.com/reference/android/view/Surface.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#getInputSurface()()` Returns the input `https://developer.android.com/reference/android/view/Surface.html`, where `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor` consumes input frames from. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#getPendingInputFrameCount()()` Returns the number of input frames that have been made available to the ` VideoFrameProcessor` but have not been processed yet. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#queueInputBitmap(android.graphics.Bitmap,androidx.media3.common.util.TimestampIterator)( inputBitmap: https://developer.android.com/reference/android/graphics/Bitmap.html!, timestampIterator: https://developer.android.com/reference/kotlin/androidx/media3/common/util/TimestampIterator! )` Provides an input `https://developer.android.com/reference/android/graphics/Bitmap.html` to the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#queueInputTexture(int,long)(textureId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Provides an input texture ID to the `VideoFrameProcessor`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#redraw()()` Updates an `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameAvailableForRendering(long,boolean)` with the modified effects. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputFrame()()` Informs the `VideoFrameProcessor` that a frame will be queued to its `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#getInputSurface()`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)( @https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.InputType inputType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!, effects: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/Effect!>!, offsetToAddUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html )` Informs the `VideoFrameProcessor` that a new input stream will be queued with the list of `https://developer.android.com/reference/kotlin/androidx/media3/common/Effect` to apply to the new input stream. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#release()()` Releases all resources. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)(renderTimeNs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Renders the oldest unrendered output frame that has become `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameAvailableForRendering(long,boolean)` at the given `renderTimeNs`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#setOnInputFrameProcessedListener(androidx.media3.common.OnInputFrameProcessedListener)( listener: https://developer.android.com/reference/kotlin/androidx/media3/common/OnInputFrameProcessedListener! )` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/common/OnInputFrameProcessedListener`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#setOnInputSurfaceReadyListener(java.lang.Runnable)(listener: https://developer.android.com/reference/java/lang/Runnable.html!)` Sets a listener that's called when the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#getInputSurface()` is ready to use. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#setOutputSurfaceInfo(androidx.media3.common.SurfaceInfo)(outputSurfaceInfo: https://developer.android.com/reference/kotlin/androidx/media3/common/SurfaceInfo?)` Sets the output surface and supporting information. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#signalEndOfInput()()` Informs the `VideoFrameProcessor` that no further input frames should be accepted. |

## Constants

### DROP_OUTPUT_FRAME

```
const val DROP_OUTPUT_FRAME = -2: Long
```

Indicates the frame should be dropped after `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)` is invoked.

### INPUT_TYPE_BITMAP

```
const val INPUT_TYPE_BITMAP = 2: Int
```

Input frames come from a `https://developer.android.com/reference/android/graphics/Bitmap.html`.

### INPUT_TYPE_SURFACE

```
const val INPUT_TYPE_SURFACE = 1: Int
```

Input frames come from a `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#getInputSurface()`.

When receiving input from a Surface, the caller must `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputFrame()` input frames before rendering them to the input `https://developer.android.com/reference/android/view/Surface.html`.

### INPUT_TYPE_SURFACE_AUTOMATIC_FRAME_REGISTRATION

```
const val INPUT_TYPE_SURFACE_AUTOMATIC_FRAME_REGISTRATION = 4: Int
```

Input frames come from the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#getInputSurface()` and don't need to be `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputFrame()` (unlike with `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`).

Every frame must use the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` frame format. Also sets the surface's `https://developer.android.com/reference/android/graphics/SurfaceTexture.html#setDefaultBufferSize(int, int)`.

### INPUT_TYPE_TEXTURE_ID

```
const val INPUT_TYPE_TEXTURE_ID = 3: Int
```

Input frames come from a `https://developer.android.com/reference/android/opengl/GLES10.html#GL_TEXTURE_2D`.

### REDRAW

```
const val REDRAW: ImmutableList<Effect!>!
```

A marker for passing to `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` to signal a redraw.

### RENDER_OUTPUT_FRAME_IMMEDIATELY

```
const val RENDER_OUTPUT_FRAME_IMMEDIATELY = -1: Long
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Pass `https://developer.android.com/reference/kotlin/androidx/media3/common/util/SystemClock#nanoTime()` to `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)` to render an output frame immediately.

### RENDER_OUTPUT_FRAME_WITH_PRESENTATION_TIME

```
const val RENDER_OUTPUT_FRAME_WITH_PRESENTATION_TIME = -3: Long
```

Indicates the frame should preserve the input presentation time when `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#renderOutputFrame(long)` is invoked.

## Public functions

### flush

```
fun flush(): Unit
```

Flushes the `VideoFrameProcessor`.

All the frames that are `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputFrame()` prior to calling this method are no longer considered to be registered when this method returns.

`https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Listener` methods invoked prior to calling this method should be ignored.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | If the `VideoFrameProcessor` does not accept `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`. |

### getInputSurface

```
fun getInputSurface(): Surface!
```

Returns the input `https://developer.android.com/reference/android/view/Surface.html`, where `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor` consumes input frames from.

The frames arriving on the `https://developer.android.com/reference/android/view/Surface.html` will not be consumed by the ` VideoFrameProcessor` until `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` is called with `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`.

For streams with `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`, the returned surface is ready to use immediately and will not have a `https://developer.android.com/reference/android/graphics/SurfaceTexture.html#setDefaultBufferSize(int, int)` set on it. This is suitable for configuring a `https://developer.android.com/reference/android/media/MediaCodec.html` decoder.

For streams with `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE_AUTOMATIC_FRAME_REGISTRATION()`, set a listener for the surface becoming ready via `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#setOnInputSurfaceReadyListener(java.lang.Runnable)` and wait for the event before using the returned surface. This is suitable for use with non-decoder producers like media projection.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | If the `VideoFrameProcessor` does not accept `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`. |

### getPendingInputFrameCount

```
fun getPendingInputFrameCount(): Int
```

Returns the number of input frames that have been made available to the ` VideoFrameProcessor` but have not been processed yet.

### queueInputBitmap

```
fun queueInputBitmap(
    inputBitmap: Bitmap!,
    timestampIterator: TimestampIterator!
): Boolean
```

Provides an input `https://developer.android.com/reference/android/graphics/Bitmap.html` to the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor`.

Can be called many times after `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` to put multiple frames in the same input stream.

An implementation could `https://developer.android.com/reference/android/graphics/Bitmap.html#recycle()` the passed in `https://developer.android.com/reference/android/graphics/Bitmap.html`, so it may not be suitable for reuse.

| Parameters |
|---|---|
| `inputBitmap: https://developer.android.com/reference/android/graphics/Bitmap.html!` | The `https://developer.android.com/reference/android/graphics/Bitmap.html` queued to the `VideoFrameProcessor`. |
| `timestampIterator: https://developer.android.com/reference/kotlin/androidx/media3/common/util/TimestampIterator!` | A `https://developer.android.com/reference/kotlin/androidx/media3/common/util/TimestampIterator` generating the exact timestamps that the bitmap should be shown at. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the `https://developer.android.com/reference/android/graphics/Bitmap.html` was successfully queued. A return value of `false` indicates the `VideoFrameProcessor` is not ready to accept input. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | If the `VideoFrameProcessor` does not accept `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_BITMAP()`. |

### queueInputTexture

```
fun queueInputTexture(textureId: Int, presentationTimeUs: Long): Boolean
```

Provides an input texture ID to the `VideoFrameProcessor`.

It must be only called after `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#setOnInputFrameProcessedListener(androidx.media3.common.OnInputFrameProcessedListener)` and `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` have been called.

| Parameters |
|---|---|
| `textureId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The ID of the texture queued to the `VideoFrameProcessor`. |
| `presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The presentation time of the queued texture, in microseconds. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the texture was successfully queued. A return value of `false` indicates the `VideoFrameProcessor` is not ready to accept input. |

### redraw

```
fun redraw(): Unit
```

Updates an `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameAvailableForRendering(long,boolean)` with the modified effects.

This method can be called from any thread.

### registerInputFrame

```
fun registerInputFrame(): Boolean
```

Informs the `VideoFrameProcessor` that a frame will be queued to its `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#getInputSurface()`.

Must be called before rendering a frame to the input surface. The caller must not render frames to the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#getInputSurface()` when `false` is returned.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the input frame was successfully registered. If `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)` is called, this method returns `false` until `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Listener#onInputStreamRegistered(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>)` is called. Otherwise, a return value of `false` indicates the `VideoFrameProcessor` is not ready to accept input. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | If the `VideoFrameProcessor` does not accept `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#INPUT_TYPE_SURFACE()`. |
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If called after `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#signalEndOfInput()` or before `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)`. |

### registerInputStream

```
fun registerInputStream(
    @VideoFrameProcessor.InputType inputType: Int,
    format: Format!,
    effects: (Mutable)List<Effect!>!,
    offsetToAddUs: Long
): Unit
```

Informs the `VideoFrameProcessor` that a new input stream will be queued with the list of `https://developer.android.com/reference/kotlin/androidx/media3/common/Effect` to apply to the new input stream.

After registering the first input stream, this method must only be called after the last frame of the already-registered input stream has been `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#registerInputFrame()`, last bitmap `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#queueInputBitmap(android.graphics.Bitmap,androidx.media3.common.util.TimestampIterator)` or last texture id `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#queueInputTexture(int,long)`.

This method blocks the calling thread until the previous calls to this method finish, that is when `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Listener#onInputStreamRegistered(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>)` is called after the underlying processing pipeline has been adapted to the registered input stream.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.InputType inputType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.InputType` of the new input stream. |
| `format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` of the new input stream. The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#colorInfo()`, the `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#width()`, the `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#height()` and the `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#pixelWidthHeightRatio()` must be set. |
| `effects: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/Effect!>!` | The list of `https://developer.android.com/reference/kotlin/androidx/media3/common/Effect` to apply to the new input stream. |
| `offsetToAddUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The offset that must be added to the frame presentation timestamps, in microseconds. This offset is not part of the input timestamps. It is added to the frame timestamps before processing, and is retained in the output timestamps. |

### release

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

Releases all resources.

If the `VideoFrameProcessor` is released before it has `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Listener#onEnded()`, it will attempt to cancel processing any input frames that have already become available. Input frames that become available after release are ignored.

This method blocks until all resources are released or releasing times out.

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

### renderOutputFrame

```
fun renderOutputFrame(renderTimeNs: Long): Unit
```

Renders the oldest unrendered output frame that has become `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameAvailableForRendering(long,boolean)` at the given `renderTimeNs`.

This will either render the output frame to the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#setOutputSurfaceInfo(androidx.media3.common.SurfaceInfo)`, or drop the frame, per `renderTimeNs`.

This method must only be called if `renderFramesAutomatically` was set to ` false` using the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Factory` and should be called exactly once for each frame that becomes `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameAvailableForRendering(long,boolean)`.

The `renderTimeNs` may be passed to `https://developer.android.com/reference/android/opengl/EGLExt.html#eglPresentationTimeANDROID(android.opengl.EGLDisplay, android.opengl.EGLSurface, long)` depending on the implementation.

| Parameters |
|---|---|
| `renderTimeNs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The render time to use for the frame, in nanoseconds. The render time can be before or after the current system time. Use `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#DROP_OUTPUT_FRAME()` to drop the frame or `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#RENDER_OUTPUT_FRAME_WITH_PRESENTATION_TIME()` to render the frame to the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#setOutputSurfaceInfo(androidx.media3.common.SurfaceInfo)` with the presentation timestamp seen in `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameAvailableForRendering(long,boolean)`. If the frame should be rendered immediately, pass in `https://developer.android.com/reference/kotlin/androidx/media3/common/util/SystemClock#nanoTime()`. |

### setOnInputFrameProcessedListener

```
fun setOnInputFrameProcessedListener(
    listener: OnInputFrameProcessedListener!
): Unit
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/common/OnInputFrameProcessedListener`.

| Parameters |
|---|---|
| `listener: https://developer.android.com/reference/kotlin/androidx/media3/common/OnInputFrameProcessedListener!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/OnInputFrameProcessedListener`. |

### setOnInputSurfaceReadyListener

```
fun setOnInputSurfaceReadyListener(listener: Runnable!): Unit
```

Sets a listener that's called when the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor#getInputSurface()` is ready to use.

### setOutputSurfaceInfo

```
fun setOutputSurfaceInfo(outputSurfaceInfo: SurfaceInfo?): Unit
```

Sets the output surface and supporting information. When output frames are rendered and not dropped, they will be rendered to this output `https://developer.android.com/reference/kotlin/androidx/media3/common/SurfaceInfo`.

The new output `https://developer.android.com/reference/kotlin/androidx/media3/common/SurfaceInfo` is applied from the next output frame rendered onwards. If the output `https://developer.android.com/reference/kotlin/androidx/media3/common/SurfaceInfo` is `null`, the `VideoFrameProcessor` will stop rendering pending frames and resume rendering once a non-null `https://developer.android.com/reference/kotlin/androidx/media3/common/SurfaceInfo` is set.

If the dimensions given in `https://developer.android.com/reference/kotlin/androidx/media3/common/SurfaceInfo` do not match the `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessor.Listener#onOutputSizeChanged(int,int)` the frames are resized before rendering to the surface and letter/pillar-boxing is applied.

The caller is responsible for tracking the lifecycle of the `https://developer.android.com/reference/kotlin/androidx/media3/common/SurfaceInfo#surface()` including calling this method with a new surface if it is destroyed. When this method returns, the previous output surface is no longer being used and can safely be released by the caller.

### signalEndOfInput

```
fun signalEndOfInput(): Unit
```

Informs the `VideoFrameProcessor` that no further input frames should be accepted.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If called more than once. |