# DebugViewShaderProgram

# DebugViewShaderProgram

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/DebugViewShaderProgram.java+class:androidx.media3.effect.DebugViewShaderProgram)

*** ** * ** ***

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

<br />

```
@UnstableApi
class DebugViewShaderProgram : GlShaderProgram
```

<br />

*** ** * ** ***

[GlShaderProgram](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram)that renders to a[SurfaceView](https://developer.android.com/reference/android/view/SurfaceView.html)provided by[DebugViewProvider](https://developer.android.com/reference/kotlin/androidx/media3/common/DebugViewProvider).

## Summary

|                                                                                                                                                                                                                                                                                              ### Public constructors                                                                                                                                                                                                                                                                                               |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DebugViewShaderProgram](https://developer.android.com/reference/kotlin/androidx/media3/effect/DebugViewShaderProgram#DebugViewShaderProgram(android.content.Context,androidx.media3.common.DebugViewProvider,androidx.media3.common.ColorInfo))`(` ` context: `[Context](https://developer.android.com/reference/android/content/Context.html)`!,` ` debugViewProvider: `[DebugViewProvider](https://developer.android.com/reference/kotlin/androidx/media3/common/DebugViewProvider)`!,` ` outputColorInfo: `[ColorInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo)`!` `)` |

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [flush](https://developer.android.com/reference/kotlin/androidx/media3/effect/DebugViewShaderProgram#flush())`()` Flushes the`GlShaderProgram`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [queueInputFrame](https://developer.android.com/reference/kotlin/androidx/media3/effect/DebugViewShaderProgram#queueInputFrame(androidx.media3.common.GlObjectsProvider,androidx.media3.common.GlTextureInfo,long))`(` ` glObjectsProvider: `[GlObjectsProvider](https://developer.android.com/reference/kotlin/androidx/media3/common/GlObjectsProvider)`!,` ` inputTexture: `[GlTextureInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/GlTextureInfo)`!,` ` presentationTimeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) `)` Processes an input frame if possible. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [release](https://developer.android.com/reference/kotlin/androidx/media3/effect/DebugViewShaderProgram#release())`()` Releases all resources.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [releaseOutputFrame](https://developer.android.com/reference/kotlin/androidx/media3/effect/DebugViewShaderProgram#releaseOutputFrame(androidx.media3.common.GlTextureInfo))`(outputTexture: `[GlTextureInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/GlTextureInfo)`!)` Notifies the`GlShaderProgram`that the frame on the given output texture is no longer used and can be overwritten.                                                                                                                                                                                                                |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [setErrorListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/DebugViewShaderProgram#setErrorListener(java.util.concurrent.Executor,androidx.media3.effect.GlShaderProgram.ErrorListener))`(` ` executor: `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html)`!,` ` errorListener: `[GlShaderProgram.ErrorListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.ErrorListener)`!` `)` Sets the[ErrorListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.ErrorListener).           |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [setInputListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/DebugViewShaderProgram#setInputListener(androidx.media3.effect.GlShaderProgram.InputListener))`(inputListener: `[GlShaderProgram.InputListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.InputListener)`!)` Sets the[InputListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.InputListener).                                                                                                                                                        |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [setOutputListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/DebugViewShaderProgram#setOutputListener(androidx.media3.effect.GlShaderProgram.OutputListener))`(outputListener: `[GlShaderProgram.OutputListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.OutputListener)`!)` Sets the[OutputListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.OutputListener).                                                                                                                                                |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [signalEndOfCurrentInputStream](https://developer.android.com/reference/kotlin/androidx/media3/effect/DebugViewShaderProgram#signalEndOfCurrentInputStream())`()` Notifies the`GlShaderProgram`that no further input frames belonging to the current input stream will be queued.                                                                                                                                                                                                                                                                                                                                                      |

## Public constructors

### DebugViewShaderProgram

```
DebugViewShaderProgram(
    context: Context!,
    debugViewProvider: DebugViewProvider!,
    outputColorInfo: ColorInfo!
)
```  

## Public functions

### flush

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

Flushes the`GlShaderProgram`.

The`GlShaderProgram`should reclaim the ownership of its allocated textures,[notify](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.InputListener#onFlush())its[InputListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.InputListener)about the flush event, and[report its availability](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.InputListener#onReadyToAcceptInputFrame())if necessary.

The implementation must not[output frames](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.OutputListener#onOutputFrameAvailable(androidx.media3.common.GlTextureInfo,long))until after this method returns.  

### queueInputFrame

```
fun queueInputFrame(
    glObjectsProvider: GlObjectsProvider!,
    inputTexture: GlTextureInfo!,
    presentationTimeUs: Long
): Unit
```

Processes an input frame if possible.

The`GlShaderProgram`owns the accepted frame until it calls[onInputFrameProcessed](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.InputListener#onInputFrameProcessed(androidx.media3.common.GlTextureInfo)). The caller should not overwrite or release the texture before the`GlShaderProgram`has finished processing it.

This method must only be called when the`GlShaderProgram`can[accept an input frame](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.InputListener#onReadyToAcceptInputFrame()).  

|                                                              Parameters                                                              |
|--------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| `glObjectsProvider: `[GlObjectsProvider](https://developer.android.com/reference/kotlin/androidx/media3/common/GlObjectsProvider)`!` | The[GlObjectsProvider](https://developer.android.com/reference/kotlin/androidx/media3/common/GlObjectsProvider)for using EGL and GLES.                  |
| `inputTexture: `[GlTextureInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/GlTextureInfo)`!`              | A[GlTextureInfo](https://developer.android.com/reference/kotlin/androidx/media3/common/GlTextureInfo)describing the texture containing the input frame. |
| `presentationTimeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                                  | The presentation timestamp of the input frame, in microseconds.                                                                                         |

### release

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

Releases all resources.  

|                                                                           Throws                                                                            |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|
| [androidx.media3.common.VideoFrameProcessingException](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessingException) | If an error occurs while releasing resources. |

### releaseOutputFrame

```
fun releaseOutputFrame(outputTexture: GlTextureInfo!): Unit
```

Notifies the`GlShaderProgram`that the frame on the given output texture is no longer used and can be overwritten.  

### setErrorListener

```
fun setErrorListener(
    executor: Executor!,
    errorListener: GlShaderProgram.ErrorListener!
): Unit
```

Sets the[ErrorListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.ErrorListener).

The[ErrorListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.ErrorListener)is invoked on the provided[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html).  

### setInputListener

```
fun setInputListener(inputListener: GlShaderProgram.InputListener!): Unit
```

Sets the[InputListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.InputListener).

The[InputListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.InputListener)should be invoked on the thread that owns the parent OpenGL context. For example,[DefaultVideoFrameProcessor](https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultVideoFrameProcessor)invokes the[InputListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.InputListener)methods on its internal thread.  

### setOutputListener

```
fun setOutputListener(outputListener: GlShaderProgram.OutputListener!): Unit
```

Sets the[OutputListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.OutputListener).

The[OutputListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.OutputListener)should be invoked on the thread that owns the parent OpenGL context. For example,[DefaultVideoFrameProcessor](https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultVideoFrameProcessor)invokes the[OutputListener](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram.OutputListener)methods on its internal thread.  

### signalEndOfCurrentInputStream

```
fun signalEndOfCurrentInputStream(): Unit
```

Notifies the`GlShaderProgram`that no further input frames belonging to the current input stream will be queued.

Input frames that are queued after this method is called belong to a different input stream.