> Documentation index: https://developer.android.com/reference/llms.txt

# CodecDbDatasetLoader

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

*** ** * ** ***


```
@ExperimentalApi
class CodecDbDatasetLoader
```

<br />

*** ** * ** ***

Loads `CodecDbEncoderDataset` instances from the CodecDB database for a specific device.

Obtain instances via `onDevice`.

## Summary

| ### Public functions |
|---|---|
| `CodecDbEncoderDataset!` | `forEncoding( fallbackProvider: Function<VideoEncoderConstraints!, VideoEncoderConfiguration?>! )` Loads a `CodecDbEncoderDataset` for the device identifiers provided during creation, using the provided fallback provider for missing configurations. |

## Public functions

### forEncoding

```
fun forEncoding(
    fallbackProvider: Function<VideoEncoderConstraints!, VideoEncoderConfiguration?>!
): CodecDbEncoderDataset!
```

Loads a `CodecDbEncoderDataset` for the device identifiers provided during creation, using the provided fallback provider for missing configurations.

The dataset includes encoding performance models relevant to the specified device, with the following order of precedence:

- Device-specific models
- Chipset-specific models
- Tier-specific models
- Generic models

If no loaded model satisfies the requested constraints, `findOptimalConfiguration` returns the result of the provided fallback provider.

| Parameters |
|---|---|
| `fallbackProvider: Function<VideoEncoderConstraints!, VideoEncoderConfiguration?>!` | A function that is queried with the requested constraints when no model loaded for this device satisfies them. It returns the configuration to use instead, or `null` if it has none, in which case the query also returns `null`. Pass ` constraints -> null` to disable the fallback. |

| Returns |
|---|---|
| `CodecDbEncoderDataset!` | A `CodecDbEncoderDataset` containing encoder-specific data. |

| Throws |
|---|---|
| `java.io.IOException` | if an error occurs while reading from the database. |