# DefaultDecoderFactory.Builder

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

*** ** * ** ***


```
class DefaultDecoderFactory.Builder
```

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder#Builder(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html!)` Creates a new `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder`. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory!` | `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder#build()()` Creates an instance of `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory`, using defaults if values are unset. |
| `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder#setCodecPriority(int)( @https://developer.android.com/reference/kotlin/androidx/media3/common/C.Priority codecPriority: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(to = https://developer.android.com/reference/kotlin/androidx/media3/common/C.PRIORITY_MAX) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Sets the codec priority. |
| `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder#setEnableDecoderFallback(boolean)(enableDecoderFallback: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether the decoder can fallback. |
| `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder#setListener(androidx.media3.transformer.DefaultDecoderFactory.Listener)(listener: https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Listener!)` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Listener`. |
| `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder#setMediaCodecSelector(androidx.media3.exoplayer.mediacodec.MediaCodecSelector)(mediaCodecSelector: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector!)` Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector` used when selecting a decoder. |
| `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder!` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder#setShouldConfigureOperatingRate(boolean)(shouldConfigureOperatingRate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether a device-specific decoder `https://developer.android.com/reference/android/media/MediaFormat.html#KEY_OPERATING_RATE` should be requested. |

## Public constructors

### Builder

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

Creates a new `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Builder`.

## Public functions

### build

```
fun build(): DefaultDecoderFactory!
```

Creates an instance of `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory`, using defaults if values are unset.

### setCodecPriority

```
@CanIgnoreReturnValue
fun setCodecPriority(
    @C.Priority codecPriority: @IntRange(to = C.PRIORITY_MAX) Int
): DefaultDecoderFactory.Builder!
```

Sets the codec priority.

Specifying codec priority allows the resource manager in the platform to reclaim less important codecs before more important codecs.

It is recommended to use predefined `https://developer.android.com/reference/kotlin/androidx/media3/common/C.Priority` like `https://developer.android.com/reference/kotlin/androidx/media3/common/C#PRIORITY_PROCESSING_FOREGROUND()`, `https://developer.android.com/reference/kotlin/androidx/media3/common/C#PRIORITY_PROCESSING_BACKGROUND()` or priority values defined relative to those defaults.

This method is a no-op on API versions before 35.

The default value is `https://developer.android.com/reference/kotlin/androidx/media3/common/C#PRIORITY_PROCESSING_FOREGROUND()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.Priority codecPriority: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(to = https://developer.android.com/reference/kotlin/androidx/media3/common/C.PRIORITY_MAX) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/C.Priority` for the codec. Should be at most `https://developer.android.com/reference/kotlin/androidx/media3/common/C#PRIORITY_MAX()`. |

### setEnableDecoderFallback

```
@CanIgnoreReturnValue
fun setEnableDecoderFallback(enableDecoderFallback: Boolean): DefaultDecoderFactory.Builder!
```

Sets whether the decoder can fallback.

This decides whether to enable fallback to lower-priority decoders if decoder initialization fails. This may result in using a decoder that is less efficient or slower than the primary decoder.

The default value is `false`.

### setListener

```
@CanIgnoreReturnValue
fun setListener(listener: DefaultDecoderFactory.Listener!): DefaultDecoderFactory.Builder!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/transformer/DefaultDecoderFactory.Listener`.

### setMediaCodecSelector

```
@CanIgnoreReturnValue
fun setMediaCodecSelector(mediaCodecSelector: MediaCodecSelector!): DefaultDecoderFactory.Builder!
```

Sets the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector` used when selecting a decoder.

The default value is `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector#DEFAULT()`

### setShouldConfigureOperatingRate

```
@CanIgnoreReturnValue
fun setShouldConfigureOperatingRate(shouldConfigureOperatingRate: Boolean): DefaultDecoderFactory.Builder!
```

Sets whether a device-specific decoder `https://developer.android.com/reference/android/media/MediaFormat.html#KEY_OPERATING_RATE` should be requested.

This is a best-effort hint to the codec. Setting this to `true` might improve decoding performance.

The effect of this field will be most noticeable when no other `https://developer.android.com/reference/android/media/MediaCodec.html` instances are in use.

Defaults to `false`.

| Parameters |
|---|---|
| `shouldConfigureOperatingRate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether to apply an `https://developer.android.com/reference/android/media/MediaFormat.html#KEY_OPERATING_RATE` configuration to the decoder. |