| [native_avcapability.h](native__avcapability_8h.md) | Declares the native APIs used to query the codec capability.<br>File to include: \<multimedia/native_avcapability.h>|
### Structs
| Name| Description|
| -------- | -------- |
| [OH_AVRange](_o_h___a_v_range.md) | Defines the value range, which contains the minimum value and maximum value.|
### Types
| Name| Description|
| -------- | -------- |
| [OH_BitrateMode](#oh_bitratemode) | Defines an enum that enumerates the bit rate modes of an encoder. |
| [OH_AVRange](#oh_avrange) | Defines a struct for the value range, which contains the minimum value and maximum value.|
| [OH_AVCodecCategory](#oh_avcodeccategory) | Defines an enum that enumerates the codec categories.|
### Enums
| Name| Description|
| -------- | -------- |
| [OH_BitrateMode](#oh_bitratemode) { **BITRATE_MODE_CBR** = 0, **BITRATE_MODE_VBR** = 1, **BITRATE_MODE_CQ** = 2 } | Enumerates the bit rate modes of an encoder. |
| \*[OH_AVCodec_GetCapability](#oh_avcodec_getcapability)(const char \*mime, bool isEncoder) | Obtains the codec capability recommended by the system.|
| \*[OH_AVCodec_GetCapabilityByCategory](#oh_avcodec_getcapabilitybycategory)(const char \*mime, bool isEncoder, [OH_AVCodecCategory](#oh_avcodeccategory) category) | Obtains the codec capability by category, which can be a hardware codec or software codec.|
| [OH_AVCapability_IsHardware](#oh_avcapability_ishardware)(OH_AVCapability\*capability) | Checks whether a codec capability instance describes a hardware codec.|
| \*[OH_AVCapability_GetName](#oh_avcapability_getname)(OH_AVCapability\*capability) | Obtains the codec name.|
| [OH_AVCapability_GetMaxSupportedInstances](#oh_avcapability_getmaxsupportedinstances)(OH_AVCapability\*capability) | Obtains the maximum number of codec instances supported by a codec.|
| [OH_AVCapability_GetEncoderBitrateRange](#oh_avcapability_getencoderbitraterange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*bitrateRange) | Obtains the bit rate range supported by an encoder.|
| [OH_AVCapability_IsEncoderBitrateModeSupported](#oh_avcapability_isencoderbitratemodesupported)(OH_AVCapability\*capability, [OH_BitrateMode](#oh_bitratemode) bitrateMode) | Checks whether an encoder supports a specific bit rate mode.|
| [OH_AVCapability_GetEncoderQualityRange](#oh_avcapability_getencoderqualityrange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*qualityRange) | Obtains the quality range supported by an encoder.|
| [OH_AVCapability_GetEncoderComplexityRange](#oh_avcapability_getencodercomplexityrange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*complexityRange) | Obtains the complexity range supported by an encoder.|
| [OH_AVCapability_GetAudioSupportedSampleRates](#oh_avcapability_getaudiosupportedsamplerates)(OH_AVCapability\*capability, const int32_t \*\*sampleRates, uint32_t \*sampleRateNum) | Obtains the sampling rates supported by an audio codec.|
| [OH_AVCapability_GetAudioChannelCountRange](#oh_avcapability_getaudiochannelcountrange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*channelCountRange) | Obtains the count range of audio channels supported by an audio codec.|
| [OH_AVCapability_GetVideoWidthAlignment](#oh_avcapability_getvideowidthalignment)(OH_AVCapability\*capability, int32_t \*widthAlignment) | Obtains the video width alignment supported by a video codec.|
| [OH_AVCapability_GetVideoHeightAlignment](#oh_avcapability_getvideoheightalignment)(OH_AVCapability\*capability, int32_t \*heightAlignment) | Obtains the video height alignment supported by a video codec.|
| [OH_AVCapability_GetVideoWidthRangeForHeight](#oh_avcapability_getvideowidthrangeforheight)(OH_AVCapability\*capability, int32_t height, [OH_AVRange](_o_h___a_v_range.md)\*widthRange) | Obtains the video width range supported by a video codec based on a given height.|
| [OH_AVCapability_GetVideoHeightRangeForWidth](#oh_avcapability_getvideoheightrangeforwidth)(OH_AVCapability\*capability, int32_t width, [OH_AVRange](_o_h___a_v_range.md)\*heightRange) | Obtains the video height range supported by a video codec based on a given width.|
| [OH_AVCapability_GetVideoWidthRange](#oh_avcapability_getvideowidthrange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*widthRange) | Obtains the video width range supported by a video codec.|
| [OH_AVCapability_GetVideoHeightRange](#oh_avcapability_getvideoheightrange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*heightRange) | Obtains the video height range supported by a video codec.|
| [OH_AVCapability_IsVideoSizeSupported](#oh_avcapability_isvideosizesupported)(OH_AVCapability\*capability, int32_t width, int32_t height) | Checks whether a video codec supports a specific video size.|
| [OH_AVCapability_GetVideoFrameRateRange](#oh_avcapability_getvideoframeraterange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*frameRateRange) | Obtains the video frame rate range supported by a video codec.|
| [OH_AVCapability_GetVideoFrameRateRangeForSize](#oh_avcapability_getvideoframeraterangeforsize)(OH_AVCapability\*capability, int32_t width, int32_t height, [OH_AVRange](_o_h___a_v_range.md)\*frameRateRange) | Obtains the video frame rate range supported by a video codec based on a given video size.|
| [OH_AVCapability_AreVideoSizeAndFrameRateSupported](#oh_avcapability_arevideosizeandframeratesupported)(OH_AVCapability\*capability, int32_t width, int32_t height, int32_t frameRate) | Checks whether a video codec supports the combination of a video size and frame rate.|
| [OH_AVCapability_GetVideoSupportedPixelFormats](#oh_avcapability_getvideosupportedpixelformats)(OH_AVCapability\*capability, const int32_t \*\*pixelFormats, uint32_t \*pixelFormatNum) | Obtains the video pixel formats supported by a video codec.|
| [OH_AVCapability_GetSupportedProfiles](#oh_avcapability_getsupportedprofiles)(OH_AVCapability\*capability, const int32_t \*\*profiles, uint32_t \*profileNum) | Obtains the profiles supported by a codec.|
| [OH_AVCapability_GetSupportedLevelsForProfile](#oh_avcapability_getsupportedlevelsforprofile)(OH_AVCapability\*capability, int32_t profile, const int32_t \*\*levels, uint32_t \*levelNum) | Obtains the codec levels supported by a profile.|
| [OH_AVCapability_AreProfileAndLevelSupported](#oh_avcapability_areprofileandlevelsupported)(OH_AVCapability\*capability, int32_t profile, int32_t level) | Checks whether a codec supports the combination of a profile and level.|
### Variables
| Name| Description|
| -------- | -------- |
| **OH_AVRange::minVal** | Defines the minimum value.|
| **OH_AVRange::maxVal** | Defines the maximum value.|
## Type Description
### OH_AVCodecCategory
```
typedef enum OH_AVCodecCategoryOH_AVCodecCategory
```
**Description**
Defines an enum that enumerates the codec categories.
| [native_avdemuxer.h](native__avdemuxer_8h.md) | Declares the native APIs used for audio and video decapsulation.<br>File to include: \<multimedia/native_avdemuxer.h> |
### Functions
| Name| Description|
| -------- | -------- |
| \*[OH_AVDemuxer_CreateWithSource](#oh_avdemuxer_createwithsource)(OH_AVSource\*source) | Creates an **OH_AVDemuxer** instance based on an **OH_AVSource** instance.|
| [OH_AVDemuxer_Destroy](#oh_avdemuxer_destroy)(OH_AVDemuxer\*demuxer) | Destroys an **OH_AVDemuxer** instance and clears internal resources.|
| [OH_AVDemuxer_SelectTrackByID](#oh_avdemuxer_selecttrackbyid)(OH_AVDemuxer\*demuxer, uint32_t trackIndex) | Selects a track, from which the demuxer reads data.|
| [OH_AVDemuxer_UnselectTrackByID](#oh_avdemuxer_unselecttrackbyid)(OH_AVDemuxer\*demuxer, uint32_t trackIndex) | Deselects a track. The demuxer no longer reads data from a track after it is deselected.|
| [OH_AVDemuxer_ReadSample](#oh_avdemuxer_readsample)(OH_AVDemuxer\*demuxer, uint32_t trackIndex, OH_AVMemory \*sample, OH_AVCodecBufferAttr \*info) | Obtains the compressed frame and related information at the current position from the selected track.|
| [OH_AVDemuxer_SeekToTime](#oh_avdemuxer_seektotime)(OH_AVDemuxer\*demuxer, int64_t millisecond, OH_AVSeekMode mode) | Seeks to the specified time for all the selected tracks based on a seek mode.|
Selects a track, from which the demuxer reads data.
You can select multiple tracks by calling this API multiple times, with a different track index passed in each time.
When **OH_AVDemuxer_ReadSample** is called, only the data in the selected track is read. If the same track is selected multiple times, **AV_ERR_OK** is returned and the API call takes effect only once.
The **AVMuxer** module provides functions for audio and video encapsulation.
\@syscap SystemCapability.Multimedia.Media.Muxer
**Since**
10
## Summary
### Files
| Name| Description|
| -------- | -------- |
| [native_avmuxer.h](native__avmuxer_8h.md) | Declares native APIs used for audio and video encapsulation.<br>File to include: <multimedia/native_avmuxer.h>|
### Functions
| Name| Description|
| -------- | -------- |
| \*[OH_AVMuxer_Create](#oh_avmuxer_create)(int32_t fd, OH_AVOutputFormat format) | Creates an **OH_AVMuxer** instance by using the file descriptor and encapsulation format.|
| [OH_AVMuxer_SetRotation](#oh_avmuxer_setrotation)(OH_AVMuxer\*muxer, int32_t rotation) | Sets the rotation angle (clockwise) of an output video.|
| [OH_AVMuxer_AddTrack](#oh_avmuxer_addtrack)(OH_AVMuxer\*muxer, int32_t \*trackIndex, OH_AVFormat \*trackFormat) | Adds a media track to the muxer.|
| [OH_AVMuxer_WriteSample](#oh_avmuxer_writesample)(OH_AVMuxer\*muxer, uint32_t trackIndex, OH_AVMemory \*sample, OH_AVCodecBufferAttr info) | Writes data to the muxer.|
This function must be called before **OH_AVMuxer_Start**.
\@syscap SystemCapability.Multimedia.Media.Muxer
**Parameters**
| Name| Description|
| -------- | -------- |
| muxer | Pointer to an **OH_AVMuxer** instance.|
| trackIndex | Pointer to the index of the media track. The index will be used in the **OH_AVMuxer_WriteSample** function. If the media track is added, the index value is greater than or equal to 0; otherwise, the value is less than 0.|
| trackFormat | Pointer to an **OH_AVFormat** instance.|
**Returns**
Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode-1) otherwise.
**Since**
10
### OH_AVMuxer_Create()
```
OH_AVMuxer* OH_AVMuxer_Create (int32_t fd, OH_AVOutputFormat format )
```
**Description**
Creates an **OH_AVMuxer** instance by using the file descriptor and encapsulation format.
\@syscap SystemCapability.Multimedia.Media.Muxer
**Parameters**
| Name| Description|
| -------- | -------- |
| fd | File descriptor (FD). You must open the file in read/write mode (O_RDWR) and close the file after using it.|
| format | Format of the encapsulated output file. For details, see [OH_AVOutputFormat](_codec_base.md#oh_avoutputformat).|
**Returns**
Returns the pointer to the **OH_AVMuxer** instance created. You must call **OH_AVMuxer_Destroy** to destroy the instance when it is no longer needed.
Clears internal resources and destroys an **OH_AVMuxer** instance.
\@syscap SystemCapability.Multimedia.Media.Muxer
**Parameters**
| Name| Description|
| -------- | -------- |
| muxer | Pointer to an **OH_AVMuxer** instance.|
**Returns**
Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode-1) otherwise. You must set the muxer to null.
This function must be called after **OH_AVMuxer_Start** and before **OH_AVMuxer_Stop**. You must ensure that the data is written to the correct media track in ascending order by time.
\@syscap SystemCapability.Multimedia.Media.Muxer
**Parameters**
| Name| Description|
| -------- | -------- |
| muxer | Pointer to an **OH_AVMuxer** instance.|
| trackIndex | Index of the media track corresponding to the data.|
| sample | Pointer to the buffer that stores the data written (data obtained after encoding or decapsulation).|
| info | Information about the data written. For details, see [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md).|
**Returns**
Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode-1) otherwise.
| [native_avsource.h](native__avsource_8h.md) | Declares the native APIs used to construct audio and video resource objects.<br>File to include: \<multimedia/native_avsource.h>|
### Functions
| Name| Description|
| -------- | -------- |
| \*[OH_AVSource_CreateWithURI](#oh_avsource_createwithuri)(char\*uri) | Creates an **OH_AVSource** instance based on a URI.|
| \*[OH_AVSource_CreateWithFD](#oh_avsource_createwithfd)(int32_t fd, int64_t offset, int64_t size) | Creates an **OH_AVSource** instance based on a file descriptor (FD).|
| [OH_AVSource_Destroy](#oh_avsource_destroy)(OH_AVSource\*source) | Destroys an **OH_AVSource** instance and clears internal resources. An instance can be destroyed only once.|
| \*[OH_AVSource_GetSourceFormat](#oh_avsource_getsourceformat)(OH_AVSource\*source) | Obtains the basic information about a media resource.|
| \*[OH_AVSource_GetTrackFormat](#oh_avsource_gettrackformat)(OH_AVSource\*source, uint32_t trackIndex) | Obtains the basic information about a track.|
Creates an **OH_AVSource** instance based on an FD.
You can release the instance by calling **OH_AVSource_Destroy**.
If **offset** is not the start position of the file or **size** is not the file size, undefined errors such as creation failure and decapsulation failure may occur due to incomplete data obtained.
Provides the functions for audio decoding. This module may not be supported on some devices. You can call [CanIUse](../syscap.md) to check whether this module is supported on your device.
The **AudioDecoder** module provides the functions for audio decoding. This module may not be supported on some devices. You can call [CanIUse](../syscap.md) to check whether your device supports this module.
| [native_avcodec_audiodecoder.h](native__avcodec__audiodecoder_8h.md) | Declares the native APIs used for audio decoding.<br>File to include: <multimedia/player_framework/native_avcodec_audiodecoder.h> |
| [native_avcodec_audiodecoder.h](native__avcodec__audiodecoder_8h.md) | Declares the native APIs used for audio decoding.<br>File to include: <multimedia/player_framework/native_avcodec_audiodecoder.h>|
| [avcodec_audio_channel_layout.h](avcodec__audio__channel__layout_8h.md) | Declares the enums used for audio codec.<br>File to include: \<multimedia/avcodec_audio_channel_layout.h>|
| \*[OHOS::Media::OH_AudioDecoder_CreateByMime](#oh_audiodecoder_createbymime)(const char \*mime) | Creates an audio decoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This function is recommended in most cases.|
| \*[OHOS::Media::OH_AudioDecoder_CreateByName](#oh_audiodecoder_createbyname)(const char \*name) | Creates an audio decoder instance based on a decoder name. To use this function, you must know the exact name of the decoder.|
| [OHOS::Media::OH_AudioDecoder_Destroy](#oh_audiodecoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of an audio decoder and destroys the decoder instance.|
| [OHOS::Media::OH_AudioDecoder_SetCallback](#oh_audiodecoder_setcallback)(OH_AVCodec\*codec, OH_AVCodecAsyncCallback callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by an audio decoder.|
| [OHOS::Media::OH_AudioDecoder_Configure](#oh_audiodecoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures an audio decoder. Typically, you need to configure the audio description information that can be extracted from the container.|
| [OHOS::Media::OH_AudioDecoder_Prepare](#oh_audiodecoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for an audio decoder. This function must be called after **Configure**.|
| [OHOS::Media::OH_AudioDecoder_Start](#oh_audiodecoder_start)(OH_AVCodec\*codec) | Starts an audio decoder. This function can be called only after the decoder is prepared successfully.|
| [OHOS::Media::OH_AudioDecoder_Stop](#oh_audiodecoder_stop)(OH_AVCodec\*codec) | Stops an audio decoder.|
| [OHOS::Media::OH_AudioDecoder_Flush](#oh_audiodecoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of an audio decoder.|
| [OHOS::Media::OH_AudioDecoder_Reset](#oh_audiodecoder_reset)(OH_AVCodec\*codec) | Resets an audio decoder. To continue decoding, you must call **Configure** to configure the decoder again.|
| \*[OHOS::Media::OH_AudioDecoder_GetOutputDescription](#oh_audiodecoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the description information about the output data of an audio decoder. For details, see **OH_AVFormat**.|
| [OHOS::Media::OH_AudioDecoder_SetParameter](#oh_audiodecoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for an audio decoder. This function can be called only after the decoder is started. Incorrect parameter settings may cause decoding failure.|
| [OHOS::Media::OH_AudioDecoder_PushInputData](#oh_audiodecoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, OH_AVCodecBufferAttr attr) | Pushes the input buffer filled with data to an audio decoder.|
| [OHOS::Media::OH_AudioDecoder_FreeOutputData](#oh_audiodecoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of an audio decoder.|
| [OHOS::Media::OH_AudioDecoder_IsValid](#oh_audiodecoder_isvalid)(OH_AVCodec\*codec, bool \*isValid) | Checks whether an audio decoder instance is valid.|
## Enum Description
### AudioChannelLayout
```
enum OHOS::Media::AudioChannelLayout : uint64_t
```
**Description**
Enumerates the types of the audio channel numbers. The output format of the decoder is represented as the channel type of the codec.
| [OH_AudioDecoder_CreateByMime](#oh_audiodecoder_createbymime)(const char \*mime) | Creates an audio decoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This API is recommended in most cases. |
| AMBISONICS_ACN1 | Channel 0 for the zero-order stereo.|
| [OH_AudioDecoder_CreateByName](#oh_audiodecoder_createbyname)(const char \*name) | Creates an audio decoder instance based on an audio decoder name. To use this API, you must know the exact name of the audio decoder. |
| AMBISONICS_ACN2 | Channel 1 for the first-order stereo.|
| [OH_AudioDecoder_Destroy](#oh_audiodecoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of an audio decoder and destroys the audio decoder instance. |
| AMBISONICS_ACN3 | Channel 2 for the first-order stereo.|
| [OH_AudioDecoder_SetCallback](#oh_audiodecoder_setcallback)(OH_AVCodec\*codec, [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md) callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by an audio decoder. This API must be called prior to **Prepare**. |
| AMBISONICS_W | Channel 3 for the first-order stereo.|
| [OH_AudioDecoder_Configure](#oh_audiodecoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures an audio decoder. Typically, you need to configure the attributes, which can be extracted from the container, of the audio track that can be decoded. This API must be called prior to **Prepare**. |
| AMBISONICS_Y | Equivalent to channel 0 for the zero-order stereo.|
| [OH_AudioDecoder_Prepare](#oh_audiodecoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for an audio decoder. This API must be called after **Configure**. |
| AMBISONICS_Z | Equivalent to channel 1 for the first-order stereo.|
| [OH_AudioDecoder_Start](#oh_audiodecoder_start)(OH_AVCodec\*codec) | Starts an audio decoder. This API can be called only after the decoder is prepared successfully. After being started, the decoder starts to report the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) event. |
| AMBISONICS_X | Equivalent to channel 2 for the first-order stereo.|
| [OH_AudioDecoder_Stop](#oh_audiodecoder_stop)(OH_AVCodec\*codec) | Stops an audio decoder. After the decoder is stopped, you can call **Start** to start it again. If you have passed codec-specific data in the previous **Start** for the decoder, you must pass it again. |
| AMBISONICS_ACN4 | Equivalent to channel 3 for the first-order stereo.|
| [OH_AudioDecoder_Flush](#oh_audiodecoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of an audio decoder. This API invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this API, ensure that the buffers corresponding to the indexes are no longer required. |
| AMBISONICS_ACN5 | Channel 4 for the second-order stereo.|
| [OH_AudioDecoder_Reset](#oh_audiodecoder_reset)(OH_AVCodec\*codec) | Resets an audio decoder. To continue decoding, you must call **Configure** and **Start** to configure and start the decoder again. |
| AMBISONICS_ACN6 | Channel 5 for the second-order stereo.|
| [OH_AudioDecoder_GetOutputDescription](#oh_audiodecoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the attributes of the output data of an audio decoder. The caller must manually release the **OH_AVFormat** instance in the return value. |
| AMBISONICS_ACN7 | Channel 6 for the second-order stereo.|
| [OH_AudioDecoder_SetParameter](#oh_audiodecoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for an audio decoder. This API can be called only after the decoder is started. Incorrect parameter settings may cause decoding failure. |
| AMBISONICS_ACN8 | Channel 7 for the second-order stereo.|
| [OH_AudioDecoder_PushInputData](#oh_audiodecoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) attr) | Pushes the input buffer filled with data to an audio decoder. The [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback reports available input buffers and their indexes. After being pushed to the decoder, a buffer is not accessible until the buffer with the same index is reported again through the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback. In addition, some decoders require the input of codec-specific data to initialize the decoding process. |
| AMBISONICS_ACN9 | Channel 8 for the second-order stereo.|
| [OH_AudioDecoder_FreeOutputData](#oh_audiodecoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of an audio decoder. |
| AMBISONICS_ACN10 | Channel 9 for the third-order stereo.|
| AMBISONICS_ACN11 | Channel 10 for the third-order stereo.|
| AMBISONICS_ACN12 | Channel 11 for the third-order stereo.|
| AMBISONICS_ACN13 | Channel 12 for the third-order stereo.|
| AMBISONICS_ACN14 | Channel 13 for the third-order stereo.|
| AMBISONICS_ACN15 | Channel 14 for the third-order stereo.|
## Function Description
## Function Description
...
@@ -47,334 +120,439 @@ Provides the functions for audio decoding. This module may not be supported on s
...
@@ -47,334 +120,439 @@ Provides the functions for audio decoding. This module may not be supported on s
```
```
OH_AVErrCode OH_AudioDecoder_Configure (OH_AVCodec * codec, OH_AVFormat * format )
OH_AVErrCode OHOS::Media::OH_AudioDecoder_Configure (OH_AVCodec * codec, OH_AVFormat * format )
```
```
**Description**<br>
Configures an audio decoder. Typically, you need to configure the attributes, which can be extracted from the container, of the audio track that can be decoded. This API must be called prior to **Prepare**.
Clears the input and output data in the internal buffer of an audio decoder. This API invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this API, ensure that the buffers corresponding to the indexes are no longer required.
Clears the input and output data in the internal buffer of an audio decoder.
This function invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this function, ensure that the buffers with the specified indexes are no longer required.
Obtains the description information about the output data of an audio decoder. For details, see **OH_AVFormat**. The caller must manually release the **OH_AVFormat** instance in the return value.
| codec | Indicates the pointer to an **OH_AVCodec** instance. |
| codec | Pointer to an **OH_AVCodec** instance.|
**Returns**
**Returns**
Returns the handle to an **OH_AVFormat** instance, which must be manually released.
Returns the handle to an **OH_AVFormat** instance. The lifecycle of this instance is refreshed when **GetOutputDescription** is called again and destroyed when the **OH_AVCodec** instance is destroyed.
Pushes the input buffer filled with data to an audio decoder. The [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback reports available input buffers and their indexes. After being pushed to the decoder, a buffer is not accessible until the buffer with the same index is reported again through the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback. In addition, some decoders require the input of codec-specific data to initialize the decoding process.
Pushes the input buffer filled with data to an audio decoder.
The **OH_AVCodecOnNeedInputData** callback reports the available input buffer and the index. After being pushed to the decoder, a buffer is not accessible until the buffer with the same index is reported again through the **OH_AVCodecOnNeedInputData** callback. In addition, some decoders require the input of specific data to initialize the decoding process.
Sets an asynchronous callback so that your application can respond to events generated by an audio decoder. This API must be called prior to **Prepare**.
| codec | Indicates the pointer to an **OH_AVCodec** instance. |
| codec | Pointer to an **OH_AVCodec** instance.|
| callback | Indicates a collection of all callback functions. For details, see [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md).|
| callback | Callback function to set. For details, see **OH_AVCodecAsyncCallback**.|
| userData | Indicates the pointer to user-specific data. |
| userData | User-specific data.|
**Returns**
**Returns**
Returns **AV_ERR_OK** if the operation is successful.
Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
**Since**
Returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) if the operation fails.
9
### OH_AudioDecoder_SetParameter()
### OH_AudioDecoder_SetParameter()
```
```
OH_AVErrCode OH_AudioDecoder_SetParameter (OH_AVCodec * codec, OH_AVFormat * format )
OH_AVErrCode OHOS::Media::OH_AudioDecoder_SetParameter (OH_AVCodec * codec, OH_AVFormat * format )
```
```
**Description**<br>
Sets dynamic parameters for an audio decoder. This API can be called only after the decoder is started. Incorrect parameter settings may cause decoding failure.
Starts an audio decoder. This API can be called only after the decoder is prepared successfully. After being started, the decoder starts to report the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) event.
Stops an audio decoder. After the decoder is stopped, you can call **Start** to start it again. If you have passed codec-specific data in the previous **Start** for the decoder, you must pass it again.
After the decoder is stopped, you can call **Start** to start it again. If you have passed specific data in the previous **Start** for the decoder, you must pass it again.
Provides the functions for audio encoding. This module may not be supported on some devices. You can call [CanIUse](../syscap.md) to check whether this module is supported on your device.
The **AudioEncoder** module provides the functions for audio encoding. This module may not be supported on some devices. You can call [CanIUse](../syscap.md) to check whether your device supports this module.
| [native_avcodec_audioencoder.h](native__avcodec__audioencoder_8h.md) | Declares the native APIs used for audio encoding.<br>File to include: <multimedia/player_framework/native_avcodec_audioencoder.h> |
| [native_avcodec_audioencoder.h](native__avcodec__audioencoder_8h.md) | Declares the native APIs used for audio encoding.<br>File to include: <multimedia/player_framework/native_avcodec_audioencoder.h> |
### Functions
### Functions
| Name| Description|
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_AudioEncoder_CreateByMime](#oh_audioencoder_createbymime)(const char \*mime) | Creates an audio encoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This API is recommended in most cases. |
| \*[OHOS::Media::OH_AudioEncoder_CreateByMime](#oh_audioencoder_createbymime)(const char \*mime) | Creates an audio encoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This function is recommended in most cases.|
| [OH_AudioEncoder_CreateByName](#oh_audioencoder_createbyname)(const char \*name) | Creates an audio encoder instance based on an audio encoder name. To use this API, you must know the exact name of the audio encoder. |
| \*[OHOS::Media::OH_AudioEncoder_CreateByName](#oh_audioencoder_createbyname)(const char \*name) | Creates an audio encoder instance based on an encoder name. To use this function, you must know the exact name of the encoder.|
| [OH_AudioEncoder_Destroy](#oh_audioencoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of an audio encoder and destroys the audio encoder instance. |
| [OHOS::Media::OH_AudioEncoder_Destroy](#oh_audioencoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of an audio encoder and destroys the encoder instance.|
| [OH_AudioEncoder_SetCallback](#oh_audioencoder_setcallback)(OH_AVCodec\*codec, [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md) callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by an audio encoder. This API must be called prior to **Prepare**. |
| [OHOS::Media::OH_AudioEncoder_SetCallback](#oh_audioencoder_setcallback)(OH_AVCodec\*codec, OH_AVCodecAsyncCallback callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by an audio encoder.|
| [OH_AudioEncoder_Configure](#oh_audioencoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures an audio encoder. Typically, you need to configure the attributes of the audio track that can be encoded. This API must be called prior to **Prepare**. |
| [OHOS::Media::OH_AudioEncoder_Configure](#oh_audioencoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures an audio encoder. Typically, you need to configure the description information about the audio track to be encoded.|
| [OH_AudioEncoder_Prepare](#oh_audioencoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for an audio encoder. This API must be called after **Configure**. |
| [OHOS::Media::OH_AudioEncoder_Prepare](#oh_audioencoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for an audio encoder. This function must be called after **Configure**.|
| [OH_AudioEncoder_Start](#oh_audioencoder_start)(OH_AVCodec\*codec) | Starts an audio encoder. This API can be called only after the encoder is prepared successfully. After being started, the encoder starts to report the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) event. |
| [OHOS::Media::OH_AudioEncoder_Start](#oh_audioencoder_start)(OH_AVCodec\*codec) | Starts an audio encoder. This function can be called only after the encoder is prepared successfully.|
| [OH_AudioEncoder_Stop](#oh_audioencoder_stop)(OH_AVCodec\*codec) | Stops an audio encoder. After the encoder is stopped, you can call **Start** to start it again. |
| [OHOS::Media::OH_AudioEncoder_Stop](#oh_audioencoder_stop)(OH_AVCodec\*codec) | Stops an audio encoder.|
| [OH_AudioEncoder_Flush](#oh_audioencoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of an audio encoder. This API invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this API, ensure that the buffers corresponding to the indexes are no longer required. |
| [OHOS::Media::OH_AudioEncoder_Flush](#oh_audioencoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of an audio encoder.|
| [OH_AudioEncoder_Reset](#oh_audioencoder_reset)(OH_AVCodec\*codec) | Resets an audio encoder. To continue encoding, you must call **Configure** and **Start** to configure and start the encoder again. |
| [OHOS::Media::OH_AudioEncoder_Reset](#oh_audioencoder_reset)(OH_AVCodec\*codec) | Resets an audio encoder.|
| [OH_AudioEncoder_GetOutputDescription](#oh_audioencoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the attributes of the output data of an audio encoder. The caller must manually release the **OH_AVFormat** instance in the return value. |
| \*[OHOS::Media::OH_AudioEncoder_GetOutputDescription](#oh_audioencoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the description information about the output data of an audio encoder. For details, see **OH_AVFormat**.|
| [OH_AudioEncoder_SetParameter](#oh_audioencoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for an audio encoder. This API can be called only after the encoder is started. Incorrect parameter settings may cause encoding failure. |
| [OHOS::Media::OH_AudioEncoder_SetParameter](#oh_audioencoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for an audio encoder.|
| [OH_AudioEncoder_PushInputData](#oh_audioencoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) attr) | Pushes the input buffer filled with data to an audio encoder. The [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback reports available input buffers and their indexes. After being pushed to the encoder, a buffer is not accessible until the buffer with the same index is reported again through the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback. |
| [OHOS::Media::OH_AudioEncoder_PushInputData](#oh_audioencoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, OH_AVCodecBufferAttr attr) | Pushes the input buffer filled with data to an audio encoder.|
| [OH_AudioEncoder_FreeOutputData](#oh_audioencoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of an audio encoder. |
| [OHOS::Media::OH_AudioEncoder_FreeOutputData](#oh_audioencoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of an audio encoder.|
| [OHOS::Media::OH_AudioEncoder_IsValid](#oh_audioencoder_isvalid)(OH_AVCodec\*codec, bool \*isValid) | Checks whether an audio encoder instance is valid.|
## Function Description
## Function Description
...
@@ -47,334 +50,435 @@ Provides the functions for audio encoding. This module may not be supported on s
...
@@ -47,334 +50,435 @@ Provides the functions for audio encoding. This module may not be supported on s
```
```
OH_AVErrCode OH_AudioEncoder_Configure (OH_AVCodec * codec, OH_AVFormat * format )
OH_AVErrCode OHOS::Media::OH_AudioEncoder_Configure (OH_AVCodec * codec, OH_AVFormat * format )
```
```
**Description**<br>
Configures an audio encoder. Typically, you need to configure the attributes of the audio track that can be encoded. This API must be called prior to **Prepare**.
Clears the input and output data in the internal buffer of an audio encoder. This API invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this API, ensure that the buffers corresponding to the indexes are no longer required.
Clears the input and output data in the internal buffer of an audio encoder.
This function invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this function, ensure that the buffers with the specified indexes are no longer required.
| codec | Indicates the pointer to an **OH_AVCodec** instance. |
| codec | Pointer to an **OH_AVCodec** instance.|
**Returns**
**Returns**
Returns the handle to an **OH_AVFormat** instance, which must be manually released.
Returns the handle to an **OH_AVFormat** instance. The lifecycle of this instance is refreshed when **GetOutputDescription** is called again and destroyed when the **OH_AVCodec** instance is destroyed.
Pushes the input buffer filled with data to an audio encoder. The [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback reports available input buffers and their indexes. After being pushed to the encoder, a buffer is not accessible until the buffer with the same index is reported again through the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback.
Pushes the input buffer filled with data to an audio encoder.
The **OH_AVCodecOnNeedInputData** callback reports the available input buffer and the index. After being pushed to the encoder, a buffer is not accessible until the buffer with the same index is reported again through the **OH_AVCodecOnNeedInputData** callback. In addition, some encoders require the input of specific data to initialize the encoding process.
Sets an asynchronous callback so that your application can respond to events generated by an audio encoder. This API must be called prior to **Prepare**.
| codec | Indicates the pointer to an **OH_AVCodec** instance. |
| codec | Pointer to an **OH_AVCodec** instance.|
| callback | Indicates a collection of all callback functions. For details, see [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md).|
| callback | Callback function to set. For details, see **OH_AVCodecAsyncCallback**.|
| userData | Indicates the pointer to user-specific data. |
| userData | User-specific data.|
**Returns**
**Returns**
Returns **AV_ERR_OK** if the operation is successful.
Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
**Since**
Returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) if the operation fails.
9
### OH_AudioEncoder_SetParameter()
### OH_AudioEncoder_SetParameter()
```
```
OH_AVErrCode OH_AudioEncoder_SetParameter (OH_AVCodec * codec, OH_AVFormat * format )
OH_AVErrCode OHOS::Media::OH_AudioEncoder_SetParameter (OH_AVCodec * codec, OH_AVFormat * format )
```
```
**Description**<br>
Sets dynamic parameters for an audio encoder. This API can be called only after the encoder is started. Incorrect parameter settings may cause encoding failure.
Starts an audio encoder. This API can be called only after the encoder is prepared successfully. After being started, the encoder starts to report the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) event.
Provides the common structs, character constants, and enums for running **OH_AVCodec** instances. This module may not be supported on some devices. You can call [CanIUse](../syscap.md) to check whether this module is supported on your device.
The **CodecBase** module provides the common structs, character constants, and enums for running **OH_AVCodec** instances. This module may not be supported on some devices. You can call [CanIUse](../syscap.md) to check whether your device supports this module.
| [native_avcodec_base.h](native__avcodec__base_8h.md) | Declares the common structs, character constants, and enums for running <b>OH_AVCodec</b> instances.<br>File to include: <multimedia/player_framework/native_avcodec_base.h> |
| [native_avcodec_base.h](native__avcodec__base_8h.md) | Declares the common structs, character constants, and enums for running **OH_AVCodec** instances.<br>File to include: \<multimedia/player_framework/native_avcodec_base.h>|
### Structs
### Structs
| Name| Description|
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) | Defines the buffer attributes of an **OH_AVCodec** instance. |
| [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) | Defines the description information about the buffer of an **OH_AVCodec** instance.|
| [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md) | Defines a collection of asynchronous callback functions for an **OH_AVCodec** instance. You must register this struct instance for an **OH_AVCodec** instance and process the information reported through these callbacks to ensure the normal running of the instance. |
| [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md) | Defines all the asynchronous callback function pointers of an **OH_AVCodec** instance.|
### Types
### Types
| Name| Description|
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_AVCodecBufferFlags](#oh_avcodecbufferflags) | Enumerates the buffer flags of an **OH_AVCodec** instance. |
| [OH_AVCodecBufferFlags](#oh_avcodecbufferflags) | Defines an enum that enumerates the flags for the buffer of an **OH_AVCodec** instance.|
| [OH_AVCodecBufferAttr](#oh_avcodecbufferattr) | Defines the buffer attributes of an **OH_AVCodec** instance. |
| [OH_AVOutputFormat](#oh_avoutputformat) | Defines an enum that enumerates the output file formats of a muxer.|
| (\*[OH_AVCodecOnError](#oh_avcodeconerror)) (OH_AVCodec \*codec, int32_t errorCode, void \*userData) | Defines the function pointer that is called to report error information when an error occurs during the running of an **OH_AVCodec** instance. |
| [OH_AVCodecBufferAttr](#oh_avcodecbufferattr) | Defines a struct for the description information about the buffer of an **OH_AVCodec** instance.|
| (\*[OH_AVCodecOnStreamChanged](#oh_avcodeconstreamchanged)) (OH_AVCodec \*codec, OH_AVFormat \*format, void \*userData) | Defines the function pointer that is called to report the attributes of the new stream when the output stream changes. Note that the lifecycle of the pointer to the **OH_AVFormat** instance is valid only when the function pointer is being called. Do not access the pointer to the instance after the function pointer is called. |
| (\*[OH_AVCodecOnError](#oh_avcodeconerror)) (OH_AVCodec \*codec, int32_t errorCode, void \*userData) | Defines the pointer to the function that is called to report error information when an error occurs during the running of an **OH_AVCodec** instance.|
| (\*[OH_AVCodecOnNeedInputData](#oh_avcodeconneedinputdata)) (OH_AVCodec \*codec, uint32_t index, OH_AVMemory \*data, void \*userData) | Defines the function pointer that is called, with a new buffer to fill in new input data, when new input data is required during the running of an **OH_AVCodec** instance. |
| (\*[OH_AVCodecOnStreamChanged](#oh_avcodeconstreamchanged)) (OH_AVCodec \*codec, OH_AVFormat \*format, void \*userData) | Defines the pointer to the function that is called to report the new stream description when the output stream changes.|
| (\*[OH_AVCodecOnNewOutputData](#oh_avcodeconnewoutputdata)) (OH_AVCodec \*codec, uint32_t index, OH_AVMemory \*data, [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md)\*attr, void \*userData) | Defines the function pointer that is called, with a buffer containing new output data, when the new output data is generated during the running of an **OH_AVCodec** instance. Note that the lifecycle of the pointer to the **OH_AVCodecBufferAttr** instance is valid only when the function pointer is being called. Do not access the pointer to the instance after the function pointer is called. |
| (\*[OH_AVCodecOnNeedInputData](#oh_avcodeconneedinputdata)) (OH_AVCodec \*codec, uint32_t index, OH_AVMemory \*data, void \*userData) | Defines the pointer to the function that is called when new input data is required during the running of an **OH_AVCodec** instance. The function carries a buffer to fill in new input data.|
| [OH_AVCodecAsyncCallback](#oh_avcodecasynccallback) | Defines a collection of asynchronous callback functions for an **OH_AVCodec** instance. You must register this struct instance for an **OH_AVCodec** instance and process the information reported through these callbacks to ensure the normal running of the instance. |
| (\*[OH_AVCodecOnNewOutputData](#oh_avcodeconnewoutputdata)) (OH_AVCodec \*codec, uint32_t index, OH_AVMemory \*data, [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md)\*attr, void \*userData) | Defines the pointer to the function that is called when new output data is generated during the running of an **OH_AVCodec** instance. The function carries a buffer filled with new output data.|
| [OH_MediaType](#oh_mediatype) | Enumerates the media types. |
| [OH_AVCodecAsyncCallback](#oh_avcodecasynccallback) | Defines a struct for all the asynchronous callback function pointers of an **OH_AVCodec** instance.|
| [OH_AVCProfile](#oh_avcprofile) | Enumerates the AVC profiles. |
| [OH_MediaType](#oh_mediatype) | Defines an enum that enumerates the media types.|
| [OH_AACProfile](#oh_aacprofile) | Enumerates the AAC profiles. |
| [OH_AVCProfile](#oh_avcprofile) | Defines an enum that enumerates the Advanced Video Coding (AVC) profiles.|
| [OH_HEVCProfile](#oh_hevcprofile) | Defines an enum that enumerates the High Efficiency Video Coding (HEVC) profiles.|
| [OH_AACProfile](#oh_aacprofile) | Defines an enum that enumerates the Advanced Audio Coding (AAC) profiles.|
| [OH_AVSeekMode](#oh_avseekmode) | Defines an enum that enumerates the seek modes.|
| [OH_ColorPrimary](#oh_colorprimary) | Defines an enum that enumerates the primary colors.|
| [OH_TransferCharacteristic](#oh_transfercharacteristic) | Defines an enum that enumerates the transfer characteristics.|
| [OH_MatrixCoefficient](#oh_matrixcoefficient) | Defines an enum that enumerates the matrix coefficients.|
| [OH_BitsPerSample](#oh_bitspersample) | Defines an enum that enumerates the number of audio bits for each coded sample.|
| [OH_BitsPerSample](#oh_bitspersample) {<br>**SAMPLE_U8** = 0, **SAMPLE_S16LE** = 1, **SAMPLE_S24LE** = 2, **SAMPLE_S32LE** = 3,<br>**SAMPLE_F32LE** = 4, **SAMPLE_U8P** = 5, **SAMPLE_S16P** = 6, **SAMPLE_S24P** = 7,<br>**SAMPLE_S32P** = 8, **SAMPLE_F32P** = 9, **INVALID_WIDTH** = -1<br>} | Enumerates the number of audio bits for each coded sample.|
### Variables
### Variables
| Name| Description|
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_AVCodecBufferAttr::pts](#pts) | Defines the presentation timestamp of the buffer, in microseconds. |
| [OH_AVCodecBufferAttr::pts](_o_h___a_v_codec_buffer_attr.md#pts) | Defines the display timestamp of the buffer, in microseconds.|
| [OH_AVCodecBufferAttr::size](#size) | Defines the size of the data contained in the buffer, in bytes. |
| [OH_AVCodecBufferAttr::size](_o_h___a_v_codec_buffer_attr.md#size) | Defines the size of data contained in the buffer, in bytes.|
| [OH_AVCodecBufferAttr::offset](#offset) | Defines the start offset of valid data in the buffer. |
| [OH_AVCodecBufferAttr::offset](_o_h___a_v_codec_buffer_attr.md#offset) | Defines the offset of valid data in the buffer.|
| [OH_AVCodecBufferAttr::flags](#flags) | Defines a buffer flag, which is a combination of multiple [OH_AVCodecBufferFlags](#oh_avcodecbufferflags). |
| [OH_AVCodecBufferAttr::flags](_o_h___a_v_codec_buffer_attr.md#flags) | Defines the flags of the buffer. It is a combination of multiple [OH_AVCodecBufferFlags](#oh_avcodecbufferflags).|
| [OH_AVCODEC_MIMETYPE_VIDEO_AVC](#oh_avcodec_mimetype_video_avc) | Defines the Multipurpose Internet Mail Extension (MIME) type for AVC. |
| [OH_AVCodecAsyncCallback::onError](_o_h___a_v_codec_async_callback.md#onerror) | Defines the callback used to report a codec operation error. For details, see [OH_AVCodecOnError](#oh_avcodeconerror).|
| [OH_AVCODEC_MIMETYPE_AUDIO_AAC](#oh_avcodec_mimetype_audio_aac) | Defines the MIME type for AAC. |
| [OH_AVCodecAsyncCallback::onStreamChanged](_o_h___a_v_codec_async_callback.md#onstreamchanged) | Defines the callback used to report a codec stream change. For details, see [OH_AVCodecOnStreamChanged](#oh_avcodeconstreamchanged).|
| [OH_ED_KEY_TIME_STAMP](#oh_ed_key_time_stamp) | Defines the unified character descriptors for the auxiliary data of the surface buffer. |
| [OH_AVCodecAsyncCallback::onNeedInputData](_o_h___a_v_codec_async_callback.md#onneedinputdata) | Defines the callback used to report input data required. For details, see [OH_AVCodecOnNeedInputData](#oh_avcodeconneedinputdata).|
| [OH_ED_KEY_EOS](#oh_ed_key_eos) | Defines the character descriptor of the end-of-stream in the surface auxiliary data. The value type is bool. |
| [OH_AVCodecAsyncCallback::onNeedOutputData](_o_h___a_v_codec_async_callback.md#onneedinputdata) | Defines the callback used to report output data generated. For details, see [OH_AVCodecOnNewOutputData](#oh_avcodeconnewoutputdata).|
| [OH_MD_KEY_TRACK_TYPE](#oh_md_key_track_type) | Defines the unified character descriptors for the media playback framework. |
| \*[OH_AVCODEC_MIMETYPE_VIDEO_AVC](#oh_avcodec_mimetype_video_avc) | Defines the pointer to the Multipurpose Internet Mail Extension (MIME) type for AVC video codec.|
| [OH_MD_KEY_CODEC_MIME](#oh_md_key_codec_mime) | Defines the character descriptor of the MIME type. The value type is string. |
| \*[OH_AVCODEC_MIMETYPE_AUDIO_AAC](#oh_avcodec_mimetype_audio_aac) | Defines the pointer to the MIME type for AAC audio codec.|
| [OH_MD_KEY_DURATION](#oh_md_key_duration) | Defines the character descriptor of duration. The value type is int64_t. |
| \*[OH_AVCODEC_MIMETYPE_VIDEO_MPEG4](#oh_avcodec_mimetype_video_mpeg4) | Defines the pointer to the MIME type for MPEG4 video codec.|
| [OH_MD_KEY_BITRATE](#oh_md_key_bitrate) | Defines the character descriptor of the bit rate. The value type is uint32_t. |
| \*[OH_AVCODEC_MIMETYPE_VIDEO_HEVC](#oh_avcodec_mimetype_video_hevc) | Defines the pointer to the MIME type for HEVC video codec.|
| [OH_MD_KEY_MAX_INPUT_SIZE](#oh_md_key_max_input_size) | Defines the character descriptor of the maximum input size. The value type is uint32_t. |
| \*[OH_AVCODEC_MIMETYPE_AUDIO_MPEG](#oh_avcodec_mimetype_audio_mpeg) | Defines the pointer to the MIME type for MPEG audio codec.|
| [OH_MD_KEY_WIDTH](#oh_md_key_width) | Defines the character descriptor of the video width. The value type is uint32_t. |
| \*[OH_AVCODEC_MIMETYPE_IMAGE_JPG](#oh_avcodec_mimetype_image_jpg) | Defines the pointer to the MIME type for JPG image codec.|
| [OH_MD_KEY_HEIGHT](#oh_md_key_height) | Defines the character descriptor of the video height. The value type is uint32_t. |
| \*[OH_AVCODEC_MIMETYPE_IMAGE_PNG](#oh_avcodec_mimetype_image_png) | Defines the pointer to the MIME type for PNG image codec.|
| [OH_MD_KEY_PIXEL_FORMAT](#oh_md_key_pixel_format) | Defines the character descriptor of the video pixel format. The value type is int32_t. For details, see [OH_AVPixelFormat](_core.md#oh_avpixelformat).|
| \*[OH_AVCODEC_MIMETYPE_IMAGE_BMP](#oh_avcodec_mimetype_image_bmp) | Defines the pointer to the MIME type for BMP image codec.|
| [OH_MD_KEY_AUDIO_SAMPLE_FORMAT](#oh_md_key_audio_sample_format) | Defines the character descriptor of the audio sample format. The value type is uint32_t. |
| \*[OH_AVCODEC_MIMETYPE_AUDIO_FLAC](#oh_avcodec_mimetype_audio_flac) | Defines the pointer to the MIME type for FLAC audio codec.|
| [OH_MD_KEY_FRAME_RATE](#oh_md_key_frame_rate) | Defines the character descriptor of the video frame rate. The value type is double. |
| \*[OH_AVCODEC_MIMETYPE_AUDIO_VORBIS](#oh_avcodec_mimetype_audio_vorbis) | Defines the pointer to the MIME type for VORBIS audio codec.|
| [OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE](#oh_md_key_video_encode_bitrate_mode) | Defines the character descriptor of the video encoding bit rate mode. The value type is int32_t. For details, see [OH_VideoEncodeBitrateMode](_video_encoder.md#oh_videoencodebitratemode).|
| \*[OH_ED_KEY_TIME_STAMP](#oh_ed_key_time_stamp) | Defines the pointer to the timestamp in the extra data of the surface. The value type is int64.|
| [OH_MD_KEY_PROFILE](#oh_md_key_profile) | Defines the character descriptor of the audio/video encoding capability. The value type is int32_t. For details, see [OH_AVCProfile](#oh_avcprofile) or [OH_AACProfile](#oh_aacprofile).|
| \*[OH_ED_KEY_EOS](#oh_ed_key_eos) | Defines the pointer to the end of stream (EOS) in the extra data of the surface. The value type is Boolean.|
| [OH_MD_KEY_AUD_CHANNEL_COUNT](#oh_md_key_aud_channel_count) | Defines the character descriptor of the number of audio channels. The value type is uint32_t. |
| \*[OH_MD_KEY_TRACK_TYPE](#oh_md_key_track_type) | Defines the pointer to a container for storing media descriptions.|
| [OH_MD_KEY_AUD_SAMPLE_RATE](#oh_md_key_aud_sample_rate) | Defines the character descriptor of the audio sampling rate. The value type is uint32_t. |
| \*[OH_MD_KEY_CODEC_MIME](#oh_md_key_codec_mime) | Define the pointer to the MIME type of codec. The value is a string.|
| [OH_MD_KEY_I_FRAME_INTERVAL](#oh_md_key_i_frame_interval) | Defines the character descriptor of the I-frame interval. The value type is int32_t, and the unit is ms. |
| \*[OH_MD_KEY_DURATION](#oh_md_key_duration) | Defines the pointer to the duration. The value type is int64_t.|
| [OH_MD_KEY_ROTATION](#oh_md_key_rotation) | Defines the character descriptor of the surface rotation angle. The value type is int32_t. The value range is {0, 90, 180, 270}. The default value is 0. |
| \*[OH_MD_KEY_BITRATE](#oh_md_key_bitrate) | Defines the pointer to the bit rate. The value type is uint32_t.|
| \*[OH_MD_KEY_MAX_INPUT_SIZE](#oh_md_key_max_input_size) | Defines the pointer to the maximum input size. The value type is uint32_t.|
| \*[OH_MD_KEY_WIDTH](#oh_md_key_width) | Defines the pointer to the video width. The value type is uint32_t.|
| \*[OH_MD_KEY_HEIGHT](#oh_md_key_height) | Defines the pointer to the video height. The value type is uint32_t.|
| \*[OH_MD_KEY_PIXEL_FORMAT](#oh_md_key_pixel_format) | Defines the pointer to the video pixel format. The value type is int32_t. For details, see [OH_AVPixelFormat](_core.md#oh_avpixelformat).|
| \*[OH_MD_KEY_RANGE_FLAG](#oh_md_key_range_flag) | Defines the pointer to the video YUV value range flag. The value type is Boolean.|
| \*[OH_MD_KEY_COLOR_PRIMARIES](#oh_md_key_color_primaries) | Defines the pointer to the primary color of the video. The value type is int32_t.|
| \*[OH_MD_KEY_TRANSFER_CHARACTERISTICS](#oh_md_key_transfer_characteristics) | Defines the pointer to the video transfer characteristics. The value type is int32_t.|
| \*[OH_MD_KEY_MATRIX_COEFFICIENTS](#oh_md_key_matrix_coefficients) | Defines the pointer to the video matrix coefficient. The value type is int32_t.|
| \*[OH_MD_KEY_AUDIO_SAMPLE_FORMAT](#oh_md_key_audio_sample_format) | Defines the pointer to the original audio format. The value type is uint32_t.|
| \*[OH_MD_KEY_FRAME_RATE](#oh_md_key_frame_rate) | Defines the pointer to the video frame rate. The value is a double-precision floating point number.|
| \*[OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE](#oh_md_key_video_encode_bitrate_mode) | Defines the pointer to the video encoding bit rate mode. The value type is int32_t. For details, see [OH_VideoEncodeBitrateMode](_video_encoder.md#oh_videoencodebitratemode).|
| \*[OH_MD_KEY_PROFILE](#oh_md_key_profile) | Defines the pointer to the encoding template. The value is a number. For details, see [OH_AVCProfile](#oh_avcprofile), [OH_AACProfile](#oh_aacprofile), or [OH_HEVCProfile](#oh_hevcprofile).|
| \*[OH_MD_KEY_AUD_CHANNEL_COUNT](#oh_md_key_aud_channel_count) | Defines the pointer to the number of audio channels. The value type is uint32_t.|
| \*[OH_MD_KEY_AUD_SAMPLE_RATE](#oh_md_key_aud_sample_rate) | Defines the pointer to the audio sampling rate. The value type is uint32_t.|
| \*[OH_MD_KEY_I_FRAME_INTERVAL](#oh_md_key_i_frame_interval) | Defines the pointer to the key frame interval, in milliseconds. The value type is int32_t.|
| \*[OH_MD_KEY_ROTATION](#oh_md_key_rotation) | Defines the pointer to the rotation angle of the surface. The value type is int32_t, and the value range is {0, 90, 180, 270}. The default value is 0.|
| \*[OH_MD_KEY_CODEC_CONFIG](#oh_md_key_codec_config) | Defines the pointer to the codec-specific data. The value type is uint8_t\*.|
| \*[OH_MD_KEY_REQUEST_I_FRAME](#oh_md_key_request_i_frame) | Defines the pointer to the request for immediate encoding of I-frames. The value type is Boolean.|
| \*[OH_MD_KEY_QUALITY](#oh_md_key_quality) | Defines the pointer to the required encoding quality. The value type is uint32_t. This key applies only to encoders configured in constant quality mode.|
| \*[OH_MD_KEY_CHANNEL_LAYOUT](#oh_md_key_channel_layout) | Defines the pointer to the required encoding channel layout. The value type is int64_t. This key applies only to encoders.|
| \*[OH_MD_KEY_BITS_PER_CODED_SAMPLE](#oh_md_key_bits_per_coded_sample) | Defines the pointer to the number of bits for each coded sample. The value type is uint32_t. This key applies to FLAC encoders. For details, see **\@OH_BitsPerSample**.|
| \*[OH_MD_KEY_AAC_IS_ADTS](#oh_md_key_aac_is_adts) | Defines the pointer to the AAC format. The value type is uint32_t. This key applies to AAC decoders.|
| \*[OH_MD_KEY_SBR](#oh_md_key_sbr) | Defines the pointer to the AAC SBR format. The value type is uint32_t. This key applies to AAC encoders.|
| \*[OH_MD_KEY_COMPLIANCE_LEVEL](#oh_md_key_compliance_level) | Defines the pointer to the FLAC compliance level. The value type is int32_t.|
| \*[OH_MD_KEY_IDENTIFICATION_HEADER](#oh_md_key_identification_header) | Defines the pointer to the VORBIS identification header. The value type is uint8_t\*. This key applies only to VORBIS decoders.|
| \*[OH_MD_KEY_SETUP_HEADER](#oh_md_key_setup_header) | Defines the pointer to the VORBIS setup header. The value type is uint8_t\*. This key applies only to VORBIS decoders.|
| \*[OH_MD_KEY_TITLE](#oh_md_key_title) | Defines the pointer to the title of the input media. The value is a string.|
| \*[OH_MD_KEY_ARTIST](#oh_md_key_artist) | Defines the pointer to the artist of the input media. The value is a string.|
| \*[OH_MD_KEY_ALBUM](#oh_md_key_album) | Defines the pointer to the album of the input media. The value is a string.|
| \*[OH_MD_KEY_ALBUM_ARTIST](#oh_md_key_album_artist) | Defines the pointer to the album_artist of the input media. The value is a string.|
| \*[OH_MD_KEY_DATE](#oh_md_key_date) | Defines the pointer to the date of the input media. The value is a string.|
| \*[OH_MD_KEY_COMMENT](#oh_md_key_comment) | Defines the pointer to the comment of the input media. The value is a string.|
| \*[OH_MD_KEY_GENRE](#oh_md_key_genre) | Defines the pointer to the genre of the input media. The value is a string.|
| \*[OH_MD_KEY_COPYRIGHT](#oh_md_key_copyright) | Defines the pointer to the copyright of the input media. The value is a string.|
| \*[OH_MD_KEY_LANGUAGE](#oh_md_key_language) | Defines the pointer to the language of the input media. The value is a string.|
| \*[OH_MD_KEY_DESCRIPTION](#oh_md_key_description) | Defines the pointer to the description of the input media. The value is a string.|
| \*[OH_MD_KEY_LYRICS](#oh_md_key_lyrics) | Defines the pointer to the lyrics of the input media. The value is a string.|
| \*[OH_MD_KEY_TRACK_COUNT](#oh_md_key_track_count) | Defines the pointer to the track count of the input media. The value type is uint32_t.|
## Type Description
## Type Description
...
@@ -93,10 +147,12 @@ Provides the common structs, character constants, and enums for running **OH_AVC
...
@@ -93,10 +147,12 @@ Provides the common structs, character constants, and enums for running **OH_AVC
Defines a collection of asynchronous callback functions for an **OH_AVCodec** instance. You must register this struct instance for an **OH_AVCodec** instance and process the information reported through these callbacks to ensure the normal running of the instance.
Defines a struct for all the asynchronous callback function pointers of an **OH_AVCodec** instance. To ensure the normal running of **OH_AVCodec**, you must register the instance of this struct with the **OH_AVCodec** instance and process the information reported by the callback function.
| onError | Indicates the callback used to report errors occurred during the running of the instance. For details, see [OH_AVCodecOnError](#oh_avcodeconerror).|
| [onError](_o_h___a_v_codec_async_callback.md#onerror) | Callback used to report a codec operation error. For details, see [OH_AVCodecOnError](#oh_avcodeconerror).|
| onStreamChanged | Indicates the callback used to report stream information. For details, see [OH_AVCodecOnStreamChanged](#oh_avcodeconstreamchanged).|
| [onStreamChanged](_o_h___a_v_codec_async_callback.md#onstreamchanged) | Callback used to report a codec stream change. For details, see [OH_AVCodecOnStreamChanged](#oh_avcodeconstreamchanged).|
| onNeedInputData | Indicates the callback used to report input data needed. For details, see [OH_AVCodecOnNeedInputData](#oh_avcodeconneedinputdata).|
| [onNeedInputData](_o_h___a_v_codec_async_callback.md#onneedinputdata) | Callback used to report input data required. For details, see [OH_AVCodecOnNeedInputData](#oh_avcodeconneedinputdata).|
| onNeedInputData | Indicates the callback used to report output data needed. For details, see [OH_AVCodecOnNewOutputData](#oh_avcodeconnewoutputdata).|
| [onNeedOutputData](_o_h___a_v_codec_async_callback.md#onneedoutputdata) | Callback used to report output data generated. For details, see [OH_AVCodecOnNewOutputData](#oh_avcodeconnewoutputdata).|
### OH_AVCodecBufferAttr
### OH_AVCodecBufferAttr
...
@@ -126,10 +184,12 @@ Defines a collection of asynchronous callback functions for an **OH_AVCodec** in
...
@@ -126,10 +184,12 @@ Defines a collection of asynchronous callback functions for an **OH_AVCodec** in
Defines the function pointer that is called, with a new buffer to fill in new input data, when new input data is required during the running of an **OH_AVCodec** instance.
Defines the pointer to the function that is called when new input data is required during the running of an **OH_AVCodec** instance. The function carries a buffer to fill in new input data.
Defines the function pointer that is called, with a buffer containing new output data, when the new output data is generated during the running of an **OH_AVCodec** instance. Note that the lifecycle of the pointer to the **OH_AVCodecBufferAttr** instance is valid only when the function pointer is being called. Do not access the pointer to the instance after the function pointer is called.
Defines the pointer to the function that is called when new output data is generated during the running of an **OH_AVCodec** instance. The function carries a buffer filled with new output data. Note that the lifecycle of the pointer to the **OH_AVCodecBufferAttr** instance is valid only when the function pointer is being called. Do not access the pointer to the instance after the function pointer is called.
| codec | Indicates the pointer to an **OH_AVCodec** instance. |
| codec | Pointer to an **OH_AVCodec** instance.|
| index | Indicates the index of a new output buffer. |
| index | Index of the new output buffer.|
| data | Indicates the pointer to the new output data. |
| data | Pointer to the data filled in the new output buffer.|
| attr | Indicates the pointer to the attributes of the new output buffer. For details, see [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md).|
| attr | Pointer to the description information about the new output buffer. For details, see [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md).|
| userData | Indicates the pointer to user-specific data. |
| userData | Pointer to user-specific data.|
### OH_AVCodecOnStreamChanged
### OH_AVCodecOnStreamChanged
...
@@ -213,18 +281,20 @@ Defines the function pointer that is called, with a buffer containing new output
...
@@ -213,18 +281,20 @@ Defines the function pointer that is called, with a buffer containing new output
Defines the function pointer that is called to report the attributes of the new stream when the output stream changes. Note that the lifecycle of the pointer to the **OH_AVFormat** instance is valid only when the function pointer is being called. Do not access the pointer to the instance after the function pointer is called.
Defines the pointer to the function that is called to report the new stream description when the output stream changes. Note that the lifecycle of the pointer to the **OH_AVFormat** instance is valid only when the function pointer is being called. Do not access the pointer to the instance after the function pointer is called.
Defines the pointer to the AAC format. The value type is uint32_t. This key applies to AAC decoders.
### OH_MD_KEY_ALBUM
```
const char* OH_MD_KEY_ALBUM
```
**Description**
Defines the pointer to the album of the input media. The value is a string.
### OH_MD_KEY_ALBUM_ARTIST
```
const char* OH_MD_KEY_ALBUM_ARTIST
```
**Description**
Defines the pointer to the album_artist of the input media. The value is a string.
### OH_MD_KEY_ARTIST
```
const char* OH_MD_KEY_ARTIST
```
**Description**
Defines the pointer to the artist of the input media. The value is a string.
### OH_MD_KEY_AUD_CHANNEL_COUNT
### OH_MD_KEY_AUD_CHANNEL_COUNT
...
@@ -389,8 +801,10 @@ Defines the unified character descriptors for the auxiliary data of the surface
...
@@ -389,8 +801,10 @@ Defines the unified character descriptors for the auxiliary data of the surface
```
```
const char* OH_MD_KEY_AUD_CHANNEL_COUNT
const char* OH_MD_KEY_AUD_CHANNEL_COUNT
```
```
**Description**<br>
Defines the character descriptor of the number of audio channels. The value type is uint32_t.
**Description**
Defines the pointer to the number of audio channels. The value type is uint32_t.
### OH_MD_KEY_AUD_SAMPLE_RATE
### OH_MD_KEY_AUD_SAMPLE_RATE
...
@@ -399,8 +813,10 @@ Defines the character descriptor of the number of audio channels. The value type
...
@@ -399,8 +813,10 @@ Defines the character descriptor of the number of audio channels. The value type
```
```
const char* OH_MD_KEY_AUD_SAMPLE_RATE
const char* OH_MD_KEY_AUD_SAMPLE_RATE
```
```
**Description**<br>
Defines the character descriptor of the audio sampling rate. The value type is uint32_t.
**Description**
Defines the pointer to the audio sampling rate. The value type is uint32_t.
### OH_MD_KEY_AUDIO_SAMPLE_FORMAT
### OH_MD_KEY_AUDIO_SAMPLE_FORMAT
...
@@ -409,8 +825,10 @@ Defines the character descriptor of the audio sampling rate. The value type is u
...
@@ -409,8 +825,10 @@ Defines the character descriptor of the audio sampling rate. The value type is u
```
```
const char* OH_MD_KEY_AUDIO_SAMPLE_FORMAT
const char* OH_MD_KEY_AUDIO_SAMPLE_FORMAT
```
```
**Description**<br>
Defines the character descriptor of the audio sample format. The value type is uint32_t.
**Description**
Defines the pointer to the original audio format. The value type is uint32_t.
### OH_MD_KEY_BITRATE
### OH_MD_KEY_BITRATE
...
@@ -419,8 +837,46 @@ Defines the character descriptor of the audio sample format. The value type is u
...
@@ -419,8 +837,46 @@ Defines the character descriptor of the audio sample format. The value type is u
```
```
const char* OH_MD_KEY_BITRATE
const char* OH_MD_KEY_BITRATE
```
```
**Description**<br>
Defines the character descriptor of the bit rate. The value type is uint32_t.
**Description**
Defines the pointer to the bit rate. The value type is uint32_t.
### OH_MD_KEY_BITS_PER_CODED_SAMPLE
```
const char* OH_MD_KEY_BITS_PER_CODED_SAMPLE
```
**Description**
Defines the pointer to the number of bits for each coded sample. The value type is uint32_t. This key applies to FLAC encoders.
### OH_MD_KEY_CHANNEL_LAYOUT
```
const char* OH_MD_KEY_CHANNEL_LAYOUT
```
**Description**
Defines the pointer to the required encoding channel layout. The value type is int64_t. This key applies only to encoders.
### OH_MD_KEY_CODEC_CONFIG
```
const char* OH_MD_KEY_CODEC_CONFIG
```
**Description**
Defines the pointer to the codec-specific data. The value type is uint8_t\*.
### OH_MD_KEY_CODEC_MIME
### OH_MD_KEY_CODEC_MIME
...
@@ -429,8 +885,82 @@ Defines the character descriptor of the bit rate. The value type is uint32_t.
...
@@ -429,8 +885,82 @@ Defines the character descriptor of the bit rate. The value type is uint32_t.
```
```
const char* OH_MD_KEY_CODEC_MIME
const char* OH_MD_KEY_CODEC_MIME
```
```
**Description**<br>
Defines the character descriptor of the MIME type. The value type is string.
**Description**
Define the pointer to the MIME type of codec. The value is a string.
### OH_MD_KEY_COLOR_PRIMARIES
```
const char* OH_MD_KEY_COLOR_PRIMARIES
```
**Description**
Defines the pointer to the primary color of the video. The value type is int32_t.
### OH_MD_KEY_COMMENT
```
const char* OH_MD_KEY_COMMENT
```
**Description**
Defines the pointer to the comment of the input media. The value is a string.
### OH_MD_KEY_COMPLIANCE_LEVEL
```
const char* OH_MD_KEY_COMPLIANCE_LEVEL
```
**Description**
Defines the pointer to the FLAC compliance level. The value type is int32_t.
### OH_MD_KEY_COPYRIGHT
```
const char* OH_MD_KEY_COPYRIGHT
```
**Description**
Defines the pointer to the copyright of the input media. The value is a string.
### OH_MD_KEY_DATE
```
const char* OH_MD_KEY_DATE
```
**Description**
Defines the pointer to the date of the input media. The value is a string.
### OH_MD_KEY_DESCRIPTION
```
const char* OH_MD_KEY_DESCRIPTION
```
**Description**
Defines the pointer to the description of the input media. The value is a string.
### OH_MD_KEY_DURATION
### OH_MD_KEY_DURATION
...
@@ -439,8 +969,10 @@ Defines the character descriptor of the MIME type. The value type is string.
...
@@ -439,8 +969,10 @@ Defines the character descriptor of the MIME type. The value type is string.
```
```
const char* OH_MD_KEY_DURATION
const char* OH_MD_KEY_DURATION
```
```
**Description**<br>
Defines the character descriptor of duration. The value type is int64_t.
**Description**
Defines the pointer to the duration. The value type is int64_t.
### OH_MD_KEY_FRAME_RATE
### OH_MD_KEY_FRAME_RATE
...
@@ -449,8 +981,22 @@ Defines the character descriptor of duration. The value type is int64_t.
...
@@ -449,8 +981,22 @@ Defines the character descriptor of duration. The value type is int64_t.
```
```
const char* OH_MD_KEY_FRAME_RATE
const char* OH_MD_KEY_FRAME_RATE
```
```
**Description**<br>
Defines the character descriptor of the video frame rate. The value type is double.
**Description**
Defines the pointer to the video frame rate. The value is a double-precision floating point number.
### OH_MD_KEY_GENRE
```
const char* OH_MD_KEY_GENRE
```
**Description**
Defines the pointer to the genre of the input media. The value is a string.
### OH_MD_KEY_HEIGHT
### OH_MD_KEY_HEIGHT
...
@@ -459,8 +1005,10 @@ Defines the character descriptor of the video frame rate. The value type is doub
...
@@ -459,8 +1005,10 @@ Defines the character descriptor of the video frame rate. The value type is doub
```
```
const char* OH_MD_KEY_HEIGHT
const char* OH_MD_KEY_HEIGHT
```
```
**Description**<br>
Defines the character descriptor of the video height. The value type is uint32_t.
**Description**
Defines the pointer to the video height. The value type is uint32_t.
### OH_MD_KEY_I_FRAME_INTERVAL
### OH_MD_KEY_I_FRAME_INTERVAL
...
@@ -469,8 +1017,58 @@ Defines the character descriptor of the video height. The value type is uint32_t
...
@@ -469,8 +1017,58 @@ Defines the character descriptor of the video height. The value type is uint32_t
```
```
const char* OH_MD_KEY_I_FRAME_INTERVAL
const char* OH_MD_KEY_I_FRAME_INTERVAL
```
```
**Description**<br>
Defines the character descriptor of the I-frame interval. The value type is int32_t, and the unit is ms.
**Description**
Defines the pointer to the key frame interval, in milliseconds. The value type is int32_t.
### OH_MD_KEY_IDENTIFICATION_HEADER
```
const char* OH_MD_KEY_IDENTIFICATION_HEADER
```
**Description**
Defines the pointer to the VORBIS identification header. The value type is uint8_t\*. This key applies only to VORBIS decoders.
### OH_MD_KEY_LANGUAGE
```
const char* OH_MD_KEY_LANGUAGE
```
**Description**
Defines the pointer to the language of the input media. The value is a string.
### OH_MD_KEY_LYRICS
```
const char* OH_MD_KEY_LYRICS
```
**Description**
Defines the pointer to the lyrics of the input media. The value is a string.
### OH_MD_KEY_MATRIX_COEFFICIENTS
```
const char* OH_MD_KEY_MATRIX_COEFFICIENTS
```
**Description**
Defines the pointer to the video matrix coefficient. The value type is int32_t.
### OH_MD_KEY_MAX_INPUT_SIZE
### OH_MD_KEY_MAX_INPUT_SIZE
...
@@ -479,8 +1077,10 @@ Defines the character descriptor of the I-frame interval. The value type is int3
...
@@ -479,8 +1077,10 @@ Defines the character descriptor of the I-frame interval. The value type is int3
```
```
const char* OH_MD_KEY_MAX_INPUT_SIZE
const char* OH_MD_KEY_MAX_INPUT_SIZE
```
```
**Description**<br>
Defines the character descriptor of the maximum input size. The value type is uint32_t.
**Description**
Defines the pointer to the maximum input size. The value type is uint32_t.
### OH_MD_KEY_PIXEL_FORMAT
### OH_MD_KEY_PIXEL_FORMAT
...
@@ -489,8 +1089,10 @@ Defines the character descriptor of the maximum input size. The value type is ui
...
@@ -489,8 +1089,10 @@ Defines the character descriptor of the maximum input size. The value type is ui
```
```
const char* OH_MD_KEY_PIXEL_FORMAT
const char* OH_MD_KEY_PIXEL_FORMAT
```
```
**Description**<br>
Defines the character descriptor of the video pixel format. The value type is int32_t. For details, see [OH_AVPixelFormat](_core.md#oh_avpixelformat).
**Description**
Defines the pointer to the video pixel format. The value type is int32_t. For details, see [OH_AVPixelFormat](_core.md#oh_avpixelformat).
### OH_MD_KEY_PROFILE
### OH_MD_KEY_PROFILE
...
@@ -499,8 +1101,46 @@ Defines the character descriptor of the video pixel format. The value type is in
...
@@ -499,8 +1101,46 @@ Defines the character descriptor of the video pixel format. The value type is in
```
```
const char* OH_MD_KEY_PROFILE
const char* OH_MD_KEY_PROFILE
```
```
**Description**<br>
Defines the character descriptor of the audio/video encoding capability. The value type is int32_t. For details, see [OH_AVCProfile](#oh_avcprofile) or [OH_AACProfile](#oh_aacprofile).
**Description**
Defines the pointer to the encoding template. The value is a number. For details, see [OH_AVCProfile](#oh_avcprofile), [OH_AACProfile](#oh_aacprofile), or [OH_HEVCProfile](#oh_hevcprofile).
### OH_MD_KEY_QUALITY
```
const char* OH_MD_KEY_QUALITY
```
**Description**
Defines the pointer to the required encoding quality. The value type is uint32_t. This key applies only to encoders configured in constant quality mode.
### OH_MD_KEY_RANGE_FLAG
```
const char* OH_MD_KEY_RANGE_FLAG
```
**Description**
Defines the pointer to the video YUV value range flag. The value type is Boolean.
### OH_MD_KEY_REQUEST_I_FRAME
```
const char* OH_MD_KEY_REQUEST_I_FRAME
```
**Description**
Defines the pointer to the request for immediate encoding of I-frames. The value type is Boolean.
### OH_MD_KEY_ROTATION
### OH_MD_KEY_ROTATION
...
@@ -509,57 +1149,105 @@ Defines the character descriptor of the audio/video encoding capability. The val
...
@@ -509,57 +1149,105 @@ Defines the character descriptor of the audio/video encoding capability. The val
```
```
const char* OH_MD_KEY_ROTATION
const char* OH_MD_KEY_ROTATION
```
```
**Description**<br>
Defines the character descriptor of the surface rotation angle. The value type is int32_t. The value range is {0, 90, 180, 270}. The default value is 0.
**Description**
Defines the pointer to the rotation angle of the surface. The value type is int32_t, and the value range is {0, 90, 180, 270}. The default value is 0.
### OH_MD_KEY_TRACK_TYPE
### OH_MD_KEY_SBR
```
```
const char* OH_MD_KEY_TRACK_TYPE
const char* OH_MD_KEY_SBR
```
```
**Description**<br>
Defines the unified character descriptors for the media playback framework.
Defines the pointer to the AAC SBR format. The value type is uint32_t. This key applies to AAC encoders.
### OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE
### OH_MD_KEY_SETUP_HEADER
```
```
const char* OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE
const char* OH_MD_KEY_SETUP_HEADER
```
```
**Description**<br>
Defines the character descriptor of the video encoding bit rate mode. The value type is int32_t. For details, see [OH_VideoEncodeBitrateMode](_video_encoder.md#oh_videoencodebitratemode).
**Description**
Defines the pointer to the VORBIS setup header. The value type is uint8_t\*. This key applies only to VORBIS decoders.
### OH_MD_KEY_WIDTH
### OH_MD_KEY_TITLE
```
```
const char* OH_MD_KEY_WIDTH
const char* OH_MD_KEY_TITLE
```
**Description**
Defines the pointer to the title of the input media. The value is a string.
### OH_MD_KEY_TRACK_COUNT
```
const char* OH_MD_KEY_TRACK_COUNT
```
```
**Description**<br>
Defines the character descriptor of the video width. The value type is uint32_t.
**Description**
### pts
Defines the pointer to the track count of the input media. The value type is uint32_t.
### OH_MD_KEY_TRACK_TYPE
```
```
int64_t OH_AVCodecBufferAttr::pts
const char* OH_MD_KEY_TRACK_TYPE
```
```
**Description**<br>
Defines the presentation timestamp of the buffer, in microseconds.
**Description**
### size
Defines the pointer to a container for storing media descriptions.
Defines the pointer to the video transfer characteristics. The value type is int32_t.
### OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE
```
```
**Description**<br>
const char* OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE
Defines the size of the data contained in the buffer, in bytes.
```
**Description**
Defines the pointer to the video encoding bit rate mode. The value type is int32_t. For details, see [OH_VideoEncodeBitrateMode](_video_encoder.md#oh_videoencodebitratemode).
### OH_MD_KEY_WIDTH
```
const char* OH_MD_KEY_WIDTH
```
**Description**
Defines the pointer to the video width. The value type is uint32_t.
Provides the basic backbone capabilities for the media playback framework, including functions related to the memory, error code, and format carrier.
The **Core** module provides the basic backbone capabilities for the media playback framework, including functions related to the memory, error code, and format carrier.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Since:**
**Since**
9
9
...
@@ -16,51 +17,55 @@ Provides the basic backbone capabilities for the media playback framework, inclu
...
@@ -16,51 +17,55 @@ Provides the basic backbone capabilities for the media playback framework, inclu
### Files
### Files
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [native_averrors.h](native__averrors_8h.md) | Declares the error codes used by the media playback framework.<br>File to Include: <multimedia/player_framework/native_averrors.h> |
| [native_averrors.h](native__averrors_8h.md) | Declares the error codes used by the media playback framework.<br>File to include: \<multimedia/player_framework/native_averrors.h> |
| [native_avformat.h](native__avformat_8h.md) | Declares the format-related functions and enums.<br>File to Include: <multimedia/player_framework/native_avformat.h> |
| [native_avformat.h](native__avformat_8h.md) | Declares the format-related functions and enums.<br>File to include: \<multimedia/player_framework/native_avformat.h> |
| [native_avmemory.h](native__avmemory_8h.md) | Declares the memory-related functions.<br>File to Include: <multimedia/player_framework/native_avmemory.h> |
| [native_avmemory.h](native__avmemory_8h.md) | Declares the memory-related functions.<br>File to include: \<multimedia/player_framework/native_avmemory.h> |
### Types
### Types
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_AVErrCode](#oh_averrcode) | Enumerates the audio and video error codes. |
| [OH_AVErrCode](#oh_averrcode) | Defines an enum that enumerates the audio and video error codes.|
| [OH_AVPixelFormat](#oh_avpixelformat) | Enumerates the audio and video pixel formats. |
| [OH_AVPixelFormat](#oh_avpixelformat) | Defines an enum that enumerates the video pixel formats.|
| [OH_AVFormat_Create](#oh_avformat_create)(void) | Creates an **OH_AVFormat** instance for reading and writing data. |
| \*[OH_AVFormat_Create](#oh_avformat_create)(void) | Creates an **OH_AVFormat** instance for reading data.|
| [OH_AVFormat_Destroy](#oh_avformat_destroy)(struct OH_AVFormat \*format) | Destroys an **OH_AVFormat** instance. |
| \*[OH_AVFormat_CreateAudioFormat](#oh_avformat_createaudioformat)(const char \*mimeType, int32_t sampleRate, int32_t channelCount) | Creates an audio **OH_AVFormat** instance for reading and writing data.|
| [OH_AVFormat_Copy](#oh_avformat_copy)(struct OH_AVFormat \*to, struct OH_AVFormat \*from) | Copies the resources from an **OH_AVFormat** instance to another. |
| \*[OH_AVFormat_CreateVideoFormat](#oh_avformat_createvideoformat)(const char \*mimeType, int32_t width, int32_t height) | Creates a video **OH_AVFormat** instance for reading and writing data.|
| [OH_AVFormat_SetIntValue](#oh_avformat_setintvalue)(struct OH_AVFormat \*format, const char \*key, int32_t value) | Writes data of the int type to an **OH_AVFormat** instance. |
| [OH_AVFormat_Destroy](#oh_avformat_destroy)(struct OH_AVFormat \*format) | Destroys an **OH_AVFormat** instance.|
| [OH_AVFormat_SetLongValue](#oh_avformat_setlongvalue)(struct OH_AVFormat \*format, const char \*key, int64_t value) | Writes data of the long type to an **OH_AVFormat** instance. |
| [OH_AVFormat_SetFloatValue](#oh_avformat_setfloatvalue)(struct OH_AVFormat \*format, const char \*key, float value) | Writes data of the float type to an **OH_AVFormat** instance. |
| [OH_AVFormat_SetIntValue](#oh_avformat_setintvalue)(struct OH_AVFormat \*format, const char \*key, int32_t value) | Writes data of the int type to an **OH_AVFormat** instance.|
| [OH_AVFormat_SetDoubleValue](#oh_avformat_setdoublevalue)(struct OH_AVFormat \*format, const char \*key, double value) | Writes data of the double type to an **OH_AVFormat** instance. |
| [OH_AVFormat_SetLongValue](#oh_avformat_setlongvalue)(struct OH_AVFormat \*format, const char \*key, int64_t value) | Writes data of the long type to an **OH_AVFormat** instance.|
| [OH_AVFormat_SetStringValue](#oh_avformat_setstringvalue)(struct OH_AVFormat \*format, const char \*key, const char \*value) | Writes data of the string type to an **OH_AVFormat** instance. |
| [OH_AVFormat_SetFloatValue](#oh_avformat_setfloatvalue)(struct OH_AVFormat \*format, const char \*key, float value) | Writes data of the float type to an **OH_AVFormat** instance.|
| [OH_AVFormat_SetBuffer](#oh_avformat_setbuffer)(struct OH_AVFormat \*format, const char \*key, const uint8_t \*addr, size_t size) | Writes data with a specified size to an **OH_AVFormat** instance. |
| [OH_AVFormat_SetDoubleValue](#oh_avformat_setdoublevalue)(struct OH_AVFormat \*format, const char \*key, double value) | Writes data of the double type to an **OH_AVFormat** instance.|
| [OH_AVFormat_GetIntValue](#oh_avformat_getintvalue)(struct OH_AVFormat \*format, const char \*key, int32_t \*out) | Reads data of the int type from an **OH_AVFormat** instance. |
| [OH_AVFormat_SetStringValue](#oh_avformat_setstringvalue)(struct OH_AVFormat \*format, const char \*key, const char \*value) | Writes data of the string type to an **OH_AVFormat** instance.|
| [OH_AVFormat_GetLongValue](#oh_avformat_getlongvalue)(struct OH_AVFormat \*format, const char \*key, int64_t \*out) | Reads data of the long type from an **OH_AVFormat** instance. |
| [OH_AVFormat_SetBuffer](#oh_avformat_setbuffer)(struct OH_AVFormat \*format, const char \*key, const uint8_t \*addr, size_t size) | Writes data blocks of a specified length to an **OH_AVFormat** instance.|
| [OH_AVFormat_GetFloatValue](#oh_avformat_getfloatvalue)(struct OH_AVFormat \*format, const char \*key, float \*out) | Reads data of the float type from an **OH_AVFormat** instance. |
| [OH_AVFormat_GetIntValue](#oh_avformat_getintvalue)(struct OH_AVFormat \*format, const char \*key, int32_t \*out) | Reads data of the int type from an **OH_AVFormat** instance.|
| [OH_AVFormat_GetDoubleValue](#oh_avformat_getdoublevalue)(struct OH_AVFormat \*format, const char \*key, double \*out) | Reads data of the double type from an **OH_AVFormat** instance. |
| [OH_AVFormat_GetLongValue](#oh_avformat_getlongvalue)(struct OH_AVFormat \*format, const char \*key, int64_t \*out) | Reads data of the long type from an **OH_AVFormat** instance.|
| [OH_AVFormat_GetStringValue](#oh_avformat_getstringvalue)(struct OH_AVFormat \*format, const char \*key, const char \*\*out) | Reads data of the double type from an **OH_AVFormat** instance. |
| [OH_AVFormat_GetFloatValue](#oh_avformat_getfloatvalue)(struct OH_AVFormat \*format, const char \*key, float \*out) | Reads data of the float type from an **OH_AVFormat** instance.|
| [OH_AVFormat_GetBuffer](#oh_avformat_getbuffer)(struct OH_AVFormat \*format, const char \*key, uint8_t \*\*addr, size_t \*size) | Reads data with a specified size from an **OH_AVFormat** instance. |
| [OH_AVFormat_GetDoubleValue](#oh_avformat_getdoublevalue)(struct OH_AVFormat \*format, const char \*key, double \*out) | Reads data of the double type from an **OH_AVFormat** instance.|
| [OH_AVFormat_DumpInfo](#oh_avformat_dumpinfo)(struct OH_AVFormat \*format) | Dumps the information contained in an**OH_AVFormat** instance as a string. |
| [OH_AVFormat_GetStringValue](#oh_avformat_getstringvalue)(struct OH_AVFormat \*format, const char \*key, const char \*\*out) | Reads data of the string type from an **OH_AVFormat** instance.|
| [OH_AVMemory_GetAddr](#oh_avmemory_getaddr)(struct OH_AVMemory \*mem) | Obtains the virtual memory address of an **OH_AVMemory** instance. |
| [OH_AVFormat_GetBuffer](#oh_avformat_getbuffer)(struct OH_AVFormat \*format, const char \*key, uint8_t \*\*addr, size_t \*size) | Reads data blocks of a specified length from an **OH_AVFormat** instance.|
| [OH_AVMemory_GetSize](#oh_avmemory_getsize)(struct OH_AVMemory \*mem) | Obtains the memory size of an **OH_AVMemory** instance. |
| \*[OH_AVFormat_DumpInfo](#oh_avformat_dumpinfo)(struct OH_AVFormat \*format) | Dumps the information contained in an **OH_AVFormat** instance as a string.|
| \*[OH_AVMemory_Create](#oh_avmemory_create)(int32_t size) | Creates an **OH_AVMemory** instance.|
| \*[OH_AVMemory_GetAddr](#oh_avmemory_getaddr)(struct OH_AVMemory \*mem) | Obtains the virtual memory address of an **OH_AVMemory** instance.|
| [OH_AVMemory_GetSize](#oh_avmemory_getsize)(struct OH_AVMemory \*mem) | Obtains the memory size of an **OH_AVMemory** instance.|
| [OH_AVMemory_Destroy](#oh_avmemory_destroy)(struct OH_AVMemory \*mem) | Releases an **OH_AVMemory** instance.|
## Type Description
## Type Description
...
@@ -72,11 +77,17 @@ Provides the basic backbone capabilities for the media playback framework, inclu
...
@@ -72,11 +77,17 @@ Provides the basic backbone capabilities for the media playback framework, inclu
```
```
typedef enum OH_AVErrCodeOH_AVErrCode
typedef enum OH_AVErrCodeOH_AVErrCode
```
```
**Description**<br>
Enumerates the audio and video error codes.
**Description**
Defines an enum that enumerates the audio and video error codes.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Since**
9
### OH_AVPixelFormat
### OH_AVPixelFormat
...
@@ -84,11 +95,17 @@ Enumerates the audio and video error codes.
...
@@ -84,11 +95,17 @@ Enumerates the audio and video error codes.
```
```
typedef enum OH_AVPixelFormatOH_AVPixelFormat
typedef enum OH_AVPixelFormatOH_AVPixelFormat
```
```
**Description**<br>
Enumerates the audio and video pixel formats.
**Description**
Defines an enum that enumerates the video pixel formats.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Since**
9
## Enum Description
## Enum Description
...
@@ -99,24 +116,30 @@ Enumerates the audio and video pixel formats.
...
@@ -99,24 +116,30 @@ Enumerates the audio and video pixel formats.
Reads data with a specified size from an **OH_AVFormat** instance.
**Description**
Reads data blocks of a specified length from an **OH_AVFormat** instance.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| format | Indicates the handle to an **OH_AVFormat** instance. |
| format | Pointer to an **OH_AVFormat** instance.|
| key | Indicates the pointer to the key of the data to read. |
| key | Pointer to the key of the data to read.|
| addr | Indicates the double pointer to the address where the data read is stored. The data read is destroyed when the **OH_AVFormat** instance is destroyed. To hold the data for an extended period of time, copy it to the memory. |
| addr | Double pointer to the address where the data read is stored. The data read is destroyed when the **OH_AVFormat** instance is destroyed. To hold the data for an extended period of time, copy it to the memory.|
| size | Indicates the pointer to the size of the data read. |
| size | Pointer to the size of the data read.|
**Returns**
**Returns**
Returns **TRUE** if the operation is successful.
Returns **true** if the operation is successful; returns **false** otherwise.
**Since**
Returns **FALSE** if the operation fails.
9
### OH_AVFormat_GetDoubleValue()
### OH_AVFormat_GetDoubleValue()
...
@@ -260,24 +371,28 @@ Returns **FALSE** if the operation fails.
...
@@ -260,24 +371,28 @@ Returns **FALSE** if the operation fails.
```
```
bool OH_AVFormat_GetDoubleValue (struct OH_AVFormat * format, const char * key, double * out )
bool OH_AVFormat_GetDoubleValue (struct OH_AVFormat * format, const char * key, double * out )
```
```
**Description**<br>
**Description**
Reads data of the double type from an **OH_AVFormat** instance.
Reads data of the double type from an **OH_AVFormat** instance.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| format | Indicates the handle to an **OH_AVFormat** instance. |
| format | Pointer to an **OH_AVFormat** instance.|
| key | Indicates the pointer to the key of the data to read. |
| key | Pointer to the key of the data to read.|
| out | Indicates the pointer to the data read. |
| out | Pointer to the value of the data read.|
**Returns**
**Returns**
Returns **TRUE** if the operation is successful.
Returns **true** if the operation is successful; returns **false** otherwise.
Returns **FALSE** if the operation fails.
**Since**
9
### OH_AVFormat_GetFloatValue()
### OH_AVFormat_GetFloatValue()
...
@@ -286,24 +401,28 @@ Returns **FALSE** if the operation fails.
...
@@ -286,24 +401,28 @@ Returns **FALSE** if the operation fails.
```
```
bool OH_AVFormat_GetFloatValue (struct OH_AVFormat * format, const char * key, float * out )
bool OH_AVFormat_GetFloatValue (struct OH_AVFormat * format, const char * key, float * out )
```
```
**Description**<br>
**Description**
Reads data of the float type from an **OH_AVFormat** instance.
Reads data of the float type from an **OH_AVFormat** instance.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| format | Indicates the handle to an **OH_AVFormat** instance. |
| format | Pointer to an **OH_AVFormat** instance.|
| key | Indicates the pointer to the key of the data to read. |
| key | Pointer to the key of the data to read.|
| out | Indicates the pointer to the data read. |
| out | Pointer to the value of the data read.|
**Returns**
**Returns**
Returns **TRUE** if the operation is successful.
Returns **true** if the operation is successful; returns **false** otherwise.
**Since**
Returns **FALSE** if the operation fails.
9
### OH_AVFormat_GetIntValue()
### OH_AVFormat_GetIntValue()
...
@@ -312,24 +431,24 @@ Returns **FALSE** if the operation fails.
...
@@ -312,24 +431,24 @@ Returns **FALSE** if the operation fails.
```
```
bool OH_AVFormat_GetIntValue (struct OH_AVFormat * format, const char * key, int32_t * out )
bool OH_AVFormat_GetIntValue (struct OH_AVFormat * format, const char * key, int32_t * out )
```
```
**Description**<br>
**Description**
Reads data of the int type from an **OH_AVFormat** instance.
Reads data of the int type from an **OH_AVFormat** instance.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| format | Indicates the handle to an **OH_AVFormat** instance. |
| format | Pointer to an **OH_AVFormat** instance.|
| key | Indicates the pointer to the key of the data to read. |
| key | Pointer to the key of the data to read.|
| out | Indicates the pointer to the data read. |
| out | Pointer to the value of the data read.|
**Returns**
**Returns**
Returns **TRUE** if the operation is successful.
Returns **true** if the operation is successful; returns **false** otherwise.
Returns **FALSE** if the operation fails.
### OH_AVFormat_GetLongValue()
### OH_AVFormat_GetLongValue()
...
@@ -338,24 +457,28 @@ Returns **FALSE** if the operation fails.
...
@@ -338,24 +457,28 @@ Returns **FALSE** if the operation fails.
```
```
bool OH_AVFormat_GetLongValue (struct OH_AVFormat * format, const char * key, int64_t * out )
bool OH_AVFormat_GetLongValue (struct OH_AVFormat * format, const char * key, int64_t * out )
```
```
**Description**<br>
**Description**
Reads data of the long type from an **OH_AVFormat** instance.
Reads data of the long type from an **OH_AVFormat** instance.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| format | Indicates the handle to an **OH_AVFormat** instance. |
| format | Pointer to an **OH_AVFormat** instance.|
| key | Indicates the pointer to the key of the data to read. |
| key | Pointer to the key of the data to read.|
| out | Indicates the pointer to the data read. |
| out | Pointer to the value of the data read.|
**Returns**
**Returns**
Returns **TRUE** if the operation is successful.
Returns **true** if the operation is successful; returns **false** otherwise.
Returns **FALSE** if the operation fails.
**Since**
9
### OH_AVFormat_GetStringValue()
### OH_AVFormat_GetStringValue()
...
@@ -364,24 +487,28 @@ Returns **FALSE** if the operation fails.
...
@@ -364,24 +487,28 @@ Returns **FALSE** if the operation fails.
```
```
bool OH_AVFormat_GetStringValue (struct OH_AVFormat * format, const char * key, const char ** out )
bool OH_AVFormat_GetStringValue (struct OH_AVFormat * format, const char * key, const char ** out )
```
```
**Description**<br>
Reads data of the double type from an **OH_AVFormat** instance.
**Description**
Reads data of the string type from an **OH_AVFormat** instance.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| format | Indicates the handle to an **OH_AVFormat** instance. |
| format | Pointer to an **OH_AVFormat** instance.|
| key | Indicates the pointer to the key of the data to read. |
| key | Pointer to the key of the data to read.|
| out | Indicates the double pointer to the data read. The data read is updated when **GetString** is called and destroyed when the **OH_AVFormat** instance is destroyed. To hold the data for an extended period of time, copy it to the memory. |
| out | Double pointer to the data read. The data read is destroyed when the **OH_AVFormat** instance is destroyed. To hold the data for an extended period of time, copy it to the memory.|
**Returns**
**Returns**
Returns **TRUE** if the operation is successful.
Returns **true** if the operation is successful; returns **false** otherwise.
Returns **FALSE** if the operation fails.
**Since**
9
### OH_AVFormat_SetBuffer()
### OH_AVFormat_SetBuffer()
...
@@ -390,25 +517,29 @@ Returns **FALSE** if the operation fails.
...
@@ -390,25 +517,29 @@ Returns **FALSE** if the operation fails.
Writes data with a specified size to an **OH_AVFormat** instance.
**Description**
Writes data blocks of a specified length to an **OH_AVFormat** instance.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| format | Indicates the handle to an **OH_AVFormat** instance. |
| format | Pointer to an **OH_AVFormat** instance.|
| key | Indicates the pointer to the key of the data to write. |
| key | Pointer to the key of the data to write.|
| addr | Indicates the pointer to the address where the data is written. |
| addr | Pointer to the address where the data is written.|
| size | Indicates the size of the data written. |
| size | Size of the data written.|
**Returns**
**Returns**
Returns **TRUE** if the operation is successful.
Returns **true** if the operation is successful; returns **false** otherwise.
Returns **FALSE** if the operation fails.
**Since**
9
### OH_AVFormat_SetDoubleValue()
### OH_AVFormat_SetDoubleValue()
...
@@ -417,24 +548,28 @@ Returns **FALSE** if the operation fails.
...
@@ -417,24 +548,28 @@ Returns **FALSE** if the operation fails.
```
```
bool OH_AVFormat_SetDoubleValue (struct OH_AVFormat * format, const char * key, double value )
bool OH_AVFormat_SetDoubleValue (struct OH_AVFormat * format, const char * key, double value )
```
```
**Description**<br>
**Description**
Writes data of the double type to an **OH_AVFormat** instance.
Writes data of the double type to an **OH_AVFormat** instance.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| format | Indicates the handle to an **OH_AVFormat** instance. |
| format | Pointer to an **OH_AVFormat** instance.|
| key | Indicates the pointer to the key of the data to write. |
| key | Pointer to the key of the data to write.|
| value | Indicates the value of the data to write. |
| value | Value of the data to write.|
**Returns**
**Returns**
Returns **TRUE** if the operation is successful.
Returns **true** if the operation is successful; returns **false** otherwise.
**Since**
Returns **FALSE** if the operation fails.
9
### OH_AVFormat_SetFloatValue()
### OH_AVFormat_SetFloatValue()
...
@@ -443,24 +578,28 @@ Returns **FALSE** if the operation fails.
...
@@ -443,24 +578,28 @@ Returns **FALSE** if the operation fails.
```
```
bool OH_AVFormat_SetFloatValue (struct OH_AVFormat * format, const char * key, float value )
bool OH_AVFormat_SetFloatValue (struct OH_AVFormat * format, const char * key, float value )
```
```
**Description**<br>
**Description**
Writes data of the float type to an **OH_AVFormat** instance.
Writes data of the float type to an **OH_AVFormat** instance.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| format | Indicates the handle to an **OH_AVFormat** instance. |
| format | Pointer to an **OH_AVFormat** instance.|
| key | Indicates the pointer to the key of the data to write. |
| key | Pointer to the key of the data to write.|
| value | Indicates the value of the data to write. |
| value | Value of the data to write.|
**Returns**
**Returns**
Returns **TRUE** if the operation is successful.
Returns **true** if the operation is successful; returns **false** otherwise.
Returns **FALSE** if the operation fails.
**Since**
9
### OH_AVFormat_SetIntValue()
### OH_AVFormat_SetIntValue()
...
@@ -469,24 +608,28 @@ Returns **FALSE** if the operation fails.
...
@@ -469,24 +608,28 @@ Returns **FALSE** if the operation fails.
```
```
bool OH_AVFormat_SetIntValue (struct OH_AVFormat * format, const char * key, int32_t value )
bool OH_AVFormat_SetIntValue (struct OH_AVFormat * format, const char * key, int32_t value )
```
```
**Description**<br>
**Description**
Writes data of the int type to an **OH_AVFormat** instance.
Writes data of the int type to an **OH_AVFormat** instance.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| format | Indicates the handle to an **OH_AVFormat** instance. |
| format | Pointer to an **OH_AVFormat** instance.|
| key | Indicates the pointer to the key of the data to write. |
| key | Pointer to the key of the data to write.|
| value | Indicates the value of the data to write. |
| value | Value of the data to write.|
**Returns**
**Returns**
Returns **TRUE** if the operation is successful.
Returns **true** if the operation is successful; returns **false** otherwise.
Returns **FALSE** if the operation fails.
**Since**
9
### OH_AVFormat_SetLongValue()
### OH_AVFormat_SetLongValue()
...
@@ -495,24 +638,28 @@ Returns **FALSE** if the operation fails.
...
@@ -495,24 +638,28 @@ Returns **FALSE** if the operation fails.
```
```
bool OH_AVFormat_SetLongValue (struct OH_AVFormat * format, const char * key, int64_t value )
bool OH_AVFormat_SetLongValue (struct OH_AVFormat * format, const char * key, int64_t value )
```
```
**Description**<br>
**Description**
Writes data of the long type to an **OH_AVFormat** instance.
Writes data of the long type to an **OH_AVFormat** instance.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Parameters**
**Parameters**
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| format | Indicates the handle to an **OH_AVFormat** instance. |
| format | Pointer to an **OH_AVFormat** instance.|
| key | Indicates the pointer to the key of the data to write. |
| key | Pointer to the key of the data to write.|
| value | Indicates the value of the data to write. |
| value | Value of the data to write.|
**Returns**
**Returns**
Returns **TRUE** if the operation is successful.
Returns **true** if the operation is successful; returns **false** otherwise.
Returns **FALSE** if the operation fails.
**Since**
9
### OH_AVFormat_SetStringValue()
### OH_AVFormat_SetStringValue()
...
@@ -521,24 +668,84 @@ Returns **FALSE** if the operation fails.
...
@@ -521,24 +668,84 @@ Returns **FALSE** if the operation fails.
```
```
bool OH_AVFormat_SetStringValue (struct OH_AVFormat * format, const char * key, const char * value )
bool OH_AVFormat_SetStringValue (struct OH_AVFormat * format, const char * key, const char * value )
```
```
**Description**<br>
**Description**
Writes data of the string type to an **OH_AVFormat** instance.
Writes data of the string type to an **OH_AVFormat** instance.
\@syscap SystemCapability.Multimedia.Media.Core
\@syscap SystemCapability.Multimedia.Media.Core
**Parameters**
**Parameters**
| Name| Description|
| -------- | -------- |
| format | Pointer to an **OH_AVFormat** instance.|
| key | Pointer to the key of the data to write.|
| value | Value of the data to write.|
**Returns**
Returns **true** if the operation is successful; returns **false** otherwise.
**Since**
9
### OH_AVMemory_Create()
```
OH_AVMemory* OH_AVMemory_Create (int32_t size)
```
**Description**
Creates an **OH_AVMemory** instance.
\@syscap SystemCapability.Multimedia.Media.Core
**Parameters**
| Name| Description|
| -------- | -------- |
| size | Size of the created memory, in bytes.|
**Returns**
Returns the pointer to the **OH_AVMemory** instance created if the operation is successful; returns a null pointer otherwise. The instance must be released by calling **OH_AVMemory_Destroy** when it is no longer required.
| [native_vsync.h](native__vsync_8h.md) | Declares the functions for obtaining and using native VSync.<br>File to include: <native_vsync/native_vsync.h>|
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeVSync](#oh_nativevsync) | Provides the declaration of an **OH_NativeVSync** struct. |
| (\*[OH_NativeVSync_FrameCallback](#oh_nativevsync_framecallback)) (long long timestamp, void \*data) | Defines the pointer to a VSync callback function.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeVSync_Create](#oh_nativevsync_create)(const char \*name, unsigned int length) | Creates an **OH_NativeVSync** instance. A new **OH_NativeVSync** instance is created each time this function is called.|
| [OH_NativeVSync_Destroy](#oh_nativevsync_destroy)([OH_NativeVSync](#oh_nativevsync)\*nativeVsync) | Destroys an **OH_NativeVSync** instance.|
| [OH_NativeVSync_RequestFrame](#oh_nativevsync_requestframe)([OH_NativeVSync](#oh_nativevsync)\*nativeVsync, [OH_NativeVSync_FrameCallback](#oh_nativevsync_framecallback) callback, void \*data) | Requests the next VSync signal. When the signal arrives, a callback function is invoked.|
## Type Description
### OH_NativeVSync
```
typedef struct OH_NativeVSync OH_NativeVSync
```
**Description**
Provides the declaration of a **OH_NativeVSync** struct.
### OH_NativeVSync_FrameCallback
```
typedef void(* OH_NativeVSync_FrameCallback) (long long timestamp, void *data)
Defines a collection of asynchronous callback functions for an **OH_AVCodec** instance. You must register this struct instance for an **OH_AVCodec** instance and process the information reported through these callbacks to ensure the normal running of the instance.
The **OH_AVCodecAsyncCallback** struct defines all the asynchronous callback function pointers of an **OH_AVCodec** instance. To ensure the normal running of **OH_AVCodec**, you must register the instance of this struct with the **OH_AVCodec** instance and process the information reported by the callback function.
@@ -20,9 +21,76 @@ Defines a collection of asynchronous callback functions for an **OH_AVCodec** in
...
@@ -20,9 +21,76 @@ Defines a collection of asynchronous callback functions for an **OH_AVCodec** in
### Member Variables
### Member Variables
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| **onError** | Indicates the callback used to report errors occurred during the running of the instance. For details, see [OH_AVCodecOnError](_codec_base.md#oh_avcodeconerror) |
| [onError](#onerror) | Defines the callback used to report a codec operation error. For details, see [OH_AVCodecOnError](_codec_base.md#oh_avcodeconerror).|
| **onStreamChanged** | Indicates the callback used to report stream information. For details, see [OH_AVCodecOnStreamChanged](_codec_base.md#oh_avcodeconstreamchanged) |
| [onStreamChanged](#onstreamchanged) | Defines the callback used to report a codec stream change. For details, see [OH_AVCodecOnStreamChanged](_codec_base.md#oh_avcodeconstreamchanged).|
| **onNeedInputData** | Indicates the callback used to report input data needed. For details, see [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) |
| [onNeedInputData](#onneedinputdata) | Defines the callback used to report input data required. For details, see [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata).|
| **onNeedOutputData** | Indicates the callback used to report output data needed. For details, see [OH_AVCodecOnNewOutputData](_codec_base.md#oh_avcodeconnewoutputdata) |
| [onNeedOutputData](#onneedoutputdata) | Defines the callback used to report output data generated. For details, see [OH_AVCodecOnNewOutputData](_codec_base.md#oh_avcodeconnewoutputdata).|
## Member Variable Description
### onError
```
OH_AVCodecOnError onError
```
**Description**
Defines the callback used to report a codec operation error. For details, see [OH_AVCodecOnError](_codec_base.md#oh_avcodeconerror).
**Since**
9
### onNeedInputData
```
OH_AVCodecOnNeedInputData onNeedInputData
```
**Description**
Defines the callback used to report input data required. For details, see [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata).
**Since**
9
### onNeedOutputData
```
OH_AVCodecOnNewOutputData onNeedOutputData
```
**Description**
Defines the callback used to report output data generated. For details, see [OH_AVCodecOnNewOutputData](_codec_base.md#oh_avcodeconnewoutputdata).
**Since**
9
### onStreamChanged
```
OH_AVCodecOnStreamChanged onStreamChanged
```
**Description**
Defines the callback used to report a codec stream change. For details, see [OH_AVCodecOnStreamChanged](_codec_base.md#oh_avcodeconstreamchanged).
The **OH_AudioCapturer_Callbacks_Struct** struct defines a pointer to the callback functions related to an audio capturer.
\@syscap SystemCapability.Multimedia.Audio.Core
**Since**
10
**Related Modules**
[OHAudio](_o_h_audio.md)
## Summary
### Member Variables
| Name| Description|
| -------- | -------- |
| (\*[OH_AudioCapturer_OnReadData](_o_h_audio.md#oh_audiocapturer_onreaddata) )([OH_AudioCapturer](_o_h_audio.md#oh_audiocapturer)\*capturer, void \*userData, void \*buffer, int32_t lenth) | Defines a function pointer to the callback function used to read audio data.|
The **OH_AudioRenderer_Callbacks_Struct** struct defines a pointer to the callback functions related to an audio renderer.
\@syscap SystemCapability.Multimedia.Audio.Core
**Since**
10
**Related Modules**
[OHAudio](_o_h_audio.md)
## Summary
### Member Variables
| Name| Description |
| -------- | -------- |
| (\*[OH_AudioRenderer_OnWriteData](_o_h_audio.md#oh_audiorenderer_onwritedata) )([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer, void \*userData, void \*buffer, int32_t lenth) | Defines a function pointer to the callback function used to write audio data.|
The **OH_NativeBuffer** module provides the capabilities of **NativeBuffer**. Using the functions provided by this module, you can apply for, use, and release the shared memory, and query its attributes.
| [native_buffer.h](native__buffer_8h.md) | Declares the functions for obtaining and using **NativeBuffer**.<br>File to include: <native_buffer/native_buffer.h> |
### Structs
| Name| Description|
| -------- | -------- |
| [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) | Defines the **OH_NativeBuffer** attribute configuration, which is used when you apply for a new **OH_NativeBuffer** instance or query the attributes of an existing instance.|
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeBuffer](#oh_nativebuffer) | Provides the declaration of an **OH_NativeBuffer** struct.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeBuffer_Alloc](#oh_nativebuffer_alloc)(const[OH_NativeBuffer_Config](_o_h___native_buffer___config.md) \*config) | Creates an **OH_NativeBuffer** instance based on an **OH_NativeBuffer_Config** struct. A new **OH_NativeBuffer** instance is created each time this function is called.|
| [OH_NativeBuffer_Reference](#oh_nativebuffer_reference)([OH_NativeBuffer](#oh_nativebuffer)\*buffer) | Increases the reference count of an **OH_NativeBuffer** instance by 1.|
| [OH_NativeBuffer_Unreference](#oh_nativebuffer_unreference)([OH_NativeBuffer](#oh_nativebuffer)\*buffer) | Decreases the reference count of an **OH_NativeBuffer** instance by 1 and, when the reference count reaches 0, destroys the instance.|
| [OH_NativeBuffer_GetConfig](#oh_nativebuffer_getconfig)([OH_NativeBuffer](#oh_nativebuffer)\*buffer, [OH_NativeBuffer_Config](_o_h___native_buffer___config.md)\*config) | Obtains the attributes of an **OH_NativeBuffer** instance.|
| [OH_NativeBuffer_Map](#oh_nativebuffer_map)([OH_NativeBuffer](#oh_nativebuffer)\*buffer, void \*\*virAddr) | Maps the ION memory corresponding to an **OH_NativeBuffer** instance to the process address space.|
| [OH_NativeBuffer_Unmap](#oh_nativebuffer_unmap)([OH_NativeBuffer](#oh_nativebuffer)\*buffer) | Unmaps the ION memory corresponding to an **OH_NativeBuffer** instance from the process address space.|
| [OH_NativeBuffer_GetSeqNum](#oh_nativebuffer_getseqnum)([OH_NativeBuffer](#oh_nativebuffer)\*buffer) | Obtains the sequence number of an **OH_NativeBuffer** instance.|
## Type Description
### OH_NativeBuffer
```
typedef struct OH_NativeBuffer OH_NativeBuffer
```
**Description**
Provides the declaration of an **OH_NativeBuffer** struct.
Creates an **OH_NativeBuffer** instance based on an **OH_NativeBuffer_Config** struct. A new **OH_NativeBuffer** instance is created each time this function is called.
The **OH_NativeBuffer_Config** struct defines the **OH_NativeBuffer** attribute configuration, which is used when you apply for a new **OH_NativeBuffer** instance or query the attributes of an existing instance.
The **OH_NativeImage** module provides the capabilities of **NativeImage**. Functioning as a data consumer, it is used to associate data with the OpenGL texture. It is used in the OpenGL environment.
| [native_image.h](native__image_8h.md) | Defines the functions for obtaining and using **NativeImage**.<br>File to include: <native_image/native_image.h> |
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeImage](#oh_nativeimage) | Provides the declaration of an **OH_NativeImage** struct.|
| [OHNativeWindow](#ohnativewindow) | Provides the capability of accessing the **NativeWindow**.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeImage_Create](#oh_nativeimage_create)(uint32_t textureId, uint32_t textureTarget) | Creates an **OH_NativeImage** instance to be associated with the OpenGL ES texture ID and target.|
| [OH_NativeImage_AcquireNativeWindow](#oh_nativeimage_acquirenativewindow)(OH_NativeImage\*image) | Obtains an **OHNativeWindow** instance associated with an **OH_NativeImage** instance. You need to call **OH_NativeWindow_DestroyNativeWindow** to release the **OHNativeWindow** instance when it is no longer required. |
| [OH_NativeImage_AttachContext](#oh_nativeimage_attachcontext)(OH_NativeImage\*image, uint32_t textureId) | Attaches an **OH_NativeImage** instance to the current OpenGL ES context.<br>The OpenGL ES texture will be bound to an **GL_TEXTURE_EXTERNAL_OES** instance and updated through the **OH_NativeImage** instance.|
| [OH_NativeImage_DetachContext](#oh_nativeimage_detachcontext)(OH_NativeImage\*image) | Detaches an **OH_NativeImage** instance from the current OpenGL ES context.|
| [OH_NativeImage_UpdateSurfaceImage](#oh_nativeimage_updatesurfaceimage)(OH_NativeImage\*image) | Updates the OpenGL ES texture associated with the latest frame through an **OH_NativeImage** instance.|
| [OH_NativeImage_GetTimestamp](#oh_nativeimage_gettimestamp)(OH_NativeImage*image) | Obtains the timestamp of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| [OH_NativeImage_GetTransformMatrix](#oh_nativeimage_gettransformmatrix)(OH_NativeImage\*image, float matrix[16]) | Obtains the transform matrix of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| [OH_NativeImage_Destroy](#oh_nativeimage_destroy)(OH_NativeImage\*\*image) | Destroys an **OH_NativeImage** instance created by calling **OH_NativeImage_Create**. After the instance is destroyed, the pointer to the **OH_NativeImage** instance is assigned **NULL**. |
## Type Description
### OH_NativeImage
```
typedef struct OH_NativeImage OH_NativeImage
```
**Description**
Provides the declaration of an **OH_NativeImage** struct.
### OHNativeWindow
```
typedef struct NativeWindow OHNativeWindow
```
**Description**
Provides the capability of accessing the **NativeWindow**.
Obtains an **OHNativeWindow** instance associated with an **OH_NativeImage** instance. You need to call **OH_NativeWindow_DestroyNativeWindow** to release the **OHNativeWindow** instance when it is no longer required.
Destroys an **OH_NativeImage** instance created by calling **OH_NativeImage_Create**. After the instance is destroyed, the pointer to the **OH_NativeImage** instance is assigned **NULL**.
The **OHAudio** module provides native APIs of the audio module.
\@syscap SystemCapability.Multimedia.Audio.Core
**Since**
10
## Summary
### Files
| Name| Description|
| -------- | -------- |
| [native_audiocapturer.h](native__audiocapturer_8h.md) | Declares the functions related to an audio capturer.<br>**File to include**: <ohaudio/native_audiocapturer.h><br>**Library**: libohaudio.so|
| [native_audiorenderer.h](native__audiorenderer_8h.md) | Declares the functions related to an audio renderer.<br>**File to include**: <ohaudio/native_audiorenderer.h><br>**Library**: libohaudio.so|
| [native_audiostream_base.h](native__audiostream__base_8h.md) | Declares the basic data structure of **OHAudio**.<br>**File to include**: <ohaudio/native_audiostream_base.h><br>**Library**: libohaudio.so|
| [native_audiostreambuilder.h](native__audiostreambuilder_8h.md) | Declares the functions related to the audio stream builder.<br>**File to include**: <ohaudio/native_audiostreambuilder.h><br>**Library**: libohaudio.so|
### Structs
| Name| Description|
| -------- | -------- |
| [OH_AudioRenderer_Callbacks_Struct](_o_h___audio_renderer___callbacks___struct.md) | Defines a pointer to the callback functions related to an audio renderer.|
| [OH_AudioCapturer_Callbacks_Struct](_o_h___audio_capturer___callbacks___struct.md) | Defines a pointer to the callback functions related to an audio capturer.|
### Types
| Name| Description|
| -------- | -------- |
| [OH_AudioStreamBuilder](#oh_audiostreambuilder) | Defines an audio stream builder.|
| [OH_AudioRenderer](#oh_audiorenderer) | Defines an audio renderer.|
| [OH_AudioCapturer](#oh_audiocapturer) | Defines an audio capturer.|
| [OH_AudioRenderer_Callbacks](#oh_audiorenderer_callbacks) | Defines a pointer to the callback functions related to an audio renderer.|
| [OH_AudioCapturer_Callbacks](#oh_audiocapturer_callbacks) | Defines a pointer to the callback functions related to an audio capturer.|
| [OH_AudioCapturer_GetCurrentState](#oh_audiocapturer_getcurrentstate)([OH_AudioCapturer](#oh_audiocapturer)\*capturer, [OH_AudioStream_State](#oh_audiostream_state)\*state) | Obtains the state of an audio stream.|
| [OH_AudioCapturer_GetLatencyMode](#oh_audiocapturer_getlatencymode)([OH_AudioCapturer](#oh_audiocapturer)\*capturer, [OH_AudioStream_LatencyMode](#oh_audiostream_latencymode)\*latencyMode) | Obtains the latency mode of an audio stream.|
| [OH_AudioCapturer_GetStreamId](#oh_audiocapturer_getstreamid)([OH_AudioCapturer](#oh_audiocapturer)\*capturer, uint32_t \*streamId) | Obtains the stream ID of an audio stream.|
| [OH_AudioCapturer_GetSamplingRate](#oh_audiocapturer_getsamplingrate)([OH_AudioCapturer](#oh_audiocapturer)\*capturer, int32_t \*rate) | Obtains the sampling rate of an audio stream.|
| [OH_AudioCapturer_GetChannelCount](#oh_audiocapturer_getchannelcount)([OH_AudioCapturer](#oh_audiocapturer)\*capturer, int32_t \*channelCount) | Obtains the number of channels for an audio stream.|
| [OH_AudioCapturer_GetSampleFormat](#oh_audiocapturer_getsampleformat)([OH_AudioCapturer](#oh_audiocapturer)\*capturer, [OH_AudioStream_SampleFormat](#oh_audiostream_sampleformat)\*sampleFormat) | Obtains the sampling format of an audio stream.|
| [OH_AudioCapturer_GetEncodingType](#oh_audiocapturer_getencodingtype)([OH_AudioCapturer](#oh_audiocapturer)\*capturer, [OH_AudioStream_EncodingType](#oh_audiostream_encodingtype)\*encodingType) | Obtains the encoding type of an audio stream.|
| [OH_AudioCapturer_GetCapturerInfo](#oh_audiocapturer_getcapturerinfo)([OH_AudioCapturer](#oh_audiocapturer)\*capturer, [OH_AudioStream_SourceType](#oh_audiostream_sourcetype)\*sourceType) | Obtains the usage scenario of an audio renderer.|
| [OH_AudioRenderer_Release](#oh_audiorenderer_release)([OH_AudioRenderer](#oh_audiorenderer)\*renderer) | Releases an audio renderer.|
| [OH_AudioRenderer_Start](#oh_audiorenderer_start)([OH_AudioRenderer](#oh_audiorenderer)\*renderer) | Starts an audio renderer.|
| [OH_AudioRenderer_Pause](#oh_audiorenderer_pause)([OH_AudioRenderer](#oh_audiorenderer)\*renderer) | Pauses an audio renderer.|
| [OH_AudioRenderer_Stop](#oh_audiorenderer_stop)([OH_AudioRenderer](#oh_audiorenderer)\*renderer) | Stops an audio renderer.|
| [OH_AudioRenderer_Flush](#oh_audiorenderer_flush)([OH_AudioRenderer](#oh_audiorenderer)\*renderer) | Flushes written audio data.|
| [OH_AudioRenderer_GetCurrentState](#oh_audiorenderer_getcurrentstate)([OH_AudioRenderer](#oh_audiorenderer)\*renderer, [OH_AudioStream_State](#oh_audiostream_state)\*state) | Obtains the state of an audio stream.|
| [OH_AudioRenderer_GetSamplingRate](#oh_audiorenderer_getsamplingrate)([OH_AudioRenderer](#oh_audiorenderer)\*renderer, int32_t \*rate) | Obtains the sampling rate of an audio stream.|
| [OH_AudioRenderer_GetStreamId](#oh_audiorenderer_getstreamid)([OH_AudioRenderer](#oh_audiorenderer)\*renderer, uint32_t \*streamId) | Obtains the stream ID of an audio stream.|
| [OH_AudioRenderer_GetChannelCount](#oh_audiorenderer_getchannelcount)([OH_AudioRenderer](#oh_audiorenderer)\*renderer, int32_t \*channelCount) | Obtains the number of channels for an audio stream.|
| [OH_AudioRenderer_GetSampleFormat](#oh_audiorenderer_getsampleformat)([OH_AudioRenderer](#oh_audiorenderer)\*renderer, [OH_AudioStream_SampleFormat](#oh_audiostream_sampleformat)\*sampleFormat) | Obtains the sampling format of an audio stream.|
| [OH_AudioRenderer_GetLatencyMode](#oh_audiorenderer_getlatencymode)([OH_AudioRenderer](#oh_audiorenderer)\*renderer, [OH_AudioStream_LatencyMode](#oh_audiostream_latencymode)\*latencyMode) | Obtains the latency mode of an audio stream.|
| [OH_AudioRenderer_GetRendererInfo](#oh_audiorenderer_getrendererinfo)([OH_AudioRenderer](#oh_audiorenderer)\*renderer, [OH_AudioStream_Usage](#oh_audiostream_usage)\*usage) | Obtains the usage scenario of an audio renderer.|
| [OH_AudioRenderer_GetEncodingType](#oh_audiorenderer_getencodingtype)([OH_AudioRenderer](#oh_audiorenderer)\*renderer, [OH_AudioStream_EncodingType](#oh_audiostream_encodingtype)\*encodingType) | Obtains the encoding type of an audio stream.|
| [OH_AudioStreamBuilder_Create](#oh_audiostreambuilder_create)([OH_AudioStreamBuilder](#oh_audiostreambuilder)\*\*builder, [OH_AudioStream_Type](#oh_audiostream_type) type) | Creates an audio stream builder, which can be an audio renderer or capturer.|
| [OH_AudioStreamBuilder_Destroy](#oh_audiostreambuilder_destroy)([OH_AudioStreamBuilder](#oh_audiostreambuilder)\*builder) | Destroys an audio stream builder.|
| [OH_AudioStreamBuilder_SetSamplingRate](#oh_audiostreambuilder_setsamplingrate)([OH_AudioStreamBuilder](#oh_audiostreambuilder)\*builder, int32_t rate) | Sets the sampling rate of an audio stream.|
| [OH_AudioStreamBuilder_SetChannelCount](#oh_audiostreambuilder_setchannelcount)([OH_AudioStreamBuilder](#oh_audiostreambuilder)\*builder, int32_t channelCount) | Sets the number of channels for an audio stream.|
| [OH_AudioStreamBuilder_SetSampleFormat](#oh_audiostreambuilder_setsampleformat)([OH_AudioStreamBuilder](#oh_audiostreambuilder)\*builder, [OH_AudioStream_SampleFormat](#oh_audiostream_sampleformat) format) | Sets the sampling format of an audio stream.|
| [OH_AudioStreamBuilder_SetEncodingType](#oh_audiostreambuilder_setencodingtype)([OH_AudioStreamBuilder](#oh_audiostreambuilder)\*builder, [OH_AudioStream_EncodingType](#oh_audiostream_encodingtype) encodingType) | Sets the encoding type of an audio stream.|
| [OH_AudioStreamBuilder_SetLatencyMode](#oh_audiostreambuilder_setlatencymode)([OH_AudioStreamBuilder](#oh_audiostreambuilder)\*builder, [OH_AudioStream_LatencyMode](#oh_audiostream_latencymode) latencyMode) | Sets the latency mode of an audio stream.|
| [OH_AudioStreamBuilder_SetRendererInfo](#oh_audiostreambuilder_setrendererinfo)([OH_AudioStreamBuilder](#oh_audiostreambuilder)\*builder, [OH_AudioStream_Usage](#oh_audiostream_usage) usage) | Sets the usage scenario of an audio renderer.|
| [OH_AudioStreamBuilder_SetCapturerInfo](#oh_audiostreambuilder_setcapturerinfo)([OH_AudioStreamBuilder](#oh_audiostreambuilder)\*builder, [OH_AudioStream_SourceType](#oh_audiostream_sourcetype) sourceType) | Sets the usage scenario of an audio capturer.|
| [OH_AudioStreamBuilder_SetRendererCallback](#oh_audiostreambuilder_setrenderercallback)([OH_AudioStreamBuilder](#oh_audiostreambuilder)\*builder, [OH_AudioRenderer_Callbacks](#oh_audiorenderer_callbacks) callbacks, void \*userData) | Sets callbacks for an audio renderer.|
| [OH_AudioStreamBuilder_SetCapturerCallback](#oh_audiostreambuilder_setcapturercallback)([OH_AudioStreamBuilder](#oh_audiostreambuilder)\*builder, [OH_AudioCapturer_Callbacks](#oh_audiocapturer_callbacks) callbacks, void \*userData) | Sets callbacks for an audio capturer.|
| [OH_AudioStreamBuilder_GenerateRenderer](#oh_audiostreambuilder_generaterenderer)([OH_AudioStreamBuilder](#oh_audiostreambuilder)\*builder, [OH_AudioRenderer](#oh_audiorenderer)\*\*audioRenderer) | Creates an audio renderer instance.|
| [OH_AudioStreamBuilder_GenerateCapturer](#oh_audiostreambuilder_generatecapturer)([OH_AudioStreamBuilder](#oh_audiostreambuilder)\*builder, [OH_AudioCapturer](#oh_audiocapturer)\*\*audioCapturer) | Creates an audio capturer instance.|
### Variables
| Name| Description|
| -------- | -------- |
| (\*[OH_AudioRenderer_Callbacks_Struct::OH_AudioRenderer_OnWriteData](#oh_audiorenderer_onwritedata) )([OH_AudioRenderer](#oh_audiorenderer)\*renderer, void \*userData, void \*buffer, int32_t lenth) | Defines a function pointer to the callback function used to write audio data.|
| (\*[OH_AudioCapturer_Callbacks_Struct::OH_AudioCapturer_OnReadData](#oh_audiocapturer_onreaddata) )([OH_AudioCapturer](#oh_audiocapturer)\*capturer, void \*userData, void \*buffer, int32_t lenth) | Defines a function pointer to the callback function used to read audio data.|
Provides the functions for video decoding. This module may not be supported on some devices. You can call [CanIUse](../syscap.md) to check whether this module is supported on your device.
The VideoDecoder module provides the functions for video decoding.
@@ -16,31 +17,32 @@ Provides the functions for video decoding. This module may not be supported on s
...
@@ -16,31 +17,32 @@ Provides the functions for video decoding. This module may not be supported on s
### Files
### Files
| Name| Description|
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [native_avcodec_videodecoder.h](native__avcodec__videodecoder_8h.md) | Declares the native APIs used for video decoding.<br>File to include: <multimedia/player_framework/native_avcodec_videodecoder.h> |
| [native_avcodec_videodecoder.h](native__avcodec__videodecoder_8h.md) | Declares the native APIs used for video decoding.<br>File to include: <multimedia/player_framework/native_avcodec_videodecoder.h> |
### Functions
### Functions
| Name| Description|
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_VideoDecoder_CreateByMime](#oh_videodecoder_createbymime)(const char \*mime) | Creates a video decoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This API is recommended in most cases. |
| \*[OH_VideoDecoder_CreateByMime](#oh_videodecoder_createbymime)(const char \*mime) | Creates a video decoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This function is recommended in most cases.|
| [OH_VideoDecoder_CreateByName](#oh_videodecoder_createbyname)(const char \*name) | Creates a video decoder instance based on a video decoder name. To use this API, you must know the exact name of the video decoder. |
| \*[OH_VideoDecoder_CreateByName](#oh_videodecoder_createbyname)(const char \*name) | Creates a video decoder instance based on a decoder name. To use this function, you must know the exact name of the decoder.|
| [OH_VideoDecoder_Destroy](#oh_videodecoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of a video decoder and destroys the video decoder instance. |
| [OH_VideoDecoder_Destroy](#oh_videodecoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of a video decoder and destroys the decoder instance.|
| [OH_VideoDecoder_SetCallback](#oh_videodecoder_setcallback)(OH_AVCodec\*codec, [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md) callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by a video decoder. This API must be called prior to **Prepare**. |
| [OH_VideoDecoder_SetCallback](#oh_videodecoder_setcallback)(OH_AVCodec\*codec, OH_AVCodecAsyncCallback callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by a video decoder.|
| [OH_VideoDecoder_SetSurface](#oh_videodecoder_setsurface)(OH_AVCodec\*codec, OHNativeWindow \*window) | Sets an output surface for a video decoder. This API must be called prior to **Prepare**. |
| [OH_VideoDecoder_SetSurface](#oh_videodecoder_setsurface)(OH_AVCodec\*codec, OHNativeWindow \*window) | Sets an output surface for a video decoder. This function must be called prior to **Prepare**.|
| [OH_VideoDecoder_Configure](#oh_videodecoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures a video decoder. Typically, you need to configure the attributes, which can be extracted from the container, of the video track that can be decoded. This API must be called prior to **Prepare**. |
| [OH_VideoDecoder_Configure](#oh_videodecoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures a video decoder. Typically, you need to configure the video track description information that can be extracted from the container.|
| [OH_VideoDecoder_Prepare](#oh_videodecoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for a video decoder. This API must be called after **Configure**. |
| [OH_VideoDecoder_Prepare](#oh_videodecoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for a video decoder. This function must be called after **Configure**.|
| [OH_VideoDecoder_Start](#oh_videodecoder_start)(OH_AVCodec\*codec) | Starts a video decoder. This API can be called only after the decoder is prepared successfully. After being started, the decoder starts to report the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) event. |
| [OH_VideoDecoder_Start](#oh_videodecoder_start)(OH_AVCodec\*codec) | Starts a video decoder. This function can be called only after the decoder is prepared successfully.|
| [OH_VideoDecoder_Stop](#oh_videodecoder_stop)(OH_AVCodec\*codec) | Stops a video decoder. After the decoder is stopped, you can call **Start** to start it again. If you have passed codec-specific data in the previous **Start** for the decoder, you must pass it again. |
| [OH_VideoDecoder_Stop](#oh_videodecoder_stop)(OH_AVCodec\*codec) | Stops a video decoder.|
| [OH_VideoDecoder_Flush](#oh_videodecoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of a video decoder. This API invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this API, ensure that the buffers corresponding to the indexes are no longer required. |
| [OH_VideoDecoder_Flush](#oh_videodecoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of a video decoder.|
| [OH_VideoDecoder_Reset](#oh_videodecoder_reset)(OH_AVCodec\*codec) | Resets a video decoder. To continue decoding, you must call **Configure** and **Start** to configure and start the decoder again. |
| [OH_VideoDecoder_Reset](#oh_videodecoder_reset)(OH_AVCodec\*codec) | Resets a video decoder.|
| [OH_VideoDecoder_GetOutputDescription](#oh_videodecoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the attributes of the output data of a video decoder. The **OH_AVFormat** instance in the return value will become invalid when this API is called again or when the **OH_AVCodec** instance is destroyed. |
| \*[OH_VideoDecoder_GetOutputDescription](#oh_videodecoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the description information about the output data of a video decoder.|
| [OH_VideoDecoder_SetParameter](#oh_videodecoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for a video decoder. This API can be called only after the decoder is started. Incorrect parameter settings may cause decoding failure. |
| [OH_VideoDecoder_SetParameter](#oh_videodecoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for a video decoder.|
| [OH_VideoDecoder_PushInputData](#oh_videodecoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) attr) | Pushes the input buffer filled with data to a video decoder. The [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback reports available input buffers and their indexes. After being pushed to the decoder, a buffer is not accessible until the buffer with the same index is reported again through the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback. In addition, some decoders require the input of codec-specific data, such as PPS/SPS data in H.264 format, to initialize the decoding process. |
| [OH_VideoDecoder_PushInputData](#oh_videodecoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, OH_AVCodecBufferAttr attr) | Pushes the input buffer filled with data to a video decoder.|
| [OH_VideoDecoder_RenderOutputData](#oh_videodecoder_renderoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of a video decoder and instructs the decoder to render the decoded data in the buffer on the output surface. If no output surface is configured, calling this API only frees the output buffer. |
| [OH_VideoDecoder_RenderOutputData](#oh_videodecoder_renderoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of a video decoder and instructs the decoder to render the decoded data in the buffer on the output surface.|
| [OH_VideoDecoder_FreeOutputData](#oh_videodecoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of a video decoder. |
| [OH_VideoDecoder_FreeOutputData](#oh_videodecoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of a video decoder.|
| [OH_VideoDecoder_IsValid](#oh_videodecoder_isvalid)(OH_AVCodec\*codec, bool \*isValid) | Checks whether a video codec instance is valid.|
## Function Description
## Function Description
...
@@ -52,23 +54,29 @@ Provides the functions for video decoding. This module may not be supported on s
...
@@ -52,23 +54,29 @@ Provides the functions for video decoding. This module may not be supported on s
```
```
OH_AVErrCode OH_VideoDecoder_Configure (OH_AVCodec * codec, OH_AVFormat * format )
OH_AVErrCode OH_VideoDecoder_Configure (OH_AVCodec * codec, OH_AVFormat * format )
```
```
**Description**<br>
Configures a video decoder. Typically, you need to configure the attributes, which can be extracted from the container, of the video track that can be decoded. This API must be called prior to **Prepare**.
Clears the input and output data in the internal buffer of a video decoder. This API invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this API, ensure that the buffers corresponding to the indexes are no longer required.
Clears the input and output data in the internal buffer of a video decoder.
This function invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this function, ensure that the buffers with the specified indexes are no longer required.
Obtains the attributes of the output data of a video decoder. The **OH_AVFormat** instance in the return value will become invalid when this API is called again or when the **OH_AVCodec** instance is destroyed.
| isVaild | Output parameter. Pointer to an instance of the Boolean type. The value **true** means that the decoder instance is valid and **false** means the opposite.|
**Returns**
Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
**Since**
10
### OH_VideoDecoder_Prepare()
### OH_VideoDecoder_Prepare()
...
@@ -216,22 +287,26 @@ Returns the pointer to an **OH_AVFormat** instance.
...
@@ -216,22 +287,26 @@ Returns the pointer to an **OH_AVFormat** instance.
Pushes the input buffer filled with data to a video decoder. The [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback reports available input buffers and their indexes. After being pushed to the decoder, a buffer is not accessible until the buffer with the same index is reported again through the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback. In addition, some decoders require the input of codec-specific data, such as PPS/SPS data in H.264 format, to initialize the decoding process.
Pushes the input buffer filled with data to a video decoder.
The **OH_AVCodecOnNeedInputData** callback reports the available input buffer and the index.
After being pushed to the decoder, a buffer is not accessible until the buffer with the same index is reported again through the **OH_AVCodecOnNeedInputData** callback.
In addition, some decoders require the input of codec-specific data, such as PPS/SPS data in H.264 format, to initialize the decoding process.
| codec | Indicates the pointer to an **OH_AVCodec** instance. |
| codec | Pointer to an **OH_AVCodec** instance.|
| index | Indicates the index of an input buffer. |
| index | Index of an input buffer.|
| attr | Indicates the attributes of the data contained in the buffer. |
| attr | Description information about the data in the buffer.|
**Returns**
**Returns**
Returns **AV_ERR_OK** if the operation is successful.
Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
Returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) if the operation fails.
**Since**
9
### OH_VideoDecoder_RenderOutputData()
### OH_VideoDecoder_RenderOutputData()
...
@@ -266,23 +351,29 @@ Returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) if the op
...
@@ -266,23 +351,29 @@ Returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) if the op
```
```
OH_AVErrCode OH_VideoDecoder_RenderOutputData (OH_AVCodec * codec, uint32_t index )
OH_AVErrCode OH_VideoDecoder_RenderOutputData (OH_AVCodec * codec, uint32_t index )
```
```
**Description**<br>
Frees an output buffer of a video decoder and instructs the decoder to render the decoded data in the buffer on the output surface. If no output surface is configured, calling this API only frees the output buffer.
Sets an asynchronous callback so that your application can respond to events generated by a video decoder. This API must be called prior to **Prepare**.
| codec | Indicates the pointer to an **OH_AVCodec** instance. |
| codec | Pointer to an **OH_AVCodec** instance.|
| callback | Indicates a collection of all callback functions. For details, see [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md).|
| callback | Callback function to set. For details, see **OH_AVCodecAsyncCallback**.|
| userData | Indicates the pointer to user-specific data. |
| userData | User-specific data.|
**Returns**
**Returns**
Returns **AV_ERR_OK** if the operation is successful.
Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
Returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) if the operation fails.
**Since**
9
### OH_VideoDecoder_SetParameter()
### OH_VideoDecoder_SetParameter()
...
@@ -341,23 +442,29 @@ Returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) if the op
...
@@ -341,23 +442,29 @@ Returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) if the op
```
```
OH_AVErrCode OH_VideoDecoder_SetParameter (OH_AVCodec * codec, OH_AVFormat * format )
OH_AVErrCode OH_VideoDecoder_SetParameter (OH_AVCodec * codec, OH_AVFormat * format )
```
```
**Description**<br>
Sets dynamic parameters for a video decoder. This API can be called only after the decoder is started. Incorrect parameter settings may cause decoding failure.
Starts a video decoder. This API can be called only after the decoder is prepared successfully. After being started, the decoder starts to report the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) event.
Stops a video decoder. After the decoder is stopped, you can call **Start** to start it again. If you have passed codec-specific data in the previous **Start** for the decoder, you must pass it again.
Provides the functions and enums for video encoding. This module may not be supported on some devices. You can call [CanIUse](../syscap.md) to check whether this module is supported on your device.
The **VideoEncoder** module provides the functions for video encoding.
| [native_avcodec_videoencoder.h](native__avcodec__videoencoder_8h.md) | Declares the native APIs used for video encoding.<br>File to include: <multimedia/player_framework/native_avcodec_videoencoder.h> |
| [native_avcodec_videoencoder.h](native__avcodec__videoencoder_8h.md) | Declares the native APIs used for video encoding.<br>File to include: <multimedia/player_framework/native_avcodec_videoencoder.h> |
### Types
### Types
| Name| Description|
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_VideoEncodeBitrateMode](#oh_videoencodebitratemode) | Enumerates the bit rate modes of video encoding. |
| [OH_VideoEncodeBitrateMode](#oh_videoencodebitratemode) | Defines an enum that enumerates the bit rate modes of a video encoder. |
### Enums
### Enums
| Name| Description|
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_VideoEncodeBitrateMode](#oh_videoencodebitratemode) { **CBR** = 0, **VBR** = 1, **CQ** = 2 } | Enumerates the bit rate modes of video encoding. |
| [OH_VideoEncodeBitrateMode](#oh_videoencodebitratemode) { **CBR** = 0, **VBR** = 1, **CQ** = 2 } | Enumerates the bit rate modes of a video encoder.|
### Functions
### Functions
| Name| Description|
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_VideoEncoder_CreateByMime](#oh_videoencoder_createbymime)(const char \*mime) | Creates a video encoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This API is recommended in most cases. |
| \*[OH_VideoEncoder_CreateByMime](#oh_videoencoder_createbymime)(const char \*mime) | Creates a video encoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This function is recommended in most cases.|
| [OH_VideoEncoder_CreateByName](#oh_videoencoder_createbyname)(const char \*name) | Creates a video encoder instance based on a video encoder name. To use this API, you must know the exact name of the video encoder. |
| \*[OH_VideoEncoder_CreateByName](#oh_videoencoder_createbyname)(const char \*name) | Creates a video encoder instance based on an encoder name. To use this function, you must know the exact name of the encoder.|
| [OH_VideoEncoder_Destroy](#oh_videoencoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of a video encoder and destroys the video encoder instance. |
| [OH_VideoEncoder_Destroy](#oh_videoencoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of a video encoder and destroys the encoder instance.|
| [OH_VideoEncoder_SetCallback](#oh_videoencoder_setcallback)(OH_AVCodec\*codec, [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md) callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by a video encoder. This API must be called prior to **Prepare**. |
| [OH_VideoEncoder_SetCallback](#oh_videoencoder_setcallback)(OH_AVCodec\*codec, OH_AVCodecAsyncCallback callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by a video encoder.|
| [OH_VideoEncoder_Configure](#oh_videoencoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures a video encoder. Typically, you need to configure the attributes of the video track that can be encoded. This API must be called prior to **Prepare**. |
| [OH_VideoEncoder_Configure](#oh_videoencoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures a video encoder. Typically, you need to configure the description information about the video track to be encoded.|
| [OH_VideoEncoder_Prepare](#oh_videoencoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for a video encoder. This API must be called after **Configure**. |
| [OH_VideoEncoder_Prepare](#oh_videoencoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for a video encoder. This function must be called after **Configure**.|
| [OH_VideoEncoder_Start](#oh_videoencoder_start)(OH_AVCodec\*codec) | Starts a video encoder. This API can be called only after the encoder is prepared successfully. After being started, the encoder starts to report the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) event. |
| [OH_VideoEncoder_Start](#oh_videoencoder_start)(OH_AVCodec\*codec) | Starts a video encoder. This function can be called only after the encoder is prepared successfully.|
| [OH_VideoEncoder_Stop](#oh_videoencoder_stop)(OH_AVCodec\*codec) | Stops a video encoder. After the encoder is stopped, you can call **Start** to start it again. |
| [OH_VideoEncoder_Stop](#oh_videoencoder_stop)(OH_AVCodec\*codec) | Stops a video encoder.|
| [OH_VideoEncoder_Flush](#oh_videoencoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of a video encoder. This API invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this API, ensure that the buffers corresponding to the indexes are no longer required. |
| [OH_VideoEncoder_Flush](#oh_videoencoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of a video encoder.|
| [OH_VideoEncoder_Reset](#oh_videoencoder_reset)(OH_AVCodec\*codec) | Resets a video encoder. To continue encoding, you must call **Configure** and **Start** to configure and start the encoder again. |
| [OH_VideoEncoder_Reset](#oh_videoencoder_reset)(OH_AVCodec\*codec) | Resets a video encoder.|
| [OH_VideoEncoder_GetOutputDescription](#oh_videoencoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the attributes of the output data of a video encoder. The **OH_AVFormat** instance in the return value will become invalid when this API is called again or when the **OH_AVCodec** instance is destroyed. |
| \*[OH_VideoEncoder_GetOutputDescription](#oh_videoencoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the description information about the output data of a video encoder. For details, see **OH_AVFormat**.|
| [OH_VideoEncoder_SetParameter](#oh_videoencoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for a video encoder. This API can be called only after the encoder is started. Incorrect parameter settings may cause encoding failure. |
| [OH_VideoEncoder_SetParameter](#oh_videoencoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for a video encoder.|
| [OH_VideoEncoder_GetSurface](#oh_videoencoder_getsurface)(OH_AVCodec\*codec, OHNativeWindow \*\*window) | Obtains an input surface from a video encoder. This API must be called prior to **Prepare**. |
| [OH_VideoEncoder_GetSurface](#oh_videoencoder_getsurface)(OH_AVCodec\*codec, OHNativeWindow \*\*window) | Sets an input surface for a video encoder. This function must be called prior to **Prepare**.|
| [OH_VideoEncoder_FreeOutputData](#oh_videoencoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of a video encoder. |
| [OH_VideoEncoder_FreeOutputData](#oh_videoencoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of a video encoder.|
| [OH_VideoEncoder_NotifyEndOfStream](#oh_videoencoder_notifyendofstream)(OH_AVCodec\*codec) | Notifies a video encoder that input streams end. This API is recommended in surface mode. |
| [OH_VideoEncoder_NotifyEndOfStream](#oh_videoencoder_notifyendofstream)(OH_AVCodec\*codec) | Notifies a video encoder that input streams end. You are advised to use this function for notification.|
| [OH_VideoEncoder_PushInputData](#oh_videoencoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, OH_AVCodecBufferAttr attr) | Pushes the input buffer filled with data to a video encoder.|
| \*[OH_VideoEncoder_GetInputDescription](#oh_videoencoder_getinputdescription)(OH_AVCodec\*codec) | Obtains the description information received by the video encoder. This function must be called after **Configure**. For details, see **OH_AVFormat**.|
| [OH_VideoEncoder_IsValid](#oh_videoencoder_isvalid)(OH_AVCodec\*codec, bool \*isValid) | Checks whether a video encoder instance is valid.|
## Type Description
## Type Description
...
@@ -60,14 +65,20 @@ Provides the functions and enums for video encoding. This module may not be supp
...
@@ -60,14 +65,20 @@ Provides the functions and enums for video encoding. This module may not be supp
@@ -96,359 +113,528 @@ Enumerates the bit rate modes of video encoding.
...
@@ -96,359 +113,528 @@ Enumerates the bit rate modes of video encoding.
### OH_VideoEncoder_Configure()
### OH_VideoEncoder_Configure()
```
```
OH_AVErrCode OH_VideoEncoder_Configure (OH_AVCodec * codec, OH_AVFormat * format )
OH_AVErrCode OH_VideoEncoder_Configure (OH_AVCodec * codec, OH_AVFormat * format )
```
```
**Description**<br>
Configures a video encoder. Typically, you need to configure the attributes of the video track that can be encoded. This API must be called prior to **Prepare**.
| mime | Indicates the pointer to a MIME type. For details, see [OH_AVCODEC_MIMETYPE_VIDEO_AVC](_codec_base.md#oh_avcodec_mimetype_video_avc).|
| mime | Pointer to a string that describes the MIME type. For details, see **AVCODEC_MIME_TYPE**.|
**Returns**
**Returns**
Returns the pointer to an **OH_AVCodec** instance.
Returns the pointer to the **OH_AVCodec** instance created. You must call **OH_VideoEncoder_Destroy** to destroy the instance when it is no longer needed.
Clears the input and output data in the internal buffer of a video encoder. This API invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this API, ensure that the buffers corresponding to the indexes are no longer required.
Clears the input and output data in the internal buffer of a video encoder.
This function invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this function, ensure that the buffers with the specified indexes are no longer required.
Obtains the attributes of the output data of a video encoder. The **OH_AVFormat** instance in the return value will become invalid when this API is called again or when the **OH_AVCodec** instance is destroyed.
Sets an asynchronous callback so that your application can respond to events generated by a video encoder. This API must be called prior to **Prepare**.
| codec | Indicates the pointer to an **OH_AVCodec** instance. |
| codec | Pointer to an **OH_AVCodec** instance.|
| callback | Indicates a collection of all callback functions. For details, see [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md).|
| callback | Callback function to set. For details, see **OH_AVCodecAsyncCallback**.|
| userData | Indicates the pointer to user-specific data. |
| userData | User-specific data.|
**Returns**
**Returns**
Returns **AV_ERR_OK** if the operation is successful.
Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
**Since**
Returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) if the operation fails.
9
### OH_VideoEncoder_SetParameter()
### OH_VideoEncoder_SetParameter()
```
```
OH_AVErrCode OH_VideoEncoder_SetParameter (OH_AVCodec * codec, OH_AVFormat * format )
OH_AVErrCode OH_VideoEncoder_SetParameter (OH_AVCodec * codec, OH_AVFormat * format )
```
```
**Description**<br>
Sets dynamic parameters for a video encoder. This API can be called only after the encoder is started. Incorrect parameter settings may cause encoding failure.
Starts a video encoder. This API can be called only after the encoder is prepared successfully. After being started, the encoder starts to report the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) event.
| [OH_AudioCapturer_GetCurrentState](_o_h_audio.md#oh_audiocapturer_getcurrentstate)([OH_AudioCapturer](_o_h_audio.md#oh_audiocapturer)\*capturer, [OH_AudioStream_State](_o_h_audio.md#oh_audiostream_state)\*state) | Obtains the state of an audio stream.|
| [OH_AudioCapturer_GetLatencyMode](_o_h_audio.md#oh_audiocapturer_getlatencymode)([OH_AudioCapturer](_o_h_audio.md#oh_audiocapturer)\*capturer, [OH_AudioStream_LatencyMode](_o_h_audio.md#oh_audiostream_latencymode)\*latencyMode) | Obtains the latency mode of an audio stream.|
| [OH_AudioCapturer_GetStreamId](_o_h_audio.md#oh_audiocapturer_getstreamid)([OH_AudioCapturer](_o_h_audio.md#oh_audiocapturer)\*capturer, uint32_t \*streamId) | Obtains the stream ID of an audio stream.|
| [OH_AudioCapturer_GetSamplingRate](_o_h_audio.md#oh_audiocapturer_getsamplingrate)([OH_AudioCapturer](_o_h_audio.md#oh_audiocapturer)\*capturer, int32_t \*rate) | Obtains the sampling rate of an audio stream.|
| [OH_AudioCapturer_GetChannelCount](_o_h_audio.md#oh_audiocapturer_getchannelcount)([OH_AudioCapturer](_o_h_audio.md#oh_audiocapturer)\*capturer, int32_t \*channelCount) | Obtains the number of channels for an audio stream.|
| [OH_AudioCapturer_GetSampleFormat](_o_h_audio.md#oh_audiocapturer_getsampleformat)([OH_AudioCapturer](_o_h_audio.md#oh_audiocapturer)\*capturer, [OH_AudioStream_SampleFormat](_o_h_audio.md#oh_audiostream_sampleformat)\*sampleFormat) | Obtains the sampling format of an audio stream.|
| [OH_AudioCapturer_GetEncodingType](_o_h_audio.md#oh_audiocapturer_getencodingtype)([OH_AudioCapturer](_o_h_audio.md#oh_audiocapturer)\*capturer, [OH_AudioStream_EncodingType](_o_h_audio.md#oh_audiostream_encodingtype)\*encodingType) | Obtains the encoding type of an audio stream.|
| [OH_AudioCapturer_GetCapturerInfo](_o_h_audio.md#oh_audiocapturer_getcapturerinfo)([OH_AudioCapturer](_o_h_audio.md#oh_audiocapturer)\*capturer, [OH_AudioStream_SourceType](_o_h_audio.md#oh_audiostream_sourcetype)\*sourceType) | Obtains the usage scenario of an audio capturer.|
The **native_audiorenderer.h** file declares the functions related to an audio renderer.
\@syscap SystemCapability.Multimedia.Audio.Core
**Since**
10
**Related Modules**
[OHAudio](_o_h_audio.md)
## Summary
### Functions
| Name| Description|
| -------- | -------- |
| [OH_AudioRenderer_Release](_o_h_audio.md#oh_audiorenderer_release)([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer) | Releases an audio renderer.|
| [OH_AudioRenderer_Start](_o_h_audio.md#oh_audiorenderer_start)([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer) | Starts an audio renderer.|
| [OH_AudioRenderer_Pause](_o_h_audio.md#oh_audiorenderer_pause)([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer) | Pauses an audio renderer.|
| [OH_AudioRenderer_Stop](_o_h_audio.md#oh_audiorenderer_stop)([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer) | Stops an audio renderer.|
| [OH_AudioRenderer_Flush](_o_h_audio.md#oh_audiorenderer_flush)([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer) | Flushes written audio data.|
| [OH_AudioRenderer_GetCurrentState](_o_h_audio.md#oh_audiorenderer_getcurrentstate)([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer, [OH_AudioStream_State](_o_h_audio.md#oh_audiostream_state)\*state) | Obtains the state of an audio stream.|
| [OH_AudioRenderer_GetSamplingRate](_o_h_audio.md#oh_audiorenderer_getsamplingrate)([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer, int32_t \*rate) | Obtains the sampling rate of an audio stream.|
| [OH_AudioRenderer_GetStreamId](_o_h_audio.md#oh_audiorenderer_getstreamid)([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer, uint32_t \*streamId) | Obtains the stream ID of an audio stream.|
| [OH_AudioRenderer_GetChannelCount](_o_h_audio.md#oh_audiorenderer_getchannelcount)([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer, int32_t \*channelCount) | Obtains the number of channels for an audio stream.|
| [OH_AudioRenderer_GetSampleFormat](_o_h_audio.md#oh_audiorenderer_getsampleformat)([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer, [OH_AudioStream_SampleFormat](_o_h_audio.md#oh_audiostream_sampleformat)\*sampleFormat) | Obtains the sampling format of an audio stream.|
| [OH_AudioRenderer_GetLatencyMode](_o_h_audio.md#oh_audiorenderer_getlatencymode)([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer, [OH_AudioStream_LatencyMode](_o_h_audio.md#oh_audiostream_latencymode)\*latencyMode) | Obtains the latency mode of an audio stream.|
| [OH_AudioRenderer_GetRendererInfo](_o_h_audio.md#oh_audiorenderer_getrendererinfo)([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer, [OH_AudioStream_Usage](_o_h_audio.md#oh_audiostream_usage)\*usage) | Obtains the usage scenario of an audio renderer.|
| [OH_AudioRenderer_GetEncodingType](_o_h_audio.md#oh_audiorenderer_getencodingtype)([OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*renderer, [OH_AudioStream_EncodingType](_o_h_audio.md#oh_audiostream_encodingtype)\*encodingType) | Obtains the encoding type of an audio stream.|
The **native_audiostream_base.h** file declares the basic data structure of **OHAudio**.
\@syscap SystemCapability.Multimedia.Audio.Core
**Since**
10
**Related Modules**
[OHAudio](_o_h_audio.md)
## Summary
### Structs
| Name| Description|
| -------- | -------- |
| [OH_AudioRenderer_Callbacks_Struct](_o_h___audio_renderer___callbacks___struct.md) | Defines a pointer to the callback functions related to an audio renderer.|
| [OH_AudioCapturer_Callbacks_Struct](_o_h___audio_capturer___callbacks___struct.md) | Defines a pointer to the callback functions related to an audio capturer.|
### Types
| Name| Description|
| -------- | -------- |
| [OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder) | Defines an audio stream builder.|
| [OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer) | Defines an audio renderer.|
| [OH_AudioCapturer](_o_h_audio.md#oh_audiocapturer) | Defines an audio capturer.|
| [OH_AudioRenderer_Callbacks](_o_h_audio.md#oh_audiorenderer_callbacks) | Defines a pointer to the callback functions related to an audio renderer.|
| [OH_AudioCapturer_Callbacks](_o_h_audio.md#oh_audiocapturer_callbacks) | Defines a pointer to the callback functions related to an audio capturer.|
The **native_audiostreambuilder.h** file declares the functions related to the audio stream builder.
You can use the functions to create and destroy an audio stream builder, set audio stream attributes, and set callbacks.
\@syscap SystemCapability.Multimedia.Audio.Core
**Since**
10
**Related Modules**
[OHAudio](_o_h_audio.md)
## Summary
### Functions
| Name| Description|
| -------- | -------- |
| [OH_AudioStreamBuilder_Create](_o_h_audio.md#oh_audiostreambuilder_create)([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder)\*\*builder, [OH_AudioStream_Type](_o_h_audio.md#oh_audiostream_type) type) | Creates an audio stream builder, which can be an audio renderer or capturer.|
| [OH_AudioStreamBuilder_Destroy](_o_h_audio.md#oh_audiostreambuilder_destroy)([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder)\*builder) | Destroys an audio stream builder.|
| [OH_AudioStreamBuilder_SetSamplingRate](_o_h_audio.md#oh_audiostreambuilder_setsamplingrate)([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder)\*builder, int32_t rate) | Sets the sampling rate of an audio stream.|
| [OH_AudioStreamBuilder_SetChannelCount](_o_h_audio.md#oh_audiostreambuilder_setchannelcount)([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder)\*builder, int32_t channelCount) | Sets the number of channels for an audio stream.|
| [OH_AudioStreamBuilder_SetSampleFormat](_o_h_audio.md#oh_audiostreambuilder_setsampleformat)([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder)\*builder, [OH_AudioStream_SampleFormat](_o_h_audio.md#oh_audiostream_sampleformat) format) | Sets the sampling format of an audio stream.|
| [OH_AudioStreamBuilder_SetEncodingType](_o_h_audio.md#oh_audiostreambuilder_setencodingtype)([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder)\*builder, [OH_AudioStream_EncodingType](_o_h_audio.md#oh_audiostream_encodingtype) encodingType) | Sets the encoding type of an audio stream.|
| [OH_AudioStreamBuilder_SetLatencyMode](_o_h_audio.md#oh_audiostreambuilder_setlatencymode)([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder)\*builder, [OH_AudioStream_LatencyMode](_o_h_audio.md#oh_audiostream_latencymode) latencyMode) | Sets the latency mode of an audio stream.|
| [OH_AudioStreamBuilder_SetRendererInfo](_o_h_audio.md#oh_audiostreambuilder_setrendererinfo)([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder)\*builder, [OH_AudioStream_Usage](_o_h_audio.md#oh_audiostream_usage) usage) | Sets the usage scenario of an audio renderer.|
| [OH_AudioStreamBuilder_SetCapturerInfo](_o_h_audio.md#oh_audiostreambuilder_setcapturerinfo)([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder)\*builder, [OH_AudioStream_SourceType](_o_h_audio.md#oh_audiostream_sourcetype) sourceType) | Sets the usage scenario of an audio capturer.|
| [OH_AudioStreamBuilder_SetRendererCallback](_o_h_audio.md#oh_audiostreambuilder_setrenderercallback)([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder)\*builder, [OH_AudioRenderer_Callbacks](_o_h_audio.md#oh_audiorenderer_callbacks) callbacks, void \*userData) | Sets callbacks for an audio renderer.|
| [OH_AudioStreamBuilder_SetCapturerCallback](_o_h_audio.md#oh_audiostreambuilder_setcapturercallback)([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder)\*builder, [OH_AudioCapturer_Callbacks](_o_h_audio.md#oh_audiocapturer_callbacks) callbacks, void \*userData) | Sets callbacks for an audio capturer.|
| [OH_AudioStreamBuilder_GenerateRenderer](_o_h_audio.md#oh_audiostreambuilder_generaterenderer)([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder)\*builder, [OH_AudioRenderer](_o_h_audio.md#oh_audiorenderer)\*\*audioRenderer) | Creates an audio renderer instance.|
| [OH_AudioStreamBuilder_GenerateCapturer](_o_h_audio.md#oh_audiostreambuilder_generatecapturer)([OH_AudioStreamBuilder](_o_h_audio.md#oh_audiostreambuilder)\*builder, [OH_AudioCapturer](_o_h_audio.md#oh_audiocapturer)\*\*audioCapturer) | Creates an audio capturer instance.|
| \*[OH_AVCodec_GetCapability](_a_v_capability.md#oh_avcodec_getcapability)(const char \*mime, bool isEncoder) | Obtains the codec capability recommended by the system.|
| \*[OH_AVCodec_GetCapabilityByCategory](_a_v_capability.md#oh_avcodec_getcapabilitybycategory)(const char \*mime, bool isEncoder, [OH_AVCodecCategory](_a_v_capability.md#oh_avcodeccategory) category) | Obtains the codec capability by category, which can be a hardware codec or software codec.|
| [OH_AVCapability_IsHardware](_a_v_capability.md#oh_avcapability_ishardware)(OH_AVCapability\*capability) | Checks whether a codec capability instance describes a hardware codec.|
| \*[OH_AVCapability_GetName](_a_v_capability.md#oh_avcapability_getname)(OH_AVCapability\*capability) | Obtains the codec name.|
| [OH_AVCapability_GetMaxSupportedInstances](_a_v_capability.md#oh_avcapability_getmaxsupportedinstances)(OH_AVCapability\*capability) | Obtains the maximum number of codec instances supported by a codec.|
| [OH_AVCapability_GetEncoderBitrateRange](_a_v_capability.md#oh_avcapability_getencoderbitraterange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*bitrateRange) | Obtains the bit rate range supported by an encoder.|
| [OH_AVCapability_IsEncoderBitrateModeSupported](_a_v_capability.md#oh_avcapability_isencoderbitratemodesupported)(OH_AVCapability\*capability, [OH_BitrateMode](_a_v_capability.md#oh_bitratemode) bitrateMode) | Checks whether an encoder supports a specific bit rate mode.|
| [OH_AVCapability_GetEncoderQualityRange](_a_v_capability.md#oh_avcapability_getencoderqualityrange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*qualityRange) | Obtains the quality range supported by an encoder.|
| [OH_AVCapability_GetEncoderComplexityRange](_a_v_capability.md#oh_avcapability_getencodercomplexityrange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*complexityRange) | Obtains the complexity range supported by an encoder.|
| [OH_AVCapability_GetAudioSupportedSampleRates](_a_v_capability.md#oh_avcapability_getaudiosupportedsamplerates)(OH_AVCapability\*capability, const int32_t \*\*sampleRates, uint32_t \*sampleRateNum) | Obtains the sampling rates supported by an audio codec.|
| [OH_AVCapability_GetAudioChannelCountRange](_a_v_capability.md#oh_avcapability_getaudiochannelcountrange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*channelCountRange) | Obtains the count range of audio channels supported by an audio codec.|
| [OH_AVCapability_GetVideoWidthAlignment](_a_v_capability.md#oh_avcapability_getvideowidthalignment)(OH_AVCapability\*capability, int32_t \*widthAlignment) | Obtains the video width alignment supported by a video codec.|
| [OH_AVCapability_GetVideoHeightAlignment](_a_v_capability.md#oh_avcapability_getvideoheightalignment)(OH_AVCapability\*capability, int32_t \*heightAlignment) | Obtains the video height alignment supported by a video codec.|
| [OH_AVCapability_GetVideoWidthRangeForHeight](_a_v_capability.md#oh_avcapability_getvideowidthrangeforheight)(OH_AVCapability\*capability, int32_t height, [OH_AVRange](_o_h___a_v_range.md)\*widthRange) | Obtains the video width range supported by a video codec based on a given height.|
| [OH_AVCapability_GetVideoHeightRangeForWidth](_a_v_capability.md#oh_avcapability_getvideoheightrangeforwidth)(OH_AVCapability\*capability, int32_t width, [OH_AVRange](_o_h___a_v_range.md)\*heightRange) | Obtains the video height range supported by a video codec based on a given width.|
| [OH_AVCapability_GetVideoWidthRange](_a_v_capability.md#oh_avcapability_getvideowidthrange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*widthRange) | Obtains the video width range supported by a video codec.|
| [OH_AVCapability_GetVideoHeightRange](_a_v_capability.md#oh_avcapability_getvideoheightrange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*heightRange) | Obtains the video height range supported by a video codec.|
| [OH_AVCapability_IsVideoSizeSupported](_a_v_capability.md#oh_avcapability_isvideosizesupported)(OH_AVCapability\*capability, int32_t width, int32_t height) | Checks whether a video codec supports a specific video size.|
| [OH_AVCapability_GetVideoFrameRateRange](_a_v_capability.md#oh_avcapability_getvideoframeraterange)(OH_AVCapability\*capability, [OH_AVRange](_o_h___a_v_range.md)\*frameRateRange) | Obtains the video frame rate range supported by a video codec.|
| [OH_AVCapability_GetVideoFrameRateRangeForSize](_a_v_capability.md#oh_avcapability_getvideoframeraterangeforsize)(OH_AVCapability\*capability, int32_t width, int32_t height, [OH_AVRange](_o_h___a_v_range.md)\*frameRateRange) | Obtains the video frame rate range supported by a video codec based on a given video size.|
| [OH_AVCapability_AreVideoSizeAndFrameRateSupported](_a_v_capability.md#oh_avcapability_arevideosizeandframeratesupported)(OH_AVCapability\*capability, int32_t width, int32_t height, int32_t frameRate) | Checks whether a video codec supports the combination of a video size and frame rate.|
| [OH_AVCapability_GetVideoSupportedPixelFormats](_a_v_capability.md#oh_avcapability_getvideosupportedpixelformats)(OH_AVCapability\*capability, const int32_t \*\*pixelFormats, uint32_t \*pixelFormatNum) | Obtains the video pixel formats supported by a video codec.|
| [OH_AVCapability_GetSupportedProfiles](_a_v_capability.md#oh_avcapability_getsupportedprofiles)(OH_AVCapability\*capability, const int32_t \*\*profiles, uint32_t \*profileNum) | Obtains the profiles supported by a codec.|
| [OH_AVCapability_GetSupportedLevelsForProfile](_a_v_capability.md#oh_avcapability_getsupportedlevelsforprofile)(OH_AVCapability\*capability, int32_t profile, const int32_t \*\*levels, uint32_t \*levelNum) | Obtains the codec levels supported by a profile.|
| [OH_AVCapability_AreProfileAndLevelSupported](_a_v_capability.md#oh_avcapability_areprofileandlevelsupported)(OH_AVCapability\*capability, int32_t profile, int32_t level) | Checks whether a codec supports the combination of a profile and level.|
The **native_avcodec_audiodecoder.h** file declares the native APIs used for audio decoding.
**Since**
**Since:**
9
9
**Related Modules:**
**Related Modules**
[AudioDecoder](_audio_decoder.md)
[AudioDecoder](_audio_decoder.md)
...
@@ -18,19 +19,20 @@ Declares the native APIs used for audio decoding.
...
@@ -18,19 +19,20 @@ Declares the native APIs used for audio decoding.
### Functions
### Functions
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_AudioDecoder_CreateByMime](_audio_decoder.md#oh_audiodecoder_createbymime)(const char \*mime) | Creates an audio decoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This API is recommended in most cases. |
| \*[OHOS::Media::OH_AudioDecoder_CreateByMime](_audio_decoder.md#oh_audiodecoder_createbymime)(const char \*mime) | Creates an audio decoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This function is recommended in most cases.|
| [OH_AudioDecoder_CreateByName](_audio_decoder.md#oh_audiodecoder_createbyname)(const char \*name) | Creates an audio decoder instance based on an audio decoder name. To use this API, you must know the exact name of the audio decoder. |
| \*[OHOS::Media::OH_AudioDecoder_CreateByName](_audio_decoder.md#oh_audiodecoder_createbyname)(const char \*name) | Creates an audio decoder instance based on a decoder name. To use this function, you must know the exact name of the decoder.|
| [OH_AudioDecoder_Destroy](_audio_decoder.md#oh_audiodecoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of an audio decoder and destroys the audio decoder instance. |
| [OHOS::Media::OH_AudioDecoder_Destroy](_audio_decoder.md#oh_audiodecoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of an audio decoder and destroys the decoder instance.|
| [OH_AudioDecoder_SetCallback](_audio_decoder.md#oh_audiodecoder_setcallback)(OH_AVCodec\*codec, [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md) callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by an audio decoder. This API must be called prior to **Prepare**. |
| [OHOS::Media::OH_AudioDecoder_SetCallback](_audio_decoder.md#oh_audiodecoder_setcallback)(OH_AVCodec\*codec, OH_AVCodecAsyncCallback callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by an audio decoder.|
| [OH_AudioDecoder_Configure](_audio_decoder.md#oh_audiodecoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures an audio decoder. Typically, you need to configure the attributes, which can be extracted from the container, of the audio track that can be decoded. This API must be called prior to **Prepare**. |
| [OHOS::Media::OH_AudioDecoder_Configure](_audio_decoder.md#oh_audiodecoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures an audio decoder. Typically, you need to configure the audio description information that can be extracted from the container.|
| [OH_AudioDecoder_Prepare](_audio_decoder.md#oh_audiodecoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for an audio decoder. This API must be called after **Configure**. |
| [OHOS::Media::OH_AudioDecoder_Prepare](_audio_decoder.md#oh_audiodecoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for an audio decoder. This function must be called after **Configure**.|
| [OH_AudioDecoder_Start](_audio_decoder.md#oh_audiodecoder_start)(OH_AVCodec\*codec) | Starts an audio decoder. This API can be called only after the decoder is prepared successfully. After being started, the decoder starts to report the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) event. |
| [OHOS::Media::OH_AudioDecoder_Start](_audio_decoder.md#oh_audiodecoder_start)(OH_AVCodec\*codec) | Starts an audio decoder. This function can be called only after the decoder is prepared successfully.|
| [OH_AudioDecoder_Stop](_audio_decoder.md#oh_audiodecoder_stop)(OH_AVCodec\*codec) | Stops an audio decoder. After the decoder is stopped, you can call **Start** to start it again. If you have passed codec-specific data in the previous **Start** for the decoder, you must pass it again. |
| [OHOS::Media::OH_AudioDecoder_Stop](_audio_decoder.md#oh_audiodecoder_stop)(OH_AVCodec\*codec) | Stops an audio decoder.|
| [OH_AudioDecoder_Flush](_audio_decoder.md#oh_audiodecoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of an audio decoder. This API invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this API, ensure that the buffers corresponding to the indexes are no longer required. |
| [OHOS::Media::OH_AudioDecoder_Flush](_audio_decoder.md#oh_audiodecoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of an audio decoder.|
| [OH_AudioDecoder_Reset](_audio_decoder.md#oh_audiodecoder_reset)(OH_AVCodec\*codec) | Resets an audio decoder. To continue decoding, you must call **Configure** and **Start** to configure and start the decoder again. |
| [OHOS::Media::OH_AudioDecoder_Reset](_audio_decoder.md#oh_audiodecoder_reset)(OH_AVCodec\*codec) | Resets an audio decoder. To continue decoding, you must call **Configure** to configure the decoder again.|
| [OH_AudioDecoder_GetOutputDescription](_audio_decoder.md#oh_audiodecoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the attributes of the output data of an audio decoder. The caller must manually release the **OH_AVFormat** instance in the return value. |
| \*[OHOS::Media::OH_AudioDecoder_GetOutputDescription](_audio_decoder.md#oh_audiodecoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the description information about the output data of an audio decoder. For details, see **OH_AVFormat**.|
| [OH_AudioDecoder_SetParameter](_audio_decoder.md#oh_audiodecoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for an audio decoder. This API can be called only after the decoder is started. Incorrect parameter settings may cause decoding failure. |
| [OHOS::Media::OH_AudioDecoder_SetParameter](_audio_decoder.md#oh_audiodecoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for an audio decoder. This function can be called only after the decoder is started. Incorrect parameter settings may cause decoding failure.|
| [OH_AudioDecoder_PushInputData](_audio_decoder.md#oh_audiodecoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) attr) | Pushes the input buffer filled with data to an audio decoder. The [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback reports available input buffers and their indexes. After being pushed to the decoder, a buffer is not accessible until the buffer with the same index is reported again through the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback. In addition, some decoders require the input of codec-specific data to initialize the decoding process. |
| [OHOS::Media::OH_AudioDecoder_PushInputData](_audio_decoder.md#oh_audiodecoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, OH_AVCodecBufferAttr attr) | Pushes the input buffer filled with data to an audio decoder.|
| [OH_AudioDecoder_FreeOutputData](_audio_decoder.md#oh_audiodecoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of an audio decoder. |
| [OHOS::Media::OH_AudioDecoder_FreeOutputData](_audio_decoder.md#oh_audiodecoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of an audio decoder.|
| [OHOS::Media::OH_AudioDecoder_IsValid](_audio_decoder.md#oh_audiodecoder_isvalid)(OH_AVCodec\*codec, bool \*isValid) | Checks whether an audio decoder instance is valid.|
The **native_avcodec_audioencoder.h** file declares the native APIs used for audio encoding.
**Since**
**Since:**
9
9
**Related Modules:**
**Related Modules**
[AudioEncoder](_audio_encoder.md)
[AudioEncoder](_audio_encoder.md)
...
@@ -18,19 +19,20 @@ Declares the native APIs used for audio encoding.
...
@@ -18,19 +19,20 @@ Declares the native APIs used for audio encoding.
### Functions
### Functions
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_AudioEncoder_CreateByMime](_audio_encoder.md#oh_audioencoder_createbymime)(const char \*mime) | Creates an audio encoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This API is recommended in most cases. |
| \*[OHOS::Media::OH_AudioEncoder_CreateByMime](_audio_encoder.md#oh_audioencoder_createbymime)(const char \*mime) | Creates an audio encoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This function is recommended in most cases.|
| [OH_AudioEncoder_CreateByName](_audio_encoder.md#oh_audioencoder_createbyname)(const char \*name) | Creates an audio encoder instance based on an audio encoder name. To use this API, you must know the exact name of the audio encoder. |
| \*[OHOS::Media::OH_AudioEncoder_CreateByName](_audio_encoder.md#oh_audioencoder_createbyname)(const char \*name) | Creates an audio encoder instance based on an encoder name. To use this function, you must know the exact name of the encoder.|
| [OH_AudioEncoder_Destroy](_audio_encoder.md#oh_audioencoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of an audio encoder and destroys the audio encoder instance. |
| [OHOS::Media::OH_AudioEncoder_Destroy](_audio_encoder.md#oh_audioencoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of an audio encoder and destroys the encoder instance.|
| [OH_AudioEncoder_SetCallback](_audio_encoder.md#oh_audioencoder_setcallback)(OH_AVCodec\*codec, [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md) callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by an audio encoder. This API must be called prior to **Prepare**. |
| [OHOS::Media::OH_AudioEncoder_SetCallback](_audio_encoder.md#oh_audioencoder_setcallback)(OH_AVCodec\*codec, OH_AVCodecAsyncCallback callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by an audio encoder.|
| [OH_AudioEncoder_Configure](_audio_encoder.md#oh_audioencoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures an audio encoder. Typically, you need to configure the attributes of the audio track that can be encoded. This API must be called prior to **Prepare**. |
| [OHOS::Media::OH_AudioEncoder_Configure](_audio_encoder.md#oh_audioencoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures an audio encoder. Typically, you need to configure the description information about the audio track to be encoded.|
| [OH_AudioEncoder_Prepare](_audio_encoder.md#oh_audioencoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for an audio encoder. This API must be called after **Configure**. |
| [OHOS::Media::OH_AudioEncoder_Prepare](_audio_encoder.md#oh_audioencoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for an audio encoder. This function must be called after **Configure**.|
| [OH_AudioEncoder_Start](_audio_encoder.md#oh_audioencoder_start)(OH_AVCodec\*codec) | Starts an audio encoder. This API can be called only after the encoder is prepared successfully. After being started, the encoder starts to report the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) event. |
| [OHOS::Media::OH_AudioEncoder_Start](_audio_encoder.md#oh_audioencoder_start)(OH_AVCodec\*codec) | Starts an audio encoder. This function can be called only after the encoder is prepared successfully.|
| [OH_AudioEncoder_Stop](_audio_encoder.md#oh_audioencoder_stop)(OH_AVCodec\*codec) | Stops an audio encoder. After the encoder is stopped, you can call **Start** to start it again. |
| [OHOS::Media::OH_AudioEncoder_Stop](_audio_encoder.md#oh_audioencoder_stop)(OH_AVCodec\*codec) | Stops an audio encoder.|
| [OH_AudioEncoder_Flush](_audio_encoder.md#oh_audioencoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of an audio encoder. This API invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this API, ensure that the buffers corresponding to the indexes are no longer required. |
| [OHOS::Media::OH_AudioEncoder_Flush](_audio_encoder.md#oh_audioencoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of an audio encoder.|
| [OH_AudioEncoder_Reset](_audio_encoder.md#oh_audioencoder_reset)(OH_AVCodec\*codec) | Resets an audio encoder. To continue encoding, you must call **Configure** and **Start** to configure and start the encoder again. |
| [OHOS::Media::OH_AudioEncoder_Reset](_audio_encoder.md#oh_audioencoder_reset)(OH_AVCodec\*codec) | Resets an audio encoder.|
| [OH_AudioEncoder_GetOutputDescription](_audio_encoder.md#oh_audioencoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the attributes of the output data of an audio encoder. The caller must manually release the **OH_AVFormat** instance in the return value. |
| \*[OHOS::Media::OH_AudioEncoder_GetOutputDescription](_audio_encoder.md#oh_audioencoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the description information about the output data of an audio encoder. For details, see **OH_AVFormat**.|
| [OH_AudioEncoder_SetParameter](_audio_encoder.md#oh_audioencoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for an audio encoder. This API can be called only after the encoder is started. Incorrect parameter settings may cause encoding failure. |
| [OHOS::Media::OH_AudioEncoder_SetParameter](_audio_encoder.md#oh_audioencoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for an audio encoder.|
| [OH_AudioEncoder_PushInputData](_audio_encoder.md#oh_audioencoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) attr) | Pushes the input buffer filled with data to an audio encoder. The [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback reports available input buffers and their indexes. After being pushed to the decoder, a buffer is not accessible until the buffer with the same index is reported again through the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback. |
| [OHOS::Media::OH_AudioEncoder_PushInputData](_audio_encoder.md#oh_audioencoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, OH_AVCodecBufferAttr attr) | Pushes the input buffer filled with data to an audio encoder.|
| [OH_AudioEncoder_FreeOutputData](_audio_encoder.md#oh_audioencoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of an audio encoder. |
| [OHOS::Media::OH_AudioEncoder_FreeOutputData](_audio_encoder.md#oh_audioencoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of an audio encoder.|
| [OHOS::Media::OH_AudioEncoder_IsValid](_audio_encoder.md#oh_audioencoder_isvalid)(OH_AVCodec\*codec, bool \*isValid) | Checks whether an audio encoder instance is valid.|
Declares the common structs, character constants, and enums for running **OH_AVCodec** instances.
The **native_avcodec_base.h** file declares the common structs, character constants, and enums for running **OH_AVCodec** instances.
**Since**
**Since:**
9
9
**Related Modules:**
**Related Modules**
[CodecBase](_codec_base.md)
[CodecBase](_codec_base.md)
...
@@ -18,59 +19,115 @@ Declares the common structs, character constants, and enums for running **OH_AVC
...
@@ -18,59 +19,115 @@ Declares the common structs, character constants, and enums for running **OH_AVC
### Structs
### Structs
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) | Defines the buffer attributes of an **OH_AVCodec** instance. |
| [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) | Defines the description information about the buffer of an **OH_AVCodec** instance.|
| [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md) | Defines a collection of asynchronous callback functions for an **OH_AVCodec** instance. You must register this struct instance for an **OH_AVCodec** instance and process the information reported through these callbacks to ensure the normal running of the instance. |
| [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md) | Defines all the asynchronous callback function pointers of an **OH_AVCodec** instance.|
### Types
### Types
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_AVCodecBufferFlags](_codec_base.md#oh_avcodecbufferflags) | Enumerates the buffer flags of an **OH_AVCodec** instance. |
| [OH_AVCodecBufferFlags](_codec_base.md#oh_avcodecbufferflags) | Defines an enum that enumerates the flags for the buffer of an **OH_AVCodec** instance.|
| [OH_AVCodecBufferAttr](_codec_base.md#oh_avcodecbufferattr) | Defines the buffer attributes of an **OH_AVCodec** instance. |
| [OH_AVOutputFormat](_codec_base.md#oh_avoutputformat) | Defines an enum that enumerates the output file formats of a muxer.|
| [OH_AVCodecOnError](_codec_base.md#oh_avcodeconerror)) (OH_AVCodec \*codec, int32_t errorCode, void \*userData) | Defines the function pointer that is called to report error information when an error occurs during the running of an **OH_AVCodec** instance. |
| [OH_AVCodecBufferAttr](_codec_base.md#oh_avcodecbufferattr) | Defines a struct for the description information about the buffer of an **OH_AVCodec** instance.|
| [OH_AVCodecOnStreamChanged](_codec_base.md#oh_avcodeconstreamchanged)) (OH_AVCodec \*codec, OH_AVFormat \*format, void \*userData) | Defines the function pointer that is called to report the attributes of the new stream when the output stream changes. Note that the lifecycle of the pointer to the **OH_AVFormat** instance is valid only when the function pointer is being called. Do not access the pointer to the instance after the function pointer is called. |
| (\*[OH_AVCodecOnError](_codec_base.md#oh_avcodeconerror)) (OH_AVCodec \*codec, int32_t errorCode, void \*userData) | Defines the pointer to the function that is called to report error information when an error occurs during the running of an **OH_AVCodec** instance.|
| [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata)) (OH_AVCodec \*codec, uint32_t index, OH_AVMemory \*data, void \*userData) | Defines the function pointer that is called, with a new buffer to fill in new input data, when new input data is required during the running of an **OH_AVCodec** instance. |
| (\*[OH_AVCodecOnStreamChanged](_codec_base.md#oh_avcodeconstreamchanged)) (OH_AVCodec \*codec, OH_AVFormat \*format, void \*userData) | Defines the pointer to the function that is called to report the new stream description when the output stream changes.|
| [OH_AVCodecOnNewOutputData](_codec_base.md#oh_avcodeconnewoutputdata)) (OH_AVCodec \*codec, uint32_t index, OH_AVMemory \*data, [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md)\*attr, void \*userData) | Defines the function pointer that is called, with a buffer containing new output data, when the new output data is generated during the running of an **OH_AVCodec** instance. Note that the lifecycle of the pointer to the **[OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md)** instance is valid only when the function pointer is being called. Do not access the pointer to the instance after the function pointer is called. |
| (\*[OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata)) (OH_AVCodec \*codec, uint32_t index, OH_AVMemory \*data, void \*userData) | Defines the pointer to the function that is called when new input data is required during the running of an **OH_AVCodec** instance. The function carries a buffer to fill in new input data.|
| [OH_AVCodecAsyncCallback](_codec_base.md#oh_avcodecasynccallback) | Defines a collection of asynchronous callback functions for an **OH_AVCodec** instance. You must register this struct instance for an **OH_AVCodec** instance and process the information reported through these callbacks to ensure the normal running of the instance. |
| (\*[OH_AVCodecOnNewOutputData](_codec_base.md#oh_avcodeconnewoutputdata)) (OH_AVCodec \*codec, uint32_t index, OH_AVMemory \*data, [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md)\*attr, void \*userData) | Defines the pointer to the function that is called when new output data is generated during the running of an **OH_AVCodec** instance. The function carries a buffer filled with new output data.|
| [OH_MediaType](_codec_base.md#oh_mediatype) | Enumerates the media types. |
| [OH_AVCodecAsyncCallback](_codec_base.md#oh_avcodecasynccallback) | Defines a struct for all the asynchronous callback function pointers of an **OH_AVCodec** instance.|
| [OH_AVCProfile](_codec_base.md#oh_avcprofile) | Enumerates the AVC profiles. |
| [OH_MediaType](_codec_base.md#oh_mediatype) | Defines an enum that enumerates the media types.|
| [OH_AACProfile](_codec_base.md#oh_aacprofile) | Enumerates the AAC profiles. |
| [OH_AVCProfile](_codec_base.md#oh_avcprofile) | Defines an enum that enumerates the Advanced Video Coding (AVC) profiles.|
| [OH_HEVCProfile](_codec_base.md#oh_hevcprofile) | Defines an enum that enumerates the High Efficiency Video Coding (HEVC) profiles.|
| [OH_AACProfile](_codec_base.md#oh_aacprofile) | Defines an enum that enumerates the Advanced Audio Coding (AAC) profiles.|
| [OH_AVSeekMode](_codec_base.md#oh_avseekmode) | Defines an enum that enumerates the seek modes.|
| [OH_ColorPrimary](_codec_base.md#oh_colorprimary) | Defines an enum that enumerates the primary colors.|
| [OH_TransferCharacteristic](_codec_base.md#oh_transfercharacteristic) | Defines an enum that enumerates the transfer characteristics.|
| [OH_MatrixCoefficient](_codec_base.md#oh_matrixcoefficient) | Defines an enum that enumerates the matrix coefficients.|
| [OH_BitsPerSample](_codec_base.md#oh_bitspersample) | Defines an enum that enumerates the number of audio bits for each coded sample.|
| [OH_BitsPerSample](_codec_base.md#oh_bitspersample) {<br>**SAMPLE_U8** = 0, **SAMPLE_S16LE** = 1, **SAMPLE_S24LE** = 2, **SAMPLE_S32LE** = 3,<br>**SAMPLE_F32LE** = 4, **SAMPLE_U8P** = 5, **SAMPLE_S16P** = 6, **SAMPLE_S24P** = 7,<br>**SAMPLE_S32P** = 8, **SAMPLE_F32P** = 9, **INVALID_WIDTH** = -1<br>} | Enumerates the number of audio bits for each coded sample.|
### Variables
### Variables
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_AVCODEC_MIMETYPE_VIDEO_AVC](_codec_base.md#oh_avcodec_mimetype_video_avc) | Defines the Multipurpose Internet Mail Extension (MIME) type for Advanced Video Coding (AVC). |
| [OH_AVCodecBufferAttr::pts](_o_h___a_v_codec_buffer_attr.md#pts) | Defines the display timestamp of the buffer, in microseconds.|
| [OH_AVCODEC_MIMETYPE_AUDIO_AAC](_codec_base.md#oh_avcodec_mimetype_audio_aac) | Defines the MIME type for Advanced Audio Coding (AAC). |
| [OH_AVCodecBufferAttr::size](_o_h___a_v_codec_buffer_attr.md#size) | Defines the size of data contained in the buffer, in bytes.|
| [OH_ED_KEY_TIME_STAMP](_codec_base.md#oh_ed_key_time_stamp) | Provides unified character descriptors for the auxiliary data of the surface buffer. |
| [OH_AVCodecBufferAttr::offset](_o_h___a_v_codec_buffer_attr.md#offset) | Defines the offset of valid data in the buffer.|
| [OH_ED_KEY_EOS](_codec_base.md#oh_ed_key_eos) | Character descriptor of the end-of-stream in the surface auxiliary data. The value type is bool.|
| [OH_AVCodecBufferAttr::flags](_o_h___a_v_codec_buffer_attr.md#flags) | Defines the flags of the buffer. It is a combination of multiple [OH_AVCodecBufferFlags](_codec_base.md#oh_avcodecbufferflags).|
| [OH_MD_KEY_TRACK_TYPE](_codec_base.md#oh_md_key_track_type) | Provides unified character descriptors for the media playback framework. |
| [OH_AVCodecAsyncCallback::onError](_o_h___a_v_codec_async_callback.md#onerror) | Defines the callback used to report a codec operation error. For details, see [OH_AVCodecOnError](_codec_base.md#oh_avcodeconerror).|
| [OH_MD_KEY_CODEC_MIME](_codec_base.md#oh_md_key_codec_mime) | Character descriptor of the MIME type. The value type is string.|
| [OH_AVCodecAsyncCallback::onStreamChanged](_o_h___a_v_codec_async_callback.md#onstreamchanged) | Defines the callback used to report a codec stream change. For details, see [OH_AVCodecOnStreamChanged](_codec_base.md#oh_avcodeconstreamchanged).|
| [OH_MD_KEY_DURATION](_codec_base.md#oh_md_key_duration) | Character descriptor of duration. The value type is int64_t.|
| [OH_AVCodecAsyncCallback::onNeedInputData](_o_h___a_v_codec_async_callback.md#onneedinputdata) | Defines the callback used to report input data required. For details, see [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata).|
| [OH_MD_KEY_BITRATE](_codec_base.md#oh_md_key_bitrate) | Character descriptor of the bit rate. The value type is uint32_t. |
| [OH_AVCodecAsyncCallback::onNeedOutputData](_o_h___a_v_codec_async_callback.md#onneedinputdata) | Defines the callback used to report output data generated. For details, see [OH_AVCodecOnNewOutputData](_codec_base.md#oh_avcodeconnewoutputdata).|
| [OH_MD_KEY_MAX_INPUT_SIZE](_codec_base.md#oh_md_key_max_input_size) | Character descriptor of the maximum input size. The value type is uint32_t. |
| \*[OH_AVCODEC_MIMETYPE_VIDEO_AVC](_codec_base.md#oh_avcodec_mimetype_video_avc) | Defines the pointer to the Multipurpose Internet Mail Extension (MIME) type for AVC video codec.|
| [OH_MD_KEY_WIDTH](_codec_base.md#oh_md_key_width) | Character descriptor of the video width. The value type is uint32_t. |
| \*[OH_AVCODEC_MIMETYPE_AUDIO_AAC](_codec_base.md#oh_avcodec_mimetype_audio_aac) | Defines the pointer to the MIME type for AAC audio codec.|
| [OH_MD_KEY_HEIGHT](_codec_base.md#oh_md_key_height) | Character descriptor of the video height. The value type is uint32_t. |
| \*[OH_AVCODEC_MIMETYPE_VIDEO_MPEG4](_codec_base.md#oh_avcodec_mimetype_video_mpeg4) | Defines the pointer to the MIME type for MPEG4 video codec.|
| [OH_MD_KEY_PIXEL_FORMAT](_codec_base.md#oh_md_key_pixel_format) | Character descriptor of the video pixel format. The value type is int32_t. |
| \*[OH_AVCODEC_MIMETYPE_VIDEO_HEVC](_codec_base.md#oh_avcodec_mimetype_video_hevc) | Defines the pointer to the MIME type for HEVC video codec.|
| [OH_MD_KEY_AUDIO_SAMPLE_FORMAT](_codec_base.md#oh_md_key_audio_sample_format) | Character descriptor of the audio sample format. The value type is uint32_t. |
| \*[OH_AVCODEC_MIMETYPE_AUDIO_MPEG](_codec_base.md#oh_avcodec_mimetype_audio_mpeg) | Defines the pointer to the MIME type for MPEG audio codec.|
| [OH_MD_KEY_FRAME_RATE](_codec_base.md#oh_md_key_frame_rate) | Character descriptor of the video frame rate. The value type is double. |
| \*[OH_AVCODEC_MIMETYPE_IMAGE_JPG](_codec_base.md#oh_avcodec_mimetype_image_jpg) | Defines the pointer to the MIME type for JPG image codec.|
| [OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE](_codec_base.md#oh_md_key_video_encode_bitrate_mode) | Character descriptor of the video encoding bit rate mode. The value type is int32_t. |
| \*[OH_AVCODEC_MIMETYPE_IMAGE_PNG](_codec_base.md#oh_avcodec_mimetype_image_png) | Defines the pointer to the MIME type for PNG image codec.|
| [OH_MD_KEY_PROFILE](_codec_base.md#oh_md_key_profile) | Character descriptor of the audio/video encoding capability. The value type is int32_t. |
| \*[OH_AVCODEC_MIMETYPE_IMAGE_BMP](_codec_base.md#oh_avcodec_mimetype_image_bmp) | Defines the pointer to the MIME type for BMP image codec.|
| [OH_MD_KEY_AUD_CHANNEL_COUNT](_codec_base.md#oh_md_key_aud_channel_count) | Character descriptor of the number of audio channels. The value type is uint32_t. |
| \*[OH_AVCODEC_MIMETYPE_AUDIO_FLAC](_codec_base.md#oh_avcodec_mimetype_audio_flac) | Defines the pointer to the MIME type for FLAC audio codec.|
| [OH_MD_KEY_AUD_SAMPLE_RATE](_codec_base.md#oh_md_key_aud_sample_rate) | Character descriptor of the audio sampling rate. The value type is uint32_t. |
| \*[OH_AVCODEC_MIMETYPE_AUDIO_VORBIS](_codec_base.md#oh_avcodec_mimetype_audio_vorbis) | Defines the pointer to the MIME type for VORBIS audio codec.|
| [OH_MD_KEY_I_FRAME_INTERVAL](_codec_base.md#oh_md_key_i_frame_interval) | Character descriptor of the I-frame interval. The value type is int32_t, and the unit is ms. |
| \*[OH_ED_KEY_TIME_STAMP](_codec_base.md#oh_ed_key_time_stamp) | Defines the pointer to the timestamp in the extra data of the surface. The value type is int64.|
| [OH_MD_KEY_ROTATION](_codec_base.md#oh_md_key_rotation) | Character descriptor of the surface rotation angle. The value type is int32_t. The value range is {0, 90, 180, 270}. The default value is 0. |
| \*[OH_ED_KEY_EOS](_codec_base.md#oh_ed_key_eos) | Defines the pointer to the end of stream (EOS) in the extra data of the surface. The value type is Boolean.|
| \*[OH_MD_KEY_TRACK_TYPE](_codec_base.md#oh_md_key_track_type) | Defines the pointer to a container for storing media descriptions.|
| \*[OH_MD_KEY_CODEC_MIME](_codec_base.md#oh_md_key_codec_mime) | Define the pointer to the MIME type of codec. The value is a string.|
| \*[OH_MD_KEY_DURATION](_codec_base.md#oh_md_key_duration) | Defines the pointer to the duration. The value type is int64_t.|
| \*[OH_MD_KEY_BITRATE](_codec_base.md#oh_md_key_bitrate) | Defines the pointer to the bit rate. The value type is uint32_t.|
| \*[OH_MD_KEY_MAX_INPUT_SIZE](_codec_base.md#oh_md_key_max_input_size) | Defines the pointer to the maximum input size. The value type is uint32_t.|
| \*[OH_MD_KEY_WIDTH](_codec_base.md#oh_md_key_width) | Defines the pointer to the video width. The value type is uint32_t.|
| \*[OH_MD_KEY_HEIGHT](_codec_base.md#oh_md_key_height) | Defines the pointer to the video height. The value type is uint32_t.|
| \*[OH_MD_KEY_PIXEL_FORMAT](_codec_base.md#oh_md_key_pixel_format) | Defines the pointer to the video pixel format. The value type is int32_t. For details, see [OH_AVPixelFormat](_core.md#oh_avpixelformat).|
| \*[OH_MD_KEY_RANGE_FLAG](_codec_base.md#oh_md_key_range_flag) | Defines the pointer to the video YUV value range flag. The value type is Boolean.|
| \*[OH_MD_KEY_COLOR_PRIMARIES](_codec_base.md#oh_md_key_color_primaries) | Defines the pointer to the primary color of the video. The value type is int32_t.|
| \*[OH_MD_KEY_TRANSFER_CHARACTERISTICS](_codec_base.md#oh_md_key_transfer_characteristics) | Defines the pointer to the video transfer characteristics. The value type is int32_t.|
| \*[OH_MD_KEY_MATRIX_COEFFICIENTS](_codec_base.md#oh_md_key_matrix_coefficients) | Defines the pointer to the video matrix coefficient. The value type is int32_t.|
| \*[OH_MD_KEY_AUDIO_SAMPLE_FORMAT](_codec_base.md#oh_md_key_audio_sample_format) | Defines the pointer to the original audio format. The value type is uint32_t.|
| \*[OH_MD_KEY_FRAME_RATE](_codec_base.md#oh_md_key_frame_rate) | Defines the pointer to the video frame rate. The value is a double-precision floating point number.|
| \*[OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE](_codec_base.md#oh_md_key_video_encode_bitrate_mode) | Defines the pointer to the video encoding bit rate mode. The value type is int32_t. For details, see [OH_VideoEncodeBitrateMode](_video_encoder.md#oh_videoencodebitratemode).|
| \*[OH_MD_KEY_PROFILE](_codec_base.md#oh_md_key_profile) | Defines the pointer to the encoding template. The value is a number. For details, see [OH_AVCProfile](_codec_base.md#oh_avcprofile), [OH_AACProfile](_codec_base.md#oh_aacprofile), or [CodecBase](_codec_base.md#oh_hevcprofile).|
| \*[OH_MD_KEY_AUD_CHANNEL_COUNT](_codec_base.md#oh_md_key_aud_channel_count) | Defines the pointer to the number of audio channels. The value type is uint32_t.|
| \*[OH_MD_KEY_AUD_SAMPLE_RATE](_codec_base.md#oh_md_key_aud_sample_rate) | Defines the pointer to the audio sampling rate. The value type is uint32_t.|
| \*[OH_MD_KEY_I_FRAME_INTERVAL](_codec_base.md#oh_md_key_i_frame_interval) | Defines the pointer to the key frame interval, in milliseconds. The value type is int32_t.|
| \*[OH_MD_KEY_ROTATION](_codec_base.md#oh_md_key_rotation) | Defines the pointer to the rotation angle of the surface. The value type is int32_t, and the value range is {0, 90, 180, 270}. The default value is 0.|
| \*[OH_MD_KEY_CODEC_CONFIG](_codec_base.md#oh_md_key_codec_config) | Defines the pointer to the codec-specific data. The value type is uint8_t\*.|
| \*[OH_MD_KEY_REQUEST_I_FRAME](_codec_base.md#oh_md_key_request_i_frame) | Defines the pointer to the request for immediate encoding of I-frames. The value type is Boolean.|
| \*[OH_MD_KEY_QUALITY](_codec_base.md#oh_md_key_quality) | Defines the pointer to the required encoding quality. The value type is uint32_t. This key applies only to encoders configured in constant quality mode.|
| \*[OH_MD_KEY_CHANNEL_LAYOUT](_codec_base.md#oh_md_key_channel_layout) | Defines the pointer to the required encoding channel layout. The value type is int64_t. This key applies only to encoders.|
| \*[OH_MD_KEY_BITS_PER_CODED_SAMPLE](_codec_base.md#oh_md_key_bits_per_coded_sample) | Defines the pointer to the number of bits for each coded sample. The value type is uint32_t. This key applies to FLAC encoders.|
| \*[OH_MD_KEY_AAC_IS_ADTS](_codec_base.md#oh_md_key_aac_is_adts) | Defines the pointer to the AAC format. The value type is uint32_t. This key applies to AAC decoders.|
| \*[OH_MD_KEY_SBR](_codec_base.md#oh_md_key_sbr) | Defines the pointer to the AAC SBR format. The value type is uint32_t. This key applies to AAC encoders.|
| \*[OH_MD_KEY_COMPLIANCE_LEVEL](_codec_base.md#oh_md_key_compliance_level) | Defines the pointer to the FLAC compliance level. The value type is int32_t.|
| \*[OH_MD_KEY_IDENTIFICATION_HEADER](_codec_base.md#oh_md_key_identification_header) | Defines the pointer to the VORBIS identification header. The value type is uint8_t\*. This key applies only to VORBIS decoders.|
| \*[OH_MD_KEY_SETUP_HEADER](_codec_base.md#oh_md_key_setup_header) | Defines the pointer to the VORBIS setup header. The value type is uint8_t\*. This key applies only to VORBIS decoders.|
| \*[OH_MD_KEY_TITLE](_codec_base.md#oh_md_key_title) | Defines the pointer to the title of the input media. The value is a string.|
| \*[OH_MD_KEY_ARTIST](_codec_base.md#oh_md_key_artist) | Defines the pointer to the artist of the input media. The value is a string.|
| \*[OH_MD_KEY_ALBUM](_codec_base.md#oh_md_key_album) | Defines the pointer to the album of the input media. The value is a string.|
| \*[OH_MD_KEY_ALBUM_ARTIST](_codec_base.md#oh_md_key_album_artist) | Defines the pointer to the album_artist of the input media. The value is a string.|
| \*[OH_MD_KEY_DATE](_codec_base.md#oh_md_key_date) | Defines the pointer to the date of the input media. The value is a string.|
| \*[OH_MD_KEY_COMMENT](_codec_base.md#oh_md_key_comment) | Defines the pointer to the comment of the input media. The value is a string.|
| \*[OH_MD_KEY_GENRE](_codec_base.md#oh_md_key_genre) | Defines the pointer to the genre of the input media. The value is a string.|
| \*[OH_MD_KEY_COPYRIGHT](_codec_base.md#oh_md_key_copyright) | Defines the pointer to the copyright of the input media. The value is a string.|
| \*[OH_MD_KEY_LANGUAGE](_codec_base.md#oh_md_key_language) | Defines the pointer to the language of the input media. The value is a string.|
| \*[OH_MD_KEY_DESCRIPTION](_codec_base.md#oh_md_key_description) | Defines the pointer to the description of the input media. The value is a string.|
| \*[OH_MD_KEY_LYRICS](_codec_base.md#oh_md_key_lyrics) | Defines the pointer to the lyrics of the input media. The value is a string.|
| \*[OH_MD_KEY_TRACK_COUNT](_codec_base.md#oh_md_key_track_count) | Defines the pointer to the track count of the input media. The value type is uint32_t.|
The **native_avcodec_videodecoder.h** file declares the native APIs used for video decoding.
**Since**
**Since:**
9
9
**Related Modules:**
**Related Modules**
[VideoDecoder](_video_decoder.md)
[VideoDecoder](_video_decoder.md)
...
@@ -18,21 +19,22 @@ Declares the native APIs used for video decoding.
...
@@ -18,21 +19,22 @@ Declares the native APIs used for video decoding.
### Functions
### Functions
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_VideoDecoder_CreateByMime](_video_decoder.md#oh_videodecoder_createbymime)(const char \*mime) | Creates a video decoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This API is recommended in most cases. |
| \*[OH_VideoDecoder_CreateByMime](_video_decoder.md#oh_videodecoder_createbymime)(const char \*mime) | Creates a video decoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This function is recommended in most cases.|
| [OH_VideoDecoder_CreateByName](_video_decoder.md#oh_videodecoder_createbyname)(const char \*name) | Creates a video decoder instance based on a video decoder name. To use this API, you must know the exact name of the video decoder. |
| \*[OH_VideoDecoder_CreateByName](_video_decoder.md#oh_videodecoder_createbyname)(const char \*name) | Creates a video decoder instance based on a decoder name. To use this function, you must know the exact name of the decoder.|
| [OH_VideoDecoder_Destroy](_video_decoder.md#oh_videodecoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of a video decoder and destroys the video decoder instance. |
| [OH_VideoDecoder_Destroy](_video_decoder.md#oh_videodecoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of a video decoder and destroys the decoder instance.|
| [OH_VideoDecoder_SetCallback](_video_decoder.md#oh_videodecoder_setcallback)(OH_AVCodec\*codec, [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md) callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by a video decoder. This API must be called prior to **Prepare**. |
| [OH_VideoDecoder_SetCallback](_video_decoder.md#oh_videodecoder_setcallback)(OH_AVCodec\*codec, OH_AVCodecAsyncCallback callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by a video decoder.|
| [OH_VideoDecoder_SetSurface](_video_decoder.md#oh_videodecoder_setsurface)(OH_AVCodec\*codec, [OHNativeWindow](_native_window.md)\*window) | Sets an output surface for a video decoder. This API must be called prior to **Prepare**. |
| [OH_VideoDecoder_SetSurface](_video_decoder.md#oh_videodecoder_setsurface)(OH_AVCodec\*codec, OHNativeWindow \*window) | Sets an output surface for a video decoder. This function must be called prior to **Prepare**.|
| [OH_VideoDecoder_Configure](_video_decoder.md#oh_videodecoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures a video decoder. Typically, you need to configure the attributes, which can be extracted from the container, of the video track that can be decoded. This API must be called prior to **Prepare**. |
| [OH_VideoDecoder_Configure](_video_decoder.md#oh_videodecoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures a video decoder. Typically, you need to configure the video track description information that can be extracted from the container.|
| [OH_VideoDecoder_Prepare](_video_decoder.md#oh_videodecoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for a video decoder. This API must be called after **Configure**. |
| [OH_VideoDecoder_Prepare](_video_decoder.md#oh_videodecoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for a video decoder. This function must be called after **Configure**.|
| [OH_VideoDecoder_Start](_video_decoder.md#oh_videodecoder_start)(OH_AVCodec\*codec) | Starts a video decoder. This API can be called only after the decoder is prepared successfully. After being started, the decoder starts to report the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) event. |
| [OH_VideoDecoder_Start](_video_decoder.md#oh_videodecoder_start)(OH_AVCodec\*codec) | Starts a video decoder. This function can be called only after the decoder is prepared successfully.|
| [OH_VideoDecoder_Stop](_video_decoder.md#oh_videodecoder_stop)(OH_AVCodec\*codec) | Stops a video decoder. After the decoder is stopped, you can call **Start** to start it again. If you have passed codec-specific data in the previous **Start** for the decoder, you must pass it again. |
| [OH_VideoDecoder_Stop](_video_decoder.md#oh_videodecoder_stop)(OH_AVCodec\*codec) | Stops a video decoder.|
| [OH_VideoDecoder_Flush](_video_decoder.md#oh_videodecoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of a video decoder. This API invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this API, ensure that the buffers corresponding to the indexes are no longer required. |
| [OH_VideoDecoder_Flush](_video_decoder.md#oh_videodecoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of a video decoder.|
| [OH_VideoDecoder_Reset](_video_decoder.md#oh_videodecoder_reset)(OH_AVCodec\*codec) | Resets a video decoder. To continue decoding, you must call **Configure** and **Start** to configure and start the decoder again. |
| [OH_VideoDecoder_Reset](_video_decoder.md#oh_videodecoder_reset)(OH_AVCodec\*codec) | Resets a video decoder.|
| [OH_VideoDecoder_GetOutputDescription](_video_decoder.md#oh_videodecoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the attributes of the output data of a video decoder. The **OH_AVFormat** instance in the return value will become invalid when this API is called again or when the **OH_AVCodec** instance is destroyed. |
| \*[OH_VideoDecoder_GetOutputDescription](_video_decoder.md#oh_videodecoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the description information about the output data of a video decoder.|
| [OH_VideoDecoder_SetParameter](_video_decoder.md#oh_videodecoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for a video decoder. This API can be called only after the decoder is started. Incorrect parameter settings may cause decoding failure. |
| [OH_VideoDecoder_SetParameter](_video_decoder.md#oh_videodecoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for a video decoder.|
| [OH_VideoDecoder_PushInputData](_video_decoder.md#oh_videodecoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) attr) | Pushes the input buffer filled with data to a video decoder. The [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback reports available input buffers and their indexes. After being pushed to the decoder, a buffer is not accessible until the buffer with the same index is reported again through the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) callback. In addition, some decoders require the input of codec-specific data, such as PPS/SPS data in H.264 format, to initialize the decoding process. |
| [OH_VideoDecoder_PushInputData](_video_decoder.md#oh_videodecoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, OH_AVCodecBufferAttr attr) | Pushes the input buffer filled with data to a video decoder.|
| [OH_VideoDecoder_RenderOutputData](_video_decoder.md#oh_videodecoder_renderoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of a video decoder and instructs the decoder to render the decoded data in the buffer on the output surface. If no output surface is configured, calling this API only frees the output buffer. |
| [OH_VideoDecoder_RenderOutputData](_video_decoder.md#oh_videodecoder_renderoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of a video decoder and instructs the decoder to render the decoded data in the buffer on the output surface.|
| [OH_VideoDecoder_FreeOutputData](_video_decoder.md#oh_videodecoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of a video decoder. |
| [OH_VideoDecoder_FreeOutputData](_video_decoder.md#oh_videodecoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of a video decoder.|
| [OH_VideoDecoder_IsValid](_video_decoder.md#oh_videodecoder_isvalid)(OH_AVCodec\*codec, bool \*isValid) | Checks whether a video codec instance is valid.|
The **native_avcodec_videoencoder.h** file declares the native APIs used for video encoding.
**Since**
**Since:**
9
9
**Related Modules:**
**Related Modules**
[VideoEncoder](_video_encoder.md)
[VideoEncoder](_video_encoder.md)
...
@@ -18,34 +19,37 @@ Declares the native APIs used for video encoding.
...
@@ -18,34 +19,37 @@ Declares the native APIs used for video encoding.
### Types
### Types
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_VideoEncodeBitrateMode](_video_encoder.md#oh_videoencodebitratemode) | Enumerates the bit rate modes of video encoding. |
| [OH_VideoEncodeBitrateMode](_video_encoder.md#oh_videoencodebitratemode) | Defines an enum that enumerates the bit rate modes of a video encoder.|
### Enums
### Enums
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_VideoEncodeBitrateMode](_video_encoder.md#oh_videoencodebitratemode) { CBR = 0, VBR = 1, CQ = 2 } | Enumerates the bit rate modes of video encoding. |
| [OH_VideoEncodeBitrateMode](_video_encoder.md#oh_videoencodebitratemode) { **CBR** = 0, **VBR** = 1, **CQ** = 2 } | Enumerates the bit rate modes of a video encoder.|
### Functions
### Functions
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_VideoEncoder_CreateByMime](_video_encoder.md#oh_videoencoder_createbymime)(const char \*mime) | Creates a video encoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This API is recommended in most cases. |
| \*[OH_VideoEncoder_CreateByMime](_video_encoder.md#oh_videoencoder_createbymime)(const char \*mime) | Creates a video encoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This function is recommended in most cases.|
| [OH_VideoEncoder_CreateByName](_video_encoder.md#oh_videoencoder_createbyname)(const char \*name) | Creates a video encoder instance based on a video encoder name. To use this API, you must know the exact name of the video encoder. |
| \*[OH_VideoEncoder_CreateByName](_video_encoder.md#oh_videoencoder_createbyname)(const char \*name) | Creates a video encoder instance based on an encoder name. To use this function, you must know the exact name of the encoder.|
| [OH_VideoEncoder_Destroy](_video_encoder.md#oh_videoencoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of a video encoder and destroys the video encoder instance. |
| [OH_VideoEncoder_Destroy](_video_encoder.md#oh_videoencoder_destroy)(OH_AVCodec\*codec) | Clears the internal resources of a video encoder and destroys the encoder instance.|
| [OH_VideoEncoder_SetCallback](_video_encoder.md#oh_videoencoder_setcallback)(OH_AVCodec\*codec, [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md) callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by a video encoder. This API must be called prior to **Prepare**. |
| [OH_VideoEncoder_SetCallback](_video_encoder.md#oh_videoencoder_setcallback)(OH_AVCodec\*codec, OH_AVCodecAsyncCallback callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by a video encoder.|
| [OH_VideoEncoder_Configure](_video_encoder.md#oh_videoencoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures a video encoder. Typically, you need to configure the attributes of the video track that can be encoded. This API must be called prior to **Prepare**. |
| [OH_VideoEncoder_Configure](_video_encoder.md#oh_videoencoder_configure)(OH_AVCodec\*codec, OH_AVFormat \*format) | Configures a video encoder. Typically, you need to configure the description information about the video track to be encoded.|
| [OH_VideoEncoder_Prepare](_video_encoder.md#oh_videoencoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for a video encoder. This API must be called after **Configure**. |
| [OH_VideoEncoder_Prepare](_video_encoder.md#oh_videoencoder_prepare)(OH_AVCodec\*codec) | Prepares internal resources for a video encoder. This function must be called after **Configure**.|
| [OH_VideoEncoder_Start](_video_encoder.md#oh_videoencoder_start)(OH_AVCodec\*codec) | Starts a video encoder. This API can be called only after the encoder is prepared successfully. After being started, the encoder starts to report the [OH_AVCodecOnNeedInputData](_codec_base.md#oh_avcodeconneedinputdata) event. |
| [OH_VideoEncoder_Start](_video_encoder.md#oh_videoencoder_start)(OH_AVCodec\*codec) | Starts a video encoder. This function can be called only after the encoder is prepared successfully.|
| [OH_VideoEncoder_Stop](_video_encoder.md#oh_videoencoder_stop)(OH_AVCodec\*codec) | Stops a video encoder. After the encoder is stopped, you can call **Start** to start it again. |
| [OH_VideoEncoder_Stop](_video_encoder.md#oh_videoencoder_stop)(OH_AVCodec\*codec) | Stops a video encoder.|
| [OH_VideoEncoder_Flush](_video_encoder.md#oh_videoencoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of a video encoder. This API invalidates the indexes of all buffers previously reported through the asynchronous callback. Therefore, before calling this API, ensure that the buffers corresponding to the indexes are no longer required. |
| [OH_VideoEncoder_Flush](_video_encoder.md#oh_videoencoder_flush)(OH_AVCodec\*codec) | Clears the input and output data in the internal buffer of a video encoder.|
| [OH_VideoEncoder_Reset](_video_encoder.md#oh_videoencoder_reset)(OH_AVCodec\*codec) | Resets a video encoder. To continue encoding, you must call **Configure** and **Start** to configure and start the encoder again. |
| [OH_VideoEncoder_Reset](_video_encoder.md#oh_videoencoder_reset)(OH_AVCodec\*codec) | Resets a video encoder.|
| [OH_VideoEncoder_GetOutputDescription](_video_encoder.md#oh_videoencoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the attributes of the output data of a video encoder. The **OH_AVFormat** instance in the return value will become invalid when this API is called again or when the **OH_AVCodec** instance is destroyed. |
| \*[OH_VideoEncoder_GetOutputDescription](_video_encoder.md#oh_videoencoder_getoutputdescription)(OH_AVCodec\*codec) | Obtains the description information about the output data of a video encoder. For details, see **OH_AVFormat**.|
| [OH_VideoEncoder_SetParameter](_video_encoder.md#oh_videoencoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for a video encoder. This API can be called only after the encoder is started. Incorrect parameter settings may cause encoding failure. |
| [OH_VideoEncoder_SetParameter](_video_encoder.md#oh_videoencoder_setparameter)(OH_AVCodec\*codec, OH_AVFormat \*format) | Sets dynamic parameters for a video encoder.|
| [OH_VideoEncoder_GetSurface](_video_encoder.md#oh_videoencoder_getsurface)(OH_AVCodec\*codec, [OHNativeWindow](_native_window.md)\*\*window) | Obtains an input surface from a video encoder. This API must be called prior to **Prepare**. |
| [OH_VideoEncoder_GetSurface](_video_encoder.md#oh_videoencoder_getsurface)(OH_AVCodec\*codec, OHNativeWindow \*\*window) | Sets an input surface for a video encoder. This function must be called prior to **Prepare**.|
| [OH_VideoEncoder_FreeOutputData](_video_encoder.md#oh_videoencoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of a video encoder. |
| [OH_VideoEncoder_FreeOutputData](_video_encoder.md#oh_videoencoder_freeoutputdata)(OH_AVCodec\*codec, uint32_t index) | Frees an output buffer of a video encoder.|
| [OH_VideoEncoder_NotifyEndOfStream](_video_encoder.md#oh_videoencoder_notifyendofstream)(OH_AVCodec\*codec) | Notifies a video encoder that input streams end. This API is recommended in surface mode. |
| [OH_VideoEncoder_NotifyEndOfStream](_video_encoder.md#oh_videoencoder_notifyendofstream)(OH_AVCodec\*codec) | Notifies a video encoder that input streams end. You are advised to use this function for notification.|
| [OH_VideoEncoder_PushInputData](_video_encoder.md#oh_videoencoder_pushinputdata)(OH_AVCodec\*codec, uint32_t index, OH_AVCodecBufferAttr attr) | Pushes the input buffer filled with data to a video encoder.|
| \*[OH_VideoEncoder_GetInputDescription](_video_encoder.md#oh_videoencoder_getinputdescription)(OH_AVCodec\*codec) | Obtains the description information received by the video encoder. This function must be called after **Configure**. For details, see **OH_AVFormat**.|
| [OH_VideoEncoder_IsValid](_video_encoder.md#oh_videoencoder_isvalid)(OH_AVCodec\*codec, bool \*isValid) | Checks whether a video encoder instance is valid.|
The **native_avdemuxer.h** file declares the native APIs used for audio and video decapsulation.
**Since**
10
**Related Modules**
[AVDemuxer](_a_v_demuxer.md)
## Summary
### Functions
| Name| Description|
| -------- | -------- |
| \*[OH_AVDemuxer_CreateWithSource](_a_v_demuxer.md#oh_avdemuxer_createwithsource)(OH_AVSource\*source) | Creates an **OH_AVDemuxer** instance based on an **OH_AVSource** instance.|
| [OH_AVDemuxer_Destroy](_a_v_demuxer.md#oh_avdemuxer_destroy)(OH_AVDemuxer\*demuxer) | Destroys an **OH_AVDemuxer** instance and clears internal resources.|
| [OH_AVDemuxer_SelectTrackByID](_a_v_demuxer.md#oh_avdemuxer_selecttrackbyid)(OH_AVDemuxer\*demuxer, uint32_t trackIndex) | Selects a track, from which the demuxer reads data.|
| [OH_AVDemuxer_UnselectTrackByID](_a_v_demuxer.md#oh_avdemuxer_unselecttrackbyid)(OH_AVDemuxer\*demuxer, uint32_t trackIndex) | Deselects a track. The demuxer no longer reads data from a track after it is deselected.|
| [OH_AVDemuxer_ReadSample](_a_v_demuxer.md#oh_avdemuxer_readsample)(OH_AVDemuxer\*demuxer, uint32_t trackIndex, OH_AVMemory \*sample, OH_AVCodecBufferAttr \*info) | Obtains the compressed frame and related information at the current position from the selected track.|
| [OH_AVDemuxer_SeekToTime](_a_v_demuxer.md#oh_avdemuxer_seektotime)(OH_AVDemuxer\*demuxer, int64_t millisecond, OH_AVSeekMode mode) | Seeks to the specified time for all the selected tracks based on a seek mode.|
| [OH_AVFormat_Create](_core.md#oh_avformat_create)(void) | Creates an **OH_AVFormat** instance for reading and writing data. |
| \*[OH_AVFormat_Create](_core.md#oh_avformat_create)(void) | Creates an **OH_AVFormat** instance for reading data.|
| [OH_AVFormat_Destroy](_core.md#oh_avformat_destroy)(struct OH_AVFormat \*format) | Destroys an **OH_AVFormat** instance. |
| \*[OH_AVFormat_CreateAudioFormat](_core.md#oh_avformat_createaudioformat)(const char \*mimeType, int32_t sampleRate, int32_t channelCount) | Creates an audio **OH_AVFormat** instance for reading and writing data.|
| [OH_AVFormat_Copy](_core.md#oh_avformat_copy)(struct OH_AVFormat \*to, struct OH_AVFormat \*from) | Copies the resources from an **OH_AVFormat** instance to another. |
| \*[OH_AVFormat_CreateVideoFormat](_core.md#oh_avformat_createvideoformat)(const char \*mimeType, int32_t width, int32_t height) | Creates a video **OH_AVFormat** instance for reading and writing data.|
| [OH_AVFormat_SetIntValue](_core.md#oh_avformat_setintvalue)(struct OH_AVFormat \*format, const char \*key, int32_t value) | Writes data of the int type to an **OH_AVFormat** instance. |
| [OH_AVFormat_Destroy](_core.md#oh_avformat_destroy)(struct OH_AVFormat \*format) | Destroys an **OH_AVFormat** instance.|
| [OH_AVFormat_SetLongValue](_core.md#oh_avformat_setlongvalue)(struct OH_AVFormat \*format, const char \*key, int64_t value) | Writes data of the long type to an **OH_AVFormat** instance. |
| [OH_AVFormat_SetFloatValue](_core.md#oh_avformat_setfloatvalue)(struct OH_AVFormat \*format, const char \*key, float value) | Writes data of the float type to an **OH_AVFormat** instance. |
| [OH_AVFormat_SetIntValue](_core.md#oh_avformat_setintvalue)(struct OH_AVFormat \*format, const char \*key, int32_t value) | Writes data of the int type to an **OH_AVFormat** instance.|
| [OH_AVFormat_SetDoubleValue](_core.md#oh_avformat_setdoublevalue)(struct OH_AVFormat \*format, const char \*key, double value) | Writes data of the double type to an **OH_AVFormat** instance. |
| [OH_AVFormat_SetLongValue](_core.md#oh_avformat_setlongvalue)(struct OH_AVFormat \*format, const char \*key, int64_t value) | Writes data of the long type to an **OH_AVFormat** instance.|
| [OH_AVFormat_SetStringValue](_core.md#oh_avformat_setstringvalue)(struct OH_AVFormat \*format, const char \*key, const char \*value) | Writes data of the string type to an **OH_AVFormat** instance. |
| [OH_AVFormat_SetFloatValue](_core.md#oh_avformat_setfloatvalue)(struct OH_AVFormat \*format, const char \*key, float value) | Writes data of the float type to an **OH_AVFormat** instance.|
| [OH_AVFormat_SetBuffer](_core.md#oh_avformat_setbuffer)(struct OH_AVFormat \*format, const char \*key, const uint8_t \*addr, size_t size) | Writes data with a specified size to an **OH_AVFormat** instance. |
| [OH_AVFormat_SetDoubleValue](_core.md#oh_avformat_setdoublevalue)(struct OH_AVFormat \*format, const char \*key, double value) | Writes data of the double type to an **OH_AVFormat** instance.|
| [OH_AVFormat_GetIntValue](_core.md#oh_avformat_getintvalue)(struct OH_AVFormat \*format, const char \*key, int32_t \*out) | Reads data of the int type from an **OH_AVFormat** instance. |
| [OH_AVFormat_SetStringValue](_core.md#oh_avformat_setstringvalue)(struct OH_AVFormat \*format, const char \*key, const char \*value) | Writes data of the string type to an **OH_AVFormat** instance.|
| [OH_AVFormat_GetLongValue](_core.md#oh_avformat_getlongvalue)(struct OH_AVFormat \*format, const char \*key, int64_t \*out) | Reads data of the long type from an **OH_AVFormat** instance. |
| [OH_AVFormat_SetBuffer](_core.md#oh_avformat_setbuffer)(struct OH_AVFormat \*format, const char \*key, const uint8_t \*addr, size_t size) | Writes data blocks of a specified length to an **OH_AVFormat** instance.|
| [OH_AVFormat_GetFloatValue](_core.md#oh_avformat_getfloatvalue)(struct OH_AVFormat \*format, const char \*key, float \*out) | Reads data of the float type from an **OH_AVFormat** instance. |
| [OH_AVFormat_GetIntValue](_core.md#oh_avformat_getintvalue)(struct OH_AVFormat \*format, const char \*key, int32_t \*out) | Reads data of the int type from an **OH_AVFormat** instance.|
| [OH_AVFormat_GetDoubleValue](_core.md#oh_avformat_getdoublevalue)(struct OH_AVFormat \*format, const char \*key, double \*out) | Reads data of the double type from an **OH_AVFormat** instance. |
| [OH_AVFormat_GetLongValue](_core.md#oh_avformat_getlongvalue)(struct OH_AVFormat \*format, const char \*key, int64_t \*out) | Reads data of the long type from an **OH_AVFormat** instance.|
| [OH_AVFormat_GetStringValue](_core.md#oh_avformat_getstringvalue)(struct OH_AVFormat \*format, const char \*key, const char \*\*out) | Reads data of the double type from an **OH_AVFormat** instance. |
| [OH_AVFormat_GetFloatValue](_core.md#oh_avformat_getfloatvalue)(struct OH_AVFormat \*format, const char \*key, float \*out) | Reads data of the float type from an **OH_AVFormat** instance.|
| [OH_AVFormat_GetBuffer](_core.md#oh_avformat_getbuffer)(struct OH_AVFormat \*format, const char \*key, uint8_t \*\*addr, size_t \*size) | Reads data with a specified size from an **OH_AVFormat** instance. |
| [OH_AVFormat_GetDoubleValue](_core.md#oh_avformat_getdoublevalue)(struct OH_AVFormat \*format, const char \*key, double \*out) | Reads data of the double type from an **OH_AVFormat** instance.|
| [OH_AVFormat_DumpInfo](_core.md#oh_avformat_dumpinfo)(struct OH_AVFormat \*format) | Dumps the information contained in an **OH_AVFormat** instance as a string. |
| [OH_AVFormat_GetStringValue](_core.md#oh_avformat_getstringvalue)(struct OH_AVFormat \*format, const char \*key, const char \*\*out) | Reads data of the string type from an **OH_AVFormat** instance.|
| [OH_AVFormat_GetBuffer](_core.md#oh_avformat_getbuffer)(struct OH_AVFormat \*format, const char \*key, uint8_t \*\*addr, size_t \*size) | Reads data blocks of a specified length from an **OH_AVFormat** instance.|
| \*[OH_AVFormat_DumpInfo](_core.md#oh_avformat_dumpinfo)(struct OH_AVFormat \*format) | Dumps the information contained in an **OH_AVFormat** instance as a string.|
The **native_avmemory.h** file declares the memory-related functions.
**Since**
**Since:**
9
9
**Related Modules:**
**Related Modules**
[Core](_core.md)
[Core](_core.md)
...
@@ -16,10 +17,11 @@ Declares the memory-related functions.
...
@@ -16,10 +17,11 @@ Declares the memory-related functions.
## Summary
## Summary
### Functions
### Functions
| Name | Description |
| Name| Description|
| -------- | -------- |
| -------- | -------- |
| [OH_AVMemory_GetAddr](_core.md#oh_avmemory_getaddr)(struct OH_AVMemory \*mem) | Obtains the virtual memory address of an **OH_AVMemory** instance. |
| \*[OH_AVMemory_Create](_core.md#oh_avmemory_create)(int32_t size) | Creates an **OH_AVMemory** instance.|
| [OH_AVMemory_GetSize](_core.md#oh_avmemory_getsize)(struct OH_AVMemory \*mem) | Obtains the memory size of an **OH_AVMemory** instance. |
| \*[OH_AVMemory_GetAddr](_core.md#oh_avmemory_getaddr)(struct OH_AVMemory \*mem) | Obtains the virtual memory address of an **OH_AVMemory** instance.|
| [OH_AVMemory_GetSize](_core.md#oh_avmemory_getsize)(struct OH_AVMemory \*mem) | Obtains the memory size of an **OH_AVMemory** instance.|
| [OH_AVMemory_Destroy](_core.md#oh_avmemory_destroy)(struct OH_AVMemory \*mem) | Releases an **OH_AVMemory** instance.|
The **native_avmuxer.h** file declares native APIs used for audio and video encapsulation.
**Since**
10
**Related Modules**
[AVMuxer](_a_v_muxer.md)
## Summary
### Functions
| Name| Description|
| -------- | -------- |
| \*[OH_AVMuxer_Create](_a_v_muxer.md#oh_avmuxer_create)(int32_t fd, OH_AVOutputFormat format) | Creates an **OH_AVMuxer** instance by using the file descriptor and encapsulation format.|
| [OH_AVMuxer_SetRotation](_a_v_muxer.md#oh_avmuxer_setrotation)(OH_AVMuxer\*muxer, int32_t rotation) | Sets the rotation angle (clockwise) of an output video.|
| [OH_AVMuxer_AddTrack](_a_v_muxer.md#oh_avmuxer_addtrack)(OH_AVMuxer\*muxer, int32_t \*trackIndex, OH_AVFormat \*trackFormat) | Adds a media track to the muxer.|
| [OH_AVMuxer_WriteSample](_a_v_muxer.md#oh_avmuxer_writesample)(OH_AVMuxer\*muxer, uint32_t trackIndex, OH_AVMemory \*sample, OH_AVCodecBufferAttr info) | Writes data to the muxer.|
The **native_avsource.h** file declares the native APIs used to construct audio and video resource objects.
**Since**
10
**Related Modules**
[AVSource](_a_v_source.md)
## Summary
### Functions
| Name| Description|
| -------- | -------- |
| \*[OH_AVSource_CreateWithURI](_a_v_source.md#oh_avsource_createwithuri)(char\*uri) | Creates an **OH_AVSource** instance based on a URI.|
| \*[OH_AVSource_CreateWithFD](_a_v_source.md#oh_avsource_createwithfd)(int32_t fd, int64_t offset, int64_t size) | Creates an **OH_AVSource** instance based on a file descriptor (FD).|
| [OH_AVSource_Destroy](_a_v_source.md#oh_avsource_destroy)(OH_AVSource\*source) | Destroys an **OH_AVSource** instance and clears internal resources. An instance can be destroyed only once.|
| \*[OH_AVSource_GetSourceFormat](_a_v_source.md#oh_avsource_getsourceformat)(OH_AVSource\*source) | Obtains the basic information about a media resource.|
| \*[OH_AVSource_GetTrackFormat](_a_v_source.md#oh_avsource_gettrackformat)(OH_AVSource\*source, uint32_t trackIndex) | Obtains the basic information about a track.|
The **native_buffer.h** file declares the functions for obtaining and using **NativeBuffer**.
**Since**
9
**Related Modules**
[OH_NativeBuffer](_o_h___native_buffer.md)
## Summary
### Structs
| Name| Description:|
| -------- | -------- |
| [OH_NativeBuffer_Config](_o_h___native_buffer___config.md) | Defines the **OH_NativeBuffer** attribute configuration, which is used when you apply for a new **OH_NativeBuffer** instance or query the attributes of an existing instance.|
### Types
| Name| Description:|
| -------- | -------- |
| [OH_NativeBuffer](_o_h___native_buffer.md#oh_nativebuffer) | Provides the declaration of an **OH_NativeBuffer** struct.|
### Functions
| Name| Description:|
| -------- | -------- |
| [OH_NativeBuffer_Alloc](_o_h___native_buffer.md#oh_nativebuffer_alloc)(const OH_NativeBuffer_Config \*config) | Creates an **OH_NativeBuffer** instance based on an **OH_NativeBuffer_Config** struct. A new **OH_NativeBuffer** instance is created each time this function is called.|
| [OH_NativeBuffer_Reference](_o_h___native_buffer.md#oh_nativebuffer_reference)(OH_NativeBuffer\*buffer) | Increases the reference count of an **OH_NativeBuffer** instance by 1.|
| [OH_NativeBuffer_Unreference](_o_h___native_buffer.md#oh_nativebuffer_unreference)(OH_NativeBuffer\*buffer) | Decreases the reference count of an **OH_NativeBuffer** instance by 1 and, when the reference count reaches 0, destroys the instance.|
| [OH_NativeBuffer_GetConfig](_o_h___native_buffer.md#oh_nativebuffer_getconfig)(OH_NativeBuffer\*buffer, OH_NativeBuffer_Config \*config) | Obtains the attributes of an **OH_NativeBuffer** instance.|
| [OH_NativeBuffer_Map](_o_h___native_buffer.md#oh_nativebuffer_map)(OH_NativeBuffer\*buffer, void \*\*virAddr) | Maps the ION memory corresponding to an **OH_NativeBuffer** instance to the process address space.|
| [OH_NativeBuffer_Unmap](_o_h___native_buffer.md#oh_nativebuffer_unmap)(OH_NativeBuffer\*buffer) | Unmaps the ION memory corresponding to an **OH_NativeBuffer** instance from the process address space.|
| [OH_NativeBuffer_GetSeqNum](_o_h___native_buffer.md#oh_nativebuffer_getseqnum)(OH_NativeBuffer\*buffer) | Obtains the sequence number of an **OH_NativeBuffer** instance.|
The **native_image.h** file declares the functions for obtaining and using **NativeImage**.
**Since**
9
**Related Modules**
[OH_NativeImage](_o_h___native_image.md)
## Summary
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeImage](_o_h___native_image.md#oh_nativeimage) | Provides the declaration of an **OH_NativeImage** struct.|
| [OHNativeWindow](_o_h___native_image.md#ohnativewindow) | Provides the capability of accessing the **NativeWindow**.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeImage_Create](_o_h___native_image.md#oh_nativeimage_create)(uint32_t textureId, uint32_t textureTarget) | Creates an **OH_NativeImage** instance to be associated with the OpenGL ES texture ID and target.|
| [OH_NativeImage_AcquireNativeWindow](_o_h___native_image.md#oh_nativeimage_acquirenativewindow)(OH_NativeImage\*image) | Obtains an **OHNativeWindow** instance associated with an **OH_NativeImage** instance. You need to call **OH_NativeWindow_DestroyNativeWindow** to release the **OHNativeWindow** instance when it is no longer required. |
| [OH_NativeImage_AttachContext](_o_h___native_image.md#oh_nativeimage_attachcontext)(OH_NativeImage\*image, uint32_t textureId) | Attaches an **OH_NativeImage** instance to the current OpenGL ES context.<br>The OpenGL ES texture will be bound to an **GL_TEXTURE_EXTERNAL_OES** instance and updated through the **OH_NativeImage** instance.|
| [OH_NativeImage_DetachContext](_o_h___native_image.md#oh_nativeimage_detachcontext)(OH_NativeImage\*image) | Detaches an **OH_NativeImage** instance from the current OpenGL ES context.|
| [OH_NativeImage_UpdateSurfaceImage](_o_h___native_image.md#oh_nativeimage_updatesurfaceimage)(OH_NativeImage\*image) | Updates the OpenGL ES texture associated with the latest frame through an **OH_NativeImage** instance.|
| [OH_NativeImage_GetTimestamp](_o_h___native_image.md#oh_nativeimage_gettimestamp)(OH_NativeImage\*image) | Obtains the timestamp of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| [OH_NativeImage_GetTransformMatrix](_o_h___native_image.md#oh_nativeimage_gettransformmatrix)(OH_NativeImage\*image, float matrix[16]) | Obtains the transform matrix of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| [OH_NativeImage_Destroy](_o_h___native_image.md#oh_nativeimage_destroy)(OH_NativeImage\*\*image) | Destroys an **OH_NativeImage** instance created by calling **OH_NativeImage_Create**. After the instance is destroyed, the pointer to the **OH_NativeImage** instance is assigned **NULL**. |
The **native_vsync.h** file declares the functions for obtaining and using native virtual synchronization (VSync).
**Since**
9
**Related Modules**
[NativeVsync](_native_vsync.md)
## Summary
### Types
| Name| Description|
| -------- | -------- |
| [OH_NativeVSync](_native_vsync.md#oh_nativevsync) | Provides the declaration of an **OH_NativeVSync** struct. |
| (\*[OH_NativeVSync_FrameCallback](_native_vsync.md#oh_nativevsync_framecallback)) (long long timestamp, void \*data) | Defines the pointer to a VSync callback function.|
### Functions
| Name| Description|
| -------- | -------- |
| [OH_NativeVSync_Create](_native_vsync.md#oh_nativevsync_create)(const char \*name, unsigned int length) | Creates an **OH_NativeVSync** instance. A new **OH_NativeVSync** instance is created each time this function is called.|
| [OH_NativeVSync_Destroy](_native_vsync.md#oh_nativevsync_destroy)(OH_NativeVSync\*nativeVsync) | Destroys an **OH_NativeVSync** instance.|
| [OH_NativeVSync_RequestFrame](_native_vsync.md#oh_nativevsync_requestframe)(OH_NativeVSync\*nativeVsync, OH_NativeVSync_FrameCallback callback, void \*data) | Requests the next VSync signal. When the signal arrives, a callback function is invoked.|