public final class CodecDescription extends Object
CodecDescriptionList.getSupportedCodecs()SystemCapability.Multimedia#MEDIA| 限定符和类型 | 方法 | 说明 |
|---|---|---|
String[] |
getMimeTypes() |
Obtains the MIME types supported by this
Codec. |
String |
getName() |
Obtains the name of this
Codec object. |
<T> T |
getPropertyValue(Format.Key<T> property) |
Gets the value of a specified property.
|
<T> T |
getPropertyValue(Format.Key<T> property,
Size size) |
Obtains the value of a specified property of this codec based on a specified video size.
|
Format |
getSupportedFormat() |
Obtains the formats supported by this
Codec. |
boolean |
isAudio() |
Checks whether this
Codec is an audios codec. |
boolean |
isEncoder() |
Checks whether this
Codec is an encoder. |
boolean |
isFormatSupported(Format format) |
Checks whether this
Codec supports a specified format. |
boolean |
isSoftware() |
Checks whether this
Codec is a software codec. |
public String getName()
Codec object.
You can understand features of a codec through its name.
The name can describe whether the codec is software or hardware, which MIME types it supports,
and whether it is an encoder or decoder.
For example, SoftwareAvcDecoder indicates a software decoder that supports the AVC format.
public boolean isEncoder()
Codec is an encoder.true if this Codec is an encoder; returns false otherwise.public boolean isAudio()
Codec is an audios codec.true if this Codec is an audio codec; returns false otherwise.public boolean isSoftware()
Codec is a software codec.
Hardware codecs are generally provided by codec vendors.
true if this Codec is a software codec; returns false otherwise.public String[] getMimeTypes()
Codec.Format.public Format getSupportedFormat()
Codec.
This method returns a Format object that contains keys in the media metadata.
The keys include ranges of the audio sampling rate and bit rate,
or ranges of the video height and width, bit rate, and frame rate.
To obtain values of these keys, you need to use the Format.getObjectValue(java.lang.String) method
and convert data types of return values.
Format keys that can be obtained are as follows:
Format.KEY_SAMPLE_RATE_SCOPE,Format.KEY_SAMPLE_RATE_LIST,
Format.KEY_BIT_RATE_SCOPE, Format.KEY_FRAME_RATE_SCOPE,
Format.KEY_HEIGHT_SCOPE, ohos.media.common.Format#KEY_WIGHT_SCOPE
Format object.public boolean isFormatSupported(Format format)
Codec supports a specified format.format - Indicates a media format, which may contain information
such as the audio sampling rate or video height and width.true if this Codec supports the format; returns false otherwise.public <T> T getPropertyValue(Format.Key<T> property)
T - Indicates the data type of the property.property - Indicates properties supported by the media.NullPointerException - Throws this exception if property is null.public <T> T getPropertyValue(Format.Key<T> property, Size size)
T - Indicates the data type of the property value.property - Indicates the property whose value is to be obtained. Available properties are defined in
the Format class.size - Indicates the video size.NullPointerException - Throws this exception if property is null.