public class Format extends Object
SystemCapability.Multimedia#MEDIA| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
Format.FormatArrays |
Saves key-value pairs in the format list created based on the
formatMap object. |
static class |
Format.Key<T> |
Defines types of codec property keys.
|
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static String |
AAC_PROFILE |
Indicates the Advanced Audio Coding (AAC) profile.
|
static String |
AUDIO_AAC |
Indicates the AAC audio type represented by an MIME string.
|
static String |
AUDIO_AC3 |
Indicates the AC3 audio type represented by an MIME string.
|
static String |
AUDIO_AMR_NB |
Indicates the AMR-NB audio type represented by an MIME type string.
|
static String |
AUDIO_AMR_WB |
Indicates the AMR-WB audio type represented by an MIME string.
|
static String |
AUDIO_EAC3 |
Indicates the EAC3 audio type represented by an MIME string.
|
static String |
AUDIO_FLAC |
Indicates the FLAC audio type represented by an MIME string.
|
static String |
AUDIO_G711_ALAW |
Indicates the G.711 A-law audio type represented by an MIME string.
|
static String |
AUDIO_G711_MLAW |
Indicates the G.711 M-law audio type represented by an MIME string.
|
static String |
AUDIO_MPEG |
Indicates the MPEG audio type represented by an MIME string.
|
static String |
AUDIO_OPUS |
Indicates the OPUS audio type represented by an MIME string.
|
static String |
AUDIO_RAW |
Indicates the RAW audio type represented by an MIME string.
|
static String |
AUDIO_VORBIS |
Indicates the VORBIS audio type represented by an MIME string.
|
static String |
BIT_RATE |
Indicates a key that describes the bit rate.
|
static String |
BITRATE_MODE |
Indicates the bit rate mode to be used by the encoder.
|
static String |
CAPTURE_RATE |
Indicates a key that describes the video capture rate.
|
static String |
CHANNEL |
Indicates a key that describes the number of audio channels.
|
static String |
COLOR_MODEL |
Indicates a key that describes the video color format.
|
static Format.Key<Scope<Integer>> |
COMPLEXITY_SCOPE |
Indicates the key of the encoding complexity range of the codec.
|
static String |
DURATION |
Indicates a key that describes the content duration (in microseconds).
|
static String |
FRAME_INTERVAL |
Indicates a key that describes the I-frame interval.
|
static String |
FRAME_RATE |
Indicates a key that describes the video frame rate.
|
static Format.Key<Scope<Double>> |
FRAME_RATE_SCOPE_FOR_SPECIFIC_SIZE |
Indicates the key of the frame rate range supported by the codec for a specific video size.
|
static String |
HEIGHT |
Indicates a key that describes the video height.
|
static Format.Key<Integer> |
HEIGHT_ALIGNMENT |
Indicates the key of the height alignment parameter of the codec.
|
static Format.Key<Scope<Integer>> |
HEIGHT_SCOPE |
Indicates the key of the video height range supported by the codec.
|
static String |
IS_AUTOSELECT |
Indicates the key of whether the current stream is automatically selected.
|
static String |
IS_DEFAULT |
Indicates the key of whether the current media stream is selected by default.
|
static String |
IS_FORCED_SUBTITLE |
Indicates the key of whether the current subtitle stream is forcibly displayed.
|
static String |
KEY_BIT_RATE_SCOPE |
Indicates the key of a bit rate range.
|
static String |
KEY_FRAME_RATE_SCOPE |
Indicates the key of a frame rate range.
|
static String |
KEY_HEIGHT_SCOPE |
Indicates the key of a height range.
|
static String |
KEY_SAMPLE_RATE_LIST |
Indicates the key of a sampling rate list.
|
static String |
KEY_SAMPLE_RATE_SCOPE |
Indicates the key of a sampling rate range.
|
static String |
KEY_WIDTH_SCOPE |
Indicates the key of a width range.
|
static String |
LANGUAGE |
Indicates the key of a language type.
|
static String |
MAX_HEIGHT |
Indicates a key that describes the maximum video height supported by a decoder.
|
static String |
MAX_INPUT_SIZE |
Indicates a key that describes the maximum input buffer size.
|
static Format.Key<Integer> |
MAX_INSTANCES |
Indicates the key of the maximum number of
codec instances that can run concurrently. |
static String |
MAX_WIDTH |
Indicates a key that describes the maximum video width supported by a decoder.
|
static String |
MIME |
Indicates a key that describes the Multipurpose Internet Mail Extensions (MIME) media type.
|
static String |
MIME_AUDIO_MSGSM |
Indicates the MSGSM audio type represented by an MIME string.
|
static String |
MIME_VIDEO_AV1 |
Indicates a video MIME type.
|
static String |
SAMPLE_RATE |
Indicates a key that describes the sampling rate.
|
static String |
VIDEO_AVC |
Indicates a key that describes the Advanced Video Coding (AVC) MIME type.
|
static String |
VIDEO_DOLBY_VISION |
Indicates the Dolby Vision video type represented by an MIME string.
|
static String |
VIDEO_H263 |
Indicates the H.263 video type represented by an MIME string.
|
static String |
VIDEO_HEVC |
Indicates the HEVC video type represented by an MIME string.
|
static String |
VIDEO_MPEG2 |
Indicates the MPEG-2 video type represented by an MIME string.
|
static String |
VIDEO_MPEG4 |
Indicates the MPEG-4 video type represented by an MIME string.
|
static String |
VIDEO_RAW |
Indicates the RAW video type represented by an MIME string.
|
static String |
VIDEO_VP8 |
Indicates the VP8 video type represented by an MIME string.
|
static String |
VIDEO_VP9 |
Indicates the VP9 video type represented by an MIME string.
|
static String |
WIDTH |
Indicates a key that describes the video width.
|
| 构造器 | 说明 |
|---|---|
Format() |
Default constructor used to create a
Format instance. |
Format(HashMap<String,Object> nativeMap) |
A constructor used to create a
Format instance. |
Format(Map<String,Object> map) |
A constructor that creates a
Format instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
double |
getDoubleValue(String key) |
Obtains a metadata value of the double floating-point type.
|
float |
getFloatValue(String key) |
Obtains a metadata value of the floating-point type.
|
Format.FormatArrays |
getFormatArrays() |
Creates a
FormatArrays instance with formatMap key-value pairs. |
HashMap<String,Object> |
getFormatMap() |
Obtains all metadata.
|
int |
getIntValue(String key) |
Obtains a metadata value of an integer type.
|
long |
getLongValue(String key) |
Obtains a metadata value of the long integer type.
|
Object |
getObjectValue(String key) |
Obtains a metadata value of the Object type.
|
String |
getStringValue(String key) |
Obtains a metadata value of the character string type.
|
boolean |
hasKey(String key) |
Checks whether a metadata key exists.
|
void |
putDoubleValue(String key,
double value) |
Sets metadata of the double floating-point type.
|
void |
putFloatValue(String key,
float value) |
Sets metadata of the floating-point type.
|
void |
putIntValue(String key,
int value) |
Sets metadata of the integer type.
|
void |
putLongValue(String key,
long value) |
Sets metadata of the long integer type.
|
void |
putObjectValue(String key,
Object value) |
Sets metadata of the character Object type.
|
void |
putStringValue(String key,
String value) |
Sets metadata of the character string type.
|
void |
setObjectFormat(String key,
Object value) |
Sets metadata of the character Object type.
|
String |
toString() |
Returns the encoded string representation of Format.
|
public static final String AAC_PROFILE
public static final String AUDIO_AAC
public static final String AUDIO_AC3
public static final String AUDIO_AMR_NB
public static final String AUDIO_AMR_WB
public static final String AUDIO_EAC3
public static final String AUDIO_FLAC
public static final String AUDIO_G711_ALAW
public static final String AUDIO_G711_MLAW
public static final String AUDIO_MPEG
public static final String AUDIO_OPUS
public static final String AUDIO_RAW
public static final String AUDIO_VORBIS
public static final String BITRATE_MODE
public static final String BIT_RATE
public static final String CAPTURE_RATE
public static final String CHANNEL
public static final String COLOR_MODEL
public static final Format.Key<Scope<Integer>> COMPLEXITY_SCOPE
You can pass this constant to (ohos.media.common.Format.Key to obtain the property value.
public static final String DURATION
public static final String FRAME_INTERVAL
public static final String FRAME_RATE
public static final Format.Key<Scope<Double>> FRAME_RATE_SCOPE_FOR_SPECIFIC_SIZE
You can pass this constant to (ohos.media.common.Format.Key to obtain the property value.
public static final String HEIGHT
public static final Format.Key<Integer> HEIGHT_ALIGNMENT
You can pass this constant to (ohos.media.common.Format.Key to obtain the property value.
public static final Format.Key<Scope<Integer>> HEIGHT_SCOPE
You can pass this constant to (ohos.media.common.Format.Key to obtain the property value.
public static final String IS_AUTOSELECT
The value of this key is an integer. A non-zero value indicates that the current stream is automatically selected, which is true by default.
public static final String IS_DEFAULT
The value of this key is an integer. A non-zero value indicates that the current media stream is selected by default, which is true by default.
public static final String IS_FORCED_SUBTITLE
The value of this key is an integer. A non-zero value indicates that the current subtitle stream is forcibly displayed, which is true by default.
public static final String KEY_BIT_RATE_SCOPE
The value is of the Scope<Integer> type.
public static final String KEY_FRAME_RATE_SCOPE
The value is of the Scope<Integer> type.
public static final String KEY_HEIGHT_SCOPE
The value is of the Scope<Integer> type.
public static final String KEY_SAMPLE_RATE_LIST
The value is of the List[] type.
public static final String KEY_SAMPLE_RATE_SCOPE
The value is of the Scope<Integer>[] type.
public static final String KEY_WIDTH_SCOPE
The value is of the Scope<Integer> type.
public static final String LANGUAGE
The value of this key is a string. The value eng represents English,
chi represents Chinese, and und represents an unknown language type.
public static final String MAX_HEIGHT
public static final String MAX_INPUT_SIZE
public static final Format.Key<Integer> MAX_INSTANCES
codec instances that can run concurrently.
You can pass this constant to (ohos.media.common.Format.Key to obtain the property value.
public static final String MAX_WIDTH
public static final String MIME
public static final String MIME_AUDIO_MSGSM
public static final String MIME_VIDEO_AV1
public static final String SAMPLE_RATE
public static final String VIDEO_AVC
public static final String VIDEO_DOLBY_VISION
public static final String VIDEO_H263
public static final String VIDEO_HEVC
public static final String VIDEO_MPEG2
public static final String VIDEO_MPEG4
public static final String VIDEO_RAW
public static final String VIDEO_VP8
public static final String VIDEO_VP9
public Format()
Format instance.public Format(HashMap<String,Object> nativeMap)
Format instance.nativeMap - Indicates key-value pairs of metadata.public HashMap<String,Object> getFormatMap()
public void putIntValue(String key, int value)
key - Indicates a metadata key.value - Indicates a metadata value, which is an integer.public void putLongValue(String key, long value)
key - Indicates a metadata key.value - Indicates a metadata value, which is a long integer.public void putFloatValue(String key, float value)
key - Indicates a metadata key.value - Indicates a metadata value, which is a floating-point number.public void putDoubleValue(String key, double value)
key - Indicates a metadata key.value - Indicates a metadata value, which is a double floating-point number.public void putStringValue(String key, String value)
key - Indicates a metadata key.value - Indicates a metadata value, which is a string.public void setObjectFormat(String key, Object value)
putObjectValue(java.lang.String,java.lang.Object).key - Indicates a metadata key.value - Indicates a metadata value, which is an Object.public void putObjectValue(String key, Object value)
key - Indicates a metadata key.value - Indicates a metadata value, which is an Object.public boolean hasKey(String key)
key - Indicates a metadata key.true if the key exists; returns false otherwise.public int getIntValue(String key)
key - Indicates a metadata key.NullPointerException - if the key does not exist or the value for the key is null.ClassCastException - if the value for the key is not type of int.public long getLongValue(String key)
key - Indicates a metadata key.NullPointerException - if the key does not exist or the value for the key is null.ClassCastException - if the value for the key is not type of long.public float getFloatValue(String key)
key - Indicates a metadata key.NullPointerException - if the key does not exist or the value for the key is null.ClassCastException - if the value for the key is not type of float.public double getDoubleValue(String key)
key - Indicates a metadata key.NullPointerException - if the key does not exist or the value for the key is null.ClassCastException - if the value for the key is not type of double.public String getStringValue(String key)
key - Indicates a metadata key.NullPointerException - if the key does not exist or the value for the key is null.ClassCastException - if the value for the key is not type of string.public Object getObjectValue(String key)
key - Indicates a metadata key.public Format.FormatArrays getFormatArrays()
FormatArrays instance with formatMap key-value pairs.
formatMap key-value pairs are in the (key1, value1), ..., (keyN, valueN) format, and the created
FormatArrays instance has the following structure:
keys: key1,key2, ... , keyN
values: value1, value2, ... , valueN
Notice this function would also convert byte[] value to a ByteBuffer value.
FormatArrays instance.