MediaCodecList
class MediaCodecList
kotlin.Any | |
↳ | android.media.MediaCodecList |
Allows you to enumerate available codecs, each specified as a MediaCodecInfo
object, find a codec supporting a given format and query the capabilities of a given codec.
See MediaCodecInfo
for sample usage.
Summary
Constants | |
---|---|
static Int |
Use in |
static Int |
Use in |
Public constructors | |
---|---|
MediaCodecList(kind: Int) Create a list of media-codecs of a specific kind. |
Public methods | |
---|---|
String! |
findDecoderForFormat(format: MediaFormat!) Find a decoder supporting a given |
String! |
findEncoderForFormat(format: MediaFormat!) Find an encoder supporting a given |
static Int |
Count the number of available (regular) codecs. |
static MediaCodecInfo! |
getCodecInfoAt(index: Int) Return the |
Array<MediaCodecInfo!>! |
Returns the list of |
Constants
ALL_CODECS
static val ALL_CODECS: Int
Use in MediaCodecList
to enumerate all codecs, even ones that are not suitable for regular (buffer-to-buffer) decoding or encoding. These include codecs, for example, that only work with special input or output surfaces, such as secure-only or tunneled-only codecs.
Value: 1
REGULAR_CODECS
static val REGULAR_CODECS: Int
Use in MediaCodecList
to enumerate only codecs that are suitable for regular (buffer-to-buffer) decoding or encoding. NOTE: These are the codecs that are returned prior to API 21, using the now deprecated static methods.
Value: 0
Public constructors
MediaCodecList
MediaCodecList(kind: Int)
Create a list of media-codecs of a specific kind.
Parameters | |
---|---|
kind |
Int: Either MediaCodecList.REGULAR_CODECS or MediaCodecList.ALL_CODECS . |
Public methods
findDecoderForFormat
fun findDecoderForFormat(format: MediaFormat!): String!
Find a decoder supporting a given MediaFormat
in the list of media-codecs.
Note: On android.os.Build.VERSION_CODES#LOLLIPOP
, format
must not contain a frame rate. Use format.setString(MediaFormat.KEY_FRAME_RATE, null)
to clear any existing frame rate setting in the format.
Parameters | |
---|---|
format |
MediaFormat!: A decoder media format with optional feature directives. |
Return | |
---|---|
String! |
the name of a decoder that supports the given format and feature requests, or null if no such codec has been found. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if format is not a valid media format. |
java.lang.NullPointerException |
if format is null. |
findEncoderForFormat
fun findEncoderForFormat(format: MediaFormat!): String!
Find an encoder supporting a given MediaFormat
in the list of media-codecs.
Note: On android.os.Build.VERSION_CODES#LOLLIPOP
, format
must not contain a frame rate. Use format.setString(MediaFormat.KEY_FRAME_RATE, null)
to clear any existing frame rate setting in the format.
Parameters | |
---|---|
format |
MediaFormat!: An encoder media format with optional feature directives. |
Return | |
---|---|
String! |
the name of an encoder that supports the given format and feature requests, or null if no such codec has been found. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if format is not a valid media format. |
java.lang.NullPointerException |
if format is null. |
getCodecCount
static fungetCodecCount(): Int
Deprecated: Use getCodecInfos
instead.
Count the number of available (regular) codecs.
See Also
getCodecInfoAt
static fungetCodecInfoAt(index: Int): MediaCodecInfo!
Deprecated: Use getCodecInfos
instead.
Return the MediaCodecInfo
object for the codec at the given index
in the regular list.
See Also
getCodecInfos
fun getCodecInfos(): Array<MediaCodecInfo!>!
Returns the list of MediaCodecInfo
objects for the list of media-codecs.