Most visited

Recently visited

Added in API level 16

MediaCodecList

public final class MediaCodecList
extends Object

java.lang.Object
    android.media.MediaCodecList


允许您枚举可用的编解码器,每个指定为 MediaCodecInfo对象,查找支持给定格式的编解码器并查询给 MediaCodecInfo解码器的功能。

有关示例用法,请参见 MediaCodecInfo

摘要(Summary)

常量(Constants)

int ALL_CODECS

用于 MediaCodecList(int)枚举所有编解码器,即使是不适合常规(缓冲区到缓冲区)解码或编码的编解码器。

int REGULAR_CODECS

用于 MediaCodecList(int)仅枚举适用于常规(缓冲区到缓冲区)解码或编码的编解码器。

Public constructors

MediaCodecList(int kind)

创建一个特定类型的媒体编解码器列表。

公共方法(Public methods)

final String findDecoderForFormat(MediaFormat format)

在媒体编解码器列表中找到支持给定 MediaFormat的解码器。

final String findEncoderForFormat(MediaFormat format)

在媒体编解码器列表中查找支持给定 MediaFormat的编码器。

static final int getCodecCount()

此方法在API级别21中已弃用。请改为使用getCodecInfos()

static final MediaCodecInfo getCodecInfoAt(int index)

此方法在API级别21中已弃用。请改为使用getCodecInfos()

final MediaCodecInfo[] getCodecInfos()

返回媒体编解码器列表的 MediaCodecInfo对象列表。

继承方法(Inherited methods)

From class java.lang.Object

常量(Constants)

ALL_CODECS

Added in API level 21
int ALL_CODECS

MediaCodecList(int)使用枚举所有编解码器,即使是不适合常规(缓冲区到缓冲区)解码或编码的编解码器。 这些包括编解码器,例如,只能用于特殊输入或输出表面,例如仅安全或隧道编解码器。

也可以看看:

常数值:1(0x00000001)

REGULAR_CODECS

Added in API level 21
int REGULAR_CODECS

用于MediaCodecList(int)仅枚举适用于常规(缓冲区到缓冲区)解码或编码的编解码器。 注意:这些是使用现在不推荐使用的静态方法在API 21之前返回的编解码器。

常量值:0(0x00000000)

Public constructors

MediaCodecList

Added in API level 21
MediaCodecList (int kind)

创建一个特定类型的媒体编解码器列表。

参数(Parameters)
kind int: Either REGULAR_CODECS or ALL_CODECS.

公共方法(Public methods)

findDecoderForFormat

Added in API level 21
String findDecoderForFormat (MediaFormat format)

在媒体编解码器列表中找到支持给定 MediaFormat的解码器。

注意:LOLLIPOPformat不能包含frame rate 使用format.setString(MediaFormat.KEY_FRAME_RATE, null)以格式清除任何现有的帧速率设置。

参数(Parameters)
format MediaFormat: A decoder media format with optional feature directives.
返回(Returns)
String the name of a decoder that supports the given format and feature requests, or null if no such codec has been found.
抛出异常(Throws)
IllegalArgumentException if format is not a valid media format.
NullPointerException if format is null.

也可以看看:

findEncoderForFormat

Added in API level 21
String findEncoderForFormat (MediaFormat format)

在媒体编解码器列表中找到支持给定 MediaFormat的编码器。

注意:LOLLIPOPformat不能包含frame rate 使用format.setString(MediaFormat.KEY_FRAME_RATE, null)清除格式中的任何现有帧速率设置。

参数(Parameters)
format MediaFormat: An encoder media format with optional feature directives.
返回(Returns)
String the name of an encoder that supports the given format and feature requests, or null if no such codec has been found.
抛出异常(Throws)
IllegalArgumentException if format is not a valid media format.
NullPointerException if format is null.

也可以看看:

getCodecCount

Added in API level 16
int getCodecCount ()

此方法在API级别21中已弃用。
改为使用getCodecInfos()

计算可用(常规)编解码器的数量。

返回(Returns)
int

也可以看看:

getCodecInfoAt

Added in API level 16
MediaCodecInfo getCodecInfoAt (int index)

此方法在API级别21中已弃用。
改为使用getCodecInfos()

返回常规列表中给定 index的编解码器的 MediaCodecInfo对象。

参数(Parameters)
index int
返回(Returns)
MediaCodecInfo

也可以看看:

getCodecInfos

Added in API level 21
MediaCodecInfo[] getCodecInfos ()

返回媒体编解码器列表的 MediaCodecInfo对象列表。

返回(Returns)
MediaCodecInfo[]

Hooray!