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 DecoderInfo |
getDecoderInfo(String mimeType,
boolean secure)
Get information about the preferred decoder for a given mime type.
|
static List<DecoderInfo> |
getDecoderInfos(String mimeType,
boolean secure)
Returns all @{link DecoderInfo}s for a given mime type, in the order given by
MediaCodecList . |
static DecoderInfo |
getPassthroughDecoderInfo()
Gets information about a decoder suitable for audio passthrough.
|
static boolean |
isH264ProfileSupported(int profile,
int level)
Deprecated.
Prefer
getDecoderInfos(String, boolean) for new code. |
static boolean |
isSizeAndRateSupportedV21(String mimeType,
boolean secure,
int width,
int height,
double frameRate)
Tests whether the device advertises it can decode video of a given type at a specified
width, height, and frame rate.
|
static boolean |
isSizeSupportedV21(String mimeType,
boolean secure,
int width,
int height)
Tests whether the device advertises it can decode video of a given type at a specified width
and height.
|
static int |
maxH264DecodableFrameSize() |
static void |
warmCodec(String mimeType,
boolean secure)
Optional call to warm the codec cache for a given mime type.
|
public static void warmCodec(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 DecoderInfo getPassthroughDecoderInfo()
DecoderInfo
describing the decoder, or null if no suitable decoder exists.public static DecoderInfo 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.DecoderInfo
describing the decoder, or null if no suitable decoder exists.MediaCodecUtil.DecoderQueryException
public static List<DecoderInfo> getDecoderInfos(String mimeType, boolean secure) throws MediaCodecUtil.DecoderQueryException
MediaCodecList
.mimeType
- The mime type.secure
- Whether the decoders are required to support secure decryption. Always pass false
unless secure decryption really is required.MediaCodecUtil.DecoderQueryException
public static boolean isSizeSupportedV21(String mimeType, boolean secure, int width, int height) throws MediaCodecUtil.DecoderQueryException
Must not be called if the device SDK version is less than 21.
mimeType
- The mime type.secure
- Whether the decoder is required to support secure decryption. Always pass false
unless secure decryption really is required.width
- Width in pixels.height
- Height in pixels.MediaCodecUtil.DecoderQueryException
public static boolean isSizeAndRateSupportedV21(String mimeType, boolean secure, int width, int height, double frameRate) throws MediaCodecUtil.DecoderQueryException
Must not be called if the device SDK version is less than 21.
mimeType
- The mime type.secure
- Whether the decoder is required to support secure decryption. Always pass false
unless secure decryption really is required.width
- Width in pixels.height
- Height in pixels.frameRate
- Frame rate in frames per second.MediaCodecUtil.DecoderQueryException
@Deprecated public static boolean isH264ProfileSupported(int profile, int level) throws MediaCodecUtil.DecoderQueryException
getDecoderInfos(String, boolean)
for new code.profile
- An AVC profile constant from MediaCodecInfo.CodecProfileLevel
.level
- An AVC profile level from MediaCodecInfo.CodecProfileLevel
.MediaCodecUtil.DecoderQueryException
public static int maxH264DecodableFrameSize() throws MediaCodecUtil.DecoderQueryException
MediaCodecUtil.DecoderQueryException