docs/doc/reference/com/google/android/exoplayer2/mediacodec/MediaCodecUtil.html
Package com.google.android.exoplayer2.mediacodec
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classMediaCodecUtilextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
A utility class for querying the available codecs.
Nested Classes | Modifier and Type | Class | Description |
| --- | --- | --- |
| static class | MediaCodecUtil.DecoderQueryException |
Deprecated.
Thrown when an error occurs querying the device for its underlying media capabilities. |
All Methods Static Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| static void | clearDecoderInfoCache() |
Deprecated.
|
| static String | getAlternativeCodecMimeType(Format format) |
Deprecated.
Returns an alternative codec MIME type (besides the default Format.sampleMimeType) that can be used to decode samples of the provided Format.
|
| static List<MediaCodecInfo> | getAlternativeDecoderInfos(MediaCodecSelector mediaCodecSelector, Format format, boolean requiresSecureDecoder, boolean requiresTunnelingDecoder) |
Deprecated.
Returns a list of decoders for alternative MIME types that can decode samples of the provided Format, in the priority order specified by the MediaCodecSelector.
|
| static Pair<Integer,Integer> | getCodecProfileAndLevel(Format format) |
Deprecated.
Returns profile and level (as defined by MediaCodecInfo.CodecProfileLevel) corresponding to the codec description string (as defined by RFC 6381) of the given format.
|
| static MediaCodecInfo | getDecoderInfo(String mimeType, boolean secure, boolean tunneling) |
Deprecated.
Returns information about the preferred decoder for a given MIME type.
|
| static List<MediaCodecInfo> | getDecoderInfos(String mimeType, boolean secure, boolean tunneling) |
Deprecated.
Returns all MediaCodecInfos for the given MIME type, in the order given by MediaCodecList.
|
| static List<MediaCodecInfo> | getDecoderInfosSoftMatch(MediaCodecSelector mediaCodecSelector, Format format, boolean requiresSecureDecoder, boolean requiresTunnelingDecoder) |
Deprecated.
Returns a list of decoders that can decode media in the specified format, in the priority order specified by the MediaCodecSelector.
|
| static List<MediaCodecInfo> | getDecoderInfosSortedByFormatSupport(List<MediaCodecInfo> decoderInfos, Format format) |
Deprecated.
Returns a copy of the provided decoder list sorted such that decoders with functional format support are listed first.
|
| static MediaCodecInfo | getDecryptOnlyDecoderInfo() |
Deprecated.
Returns information about a decoder that will only decrypt data, without decoding it.
|
| static int | maxH264DecodableFrameSize() |
Deprecated.
Returns the maximum frame size supported by the default H264 decoder.
|
| static void | warmDecoderInfoCache(String mimeType, boolean secure, boolean tunneling) |
Deprecated.
Optional call to warm the codec cache for a given MIME type. |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public static void warmDecoderInfoCache([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType,
boolean secure,
boolean tunneling)
Deprecated.
Optional call to warm the codec cache for a given MIME type.
Calling this method may speed up subsequent calls to getDecoderInfo(String, boolean, boolean) and getDecoderInfos(String, boolean, boolean).
Parameters:mimeType - The MIME type.secure - Whether the decoder is required to support secure decryption. Always pass false unless secure decryption really is required.tunneling - Whether the decoder is required to support tunneling. Always pass false unless tunneling really is required.
-
public static void clearDecoderInfoCache()
Deprecated.
-
@Nullable
public static[MediaCodecInfo](MediaCodecInfo.html "class in com.google.android.exoplayer2.mediacodec")getDecryptOnlyDecoderInfo()
throws[MediaCodecUtil.DecoderQueryException](MediaCodecUtil.DecoderQueryException.html "class in com.google.android.exoplayer2.mediacodec")
Deprecated.
Returns information about a decoder that will only decrypt data, without decoding it.
Returns:A MediaCodecInfo describing the decoder, or null if no suitable decoder exists.Throws:MediaCodecUtil.DecoderQueryException - If there was an error querying the available decoders.
-
@Nullable
public static[MediaCodecInfo](MediaCodecInfo.html "class in com.google.android.exoplayer2.mediacodec")getDecoderInfo([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType,
boolean secure,
boolean tunneling)
throws[MediaCodecUtil.DecoderQueryException](MediaCodecUtil.DecoderQueryException.html "class in com.google.android.exoplayer2.mediacodec")
Deprecated.
Returns information about the preferred decoder for a given MIME type.
Parameters:mimeType - The MIME type.secure - Whether the decoder is required to support secure decryption. Always pass false unless secure decryption really is required.tunneling - Whether the decoder is required to support tunneling. Always pass false unless tunneling really is required.Returns:A MediaCodecInfo describing the decoder, or null if no suitable decoder exists.Throws:MediaCodecUtil.DecoderQueryException - If there was an error querying the available decoders.
-
public static[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[MediaCodecInfo](MediaCodecInfo.html "class in com.google.android.exoplayer2.mediacodec")> getDecoderInfos([String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")mimeType,
boolean secure,
boolean tunneling)
throws[MediaCodecUtil.DecoderQueryException](MediaCodecUtil.DecoderQueryException.html "class in com.google.android.exoplayer2.mediacodec")
Deprecated.
Returns all MediaCodecInfos for the given MIME type, in the order given by MediaCodecList.
Parameters:mimeType - The MIME type.secure - Whether the decoder is required to support secure decryption. Always pass false unless secure decryption really is required.tunneling - Whether the decoder is required to support tunneling. Always pass false unless tunneling really is required.Returns:An unmodifiable list of all MediaCodecInfos for the given MIME type, in the order given by MediaCodecList.Throws:MediaCodecUtil.DecoderQueryException - If there was an error querying the available decoders.
-
@RequiresNonNull("#2.sampleMimeType")
public static[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[MediaCodecInfo](MediaCodecInfo.html "class in com.google.android.exoplayer2.mediacodec")> getDecoderInfosSoftMatch([MediaCodecSelector](MediaCodecSelector.html "interface in com.google.android.exoplayer2.mediacodec")mediaCodecSelector,[Format](../Format.html "class in com.google.android.exoplayer2")format,
boolean requiresSecureDecoder,
boolean requiresTunnelingDecoder)
throws[MediaCodecUtil.DecoderQueryException](MediaCodecUtil.DecoderQueryException.html "class in com.google.android.exoplayer2.mediacodec")
Deprecated.
Returns a list of decoders that can decode media in the specified format, in the priority order specified by the MediaCodecSelector.
Since the MediaCodecSelector only has access to 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). getDecoderInfosSortedByFormatSupport(java.util.List<com.google.android.exoplayer2.mediacodec.MediaCodecInfo>, com.google.android.exoplayer2.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 getDecoderInfos(java.lang.String, boolean, boolean), as it also considers alternative MIME types that are a close match using getAlternativeCodecMimeType(com.google.android.exoplayer2.Format).
Parameters:mediaCodecSelector - The decoder selector.format - The Format for which a decoder is required.requiresSecureDecoder - Whether a secure decoder is required.requiresTunnelingDecoder - Whether a tunneling decoder is required.Returns:A list of MediaCodecInfos corresponding to decoders. May be empty.Throws:MediaCodecUtil.DecoderQueryException - Thrown if there was an error querying decoders.
-
public static[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[MediaCodecInfo](MediaCodecInfo.html "class in com.google.android.exoplayer2.mediacodec")> getAlternativeDecoderInfos([MediaCodecSelector](MediaCodecSelector.html "interface in com.google.android.exoplayer2.mediacodec")mediaCodecSelector,[Format](../Format.html "class in com.google.android.exoplayer2")format,
boolean requiresSecureDecoder,
boolean requiresTunnelingDecoder)
throws[MediaCodecUtil.DecoderQueryException](MediaCodecUtil.DecoderQueryException.html "class in com.google.android.exoplayer2.mediacodec")
Deprecated.
Returns a list of decoders for alternative MIME types that can decode samples of the provided Format, in the priority order specified by the MediaCodecSelector.
Since the MediaCodecSelector only has access to 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). getDecoderInfosSortedByFormatSupport(java.util.List<com.google.android.exoplayer2.mediacodec.MediaCodecInfo>, com.google.android.exoplayer2.Format) can be used to further sort the list into an order where decoders that fully support the format come first.
Parameters:mediaCodecSelector - The decoder selector.format - The Format for which an alternative decoder is required.requiresSecureDecoder - Whether a secure decoder is required.requiresTunnelingDecoder - Whether a tunneling decoder is required.Returns:A list of MediaCodecInfos corresponding to alternative decoders. May be empty.Throws:MediaCodecUtil.DecoderQueryException - Thrown if there was an error querying decoders.
-
@CheckResult
public static[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[MediaCodecInfo](MediaCodecInfo.html "class in com.google.android.exoplayer2.mediacodec")> getDecoderInfosSortedByFormatSupport([List](https://developer.android.com/reference/java/util/List.html?is-external=true "class or interface in java.util")<[MediaCodecInfo](MediaCodecInfo.html "class in com.google.android.exoplayer2.mediacodec")> decoderInfos,[Format](../Format.html "class in com.google.android.exoplayer2")format)
Deprecated.
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.
-
public static int maxH264DecodableFrameSize()
throws[MediaCodecUtil.DecoderQueryException](MediaCodecUtil.DecoderQueryException.html "class in com.google.android.exoplayer2.mediacodec")
Deprecated.
Returns the maximum frame size supported by the default H264 decoder.
Returns:The maximum frame size for an H264 stream that can be decoded on the device.Throws:MediaCodecUtil.DecoderQueryException
-
@Nullable
public static[Pair](https://developer.android.com/reference/android/util/Pair.html "class or interface in android.util")<[Integer](https://developer.android.com/reference/java/lang/Integer.html?is-external=true "class or interface in java.lang"),[Integer](https://developer.android.com/reference/java/lang/Integer.html?is-external=true "class or interface in java.lang")> getCodecProfileAndLevel([Format](../Format.html "class in com.google.android.exoplayer2")format)
Deprecated.
Returns profile and level (as defined by MediaCodecInfo.CodecProfileLevel) corresponding to the codec description string (as defined by RFC 6381) of the given format.
Parameters:format - Media format with a codec description string, as defined by RFC 6381.Returns:A pair (profile constant, level constant) if the codec of the format is well-formed and recognized, or null otherwise.
-
@Nullable
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getAlternativeCodecMimeType([Format](../Format.html "class in com.google.android.exoplayer2")format)
Deprecated.
Returns an alternative codec MIME type (besides the default Format.sampleMimeType) that can be used to decode samples of the provided Format.
Parameters:format - The media format.Returns:An alternative MIME type of a codec that be used decode samples of the provided Format (besides the default Format.sampleMimeType), or null if no such alternative exists.