# MediaCodecUtil

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

*** ** * ** ***


```
@UnstableApi
class MediaCodecUtil
```

<br />

*** ** * ** ***

A utility class for querying the available codecs.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil.DecoderQueryException : https://developer.android.com/reference/java/lang/Exception.html` Thrown when an error occurs querying the device for its underlying media capabilities. |

| ### Public functions |
|---|---|
| `synchronized java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/VisibleForTesting https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#clearDecoderInfoCache()()` |
| `java-static https://developer.android.com/reference/android/media/MediaCodecInfo.CodecProfileLevel.html!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#createCodecProfileLevel(int,int)(profile: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, level: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns a `https://developer.android.com/reference/android/media/MediaCodecInfo.CodecProfileLevel.html` configured with the provided `profile` and ` level`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getAlternativeCodecMimeType(androidx.media3.common.Format)(format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)` Returns an alternative codec MIME type (besides the default `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#sampleMimeType()`) that can be used to decode samples of the provided `https://developer.android.com/reference/kotlin/androidx/media3/common/Format`. |
| `java-static (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getAlternativeDecoderInfos(androidx.media3.exoplayer.mediacodec.MediaCodecSelector,androidx.media3.common.Format,boolean,boolean)( mediaCodecSelector: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector!, format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!, requiresSecureDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, requiresTunnelingDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Returns a list of decoders for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getAlternativeCodecMimeType(androidx.media3.common.Format)` that can decode samples of the provided `https://developer.android.com/reference/kotlin/androidx/media3/common/Format`, in the priority order specified by the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector`. |
| `java-static (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getAlternativeDecoderInfosFilteredByFormatSupport(android.content.Context,androidx.media3.exoplayer.mediacodec.MediaCodecSelector,androidx.media3.common.Format,boolean,boolean)( context: https://developer.android.com/reference/android/content/Context.html!, mediaCodecSelector: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector!, format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!, requiresSecureDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, requiresTunnelingDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Returns a list of decoders for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getAlternativeCodecMimeType(androidx.media3.common.Format)` that can decode samples of the provided `https://developer.android.com/reference/kotlin/androidx/media3/common/Format`, in the priority order specified by the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector`. |
| `java-static https://developer.android.com/reference/android/util/Pair.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>?` | `@https://checkerframework.org/api/com/google/errorprone/annotations/InlineMe.html(replacement = "CodecSpecificDataUtil.getCodecProfileAndLevel(format)", imports = [""androidx.media3.common.util.CodecSpecificDataUtil""]) [getCodecProfileAndLevel](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getCodecProfileAndLevel(androidx.media3.common.Format))(format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/common/util/CodecSpecificDataUtil#getCodecProfileAndLevel(androidx.media3.common.Format)`. <br /> |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo?` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfo(java.lang.String,boolean,boolean)(mimeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, secure: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, tunneling: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns information about the preferred decoder for a given MIME type. |
| `synchronized java-static (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfos(java.lang.String,boolean,boolean)(mimeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, secure: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, tunneling: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns all `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo`s for the given MIME type, in the order given by `https://developer.android.com/reference/android/media/MediaCodecList.html`. |
| `java-static (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!` | `@https://checkerframework.org/api/org/checkerframework/checker/nullness/qual/RequiresNonNull.html(value = "#2.sampleMimeType") https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfosSoftMatch(androidx.media3.exoplayer.mediacodec.MediaCodecSelector,androidx.media3.common.Format,boolean,boolean)( mediaCodecSelector: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector!, format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!, requiresSecureDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, requiresTunnelingDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Returns a list of decoders that can decode media in the specified format, in the priority order specified by the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector`. |
| `java-static (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!` | `@https://checkerframework.org/api/org/checkerframework/checker/nullness/qual/RequiresNonNull.html(value = "#3.sampleMimeType") https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfosSoftMatchFilteredByFormatSupport(android.content.Context,androidx.media3.exoplayer.mediacodec.MediaCodecSelector,androidx.media3.common.Format,boolean,boolean)( context: https://developer.android.com/reference/android/content/Context.html!, mediaCodecSelector: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector!, format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!, requiresSecureDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, requiresTunnelingDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Returns a list of decoders that can decode media in the specified format, in the priority order specified by the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector`. |
| `java-static (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfosSortedByFormatSupport(android.content.Context,java.util.List<androidx.media3.exoplayer.mediacodec.MediaCodecInfo>,androidx.media3.common.Format)( context: https://developer.android.com/reference/android/content/Context.html!, decoderInfos: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!, format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format! )` Returns a copy of the provided decoder list sorted such that decoders with functional format support are listed first. |
| `java-static (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfosSortedByFullFormatSupport(android.content.Context,java.util.List<androidx.media3.exoplayer.mediacodec.MediaCodecInfo>,androidx.media3.common.Format)( context: https://developer.android.com/reference/android/content/Context.html!, decoderInfos: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!, format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format! )` Returns a copy of the provided decoder list sorted such that decoders with complete format support are listed first. |
| `java-static (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfosSortedBySoftwareOnly(java.util.List<androidx.media3.exoplayer.mediacodec.MediaCodecInfo>)( decoderInfos: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>! )` Returns a copy of the provided decoder list sorted such that software decoders are listed first. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo?` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecryptOnlyDecoderInfo()()` Returns information about a decoder that will only decrypt data, without decoding it. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/common/util/CodecSpecificDataUtil.MediaCodecProfileAndLevel?` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getHevcBaseLayerCodecProfileAndLevel(androidx.media3.common.Format)(format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)` Returns profile and level (as defined by `https://developer.android.com/reference/android/media/MediaCodecInfo.CodecProfileLevel.html`) corresponding to the base layer (for the case of falling back to single-layer HEVC from L-HEVC). |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#maxH264DecodableFrameSize()()` Returns the maximum frame size supported by the default H264 decoder. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#warmDecoderInfoCache(java.lang.String,boolean,boolean)(mimeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, secure: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, tunneling: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Optional call to warm the codec cache for a given MIME type. |

## Public functions

### clearDecoderInfoCache

```
@VisibleForTesting
synchronized java-static fun clearDecoderInfoCache(): Unit
```

### createCodecProfileLevel

```
@UnstableApi
java-static fun createCodecProfileLevel(profile: Int, level: Int): MediaCodecInfo.CodecProfileLevel!
```

Returns a `https://developer.android.com/reference/android/media/MediaCodecInfo.CodecProfileLevel.html` configured with the provided `profile` and `
level`.

### getAlternativeCodecMimeType

```
java-static fun getAlternativeCodecMimeType(format: Format!): String?
```

Returns an alternative codec MIME type (besides the default `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#sampleMimeType()`) that can be used to decode samples of the provided `https://developer.android.com/reference/kotlin/androidx/media3/common/Format`.

| Parameters |
|---|---|
| `format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The media format. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | An alternative MIME type of a codec that be used decode samples of the provided ` Format` (besides the default `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#sampleMimeType()`), or null if no such alternative exists. |

### getAlternativeDecoderInfos

```
java-static fun getAlternativeDecoderInfos(
    mediaCodecSelector: MediaCodecSelector!,
    format: Format!,
    requiresSecureDecoder: Boolean,
    requiresTunnelingDecoder: Boolean
): (Mutable)List<MediaCodecInfo!>!
```

Returns a list of decoders for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getAlternativeCodecMimeType(androidx.media3.common.Format)` that can decode samples of the provided `https://developer.android.com/reference/kotlin/androidx/media3/common/Format`, in the priority order specified by the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector`.

Since the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector` only has access to `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#sampleMimeType()`, the list is not ordered to account for whether each decoder supports the details of the format (e.g., taking into account the format's profile, level, resolution and so on). `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfosSortedByFormatSupport(android.content.Context,java.util.List<androidx.media3.exoplayer.mediacodec.MediaCodecInfo>,androidx.media3.common.Format)` can be used to further sort the list into an order where decoders that fully support the format come first.

| Parameters |
|---|---|
| `mediaCodecSelector: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector!` | The decoder selector. |
| `format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` for which an alternative decoder is required. |
| `requiresSecureDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether a secure decoder is required. |
| `requiresTunnelingDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether a tunneling decoder is required. |

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!` | A list of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo`s corresponding to alternative decoders. May be empty. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil.DecoderQueryException` | Thrown if there was an error querying decoders. |

### getAlternativeDecoderInfosFilteredByFormatSupport

```
java-static fun getAlternativeDecoderInfosFilteredByFormatSupport(
    context: Context!,
    mediaCodecSelector: MediaCodecSelector!,
    format: Format!,
    requiresSecureDecoder: Boolean,
    requiresTunnelingDecoder: Boolean
): (Mutable)List<MediaCodecInfo!>!
```

Returns a list of decoders for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getAlternativeCodecMimeType(androidx.media3.common.Format)` that can decode samples of the provided `https://developer.android.com/reference/kotlin/androidx/media3/common/Format`, in the priority order specified by the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector`. Unlike `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getAlternativeDecoderInfos(androidx.media3.exoplayer.mediacodec.MediaCodecSelector,androidx.media3.common.Format,boolean,boolean)`, this method excludes decoders that do not support relevant format details.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | The application context. |
| `mediaCodecSelector: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector!` | The decoder selector. |
| `format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` for which an alternative decoder is required. |
| `requiresSecureDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether a secure decoder is required. |
| `requiresTunnelingDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether a tunneling decoder is required. |

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!` | A list of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo`s corresponding to alternative decoders. May be empty. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil.DecoderQueryException` | Thrown if there was an error querying decoders. |

### getCodecProfileAndLevel

```
@InlineMe(replacement = "CodecSpecificDataUtil.getCodecProfileAndLevel(format)", imports = [""androidx.media3.common.util.CodecSpecificDataUtil""])
java-static fun [getCodecProfileAndLevel](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getCodecProfileAndLevel(androidx.media3.common.Format))(format: Format!): Pair<Int!, Int!>?
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/common/util/CodecSpecificDataUtil#getCodecProfileAndLevel(androidx.media3.common.Format)`.

### getDecoderInfo

```
java-static fun getDecoderInfo(mimeType: String!, secure: Boolean, tunneling: Boolean): MediaCodecInfo?
```

Returns information about the preferred decoder for a given MIME type.

| Parameters |
|---|---|
| `mimeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The MIME type. |
| `secure: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the decoder is required to support secure decryption. Always pass false unless secure decryption really is required. |
| `tunneling: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the decoder is required to support tunneling. Always pass false unless tunneling really is required. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo?` | A `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo` describing the decoder, or null if no suitable decoder exists. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil.DecoderQueryException` | If there was an error querying the available decoders. |

### getDecoderInfos

```
synchronized java-static fun getDecoderInfos(mimeType: String!, secure: Boolean, tunneling: Boolean): (Mutable)List<MediaCodecInfo!>!
```

Returns all `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo`s for the given MIME type, in the order given by `https://developer.android.com/reference/android/media/MediaCodecList.html`.

| Parameters |
|---|---|
| `mimeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The MIME type. |
| `secure: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the decoder is required to support secure decryption. Always pass false unless secure decryption really is required. |
| `tunneling: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the decoder is required to support tunneling. Always pass false unless tunneling really is required. |

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!` | An unmodifiable list of all `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo`s for the given MIME type, in the order given by `https://developer.android.com/reference/android/media/MediaCodecList.html`. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil.DecoderQueryException` | If there was an error querying the available decoders. |

### getDecoderInfosSoftMatch

```
@RequiresNonNull(value = "#2.sampleMimeType")
java-static fun getDecoderInfosSoftMatch(
    mediaCodecSelector: MediaCodecSelector!,
    format: Format!,
    requiresSecureDecoder: Boolean,
    requiresTunnelingDecoder: Boolean
): (Mutable)List<MediaCodecInfo!>!
```

Returns a list of decoders that can decode media in the specified format, in the priority order specified by the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector`.

Since the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector` only has access to `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#sampleMimeType()`, the list is not ordered to account for whether each decoder supports the details of the format (e.g., taking into account the format's profile, level, resolution and so on). `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfosSortedByFormatSupport(android.content.Context,java.util.List<androidx.media3.exoplayer.mediacodec.MediaCodecInfo>,androidx.media3.common.Format)` can be used to further sort the list into an order where decoders that fully support the format come first.

This list is more complete than `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfos(java.lang.String,boolean,boolean)`, as it also considers alternative MIME types that are a close match using `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getAlternativeCodecMimeType(androidx.media3.common.Format)`.

| Parameters |
|---|---|
| `mediaCodecSelector: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector!` | The decoder selector. |
| `format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` for which a decoder is required. |
| `requiresSecureDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether a secure decoder is required. |
| `requiresTunnelingDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether a tunneling decoder is required. |

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!` | A list of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo`s corresponding to decoders. May be empty. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil.DecoderQueryException` | Thrown if there was an error querying decoders. |

### getDecoderInfosSoftMatchFilteredByFormatSupport

```
@RequiresNonNull(value = "#3.sampleMimeType")
java-static fun getDecoderInfosSoftMatchFilteredByFormatSupport(
    context: Context!,
    mediaCodecSelector: MediaCodecSelector!,
    format: Format!,
    requiresSecureDecoder: Boolean,
    requiresTunnelingDecoder: Boolean
): (Mutable)List<MediaCodecInfo!>!
```

Returns a list of decoders that can decode media in the specified format, in the priority order specified by the `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector`. Unlike `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfosSoftMatch(androidx.media3.exoplayer.mediacodec.MediaCodecSelector,androidx.media3.common.Format,boolean,boolean)`, this method may exclude decoders that match the sample MIME type but do not support relevant format details.

This list is more complete than `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfos(java.lang.String,boolean,boolean)`, as it also considers alternative MIME types that are a close match using `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getAlternativeCodecMimeType(androidx.media3.common.Format)`.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | The application context. |
| `mediaCodecSelector: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecSelector!` | The decoder selector. |
| `format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` for which a decoder is required. |
| `requiresSecureDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether a secure decoder is required. |
| `requiresTunnelingDecoder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether a tunneling decoder is required. |

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo!>!` | A list of `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo`s corresponding to decoders. May be empty. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil.DecoderQueryException` | Thrown if there was an error querying decoders. |

### getDecoderInfosSortedByFormatSupport

```
java-static fun getDecoderInfosSortedByFormatSupport(
    context: Context!,
    decoderInfos: (Mutable)List<MediaCodecInfo!>!,
    format: Format!
): (Mutable)List<MediaCodecInfo!>!
```

Returns a copy of the provided decoder list sorted such that decoders with functional format support are listed first. The returned list is modifiable for convenience.

### getDecoderInfosSortedByFullFormatSupport

```
java-static fun getDecoderInfosSortedByFullFormatSupport(
    context: Context!,
    decoderInfos: (Mutable)List<MediaCodecInfo!>!,
    format: Format!
): (Mutable)List<MediaCodecInfo!>!
```

Returns a copy of the provided decoder list sorted such that decoders with complete format support are listed first. The returned list is modifiable for convenience.

### getDecoderInfosSortedBySoftwareOnly

```
java-static fun getDecoderInfosSortedBySoftwareOnly(
    decoderInfos: (Mutable)List<MediaCodecInfo!>!
): (Mutable)List<MediaCodecInfo!>!
```

Returns a copy of the provided decoder list sorted such that software decoders are listed first. Break ties by listing non-`https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo#vendor()` decoders first, due to issues with decoder reuse with some software vendor codecs. See b/382447848.

The returned list is not modifiable.

### getDecryptOnlyDecoderInfo

```
java-static fun getDecryptOnlyDecoderInfo(): MediaCodecInfo?
```

Returns information about a decoder that will only decrypt data, without decoding it.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo?` | A `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecInfo` describing the decoder, or null if no suitable decoder exists. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil.DecoderQueryException` | If there was an error querying the available decoders. |

### getHevcBaseLayerCodecProfileAndLevel

```
java-static fun getHevcBaseLayerCodecProfileAndLevel(format: Format!): CodecSpecificDataUtil.MediaCodecProfileAndLevel?
```

Returns profile and level (as defined by `https://developer.android.com/reference/android/media/MediaCodecInfo.CodecProfileLevel.html`) corresponding to the base layer (for the case of falling back to single-layer HEVC from L-HEVC).

| Parameters |
|---|---|
| `format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | Media format with codec specific initialization data. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/CodecSpecificDataUtil.MediaCodecProfileAndLevel?` | A pair (profile constant, level constant) if the initializationData of the ` format` is well-formed and recognized, or null otherwise. |

### maxH264DecodableFrameSize

```
java-static fun maxH264DecodableFrameSize(): Int
```

Returns the maximum frame size supported by the default H264 decoder.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The maximum frame size for an H264 stream that can be decoded on the device. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil.DecoderQueryException` |   |

### warmDecoderInfoCache

```
java-static fun warmDecoderInfoCache(mimeType: String!, secure: Boolean, tunneling: Boolean): Unit
```

Optional call to warm the codec cache for a given MIME type.

Calling this method may speed up subsequent calls to `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfo(java.lang.String,boolean,boolean)` and `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil#getDecoderInfos(java.lang.String,boolean,boolean)`.

| Parameters |
|---|---|
| `mimeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The MIME type. |
| `secure: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the decoder is required to support secure decryption. Always pass false unless secure decryption really is required. |
| `tunneling: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the decoder is required to support tunneling. Always pass false unless tunneling really is required. |