public final class MediaCodecUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
MediaCodecUtil.DecoderQueryException
Thrown when an error occurs querying the device for its underlying media capabilities.
|
Modifier and Type | Method and Description |
---|---|
static Pair<Integer,Integer> |
getCodecProfileAndLevel(String codec)
Returns profile and level (as defined by
MediaCodecInfo.CodecProfileLevel ) corresponding to the given
codec description string (as defined by RFC 6381). |
static MediaCodecInfo |
getDecoderInfo(String mimeType,
boolean secure)
Returns information about the preferred decoder for a given mime type.
|
static List<MediaCodecInfo> |
getDecoderInfos(String mimeType,
boolean secure)
Returns all
MediaCodecInfo s for the given mime type, in the order given by
MediaCodecList . |
static MediaCodecInfo |
getPassthroughDecoderInfo()
Returns information about a decoder suitable for audio passthrough.
|
static int |
maxH264DecodableFrameSize()
Returns the maximum frame size supported by the default H264 decoder.
|
static void |
warmDecoderInfoCache(String mimeType,
boolean secure)
Optional call to warm the codec cache for a given mime type.
|
public static void warmDecoderInfoCache(String mimeType, boolean secure)
Calling this method may speed up subsequent calls to getDecoderInfo(String, boolean)
.
mimeType
- The mime type.secure
- Whether the decoder is required to support secure decryption. Always pass false
unless secure decryption really is required.public static MediaCodecInfo getPassthroughDecoderInfo()
MediaCodecInfo
describing the decoder, or null if no suitable decoder
exists.public static MediaCodecInfo getDecoderInfo(String mimeType, boolean secure) 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.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) throws MediaCodecUtil.DecoderQueryException
MediaCodecInfo
s for the given mime type, in the order given by
MediaCodecList
.mimeType
- The mime type.secure
- Whether the decoder is required to support secure decryption. Always pass false
unless secure decryption really is required.MediaCodecList
.MediaCodecUtil.DecoderQueryException
- If there was an error querying the available decoders.public static int maxH264DecodableFrameSize() throws MediaCodecUtil.DecoderQueryException
MediaCodecUtil.DecoderQueryException
public static Pair<Integer,Integer> getCodecProfileAndLevel(String codec)
MediaCodecInfo.CodecProfileLevel
) corresponding to the given
codec description string (as defined by RFC 6381).codec
- A codec description string, as defined by RFC 6381.codec
is well-formed and
recognized, or null otherwise