# MultiMedia\_MediaCommon - [Overview](#section1004268445165625) - [Summary](#section131157484165625) - [Files](#files) - [Data Structures](#nested-classes) - [Enumerations](#enum-members) - [Functions](#func-members) - [Details](#section217873255165625) - [Enumeration Type](#section1898325319165625) - [AudioBitWidth](#gae3e35ee2a2222a667fdebbc5b793ca7c) - [AudioCodecFormat](#gaa4ea6f314644ed287e0704be26c768b7) - [AudioSourceType](#gadc3158e093b995ca7b9b6aa32388ccdd) - [AudioStreamType](#gae7077e4211e48131ae544adb20fc494a) - [BufferFlags](#ga6f4847f443de5cdf3641386011335e21) - [FormatDataType](#gaa3bfacc6563d8ec8bc870f4b216b4f46) - [SourceType](#ga4052b7b55dfd94f1d07678e79d80b507) - [VideoCodecFormat](#ga797e6c5e38e23e730eff5bcc41427d7e) - [Function](#section1996891878165625) - [CopyFrom\(\)](#ga528134c9f87bf755077b3ef51d64e198) - [ErrCodeOffset\(\)](#ga5534cc5ecbcb6eb719f55d8695bbb481) - [Format\(\)](#ga42435567c8fd61fd2da4834465aca98e) - [GetBuffer\(\)](#ga8f897b8b2d5baf06e15accfeb97892ae) - [GetDoubleValue\(\) \[1/2\]](#gafe949ed0c2d9dcb5c5e57c7fde226f3e) - [GetDoubleValue\(\) \[2/2\]](#gac1ed56f6d35982f770d083dc16e97dbd) - [GetFloatValue\(\) \[1/2\]](#gac4e963a9fe320c0143ed33df5f737cb3) - [GetFloatValue\(\) \[2/2\]](#gada31b9cf5daa944104417442a5e459dc) - [GetFormatMap\(\)](#ga4adff4846515cef00987a360a4d117af) - [GetInt32Value\(\)](#gac116d67e5e80f1f9c1c573ceb24df36a) - [GetInt64Value\(\)](#ga1f24cb15577c40f7044f4beb96515cfc) - [GetIntValue\(\)](#ga798ef733a253558757f49714090b3969) - [GetLongValue\(\)](#ga7f1c503f40b78083cb9b9ae9ce93d3b4) - [GetSourceStream\(\)](#ga395325402881ad38ef40c9ebd13f174d) - [GetSourceStreamFormat\(\)](#gafbd3c732660124a1dc1d9dd0dfb51393) - [GetSourceType\(\)](#ga93a8f8b86a9385436f6bbce10a860770) - [GetSourceUri\(\)](#ga69ed2683ce3a632f6b2295fb398e4b7b) - [GetStringValue\(\) \[1/2\]](#ga089a3e44e128fb662b72c56b53c7068b) - [GetStringValue\(\) \[2/2\]](#ga9687bb5d98a92e7beb53dfe4ac44eec1) - [GetType\(\)](#ga178a65e0d58071de84e2dbc09ac93407) - [OnBufferAvailable\(\)](#gaaebd4fe9df44b434f410aec32cf23467) - [PutDoubleValue\(\)](#ga9a98a92eb4436301853a049b5f3313c6) - [PutFloatValue\(\)](#gabec9417120824f5bb9eb676be380016f) - [PutIntValue\(\)](#ga66771efe315d001e79a14d316c58718e) - [PutLongValue\(\)](#ga5b4477636095d80ec4e65c1be617c61c) - [PutStringValue\(\)](#gabdc104597559320256930f420eaab82f) - [QueueBuffer\(\)](#gaa62705632557f47f9fd9632157e53a21) - [SetParameters\(\)](#ga29f8c86744bda61f84920654c5f40df0) - [SetStreamCallback\(\)](#ga078516891396a86226c945e02c79c1f5) - [SetValue\(\) \[1/5\]](#gacbbf1dca947de8bce2e1a323a1c2664a) - [SetValue\(\) \[2/5\]](#ga5e9360adeb46e7b147757ca22c65c268) - [SetValue\(\) \[3/5\]](#gaa5ca8643885118cd0b3668d5497a90da) - [SetValue\(\) \[4/5\]](#gaa1a80e9075010faca14c5c71855efe2d) - [SetValue\(\) \[5/5\]](#gabb73fee1739b96b402a430f7879b2ca6) - [Source\(\) \[1/2\]](#gae3640fec3bb0f33f4076dc30e88dac61) - [Source\(\) \[2/2\]](#gab9bfa209ae382e3ba5d5242e8dfe5b20) - [Variable](#section357746916165625) - [BITRATE\_MODE\_CBR](#gaec6a6f6857ff914973ae8dbd6d24435d) - [BITRATE\_MODE\_CQ](#gaa1ea5c3322d75d18fbff0422b758d602) - [BITRATE\_MODE\_VBR](#gad5d276721fde992fff0b3302a6d2c1dc) - [CODEC\_MIME](#ga1b77959b9e9bb70ec3f3a85ddba29f81) - [COLOR\_FORMAT\_ARGB8888\_32BIT](#gaf8f714899f0b11248ea310f8b682ca52) - [COLOR\_FORMAT\_YUV420SP](#ga4a599efd2466cfef88ed7c8332341f28) - [deviceId](#gae354490defc2b40c8aeb7b98700cbbd0) - [deviceName](#gaa24e76abf7ecc4088c6888128109d3e8) - [ERR\_EARLY\_PREPARE](#ga780504ecfc7b140c8fcac6000d21d2cc) - [ERR\_ILLEGAL\_STATE](#ga7d62e4ebba157bb7891397f67686da20) - [ERR\_INVALID\_OPERATION](#gaea6d0afbc7c159296297185d13289c45) - [ERR\_INVALID\_PARAM](#gab54ceb09402da2ac1bec5e93a95dd5a2) - [ERR\_INVALID\_READ](#gaa3475307553e2de4dd7ef799bdc98c14) - [ERR\_NOFREE\_CHANNEL](#ga59c64e4fd1f5890b84e263cb8f1b4a86) - [ERR\_NOT\_STARTED](#ga09c48c16cb88d0f8860fb7bded0d1369) - [ERR\_READ\_BUFFER](#ga93ac3a083852a72b74871883236586ca) - [ERR\_SOURCE\_NOT\_SET](#gafad29c0ac3ef7729944bb907c9abc139) - [ERR\_UNKNOWN](#gaac1feac62b2f5501fb7ea1903c9f2cfc) - [ERROR](#ga9881ac3b69915a2e0e9c401759f77952) - [inputSourceType](#ga8c4f565aa744ec55a784529a843f853e) - [KEY\_IS\_SYNC\_FRAME](#gaa0ad827cdc16d18a73f280911c009cf1) - [KEY\_TIME\_US](#gadac31555c0ac0612c9f72356f9eb1685) - [MIME\_AUDIO\_AAC](#ga9cfdd72ca1bf4a012f2307985a37871f) - [MIME\_AUDIO\_RAW](#ga28a526cce33c93a3c3b797ca94fe03e9) - [SUCCESS](#gaad1937270d3d6c2012ed0e014bd2dc28) ## **Overview** **Description:** Provides data types and media formats required for recording and playing audio and videos. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Files
Saves and sets media metadata, such as the media playback duration. |
|
Provides functions to obtain the address of a buffer memory and write the filled buffers into the playback queue. You need to implement the StreamCallback functions in a player object. |
|
Provides functions related to the stream source for upper-layer applications. |
|
OHOS::Media::FormatData::GetType () const |
|
OHOS::Media::FormatData::SetValue (int32_t val) |
|
OHOS::Media::FormatData::SetValue (int64_t val) |
|
OHOS::Media::FormatData::SetValue (float val) |
|
OHOS::Media::FormatData::SetValue (double val) |
|
OHOS::Media::FormatData::SetValue (const std::string &val) |
|
OHOS::Media::FormatData::GetInt32Value (int32_t &val) const |
|
OHOS::Media::FormatData::GetInt64Value (int64_t &val) const |
|
OHOS::Media::FormatData::GetFloatValue (float &val) const |
|
OHOS::Media::FormatData::GetDoubleValue (double &val) const |
|
OHOS::Media::FormatData::GetStringValue (std::string &val) const |
|
|
Default constructor of the Format instance. |
|
OHOS::Media::Format::PutIntValue (const std::string &key, int32_t value) |
|
OHOS::Media::Format::PutLongValue (const std::string &key, int64_t value) |
|
OHOS::Media::Format::PutFloatValue (const std::string &key, float value) |
|
OHOS::Media::Format::PutDoubleValue (const std::string &key, double value) |
|
OHOS::Media::Format::PutStringValue (const std::string &key, const std::string &value) |
|
OHOS::Media::Format::GetIntValue (const std::string &key, int32_t &value) const |
|
OHOS::Media::Format::GetLongValue (const std::string &key, int64_t &value) const |
|
OHOS::Media::Format::GetFloatValue (const std::string &key, float &value) const |
Obtains the metadata value of the single-precision floating-point type. |
OHOS::Media::Format::GetDoubleValue (const std::string &key, double &value) const |
Obtains the metadata value of the double-precision floating-point type. |
OHOS::Media::Format::GetStringValue (const std::string &key, std::string &value) const |
|
OHOS::Media::Format::GetFormatMap () const |
const std::map< std::string, FormatData * > & |
OHOS::Media::Format::CopyFrom (const Format &format) |
|
OHOS::Media::ErrCodeOffset (unsigned int subsystem, unsigned int module=0) |
Generates a start error code with a unique identifier based on specified subsystem and module bit numbers. |
OHOS::Media::StreamCallback::GetBuffer (size_t index)=0 |
Obtains the virtual address of a buffer memory block based on its index. |
OHOS::Media::StreamCallback::QueueBuffer (size_t index, size_t offset, size_t size, int64_t timestampUs, uint32_t flags)=0 |
Writes the filled buffer memory block into the player memory. |
OHOS::Media::StreamCallback::SetParameters (const Format ¶ms)=0 |
|
OHOS::Media::StreamSource::OnBufferAvailable (size_t index, size_t offset, size_t size)=0 |
Notifies your application of the information about the buffer memory block that can be filled with data. |
OHOS::Media::StreamSource::SetStreamCallback (const std::shared_ptr< StreamCallback > &callback)=0 |
|
OHOS::Media::Source::Source (const std::string &uri) |
A constructor used to create a Source instance based on a specified URI. |
OHOS::Media::Source::Source (const std::shared_ptr< StreamSource > &stream, const Format &formats) |
A constructor used to create a Source instance based on the stream source and format information. |
OHOS::Media::Source::GetSourceType () const |
|
OHOS::Media::Source::GetSourceUri () const |
|
OHOS::Media::Source::GetSourceStream () const |
const std::shared_ptr< StreamSource > & |
const Format & |
| BIT_WIDTH_8 | |
| BIT_WIDTH_16 | |
| BIT_WIDTH_24 | |
| BIT_WIDTH_BUTT |
| AUDIO_DEFAULT | |
| AAC_LC | |
| AAC_HE_V1 | High-Efficiency Advanced Audio Coding (AAC-HE), previously known as AAC+ or aacPlus v1 |
| AAC_HE_V2 | |
| AAC_LD | |
| AAC_ELD | |
| FORMAT_BUTT |
| TYPE_DEFAULT | |
| TYPE_MEDIA | |
| TYPE_VOICE_COMMUNICATION | |
| TYPE_SYSTEM | |
| TYPE_RING | |
| TYPE_MUSIC | |
| TYPE_ALARM | |
| TYPE_NOTIFICATION | |
| TYPE_BLUETOOTH_SCO | |
| TYPE_ENFORCED_AUDIBLE | |
| TYPE_DTMF | |
| TYPE_TTS | |
| TYPE_ACCESSIBILITY |
| FORMAT_TYPE_NONE | |
| FORMAT_TYPE_INT32 | |
| FORMAT_TYPE_INT64 | |
| FORMAT_TYPE_FLOAT | |
| FORMAT_TYPE_DOUBLE | |
| FORMAT_TYPE_STRING |
| SOURCE_TYPE_URI | |
| SOURCE_TYPE_FD | |
| SOURCE_TYPE_STREAM | Stream data, such as Advanced Audio Coding (AAC) stream data |
| VIDEO_DEFAULT | |
| H264 | |
| HEVC |
| format | Indicates the format. For details, see Format. |
| subsystem | Indicates the subsystem bit number. |
| module | Indicates the module bit number. |
| index | Indicates the index of the buffer memory block. |
| key | Indicates the metadata key. |
| value | Indicates the metadata value to obtain, which is a double-precision floating-point number. |
| val | Indicates the double-precision floating-point number to obtain. |
| key | Indicates the metadata key. |
| value | Indicates the metadata value to obtain, which is a single-precision floating-point number. |
| val | Indicates the single-precision floating-point number to obtain. |
| val | Indicates the 32-bit integer to obtain. |
| val | Indicates the long integer to obtain. |
| key | Indicates the metadata key. |
| value | Indicates the metadata value to obtain, which is a 32-bit integer. |
| key | Indicates the metadata key. |
| value | Indicates the metadata value to obtain, which is a 64-bit long integer. |
| key | Indicates the metadata key. |
| value | Indicates the metadata value to obtain, which is a string. |
| val | Indicates the string to obtain. |
| index | Indicates the index of the buffer memory block. |
| offset | Indicates the start offset into which the data will be written. |
| size | Indicates the size of data that the buffer memory block can store. |
| key | Indicates the metadata key. |
| value | Indicates the metadata value, which is a double-precision floating-point number. |
| key | Indicates the metadata key. |
| value | Indicates the metadata value, which is a single-precision floating-point number. |
| key | Indicates the metadata key. |
| value | Indicates the metadata value, which is a 32-bit integer. |
| key | Indicates the metadata key. |
| value | Indicates the metadata value, which is a 64-bit integer. |
| key | Indicates the metadata key. |
| value | Indicates the metadata value, which is a string. |
| index | Indicates the index of the buffer memory block. |
| offset | Indicates the start offset into which the buffer memory block will be written. |
| size | Indicates the size of the data filled in the buffer memory block. |
| timestampUs | Indicates the timestamp of the frame filled in the buffer memory block. As data in AAC streams can be filled not on a frame basis, set this parameter to 0 for AAC streams. |
| flags | Indicates the type of the current buffer memory block. For details, see BufferFlags. |
| params | Indicates the parameters for additional stream information. For details, see Format. |
| callback | Indicates the StreamCallback function to set. |
| val | Indicates the string to set. |
| val | Indicates the double-precision floating-point number to set. |
| val | Indicates the single-precision floating-point number to set. |
| val | Indicates the 32-bit integer to set. |
| val | Indicates the 64-bit long integer to set. |
| stream | Indicates the media source stream. For details, see StreamSource. |
| formats | Indicates stream data information, which is subject to the stream type. For example, the key is CODEC_MIME, and the value is MIME_AUDIO_AAC. For details, see Format. This parameter can be null if no information needs to be passed. |
| uri | Indicates the media source URI, which can be a network URI or local file path. |