public final class MediaCodecInfo extends Object
MediaCodecList
. For example,
here's how to find an encoder that supports a given MIME type:
private static MediaCodecInfo selectCodec(String mimeType) { int numCodecs = MediaCodecList.getCodecCount(); for (int i = 0; i < numCodecs; i++) { MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i); if (!codecInfo.isEncoder()) { continue; } String[] types = codecInfo.getSupportedTypes(); for (int j = 0; j < types.length; j++) { if (types[j].equalsIgnoreCase(mimeType)) { return codecInfo; } } } return null; }
Modifier and Type | Class and Description |
---|---|
static class |
MediaCodecInfo.AudioCapabilities
A class that supports querying the audio capabilities of a codec.
|
static class |
MediaCodecInfo.CodecCapabilities
Encapsulates the capabilities of a given codec component.
|
static class |
MediaCodecInfo.CodecProfileLevel
Encapsulates the profiles available for a codec component.
|
static class |
MediaCodecInfo.EncoderCapabilities
A class that supports querying the encoding capabilities of a codec.
|
static class |
MediaCodecInfo.VideoCapabilities
A class that supports querying the video capabilities of a codec.
|
Modifier and Type | Method and Description |
---|---|
MediaCodecInfo.CodecCapabilities |
getCapabilitiesForType(String type)
Enumerates the capabilities of the codec component.
|
String |
getName()
Retrieve the codec name.
|
String[] |
getSupportedTypes()
Query the media types supported by the codec.
|
boolean |
isEncoder()
Query if the codec is an encoder.
|
MediaCodecInfo |
makeRegular() |
public final String getName()
public final boolean isEncoder()
public final String[] getSupportedTypes()
public final MediaCodecInfo.CodecCapabilities getCapabilitiesForType(String type)
type
- The MIME type to querypublic MediaCodecInfo makeRegular()