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

*** ** * ** ***


```
public final class DefaultGlFrameProcessor.Factory.Builder
```

<br />

*** ** * ** ***

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

## Summary

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

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

## Public constructors

### Builder

```
public Builder(Context context)
```

Creates an instance.

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

## Public methods

### build

```
public DefaultGlFrameProcessor.Factory build()
```

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

### setGlObjectsProviderAndExecutorService

```
@CanIgnoreReturnValue
public DefaultGlFrameProcessor.Factory.Builder setGlObjectsProviderAndExecutorService(
    GlObjectsProvider glObjectsProvider,
    ExecutorService executorService
)
```

Sets the `https://developer.android.com/reference/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/androidx/media3/effect/DefaultGlFrameProcessor` uses a new `https://developer.android.com/reference/androidx/media3/effect/DefaultGlObjectsProvider` and a new single-thread executor, and releases both when it's `https://developer.android.com/reference/androidx/media3/common/video/FrameProcessor#close()`.

If set, the caller owns both. After all the `https://developer.android.com/reference/androidx/media3/effect/DefaultGlFrameProcessor` instances created by the built `https://developer.android.com/reference/androidx/media3/effect/DefaultGlFrameProcessor.Factory` have been closed, the caller must release the `https://developer.android.com/reference/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 |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/GlObjectsProvider glObjectsProvider` | The `https://developer.android.com/reference/androidx/media3/common/GlObjectsProvider`. |
| `https://developer.android.com/reference/java/util/concurrent/ExecutorService.html executorService` | The `https://developer.android.com/reference/java/util/concurrent/ExecutorService.html`. |

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

### setHardwareBufferJniWrapper

```
@CanIgnoreReturnValue
public DefaultGlFrameProcessor.Factory.Builder setHardwareBufferJniWrapper(
    HardwareBufferJniWrapper hardwareBufferJniWrapper
)
```

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

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

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

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

### setWorkingColorSpace

```
@CanIgnoreReturnValue
public DefaultGlFrameProcessor.Factory.Builder setWorkingColorSpace(ColorInfo workingColorSpace)
```

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/androidx/media3/effect/ColorConversion` also output frames in it.

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

Before frames are written to the `https://developer.android.com/reference/androidx/media3/common/video/FrameWriter`, frames in a linear working color space are converted to an electrical color space: `https://developer.android.com/reference/androidx/media3/effect/DefaultGlFrameProcessor#BT2020_LINEAR()` to `https://developer.android.com/reference/androidx/media3/effect/DefaultGlFrameProcessor#BT2020_HLG()`, and `https://developer.android.com/reference/androidx/media3/effect/DefaultGlFrameProcessor#BT709_LINEAR()` to `https://developer.android.com/reference/androidx/media3/effect/DefaultGlFrameProcessor#BT709_SRGB()`. Frames in an electrical working color space are written unchanged. A `https://developer.android.com/reference/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/androidx/media3/effect/DefaultGlFrameProcessor#BT2020_LINEAR()` for HDR video and Ultra HDR images, and `https://developer.android.com/reference/androidx/media3/effect/DefaultGlFrameProcessor#BT709_SRGB()` otherwise.

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

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

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