MultiMedia_MediaCommon

    Since:

    1.0

    Version:

    1.0

    Summary

    Files

    Data Structures

    Data Structure Name

    Description

    Represents the data format.

    OHOS::Media::Format

    Saves and sets media metadata, such as the media playback duration.

    Defines the audio Device Descriptor.

    OHOS::Media::StreamCallback

    Provides functions to obtain the address of a buffer memory and write the filled buffers into the playback queue. You need to implement the functions in a player object.

    OHOS::Media::StreamSource

    Provides functions related to the stream source for upper-layer applications.

    Provides functions to implement source-related operations.

    Enumerations

    Enumeration Name

    Description

    OHOS::Media::FormatDataType : uint32_t {   , OHOS::Media::FORMAT_TYPE_INT32, , OHOS::Media::FORMAT_TYPE_FLOAT,   , OHOS::Media::FORMAT_TYPE_STRING }

    Enumerates formats.

    {   AUDIO_SOURCE_INVALID = -1, = 0, AUDIO_MIC = 1, = 2,   AUDIO_VOICE_DOWNLINK = 3, = 4, AUDIO_CAMCORDER = 5, = 6,   AUDIO_VOICE_COMMUNICATION = 7, = 8, AUDIO_UNPROCESSED = 9, = 10,   AUDIO_ECHO_REFERENCE = 1997, = 1998, AUDIO_HOTWORD = 1999, = 10007 }

    Enumerates audio source types.

    AudioStreamType {    = -1, TYPE_MEDIA = 0, = 1, TYPE_SYSTEM = 2,    = 3, TYPE_MUSIC = 4, = 5, TYPE_NOTIFICATION = 6,    = 7, TYPE_ENFORCED_AUDIBLE = 8, = 9, TYPE_TTS = 10,    = 11 }

    Enumerates audio stream types.

    VideoCodecFormat { = 0, H264 = 2, = 5 }

    Enumerates video codec formats.

    AudioCodecFormat {    = 0, AAC_LC = 1, = 2, AAC_HE_V2 = 3,    = 4, AAC_ELD = 5, }

    Enumerates audio codec formats.

    AudioBitWidth { = 8, BIT_WIDTH_16 = 16, = 24, BIT_WIDTH_BUTT }

    Enumerates audio bit widths.

    : int32_t { OHOS::Media::SourceType::SOURCE_TYPE_URI = 0, , OHOS::Media::SourceType::SOURCE_TYPE_STREAM }

    Enumerates media source types.

    : uint32_t {   OHOS::Media::StreamCallback::STREAM_FLAG_SYNCFRAME = 1, = 2, OHOS::Media::StreamCallback::STREAM_FLAG_EOS = 4, = 8,   OHOS::Media::StreamCallback::STREAM_FLAG_ENDOFFRAME = 16, = 32 }

    Enumerates buffer types of stream sources.

    Functions

    Function Name

    Description

    OHOS::Media::FormatData::GetType () const

     

    Obtains the format type.

    OHOS::Media::FormatData::SetValue (int32_t val)

    bool 

    Sets a 32-bit integer.

    (int64_t val)

    bool 

    Sets a 64-bit long integer.

    OHOS::Media::FormatData::SetValue (float val)

    bool 

    Sets a single-precision floating-point number.

    (double val)

    bool 

    Sets a double-precision floating-point number.

    OHOS::Media::FormatData::SetValue (const std::string &val)

    bool 

    Sets a string.

    (int32_t &val) const

    bool 

    Obtains a 32-bit integer.

    OHOS::Media::FormatData::GetInt64Value (int64_t &val) const

    bool 

    Obtains a long integer.

    (float &val) const

    bool 

    Obtains a single-precision floating-point number.

    OHOS::Media::FormatData::GetDoubleValue (double &val) const

    bool 

    Obtains a double-precision floating-point number.

    (std::string &val) const

    bool 

    Obtains a string.

    OHOS::Media::Format::Format ()

     

    Default constructor of the instance.

    OHOS::Media::Format::PutIntValue (const std::string &key, int32_t value)

    bool 

    Sets metadata of the integer type.

    (const std::string &key, int64_t value)

    bool 

    Sets metadata of the long integer type.

    OHOS::Media::Format::PutFloatValue (const std::string &key, float value)

    bool 

    Sets metadata of the single-precision floating-point type.

    (const std::string &key, double value)

    bool 

    Sets metadata of the double-precision floating-point type.

    OHOS::Media::Format::PutStringValue (const std::string &key, const std::string &value)

    bool 

    Sets metadata of the string type.

    (const std::string &key, int32_t &value) const

    bool 

    Obtains the metadata value of the integer type.

    OHOS::Media::Format::GetLongValue (const std::string &key, int64_t &value) const

    bool 

    Obtains the metadata value of the long integer type.

    (const std::string &key, float &value) const

    bool 

    Obtains the metadata value of the single-precision floating-point type.

    OHOS::Media::Format::GetDoubleValue (const std::string &key, double &value) const

    bool 

    Obtains the metadata value of the double-precision floating-point type.

    (const std::string &key, std::string &value) const

    bool 

    Obtains the metadata value of the string type.

    OHOS::Media::Format::GetFormatMap () const

    const std::map< std::string, > & 

    Obtains the metadata map.

    OHOS::Media::Format::CopyFrom (const &format)

    bool 

    Sets all metadata to a specified format.

    OHOS::Media::ErrCodeOffset (unsigned int subsystem, unsigned int module=0)

    constexpr ErrCode 

    Generates a start error code with a unique identifier based on specified subsystem and module bit numbers.

    (size_t index)=0

    virtual uint8_t  

    Obtains the virtual address of a buffer memory block based on its index.

    (size_t index, size_t offset, size_t size, int64_t timestampUs, uint32_t flags)=0

    virtual void 

    Writes the filled buffer memory block into the player memory.

    (const Format &params)=0

    virtual void 

    Sets additional information about a stream.

    (size_t index, size_t offset, size_t size)=0

    virtual void 

    Notifies your application of the information about the buffer memory block that can be filled with data.

    (const std::shared_ptr< StreamCallback > &callback)=0

    virtual void 

    Sets a callback function for your application.

    (const std::string &uri)

     

    A constructor used to create a Source instance based on a specified URI.

    (const std::string &uri, const std::map< std::string, std::string > &header)

     

    A constructor used to create a Source instance based on a specified URI and header.

    (const std::shared_ptr< StreamSource > &stream, const &formats)

     

    A constructor used to create a Source instance based on the stream source and format information.

    () const

    SourceType 

    Obtains the source type.

    () const

    const std::string & 

    Obtains the media source URI.

    OHOS::Media::Source::GetSourceHeader () const

    const std::map< std::string, std::string > & 

    Obtains the HTTP header for the media source.

    () const

    const std::shared_ptr< StreamSource > & 

    Obtains information about the media source stream.

    () const

    const Format

    Obtains the media source stream format.

    Details

    Enumeration Type Documentation

    AudioBitWidth

    Description:

    Enumerates audio bit widths.

    Enumerator

    Description

    BIT_WIDTH_8 

    8-bit width

    BIT_WIDTH_16 

    16-bit width

    BIT_WIDTH_24 

    24-bit width

    BIT_WIDTH_BUTT 

    Invalid value

    AudioCodecFormat

    Description:

    Enumerates audio codec formats.

    Enumerator

    Description

    AUDIO_DEFAULT 

    Default format

    AAC_LC 

    Advanced Audio Coding Low Complexity (AAC-LC)

    AAC_HE_V1 

    High-Efficiency Advanced Audio Coding (AAC-HE), previously known as AAC+ or aacPlus v1

    AAC_HE_V2 

    AAC++ or aacPlus v2

    AAC_LD 

    Advanced Audio Coding Low Delay (AAC-LD)

    AAC_ELD 

    Advanced Audio Coding Enhanced Low Delay (AAC-ELD)

    FORMAT_BUTT 

    Invalid value

    AudioSourceType

    1. enum [AudioSourceType]($api-api-SmartVision-Devices-MultiMedia_MediaCommon.md#gadc3158e093b995ca7b9b6aa32388ccdd)

    Description:

    Enumerates audio source types.

    Description

    AUDIO_SOURCE_INVALID 

    Invalid audio source

    AUDIO_SOURCE_DEFAULT 

    Default audio source

    AUDIO_MIC 

    Microphone

    AUDIO_VOICE_UPLINK 

    Uplink voice

    AUDIO_VOICE_DOWNLINK 

    Downlink voice

    AUDIO_VOICE_CALL 

    Voice call

    AUDIO_CAMCORDER 

    Camcorder

    AUDIO_VOICE_RECOGNITION 

    Voice recognition

    AUDIO_VOICE_COMMUNICATION 

    Voice communication

    AUDIO_REMOTE_SUBMIX 

    Remote submix

    AUDIO_UNPROCESSED 

    Unprocessed audio

    AUDIO_VOICE_PERFORMANCE 

    Voice performance

    AUDIO_ECHO_REFERENCE 

    Echo reference

    AUDIO_RADIO_TUNER 

    Radio tuner

    AUDIO_HOTWORD 

    Hotword

    AUDIO_REMOTE_SUBMIX_EXTEND 

    Extended remote submix

    AudioStreamType

    1. enum [AudioStreamType]($api-api-SmartVision-Devices-MultiMedia_MediaCommon.md#gae7077e4211e48131ae544adb20fc494a)

    Description:

    Enumerates audio stream types.

    Enumerator

    Description

    TYPE_DEFAULT 

    Default audio stream type

    TYPE_MEDIA 

    Media

    TYPE_VOICE_COMMUNICATION 

    Voice call

    TYPE_SYSTEM 

    System sound

    TYPE_RING 

    Ringtone

    TYPE_MUSIC 

    Music

    TYPE_ALARM 

    Alarm

    TYPE_NOTIFICATION 

    Notification

    TYPE_BLUETOOTH_SCO 

    Bluetooth Synchronous Connection-Oriented (SCO)

    TYPE_ENFORCED_AUDIBLE 

    Enforced audible

    TYPE_DTMF 

    Dual-tone multi-frequency (DTMF)

    TYPE_TTS 

    Text-To-Speech (TTS)

    TYPE_ACCESSIBILITY 

    Accessibility

    BufferFlags

    1. enum [OHOS::Media::StreamCallback::BufferFlags]($api-api-SmartVision-Devices-MultiMedia_MediaCommon.md#ga6f4847f443de5cdf3641386011335e21) : uint32_t

    Description:

    Enumerates buffer types of stream sources.

    Enumerator

    Description

    STREAM_FLAG_SYNCFRAME 

    Synchronous frame

    STREAM_FLAG_CODECCONFIG 

    Codec configuration information

    STREAM_FLAG_EOS 

    End of Stream (EOS)

    STREAM_FLAG_PARTIAL_FRAME 

    Part of a frame

    STREAM_FLAG_ENDOFFRAME 

    End of a frame. It is used in pair with STREAM_FLAG_PARTIAL_FRAME.

    STREAM_FLAG_MUXER_DATA 

    Container file data, such as MP4 file data (not supported yet)

    FormatDataType

    1. enum [OHOS::Media::FormatDataType]($api-api-SmartVision-Devices-MultiMedia_MediaCommon.md#gaa3bfacc6563d8ec8bc870f4b216b4f46) : uint32_t

    Description:

    Enumerates formats.

    Enumerator

    Description

    FORMAT_TYPE_NONE 

    None

    FORMAT_TYPE_INT32 

    Int32

    FORMAT_TYPE_INT64 

    Int64

    FORMAT_TYPE_FLOAT 

    Float

    FORMAT_TYPE_DOUBLE 

    Double

    FORMAT_TYPE_STRING 

    String

    SourceType

    1. enum [OHOS::Media::SourceType]($api-api-SmartVision-Devices-MultiMedia_MediaCommon.md#ga4052b7b55dfd94f1d07678e79d80b507) : int32_t

    Description:

    Enumerates media source types.

    Enumerator

    Description

    SOURCE_TYPE_URI 

    Local file path or network address

    SOURCE_TYPE_FD 

    Local file descriptor

    SOURCE_TYPE_STREAM 

    Stream data, such as Advanced Audio Coding (AAC) stream data

    VideoCodecFormat

    1. enum [VideoCodecFormat]($api-api-SmartVision-Devices-MultiMedia_MediaCommon.md#ga797e6c5e38e23e730eff5bcc41427d7e)

    Description:

    Enumerates video codec formats.

    Enumerator

    Description

    VIDEO_DEFAULT 

    Default format

    H264 

    H.264

    HEVC 

    High Efficiency Video Coding (HEVC)

    Function Documentation

    CopyFrom()

    1. bool OHOS::Media::Format::CopyFrom (const [Format]($api-api-SmartVision-Devices-OHOS-Media-Format.md) & format)

    Description:

    Sets all metadata to a specified format.

    Parameters:

    Name

    Description

    format Indicates the format. For details, see Format.

    Returns:

    Returns true if the setting is successful; returns false otherwise.

    ErrCodeOffset()

    1. constexpr ErrCode OHOS::Media::ErrCodeOffset (unsigned int subsystem, unsigned int module = [/topic/body/section/screen/code
    2. {""}) 0 (code] )

    Description:

    Generates a start error code with a unique identifier based on specified subsystem and module bit numbers.

    Parameters:

    Name

    Description

    subsystem Indicates the subsystem bit number.
    module Indicates the module bit number.

    Returns:

    Format()

    1. OHOS::Media::Format::Format ()

    Description:

    Default constructor of the Format instance.

    GetBuffer()

    1. virtual uint8_t* OHOS::Media::StreamCallback::GetBuffer (size_t index)

    Description:

    Obtains the virtual address of a buffer memory block based on its index.

    Parameters:

    Returns:

    Returns the pointer to the virtual address of the buffer memory block.

    GetDoubleValue() [1/2]

    1. bool OHOS::Media::Format::GetDoubleValue (const std::string & key, double & value ) const

    Description:

    Obtains the metadata value of the double-precision floating-point type.

    Parameters:

    Name

    Description

    key Indicates the metadata key.
    value Indicates the metadata value to obtain, which is a double-precision floating-point number.

    Returns:

    Returns true if the double-precision number is successfully obtained; returns false otherwise.

    GetDoubleValue() [2/2]

    1. bool OHOS::Media::FormatData::GetDoubleValue (double & val) const

    Description:

    Obtains a double-precision floating-point number.

    Parameters:

    Name

    Description

    val Indicates the double-precision floating-point number to obtain.

    Returns:

    Returns true if the double-precision number is successfully obtained; returns false otherwise.

    GetFloatValue() [1/2]

    1. bool OHOS::Media::Format::GetFloatValue (const std::string & key, float & value ) const

    Description:

    Obtains the metadata value of the single-precision floating-point type.

    Parameters:

    Name

    Description

    key Indicates the metadata key.
    value Indicates the metadata value to obtain, which is a single-precision floating-point number.

    Returns:

    Returns true if the single-precision number is successfully obtained; returns false otherwise.

    GetFloatValue() [2/2]

    1. bool OHOS::Media::FormatData::GetFloatValue (float & val) const

    Description:

    Obtains a single-precision floating-point number.

    Parameters:

    Name

    Description

    val Indicates the single-precision floating-point number to obtain.

    Returns:

    Returns true if the single-precision number is successfully obtained; returns false otherwise.

    GetFormatMap()

    1. const std::map<std::string, [FormatData]($api-api-SmartVision-Devices-OHOS-Media-FormatData.md) *>& OHOS::Media::Format::GetFormatMap () const

    Description:

    Obtains the metadata map.

    Returns:

    Returns the map object.

    GetInt32Value()

    1. bool OHOS::Media::FormatData::GetInt32Value (int32_t & val) const

    Description:

    Obtains a 32-bit integer.

    Parameters:

    Name

    Description

    val Indicates the 32-bit integer to obtain.

    Returns:

    Returns true if the integer is successfully obtained; returns false otherwise.

      Description:

      Obtains a long integer.

      Parameters:

      Name

      Description

      val Indicates the long integer to obtain.

      Returns:

      Returns true if the integer is successfully obtained; returns false otherwise.

      GetIntValue()

      1. bool OHOS::Media::Format::GetIntValue (const std::string & key, int32_t & value ) const

      Description:

      Obtains the metadata value of the integer type.

      Parameters:

      Name

      Description

      key Indicates the metadata key.
      value Indicates the metadata value to obtain, which is a 32-bit integer.

      Returns:

      Returns true if the integer is successfully obtained; returns false otherwise.

      GetLongValue()

      1. bool OHOS::Media::Format::GetLongValue (const std::string & key, int64_t & value ) const

      Description:

      Obtains the metadata value of the long integer type.

      Parameters:

      Name

      Description

      key Indicates the metadata key.
      value Indicates the metadata value to obtain, which is a 64-bit long integer.

      Returns:

      Returns true if the integer is successfully obtained; returns false otherwise.

      GetSourceHeader()

      1. const std::map<std::string, std::string>& OHOS::Media::Source::GetSourceHeader () const

      Description:

      Obtains the HTTP header for the media source.

      This function is called only when the SourceType is .

      Returns:

      Returns the media source header.

      GetSourceStream()

      Description:

      Obtains information about the media source stream.

      This function is called only when the is SOURCE_TYPE_STREAM.

      Returns:

      Returns information about the media source stream. For details, see .

      GetSourceStreamFormat()

      Description:

      Obtains the media source stream format.

      Returns:

      Returns the media source stream format. For details, see .

      GetSourceType()

      1. [SourceType]($api-api-SmartVision-Devices-MultiMedia_MediaCommon.md#ga4052b7b55dfd94f1d07678e79d80b507) OHOS::Media::Source::GetSourceType () const

      Description:

      Obtains the source type.

      Returns:

      Returns the source type. For details, see .

      GetSourceUri()

      1. const std::string& OHOS::Media::Source::GetSourceUri () const

      Description:

      Obtains the media source URI.

      This function is called only when the is SOURCE_TYPE_URI.

      Returns:

      Returns the media source URI.

      GetStringValue() [1/2]

      1. bool OHOS::Media::Format::GetStringValue (const std::string & key, std::string & value ) const

      Description:

      Parameters:

      Name

      Description

      key Indicates the metadata key.
      value Indicates the metadata value to obtain, which is a string.

      Returns:

      Returns true if the string is successfully obtained; returns false otherwise.

      GetStringValue() [2/2]

      1. bool OHOS::Media::FormatData::GetStringValue (std::string & val) const

      Description:

      Obtains a string.

      Parameters:

      Name

      Description

      val Indicates the string to obtain.

      Returns:

      Returns true if the string is successfully obtained; returns false otherwise.

      GetType()

      1. [FormatDataType]($api-api-SmartVision-Devices-MultiMedia_MediaCommon.md#gaa3bfacc6563d8ec8bc870f4b216b4f46) OHOS::Media::FormatData::GetType () const

      Description:

      Obtains the format type.

      Returns:

      Returns the format type. For details, see OHOS::Media::FormatDataType.

      OnBufferAvailable()

      1. virtual void OHOS::Media::StreamSource::OnBufferAvailable (size_t index, size_t offset, size_t size )

      Description:

      Notifies your application of the information about the buffer memory block that can be filled with data.

      Parameters:

      Name

      Description

      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.

      PutDoubleValue()

      1. bool OHOS::Media::Format::PutDoubleValue (const std::string & key, double value )

      Description:

      Sets metadata of the double-precision floating-point type.

      Parameters:

      Name

      Description

      key Indicates the metadata key.
      value Indicates the metadata value, which is a double-precision floating-point number.

      Returns:

      Returns true if the setting is successful; returns false otherwise.

      PutFloatValue()

      1. bool OHOS::Media::Format::PutFloatValue (const std::string & key, float value )

      Description:

      Sets metadata of the single-precision floating-point type.

      Parameters:

      Name

      Description

      key Indicates the metadata key.
      value Indicates the metadata value, which is a single-precision floating-point number.

      Returns:

      Returns true if the metadata is successfully set; returns false otherwise.

      PutIntValue()

      1. bool OHOS::Media::Format::PutIntValue (const std::string & key, int32_t value )

      Description:

      Sets metadata of the integer type.

      Parameters:

      Returns:

      Returns true if the setting is successful; returns false otherwise.

      PutLongValue()

      1. bool OHOS::Media::Format::PutLongValue (const std::string & key, int64_t value )

      Description:

      Sets metadata of the long integer type.

      Parameters:

      Name

      Description

      key Indicates the metadata key.
      value Indicates the metadata value, which is a 64-bit integer.

      Returns:

      Returns true if the setting is successful; returns false otherwise.

      PutStringValue()

      1. bool OHOS::Media::Format::PutStringValue (const std::string & key, const std::string & value )

      Description:

      Sets metadata of the string type.

      Parameters:

      Name

      Description

      key Indicates the metadata key.
      value Indicates the metadata value, which is a string.

      Returns:

      Returns true if the metadata is successfully set; returns false otherwise.

      QueueBuffer()

      1. virtual void OHOS::Media::StreamCallback::QueueBuffer (size_t index, size_t offset, size_t size, int64_t timestampUs, uint32_t flags )

      Description:

      Writes the filled buffer memory block into the player memory.

      Parameters:

      Name

      Description

      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.

      SetParameters()

      1. virtual void OHOS::Media::StreamCallback::SetParameters (const [Format]($api-api-SmartVision-Devices-OHOS-Media-Format.md) & params)

      Description:

      Sets additional information about a stream.

      Parameters:

      Name

      Description

      params Indicates the parameters for additional stream information. For details, see .

      SetStreamCallback()

      1. virtual void OHOS::Media::StreamSource::SetStreamCallback (const std::shared_ptr< [StreamCallback]($api-api-SmartVision-Devices-OHOS-Media-StreamCallback.md) > & callback)

      Description:

      Sets a callback function for your application.

      Parameters:

      Name

      Description

      callback Indicates the StreamCallback function to set.

      SetValue() [1/5]

      1. bool OHOS::Media::FormatData::SetValue (const std::string & val)

      Description:

      Sets a string.

      Parameters:

      Name

      Description

      val Indicates the string to set.

      Returns:

      Returns true if the setting is successful; returns false otherwise.

      SetValue() [2/5]

      1. bool OHOS::Media::FormatData::SetValue (double val)

      Description:

      Sets a double-precision floating-point number.

      Parameters:

      Name

      Description

      val Indicates the double-precision floating-point number to set.

      Returns:

      Returns true if the double-precision floating-point number is successfully set; returns false otherwise.

      SetValue() [3/5]

      1. bool OHOS::Media::FormatData::SetValue (float val)

      Description:

      Sets a single-precision floating-point number.

      Parameters:

      Name

      Description

      val Indicates the single-precision floating-point number to set.

      Returns:

      Returns true if the setting is successful; returns false otherwise.

      SetValue() [4/5]

      1. bool OHOS::Media::FormatData::SetValue (int32_t val)

      Description:

      Sets a 32-bit integer.

      Parameters:

      Name

      Description

      val Indicates the 32-bit integer to set.

      Returns:

      Returns true if the setting is successful; returns false otherwise.

      SetValue() [5/5]

      1. bool OHOS::Media::FormatData::SetValue (int64_t val)

      Description:

      Sets a 64-bit long integer.

      Parameters:

      Name

      Description

      val Indicates the 64-bit long integer to set.

      Returns:

      Returns true if the setting is successful; returns false otherwise.

      Source() [1/3]

      1. OHOS::Media::Source::Source (const std::shared_ptr< [StreamSource]($api-api-SmartVision-Devices-OHOS-Media-StreamSource.md) > & stream, const [Format]($api-api-SmartVision-Devices-OHOS-Media-Format.md) & formats )

      Description:

      A constructor used to create a Source instance based on the stream source and format information.

      Parameters:

      Name

      Description

      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 . This parameter can be null if no information needs to be passed.

      Source() [2/3]

      1. OHOS::Media::Source::Source (const std::string & uri)

      Description:

      A constructor used to create a instance based on a specified URI.

      Parameters:

      Name

      Description

      uri Indicates the media source URI, which can be a network URI or local file path.

      Description:

      A constructor used to create a instance based on a specified URI and header.

      If the HTTP URL header does not carry valid information for network playback, this function is equivalent to Source(const std::string& uri).

      Parameters:

      Name

      Description

      uri Indicates the media source URI.
      header Indicates the header.

      Variable Documentation

      BITRATE_MODE_CBR

      Description:

      Indicates the constant bit rate mode. In this mode, the codec keeps the output bit rate as constant as possible.

      BITRATE_MODE_CQ

      1. const int BITRATE_MODE_CQ = 0

      Description:

      Indicates the constant quality mode. In this mode, the bit rate is not limited to guarantee the image quality to the largest extent.

      BITRATE_MODE_VBR

      1. const int BITRATE_MODE_VBR = 1

      Description:

      Indicates the variable bit rate mode. In this mode, the codec dynamically adjusts the output bit rate based on the image complexity. The codec increases the bit rate if the image is complex and decreases the bit rate if the image is simple.

      CODEC_MIME

      1. const char* OHOS::Media::CODEC_MIME

      Description:

      Indicates the key representing the codec type.

      COLOR_FORMAT_ARGB8888_32BIT

      1. const int32_t COLOR_FORMAT_ARGB8888_32BIT = 16

      Description:

      Indicates the ARGB8888 color format.

      COLOR_FORMAT_YUV420SP

      1. const int32_t COLOR_FORMAT_YUV420SP = 21

      Description:

      Indicates the YUV420SP color format.

      deviceId

      1. uint32_t AudioDeviceDesc::deviceId

      Description:

      Bits 31-24: reserved bits; bits 23-16: mode ID; bits 15-8: device ID; bits 7-0: channel ID

      deviceName

      1. std::string AudioDeviceDesc::deviceName

      Description:

      Device name

      ERR_EARLY_PREPARE

      1. const int32_t OHOS::Media::ERR_EARLY_PREPARE = BASE_MEDIA_ERR_OFFSET + 3

      Description:

      Early media preparation

      ERR_ILLEGAL_STATE

      1. const int32_t OHOS::Media::ERR_ILLEGAL_STATE = BASE_MEDIA_ERR_OFFSET + 1

      Description:

      Status error

      ERR_INVALID_OPERATION

      1. const int32_t OHOS::Media::ERR_INVALID_OPERATION = BASE_MEDIA_ERR_OFFSET + 5

      Description:

      Invalid operation

      ERR_INVALID_PARAM

      1. const int32_t OHOS::Media::ERR_INVALID_PARAM = BASE_MEDIA_ERR_OFFSET + 2

      Description:

      Invalid parameter

      ERR_INVALID_READ

      1. const int32_t OHOS::Media::ERR_INVALID_READ = -1

      Description:

      Invalid data size that has been read

      ERR_NOFREE_CHANNEL

      1. const int32_t OHOS::Media::ERR_NOFREE_CHANNEL = BASE_MEDIA_ERR_OFFSET + 6

      Description:

      No idle channel

      ERR_NOT_STARTED

      1. const int32_t OHOS::Media::ERR_NOT_STARTED = BASE_MEDIA_ERR_OFFSET + 8

      Description:

      Device not started

      ERR_READ_BUFFER

      1. const int32_t OHOS::Media::ERR_READ_BUFFER = BASE_MEDIA_ERR_OFFSET + 7

      Description:

      Buffer reading failed

      ERR_SOURCE_NOT_SET

      1. const int32_t OHOS::Media::ERR_SOURCE_NOT_SET = BASE_MEDIA_ERR_OFFSET + 4

      Description:

      No media source

      ERR_UNKNOWN

      1. const int32_t OHOS::Media::ERR_UNKNOWN = BASE_MEDIA_ERR_OFFSET + 200

      Description:

      Unknown error

      ERROR

      1. const int32_t OHOS::Media::ERROR = BASE_MEDIA_ERR_OFFSET

      Description:

      Fail

      inputSourceType

      1. [AudioSourceType]($api-api-SmartVision-Devices-MultiMedia_MediaCommon.md#gadc3158e093b995ca7b9b6aa32388ccdd) AudioDeviceDesc::inputSourceType

      Description:

      Type of the audio input source

      KEY_IS_SYNC_FRAME

      1. const std::string KEY_IS_SYNC_FRAME = "is-sync-frame"

      Description:

      Indicates that the current frame is an Instantaneous Decoder Refresh (IDR) frame.

      KEY_TIME_US

      1. const std::string KEY_TIME_US = "timeUs"

      Description:

      Indicates the frame timestamp.

      MIME_AUDIO_AAC

      Description:

      Indicates the codec for Advanced Audio Coding (AAC) streams, which is a value of the codec type key.

      MIME_AUDIO_RAW

      Description:

      Indicates the codec for RAW audios (not supported yet), which is a value of the codec type key.

      SUCCESS

      1. const int32_t OHOS::Media::SUCCESS = 0

      Description: