public final class MediaCodecUtil extends Object
| Modifier and Type | Class | Description |
|---|---|---|
static class |
MediaCodecUtil.DecoderQueryException |
Thrown when an error occurs querying the device for its underlying media capabilities.
|
| Modifier and Type | Method | Description |
|---|---|---|
static void |
clearDecoderInfoCache() |
Clears the codec cache.
|
static Pair<Integer,Integer> |
getCodecProfileAndLevel(Format format) |
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) |
Returns information about the preferred decoder for a given mime type.
|
static List<MediaCodecInfo> |
getDecoderInfos(String mimeType,
boolean secure,
boolean tunneling) |
|
static List<MediaCodecInfo> |
getDecoderInfosSortedByFormatSupport(List<MediaCodecInfo> decoderInfos,
Format format) |
Returns a copy of the provided decoder list sorted such that decoders with format support are
listed first.
|
static MediaCodecInfo |
getDecryptOnlyDecoderInfo() |
Returns information about a decoder that will only decrypt data, without decoding it.
|
static int |
maxH264DecodableFrameSize() |
Returns the maximum frame size supported by the default H264 decoder.
|
static void |
warmDecoderInfoCache(String mimeType,
boolean secure,
boolean tunneling) |
Optional call to warm the codec cache for a given mime type.
|
public static void warmDecoderInfoCache(String mimeType, boolean secure, boolean tunneling)
Calling this method may speed up subsequent calls to getDecoderInfo(String, boolean,
boolean) and getDecoderInfos(String, boolean, boolean).
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()
This method should only be called in tests.
@Nullable public static MediaCodecInfo getDecryptOnlyDecoderInfo() throws MediaCodecUtil.DecoderQueryException
MediaCodecInfo describing the decoder, or null if no suitable decoder exists.MediaCodecUtil.DecoderQueryException - If there was an error querying the available decoders.@Nullable public static MediaCodecInfo getDecoderInfo(String mimeType, boolean secure, boolean tunneling) throws MediaCodecUtil.DecoderQueryException
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.MediaCodecInfo describing the decoder, or null if no suitable decoder exists.MediaCodecUtil.DecoderQueryException - If there was an error querying the available decoders.public static List<MediaCodecInfo> getDecoderInfos(String mimeType, boolean secure, boolean tunneling) throws MediaCodecUtil.DecoderQueryException
@CheckResult public static List<MediaCodecInfo> getDecoderInfosSortedByFormatSupport(List<MediaCodecInfo> decoderInfos, Format format)
public static int maxH264DecodableFrameSize()
throws MediaCodecUtil.DecoderQueryException
MediaCodecUtil.DecoderQueryException@Nullable public static Pair<Integer,Integer> getCodecProfileAndLevel(Format format)
MediaCodecInfo.CodecProfileLevel) corresponding to the codec
description string (as defined by RFC 6381) of the given format.format - Media format with a codec description string, as defined by RFC 6381.format is
well-formed and recognized, or null otherwise.