# Codec.DecoderFactory

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/Codec.java+class:androidx.media3.transformer.Codec.DecoderFactory)

*** ** * ** ***


```
public interface Codec.DecoderFactory
```

<br />

Known direct subclasses [DefaultDecoderFactory](https://developer.android.com/reference/androidx/media3/transformer/DefaultDecoderFactory)

|---|---|
| `https://developer.android.com/reference/androidx/media3/transformer/DefaultDecoderFactory` | Default implementation of `https://developer.android.com/reference/androidx/media3/transformer/Codec.DecoderFactory` that uses `https://developer.android.com/reference/android/media/MediaCodec.html` for decoding. |

*** ** * ** ***

A factory for `https://developer.android.com/reference/androidx/media3/transformer/Codec` instances.

## Summary

| ### Public methods |
|---|---|
| `abstract https://developer.android.com/reference/androidx/media3/transformer/Codec` | `https://developer.android.com/reference/androidx/media3/transformer/Codec.DecoderFactory#createForAudioDecoding(androidx.media3.common.Format,android.media.metrics.LogSessionId)( https://developer.android.com/reference/androidx/media3/common/Format format, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/media/metrics/LogSessionId.html logSessionId )` Returns a `https://developer.android.com/reference/androidx/media3/transformer/Codec` for audio decoding. |
| `abstract https://developer.android.com/reference/androidx/media3/transformer/Codec` | `https://developer.android.com/reference/androidx/media3/transformer/Codec.DecoderFactory#createForVideoDecoding(androidx.media3.common.Format,android.view.Surface,boolean,android.media.metrics.LogSessionId)( https://developer.android.com/reference/androidx/media3/common/Format format, https://developer.android.com/reference/android/view/Surface.html outputSurface, boolean requestSdrToneMapping, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/media/metrics/LogSessionId.html logSessionId )` Returns a `https://developer.android.com/reference/androidx/media3/transformer/Codec` for video decoding. |

## Public methods

### createForAudioDecoding

```
abstract Codec createForAudioDecoding(
    Format format,
    @Nullable LogSessionId logSessionId
)
```

Returns a `https://developer.android.com/reference/androidx/media3/transformer/Codec` for audio decoding.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Format format` | The `https://developer.android.com/reference/androidx/media3/common/Format` (of the input data) used to determine the underlying decoder and its configuration values. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/media/metrics/LogSessionId.html logSessionId` | The optional `https://developer.android.com/reference/android/media/metrics/LogSessionId.html` of the `https://developer.android.com/reference/android/media/metrics/EditingSession.html`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/transformer/Codec` | A `https://developer.android.com/reference/androidx/media3/transformer/Codec` for audio decoding. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/transformer/ExportException` | If no suitable `https://developer.android.com/reference/androidx/media3/transformer/Codec` can be created. |

### createForVideoDecoding

```
abstract Codec createForVideoDecoding(
    Format format,
    Surface outputSurface,
    boolean requestSdrToneMapping,
    @Nullable LogSessionId logSessionId
)
```

Returns a `https://developer.android.com/reference/androidx/media3/transformer/Codec` for video decoding.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Format format` | The `https://developer.android.com/reference/androidx/media3/common/Format` (of the input data) used to determine the underlying decoder and its configuration values. |
| `https://developer.android.com/reference/android/view/Surface.html outputSurface` | The `https://developer.android.com/reference/android/view/Surface.html` to which the decoder output is rendered. |
| `boolean requestSdrToneMapping` | Whether to request tone-mapping to SDR. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/media/metrics/LogSessionId.html logSessionId` | The optional `https://developer.android.com/reference/android/media/metrics/LogSessionId.html` of the `https://developer.android.com/reference/android/media/metrics/EditingSession.html`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/transformer/Codec` | A `https://developer.android.com/reference/androidx/media3/transformer/Codec` for video decoding. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/transformer/ExportException` | If no suitable `https://developer.android.com/reference/androidx/media3/transformer/Codec` can be created. |