# DefaultGlFrameProcessor.Factory.Builder

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

*** ** * ** ***


```
class DefaultGlFrameProcessor.Factory.Builder
```

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory.Builder#Builder(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html!)` Creates an instance. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory.Builder#build()()` Builds a `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory` instance. |
| `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory.Builder#setGlObjectsProviderAndExecutorService(androidx.media3.common.GlObjectsProvider,java.util.concurrent.ExecutorService)( glObjectsProvider: https://developer.android.com/reference/kotlin/androidx/media3/common/GlObjectsProvider!, executorService: https://developer.android.com/reference/java/util/concurrent/ExecutorService.html! )` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/common/GlObjectsProvider` and the `https://developer.android.com/reference/java/util/concurrent/ExecutorService.html` to execute OpenGL commands on. |
| `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory.Builder#setHardwareBufferJniWrapper(androidx.media3.effect.HardwareBufferJniWrapper)( hardwareBufferJniWrapper: https://developer.android.com/reference/kotlin/androidx/media3/effect/HardwareBufferJniWrapper! )` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/effect/HardwareBufferJniWrapper`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory.Builder#setWorkingColorSpace(androidx.media3.common.ColorInfo)(workingColorSpace: https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo!)` Sets the working color space, which is the color space of frames as they move through the pipeline. |

## Public constructors

### Builder

```
Builder(context: Context!)
```

Creates an instance.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | The `https://developer.android.com/reference/android/content/Context.html`. |

## Public functions

### build

```
fun build(): DefaultGlFrameProcessor.Factory!
```

Builds a `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory` instance.

### setGlObjectsProviderAndExecutorService

```
@CanIgnoreReturnValue
fun setGlObjectsProviderAndExecutorService(
    glObjectsProvider: GlObjectsProvider!,
    executorService: ExecutorService!
): DefaultGlFrameProcessor.Factory.Builder!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/common/GlObjectsProvider` and the `https://developer.android.com/reference/java/util/concurrent/ExecutorService.html` to execute OpenGL commands on.

If not set, each created `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor` uses a new `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlObjectsProvider` and a new single-thread executor, and releases both when it's `https://developer.android.com/reference/kotlin/androidx/media3/common/video/FrameProcessor#close()`.

If set, the caller owns both. After all the `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor` instances created by the built `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory` have been closed, the caller must release the `https://developer.android.com/reference/kotlin/androidx/media3/common/GlObjectsProvider` on the `https://developer.android.com/reference/java/util/concurrent/ExecutorService.html`'s thread, and then `https://developer.android.com/reference/java/util/concurrent/ExecutorService.html#shutdown()` the `https://developer.android.com/reference/java/util/concurrent/ExecutorService.html`.

| Parameters |
|---|---|
| `glObjectsProvider: https://developer.android.com/reference/kotlin/androidx/media3/common/GlObjectsProvider!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/GlObjectsProvider`. |
| `executorService: https://developer.android.com/reference/java/util/concurrent/ExecutorService.html!` | The `https://developer.android.com/reference/java/util/concurrent/ExecutorService.html`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory.Builder!` | This builder. |

### setHardwareBufferJniWrapper

```
@CanIgnoreReturnValue
fun setHardwareBufferJniWrapper(
    hardwareBufferJniWrapper: HardwareBufferJniWrapper!
): DefaultGlFrameProcessor.Factory.Builder!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/effect/HardwareBufferJniWrapper`.

The default value is `https://developer.android.com/reference/kotlin/androidx/media3/effect/HardwareBufferJni#INSTANCE()`.

| Parameters |
|---|---|
| `hardwareBufferJniWrapper: https://developer.android.com/reference/kotlin/androidx/media3/effect/HardwareBufferJniWrapper!` | The `https://developer.android.com/reference/kotlin/androidx/media3/effect/HardwareBufferJniWrapper`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory.Builder!` | This builder. |

### setWorkingColorSpace

```
@CanIgnoreReturnValue
fun setWorkingColorSpace(workingColorSpace: ColorInfo!): DefaultGlFrameProcessor.Factory.Builder!
```

Sets the working color space, which is the color space of frames as they move through the pipeline. Input frames are converted to it, and effects receive frames in it. Effects other than `https://developer.android.com/reference/kotlin/androidx/media3/effect/ColorConversion` also output frames in it.

Supported values are `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor#BT2020_LINEAR()`, `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor#BT2020_HLG()`, `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor#BT709_LINEAR()` and `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor#BT709_SRGB()`.

Before frames are written to the `https://developer.android.com/reference/kotlin/androidx/media3/common/video/FrameWriter`, frames in a linear working color space are converted to an electrical color space: `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor#BT2020_LINEAR()` to `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor#BT2020_HLG()`, and `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor#BT709_LINEAR()` to `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor#BT709_SRGB()`. Frames in an electrical working color space are written unchanged. A `https://developer.android.com/reference/kotlin/androidx/media3/effect/ColorConversion` applied as the last effect overrides both.

When the working color space is BT.709, HDR input is tone mapped to SDR. Ultra HDR gain maps are only applied when the working color space is BT.2020, on API 34+.

If not set, the working color space is resolved from the first input frame: `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor#BT2020_LINEAR()` for HDR video and Ultra HDR images, and `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor#BT709_SRGB()` otherwise.

| Parameters |
|---|---|
| `workingColorSpace: https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo!` | The working `https://developer.android.com/reference/kotlin/androidx/media3/common/ColorInfo`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/effect/DefaultGlFrameProcessor.Factory.Builder!` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If `workingColorSpace` is not supported. |