# Codec.DecoderFactory

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

*** ** * ** ***

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

<br />

```
interface Codec.DecoderFactory
```

<br />

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

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

*** ** * ** ***

A factory for[decoder](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec)instances.

## Summary

|                                     ### Public functions                                     |
|----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Codec](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec)`!` | [createForAudioDecoding](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec.DecoderFactory#createForAudioDecoding(androidx.media3.common.Format,android.media.metrics.LogSessionId))`(format: `[Format](https://developer.android.com/reference/kotlin/androidx/media3/common/Format)`!, logSessionId: `[LogSessionId](https://developer.android.com/reference/android/media/metrics/LogSessionId.html)`?)` Returns a[Codec](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec)for audio decoding.                                                                                                                                                                                                                                                            |
| [Codec](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec)`!` | [createForVideoDecoding](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec.DecoderFactory#createForVideoDecoding(androidx.media3.common.Format,android.view.Surface,boolean,android.media.metrics.LogSessionId))`(` ` format: `[Format](https://developer.android.com/reference/kotlin/androidx/media3/common/Format)`!,` ` outputSurface: `[Surface](https://developer.android.com/reference/android/view/Surface.html)`!,` ` requestSdrToneMapping: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`,` ` logSessionId: `[LogSessionId](https://developer.android.com/reference/android/media/metrics/LogSessionId.html)`?` `)` Returns a[Codec](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec)for video decoding. |

## Public functions

### createForAudioDecoding

```
fun createForAudioDecoding(format: Format!, logSessionId: LogSessionId?): Codec!
```

Returns a[Codec](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec)for audio decoding.  

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

|                                           Returns                                            |
|----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
| [Codec](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec)`!` | A[Codec](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec)for audio decoding. |

|                                                                  Throws                                                                   |
|-------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| [androidx.media3.transformer.ExportException](https://developer.android.com/reference/kotlin/androidx/media3/transformer/ExportException) | If no suitable[Codec](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec)can be created. |

### createForVideoDecoding

```
fun createForVideoDecoding(
    format: Format!,
    outputSurface: Surface!,
    requestSdrToneMapping: Boolean,
    logSessionId: LogSessionId?
): Codec!
```

Returns a[Codec](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec)for video decoding.  

|                                                     Parameters                                                     |
|--------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `format: `[Format](https://developer.android.com/reference/kotlin/androidx/media3/common/Format)`!`                | The[Format](https://developer.android.com/reference/kotlin/androidx/media3/common/Format)(of the input data) used to determine the underlying decoder and its configuration values.                                                         |
| `outputSurface: `[Surface](https://developer.android.com/reference/android/view/Surface.html)`!`                   | The[Surface](https://developer.android.com/reference/android/view/Surface.html)to which the decoder output is rendered.                                                                                                                     |
| `requestSdrToneMapping: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)       | Whether to request tone-mapping to SDR.                                                                                                                                                                                                     |
| `logSessionId: `[LogSessionId](https://developer.android.com/reference/android/media/metrics/LogSessionId.html)`?` | The optional[LogSessionId](https://developer.android.com/reference/android/media/metrics/LogSessionId.html)of the[android.media.metrics.EditingSession](https://developer.android.com/reference/android/media/metrics/EditingSession.html). |

|                                           Returns                                            |
|----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
| [Codec](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec)`!` | A[Codec](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec)for video decoding. |

|                                                                  Throws                                                                   |
|-------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| [androidx.media3.transformer.ExportException](https://developer.android.com/reference/kotlin/androidx/media3/transformer/ExportException) | If no suitable[Codec](https://developer.android.com/reference/kotlin/androidx/media3/transformer/Codec)can be created. |