From 0c288761915b04033ee4b0244a42d83d42021ba5 Mon Sep 17 00:00:00 2001 From: Gloria Date: Thu, 8 Jun 2023 20:21:34 +0800 Subject: [PATCH] Update docs against 18990 Signed-off-by: wusongqing --- .../reference/native-apis/_audio_decoder.md | 169 ++++++------ .../reference/native-apis/_audio_encoder.md | 171 ++++++------ .../reference/native-apis/_codec_base.md | 256 +++++++++--------- .../reference/native-apis/_video_decoder.md | 190 ++++++------- .../reference/native-apis/_video_encoder.md | 197 +++++++------- 5 files changed, 489 insertions(+), 494 deletions(-) diff --git a/en/application-dev/reference/native-apis/_audio_decoder.md b/en/application-dev/reference/native-apis/_audio_decoder.md index 2e9139ac64..73487fa40d 100644 --- a/en/application-dev/reference/native-apis/_audio_decoder.md +++ b/en/application-dev/reference/native-apis/_audio_decoder.md @@ -3,42 +3,41 @@ ## Overview -Provides the functions for audio decoding. +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. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder -**Since:** +**Since** 9 - ## Summary ### Files -| Name | Description | + | Name| Description| | -------- | -------- | -| [native_avcodec_audiodecoder.h](native__avcodec__audiodecoder_8h.md) | Declares the native APIs used for audio decoding.
File to Include: | +| [native_avcodec_audiodecoder.h](native__avcodec__audiodecoder_8h.md) | Declares the native APIs used for audio decoding.
File to include: | ### Functions -| Name | Description | + | Name| Description| | -------- | -------- | -| [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. | -| [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. | -| [OH_AudioDecoder_Destroy](#oh_audiodecoder_destroy) (OH_AVCodec \*codec) | Clears the internal resources of an audio decoder and destroys the audio decoder instance. | -| [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**. | -| [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**. | -| [OH_AudioDecoder_Prepare](#oh_audiodecoder_prepare) (OH_AVCodec \*codec) | Prepares internal resources for an audio decoder. This API must be called after **Configure**. | -| [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. | -| [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. | -| [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. | -| [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. | -| [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. | -| [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. | -| [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. | -| [OH_AudioDecoder_FreeOutputData](#oh_audiodecoder_freeoutputdata) (OH_AVCodec \*codec, uint32_t index) | Frees an output buffer of an audio decoder. | +| [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. | +| [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. | +| [OH_AudioDecoder_Destroy](#oh_audiodecoder_destroy) (OH_AVCodec \*codec) | Clears the internal resources of an audio decoder and destroys the audio decoder instance. | +| [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**. | +| [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**. | +| [OH_AudioDecoder_Prepare](#oh_audiodecoder_prepare) (OH_AVCodec \*codec) | Prepares internal resources for an audio decoder. This API must be called after **Configure**. | +| [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. | +| [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. | +| [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. | +| [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. | +| [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. | +| [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. | +| [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. | +| [OH_AudioDecoder_FreeOutputData](#oh_audiodecoder_freeoutputdata) (OH_AVCodec \*codec, uint32_t index) | Frees an output buffer of an audio decoder. | ## Function Description @@ -53,14 +52,14 @@ OH_AVErrCode OH_AudioDecoder_Configure (OH_AVCodec * codec, OH_AVFormat * format **Description**
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**. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| format | Indicates the handle to an **OH_AVFormat** instance, which provides the attributes of the audio track to be decoded. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| format | Indicates the handle to an **OH_AVFormat** instance, which provides the attributes of the audio track to be decoded. | **Returns** @@ -76,15 +75,15 @@ Returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) if the op OH_AVCodec* OH_AudioDecoder_CreateByMime (const char * mime) ``` **Description**
-Creates an audio decoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This API is recommended in most cases. +Creates an audio decoder instance based on a MIME type. This API is recommended in most cases. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| mime | Indicates the pointer to a MIME type. For details, see [OH_AVCODEC_MIMETYPE_AUDIO_AAC](_codec_base.md#oh_avcodec_mimetype_audio_aac). | +| mime | Indicates the pointer to a MIME type. For details, see [OH_AVCODEC_MIMETYPE_AUDIO_AAC](_codec_base.md#oh_avcodec_mimetype_audio_aac).| **Returns** @@ -100,13 +99,13 @@ OH_AVCodec* OH_AudioDecoder_CreateByName (const char * name) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| name | Indicates the pointer to an audio decoder name. | +| name | Indicates the pointer to an audio decoder name. | **Returns** @@ -122,13 +121,13 @@ OH_AVErrCode OH_AudioDecoder_Destroy (OH_AVCodec * codec) **Description**
Clears the internal resources of an audio decoder and destroys the audio decoder instance. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -146,13 +145,13 @@ OH_AVErrCode OH_AudioDecoder_Flush (OH_AVCodec * codec) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -170,14 +169,14 @@ OH_AVErrCode OH_AudioDecoder_FreeOutputData (OH_AVCodec * codec, uint32_t index **Description**
Frees an output buffer of an audio decoder. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| index | Indicates the index of an output buffer. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| index | Indicates the index of an output buffer. | **Returns** @@ -195,13 +194,13 @@ OH_AVFormat* OH_AudioDecoder_GetOutputDescription (OH_AVCodec * codec) **Description**
Obtains the attributes of the output data of an audio decoder. The caller must manually release the **OH_AVFormat** instance in the return value. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -217,13 +216,13 @@ OH_AVErrCode OH_AudioDecoder_Prepare (OH_AVCodec * codec) **Description**
Prepares internal resources for an audio decoder. This API must be called after **Configure**. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -241,15 +240,15 @@ OH_AVErrCode OH_AudioDecoder_PushInputData (OH_AVCodec * codec, uint32_t index, **Description**
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. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| index | Indicates the index of an input buffer. | -| attr | Indicates the attributes of the data contained in the buffer. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| index | Indicates the index of an input buffer. | +| attr | Indicates the attributes of the data contained in the buffer. | **Returns** @@ -267,13 +266,13 @@ OH_AVErrCode OH_AudioDecoder_Reset (OH_AVCodec * codec) **Description**
Resets an audio decoder. To continue decoding, you must call **Configure** and **Start** to configure and start the decoder again. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -291,15 +290,15 @@ OH_AVErrCode OH_AudioDecoder_SetCallback (OH_AVCodec * codec, OH_AVCodecAsyncCal **Description**
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**. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the 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). | -| userData | Indicates the pointer to user-specific data. | +| codec | Indicates the 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).| +| userData | Indicates the pointer to user-specific data. | **Returns** @@ -317,14 +316,14 @@ OH_AVErrCode OH_AudioDecoder_SetParameter (OH_AVCodec * codec, OH_AVFormat * for **Description**
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. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| format | Indicates the handle to an **OH_AVFormat** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| format | Indicates the handle to an **OH_AVFormat** instance. | **Returns** @@ -342,13 +341,13 @@ OH_AVErrCode OH_AudioDecoder_Start (OH_AVCodec * codec) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -366,13 +365,13 @@ OH_AVErrCode OH_AudioDecoder_Stop (OH_AVCodec * codec) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.AudioDecoder +@syscap SystemCapability.Multimedia.Media.AudioDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** diff --git a/en/application-dev/reference/native-apis/_audio_encoder.md b/en/application-dev/reference/native-apis/_audio_encoder.md index 07a727f5b5..cf621c755c 100644 --- a/en/application-dev/reference/native-apis/_audio_encoder.md +++ b/en/application-dev/reference/native-apis/_audio_encoder.md @@ -3,42 +3,41 @@ ## Overview -Provides the functions for audio encoding. +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. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder -**Since:** +**Since** 9 - ## Summary ### Files -| Name | Description | + | Name| Description| | -------- | -------- | -| [native_avcodec_audioencoder.h](native__avcodec__audioencoder_8h.md) | Declares the native APIs used for audio encoding.
File to Include: | +| [native_avcodec_audioencoder.h](native__avcodec__audioencoder_8h.md) | Declares the native APIs used for audio encoding.
File to include: | ### 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. | -| [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. | -| [OH_AudioEncoder_Destroy](#oh_audioencoder_destroy) (OH_AVCodec \*codec) | Clears the internal resources of an audio encoder and destroys the audio 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**. | -| [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**. | -| [OH_AudioEncoder_Prepare](#oh_audioencoder_prepare) (OH_AVCodec \*codec) | Prepares internal resources for an audio encoder. This API 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. | -| [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. | -| [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. | -| [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. | -| [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. | -| [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. | -| [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 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. | -| [OH_AudioEncoder_FreeOutputData](#oh_audioencoder_freeoutputdata) (OH_AVCodec \*codec, uint32_t index) | Frees an output buffer of an audio encoder. | +| [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. | +| [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. | +| [OH_AudioEncoder_Destroy](#oh_audioencoder_destroy) (OH_AVCodec \*codec) | Clears the internal resources of an audio encoder and destroys the audio 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**. | +| [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**. | +| [OH_AudioEncoder_Prepare](#oh_audioencoder_prepare) (OH_AVCodec \*codec) | Prepares internal resources for an audio encoder. This API 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. | +| [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. | +| [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. | +| [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. | +| [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. | +| [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. | +| [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. | +| [OH_AudioEncoder_FreeOutputData](#oh_audioencoder_freeoutputdata) (OH_AVCodec \*codec, uint32_t index) | Frees an output buffer of an audio encoder. | ## Function Description @@ -53,14 +52,14 @@ OH_AVErrCode OH_AudioEncoder_Configure (OH_AVCodec * codec, OH_AVFormat * format **Description**
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**. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| format | Indicates the handle to an **OH_AVFormat** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| format | Indicates the handle to an **OH_AVFormat** instance. | **Returns** @@ -76,15 +75,15 @@ Returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) if the op OH_AVCodec* OH_AudioEncoder_CreateByMime (const char * mime) ``` **Description**
-Creates an audio encoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This API is recommended in most cases. +Creates an audio encoder instance based on a MIME type. This API is recommended in most cases. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| mime | Indicates the pointer to a MIME type. For details, see [OH_AVCODEC_MIMETYPE_AUDIO_AAC](_codec_base.md#oh_avcodec_mimetype_audio_aac). | +| mime | Indicates the pointer to a MIME type. For details, see [OH_AVCODEC_MIMETYPE_AUDIO_AAC](_codec_base.md#oh_avcodec_mimetype_audio_aac).| **Returns** @@ -100,13 +99,13 @@ OH_AVCodec* OH_AudioEncoder_CreateByName (const char * name) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| name | Indicates the pointer to an audio encoder name. | +| name | Indicates the pointer to an audio encoder name. | **Returns** @@ -122,13 +121,13 @@ OH_AVErrCode OH_AudioEncoder_Destroy (OH_AVCodec * codec) **Description**
Clears the internal resources of an audio encoder and destroys the audio encoder instance. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -146,13 +145,13 @@ OH_AVErrCode OH_AudioEncoder_Flush (OH_AVCodec * codec) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -170,14 +169,14 @@ OH_AVErrCode OH_AudioEncoder_FreeOutputData (OH_AVCodec * codec, uint32_t index **Description**
Frees an output buffer of an audio encoder. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| index | Indicates the index of an output buffer. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| index | Indicates the index of an output buffer. | **Returns** @@ -195,13 +194,13 @@ OH_AVFormat* OH_AudioEncoder_GetOutputDescription (OH_AVCodec * codec) **Description**
Obtains the attributes of the output data of an audio encoder. The caller must manually release the **OH_AVFormat** instance in the return value. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -217,13 +216,13 @@ OH_AVErrCode OH_AudioEncoder_Prepare (OH_AVCodec * codec) **Description**
Prepares internal resources for an audio encoder. This API must be called after **Configure**. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -239,17 +238,17 @@ Returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) if the op OH_AVErrCode OH_AudioEncoder_PushInputData (OH_AVCodec * codec, uint32_t index, OH_AVCodecBufferAttr attr ) ``` **Description**
-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. +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. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| index | Indicates the index of an input buffer. | -| attr | Indicates the attributes of the data contained in the buffer. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| index | Indicates the index of an input buffer. | +| attr | Indicates the attributes of the data contained in the buffer. | **Returns** @@ -267,13 +266,13 @@ OH_AVErrCode OH_AudioEncoder_Reset (OH_AVCodec * codec) **Description**
Resets an audio encoder. To continue encoding, you must call **Configure** and **Start** to configure and start the encoder again. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -291,15 +290,15 @@ OH_AVErrCode OH_AudioEncoder_SetCallback (OH_AVCodec * codec, OH_AVCodecAsyncCal **Description**
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**. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the 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). | -| userData | Indicates the pointer to user-specific data. | +| codec | Indicates the 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).| +| userData | Indicates the pointer to user-specific data. | **Returns** @@ -317,14 +316,14 @@ OH_AVErrCode OH_AudioEncoder_SetParameter (OH_AVCodec * codec, OH_AVFormat * for **Description**
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. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| format | Indicates the handle to an **OH_AVFormat** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| format | Indicates the handle to an **OH_AVFormat** instance. | **Returns** @@ -342,13 +341,13 @@ OH_AVErrCode OH_AudioEncoder_Start (OH_AVCodec * codec) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -366,13 +365,13 @@ OH_AVErrCode OH_AudioEncoder_Stop (OH_AVCodec * codec) **Description**
Stops an audio encoder. After the encoder is stopped, you can call **Start** to start it again. -\@syscap SystemCapability.Multimedia.Media.AudioEncoder +@syscap SystemCapability.Multimedia.Media.AudioEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** diff --git a/en/application-dev/reference/native-apis/_codec_base.md b/en/application-dev/reference/native-apis/_codec_base.md index c908c604e4..a1f4f21a70 100644 --- a/en/application-dev/reference/native-apis/_codec_base.md +++ b/en/application-dev/reference/native-apis/_codec_base.md @@ -3,86 +3,85 @@ ## Overview -Provides the common structs, character constants, and enums for running **OH_AVCodec** instances. +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. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase -**Since:** +**Since** 9 - ## Summary ### Files -| Name | Description | + | Name| Description| | -------- | -------- | -| [native_avcodec_base.h](native__avcodec__base_8h.md) | Declares the common structs, character constants, and enums for running **OH_AVCodec** instances.
File to Include: | +| [native_avcodec_base.h](native__avcodec__base_8h.md) | Declares the common structs, character constants, and enums for running OH_AVCodec instances.
File to include: | ### 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_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_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) | Defines the buffer attributes 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. | ### Types -| Name | Description | + | Name| Description| | -------- | -------- | -| [OH_AVCodecBufferFlags](#oh_avcodecbufferflags) | Enumerates the buffer flags of an **OH_AVCodec** instance. | -| [OH_AVCodecBufferAttr](#oh_avcodecbufferattr) | Defines the buffer attributes of an **OH_AVCodec** instance. | -| [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_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_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_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](_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_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_MediaType](#oh_mediatype) | Enumerates the media types. | -| [OH_AVCProfile](#oh_avcprofile) | Enumerates the AVC profiles. | -| [OH_AACProfile](#oh_aacprofile) | Enumerates the AAC profiles. | +| [OH_AVCodecBufferFlags](#oh_avcodecbufferflags) | Enumerates the buffer flags of an **OH_AVCodec** instance. | +| [OH_AVCodecBufferAttr](#oh_avcodecbufferattr) | Defines the buffer attributes of an **OH_AVCodec** instance. | +| (\*[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_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_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_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_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_MediaType](#oh_mediatype) | Enumerates the media types. | +| [OH_AVCProfile](#oh_avcprofile) | Enumerates the AVC profiles. | +| [OH_AACProfile](#oh_aacprofile) | Enumerates the AAC profiles. | ### Enums -| Name | Description | + | Name| Description| | -------- | -------- | -| [OH_AVCodecBufferFlags](#oh_avcodecbufferflags) {
**AVCODEC_BUFFER_FLAGS_NONE** = 0, AVCODEC_BUFFER_FLAGS_EOS = 1 << 0, AVCODEC_BUFFER_FLAGS_SYNC_FRAME = 1 << 1, AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME = 1 << 2,
AVCODEC_BUFFER_FLAGS_CODEC_DATA = 1 << 3
} | Enumerates the buffer flags of an **OH_AVCodec** instance. | -| [OH_MediaType](#oh_mediatype) { MEDIA_TYPE_AUD = 0, MEDIA_TYPE_VID = 1 } | Enumerates the media types. | -| [OH_AVCProfile](#oh_avcprofile) { **AVC_PROFILE_BASELINE** = 0, **AVC_PROFILE_HIGH** = 4, **AVC_PROFILE_MAIN** = 8 } | Enumerates the AVC profiles. | -| [OH_AACProfile](#oh_aacprofile) { **AAC_PROFILE_LC** = 0 } | Enumerates the AAC profiles. | +| [OH_AVCodecBufferFlags](#oh_avcodecbufferflags) {
**AVCODEC_BUFFER_FLAGS_NONE** = 0, **AVCODEC_BUFFER_FLAGS_EOS** = 1 << 0, **AVCODEC_BUFFER_FLAGS_SYNC_FRAME** = 1 << 1, **AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME** = 1 << 2, **AVCODEC_BUFFER_FLAGS_CODEC_DATA**= 1 << 3
} | Enumerates the buffer flags of an **OH_AVCodec** instance. | +| [OH_MediaType](#oh_mediatype) { **MEDIA_TYPE_AUD** = 0, **MEDIA_TYPE_VID** = 1 } | Enumerates the media types. | +| [OH_AVCProfile](#oh_avcprofile) { **AVC_PROFILE_BASELINE** = 0, **AVC_PROFILE_HIGH** = 4, **AVC_PROFILE_MAIN** = 8 } | Enumerates the Advanced Video Coding (AVC) profiles. | +| [OH_AACProfile](#oh_aacprofile) { **AAC_PROFILE_LC** = 0 } | Enumerates the Advanced Audio Coding (AAC) profiles. | ### Variables -| Name | Description | + | Name| Description| | -------- | -------- | -| [OH_AVCodecBufferAttr::pts](#pts) | Presentation timestamp of the buffer, in microseconds. | -| [OH_AVCodecBufferAttr::size](#size) | Size of the data contained in the buffer, in bytes. | -| [OH_AVCodecBufferAttr::offset](#offset) | Start offset of valid data in the buffer. | -| [OH_AVCodecBufferAttr::flags](#flags) | Buffer flag, which 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 Advanced Video Coding (AVC). | -| [OH_AVCODEC_MIMETYPE_AUDIO_AAC](#oh_avcodec_mimetype_audio_aac) | Defines the MIME type for Advanced Audio Coding (AAC). | -| [OH_ED_KEY_TIME_STAMP](#oh_ed_key_time_stamp) | Provides unified character descriptors for the auxiliary data of the surface buffer. | -| [OH_ED_KEY_EOS](#oh_ed_key_eos) | Character descriptor of the end-of-stream in the surface auxiliary data. The value type is bool. | -| [OH_MD_KEY_TRACK_TYPE](#oh_md_key_track_type) | Provides unified character descriptors for the media playback framework. | -| [OH_MD_KEY_CODEC_MIME](#oh_md_key_codec_mime) | Character descriptor of the MIME type. The value type is string. | -| [OH_MD_KEY_DURATION](#oh_md_key_duration) | Character descriptor of duration. The value type is int64_t. | -| [OH_MD_KEY_BITRATE](#oh_md_key_bitrate) | Character descriptor of the bit rate. The value type is uint32_t. | -| [OH_MD_KEY_MAX_INPUT_SIZE](#oh_md_key_max_input_size) | Character descriptor of the maximum input size. The value type is uint32_t. | -| [OH_MD_KEY_WIDTH](#oh_md_key_width) | Character descriptor of the video width. The value type is uint32_t. | -| [OH_MD_KEY_HEIGHT](#oh_md_key_height) | Character descriptor of the video height. The value type is uint32_t. | -| [OH_MD_KEY_PIXEL_FORMAT](#oh_md_key_pixel_format) | Character descriptor of the video pixel format. The value type is int32_t. For details, see [OH_AVPixelFormat](_core.md#oh_avpixelformat). | -| [OH_MD_KEY_AUDIO_SAMPLE_FORMAT](#oh_md_key_audio_sample_format) | Character descriptor of the audio sample format. The value type is uint32_t. | -| [OH_MD_KEY_FRAME_RATE](#oh_md_key_frame_rate) | Character descriptor of the video frame rate. The value type is double. | -| [OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE](#oh_md_key_video_encode_bitrate_mode) | 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_MD_KEY_PROFILE](#oh_md_key_profile) | 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_MD_KEY_AUD_CHANNEL_COUNT](#oh_md_key_aud_channel_count) | Character descriptor of the number of audio channels. The value type is uint32_t. | -| [OH_MD_KEY_AUD_SAMPLE_RATE](#oh_md_key_aud_sample_rate) | Character descriptor of the audio sampling rate. The value type is uint32_t. | -| [OH_MD_KEY_I_FRAME_INTERVAL](#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_MD_KEY_ROTATION](#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_AVCodecBufferAttr::pts](#pts) | Defines the presentation timestamp of the buffer, in microseconds. | +| [OH_AVCodecBufferAttr::size](#size) | Defines the size of the data contained in the buffer, in bytes. | +| [OH_AVCodecBufferAttr::offset](#offset) | Defines the start 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_AVCODEC_MIMETYPE_VIDEO_AVC](#oh_avcodec_mimetype_video_avc) | Defines the Multipurpose Internet Mail Extension (MIME) type for AVC. | +| [OH_AVCODEC_MIMETYPE_AUDIO_AAC](#oh_avcodec_mimetype_audio_aac) | Defines the MIME type for AAC. | +| [OH_ED_KEY_TIME_STAMP](#oh_ed_key_time_stamp) | Defines the unified character descriptors for the auxiliary data of the surface buffer. | +| [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_MD_KEY_TRACK_TYPE](#oh_md_key_track_type) | Defines the unified character descriptors for the media playback framework. | +| [OH_MD_KEY_CODEC_MIME](#oh_md_key_codec_mime) | Defines the character descriptor of the MIME type. The value type is string. | +| [OH_MD_KEY_DURATION](#oh_md_key_duration) | Defines the character descriptor of duration. The value type is int64_t. | +| [OH_MD_KEY_BITRATE](#oh_md_key_bitrate) | Defines the character descriptor of the bit rate. The value type is uint32_t. | +| [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_MD_KEY_WIDTH](#oh_md_key_width) | Defines the character descriptor of the video width. The value type is uint32_t. | +| [OH_MD_KEY_HEIGHT](#oh_md_key_height) | Defines the character descriptor of the video height. The value type is uint32_t. | +| [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_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_MD_KEY_FRAME_RATE](#oh_md_key_frame_rate) | Defines the character descriptor of the video frame rate. The value type is double. | +| [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_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_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_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_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_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. | ## Type Description @@ -97,7 +96,7 @@ typedef enum OH_AACProfileOH_AACProfile **Description**
Enumerates the AAC profiles. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase ### OH_AVCodecAsyncCallback @@ -109,16 +108,16 @@ typedef struct OH_AVCodecAsyncCallbackOH_AVCodecAsyncCallback **Description**
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. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| onError | Indicates the callback used to report errors occurred during the running of the instance. For details, see [OH_AVCodecOnError](#oh_avcodeconerror). | -| onStreamChanged | Indicates the callback used to report stream information. 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 | Indicates the callback used to report output data needed. For details, see [OH_AVCodecOnNewOutputData](#oh_avcodeconnewoutputdata). | +| onError | Indicates the callback used to report errors occurred during the running of the instance. For details, see [OH_AVCodecOnError](#oh_avcodeconerror).| +| onStreamChanged | Indicates the callback used to report stream information. 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 | Indicates the callback used to report output data needed. For details, see [OH_AVCodecOnNewOutputData](#oh_avcodeconnewoutputdata).| ### OH_AVCodecBufferAttr @@ -130,7 +129,7 @@ typedef struct OH_AVCodecBufferAttrOH_AVCodecBufferAttr **Description**
Defines the buffer attributes of an **OH_AVCodec** instance. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase ### OH_AVCodecBufferFlags @@ -142,7 +141,7 @@ typedef enum OH_AVCodecBufferFlagsOH_AVCodecBufferFlags **Description**
Enumerates the buffer flags of an **OH_AVCodec** instance. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase ### OH_AVCodecOnError @@ -154,15 +153,15 @@ typedef void(* OH_AVCodecOnError) (OH_AVCodec *codec, int32_t errorCode, void *u **Description**
Defines the function pointer that is called to report error information when an error occurs during the running of an **OH_AVCodec** instance. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| errorCode | Indicates an error code. | -| userData | Indicates the pointer to user-specific data. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| errorCode | Indicates an error code. | +| userData | Indicates the pointer to user-specific data. | ### OH_AVCodecOnNeedInputData @@ -174,16 +173,16 @@ typedef void(* OH_AVCodecOnNeedInputData) (OH_AVCodec *codec, uint32_t index, OH **Description**
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. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| index | Indicates the index of an input buffer. | -| data | Indicates the pointer to the new input data. | -| userData | Indicates the pointer to user-specific data. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| index | Indicates the index of an input buffer. | +| data | Indicates the pointer to the new input data. | +| userData | Indicates the pointer to user-specific data. | ### OH_AVCodecOnNewOutputData @@ -193,20 +192,19 @@ Defines the function pointer that is called, with a new buffer to fill in new in typedef void(* OH_AVCodecOnNewOutputData) (OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, OH_AVCodecBufferAttr *attr, void *userData) ``` **Description**
-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. +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. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| index | Indicates the index of a new output buffer. | -| data | Indicates the pointer to the new output data. | -| 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). | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| index | Indicates the index of a new output buffer. | +| data | Indicates the pointer to the new output data. | +| 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).| | userData | Indicates the pointer to user-specific data. | -| userData | specified data | ### OH_AVCodecOnStreamChanged @@ -218,15 +216,15 @@ typedef void(* OH_AVCodecOnStreamChanged) (OH_AVCodec *codec, OH_AVFormat *forma **Description**
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. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| format | Indicates the handle to the attributes of the new output stream. | -| userData | Indicates the pointer to user-specific data. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| format | Indicates the handle to the attributes of the new output stream. | +| userData | Indicates the pointer to user-specific data. | ### OH_AVCProfile @@ -238,7 +236,7 @@ typedef enum OH_AVCProfileOH_AVCProfile **Description**
Enumerates the AVC profiles. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase ### OH_MediaType @@ -250,7 +248,7 @@ typedef enum OH_MediaTypeOH_MediaType **Description**
Enumerates the media types. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase ## Enum Description @@ -265,7 +263,7 @@ enum OH_AACProfile **Description**
Enumerates the AAC profiles. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase ### OH_AVCodecBufferFlags @@ -277,14 +275,14 @@ enum OH_AVCodecBufferFlags **Description**
Enumerates the buffer flags of an **OH_AVCodec** instance. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase -| Name | Description | + | Value| Description| | -------- | -------- | -| AVCODEC_BUFFER_FLAGS_EOS | The buffer contains an end-of-stream frame. | -| AVCODEC_BUFFER_FLAGS_SYNC_FRAME | The buffer contains a sync frame. | -| AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME | The buffer contains part of a frame. | -| AVCODEC_BUFFER_FLAGS_CODEC_DATA | The buffer contains codec-specific data. | +| AVCODEC_BUFFER_FLAGS_EOS | The buffer contains an end-of-stream frame.| +| AVCODEC_BUFFER_FLAGS_SYNC_FRAME | The buffer contains a sync frame.| +| AVCODEC_BUFFER_FLAGS_INCOMPLETE_FRAME | The buffer contains part of a frame.| +| AVCODEC_BUFFER_FLAGS_CODEC_DATA | The buffer contains codec-specific data.| ### OH_AVCProfile @@ -296,7 +294,7 @@ enum OH_AVCProfile **Description**
Enumerates the AVC profiles. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase ### OH_MediaType @@ -308,12 +306,12 @@ enum OH_MediaType **Description**
Enumerates the media types. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase -| Name | Description | + | Value| Description| | -------- | -------- | -| MEDIA_TYPE_AUD | Audio track. | -| MEDIA_TYPE_VID | Video track. | +| MEDIA_TYPE_AUD | Audio track.| +| MEDIA_TYPE_VID | Video track.| ## Variable Description @@ -326,7 +324,7 @@ Enumerates the media types. uint32_t OH_AVCodecBufferAttr::flags ``` **Description**
-Buffer flag, which is a combination of multiple [OH_AVCodecBufferFlags](#oh_avcodecbufferflags). +Defines a buffer flag, which is a combination of multiple [OH_AVCodecBufferFlags](#oh_avcodecbufferflags). ### offset @@ -346,9 +344,9 @@ Start offset of valid data in the buffer. const char* OH_AVCODEC_MIMETYPE_AUDIO_AAC ``` **Description**
-Defines the MIME type for Advanced Audio Coding (AAC). +Defines the MIME type for AAC. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase ### OH_AVCODEC_MIMETYPE_VIDEO_AVC @@ -358,9 +356,9 @@ Defines the MIME type for Advanced Audio Coding (AAC). const char* OH_AVCODEC_MIMETYPE_VIDEO_AVC ``` **Description**
-Defines the Multipurpose Internet Mail Extension (MIME) type for Advanced Video Coding (AVC). +Defines the MIME type for AVC. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase ### OH_ED_KEY_EOS @@ -370,7 +368,7 @@ Defines the Multipurpose Internet Mail Extension (MIME) type for Advanced Video const char* OH_ED_KEY_EOS ``` **Description**
-Character descriptor of the end-of-stream in the surface auxiliary data. The value type is bool. +Defines the character descriptor of the end-of-stream in the surface auxiliary data. The value type is bool. ### OH_ED_KEY_TIME_STAMP @@ -380,9 +378,9 @@ Character descriptor of the end-of-stream in the surface auxiliary data. The val const char* OH_ED_KEY_TIME_STAMP ``` **Description**
-Provides unified character descriptors for the auxiliary data of the surface buffer. +Defines the unified character descriptors for the auxiliary data of the surface buffer. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase ### OH_MD_KEY_AUD_CHANNEL_COUNT @@ -392,7 +390,7 @@ Provides unified character descriptors for the auxiliary data of the surface buf const char* OH_MD_KEY_AUD_CHANNEL_COUNT ``` **Description**
-Character descriptor of the number of audio channels. The value type is uint32_t. +Defines the character descriptor of the number of audio channels. The value type is uint32_t. ### OH_MD_KEY_AUD_SAMPLE_RATE @@ -402,7 +400,7 @@ Character descriptor of the number of audio channels. The value type is uint32_t const char* OH_MD_KEY_AUD_SAMPLE_RATE ``` **Description**
-Character descriptor of the audio sampling rate. The value type is uint32_t. +Defines the character descriptor of the audio sampling rate. The value type is uint32_t. ### OH_MD_KEY_AUDIO_SAMPLE_FORMAT @@ -412,7 +410,7 @@ Character descriptor of the audio sampling rate. The value type is uint32_t. const char* OH_MD_KEY_AUDIO_SAMPLE_FORMAT ``` **Description**
-Character descriptor of the audio sample format. The value type is uint32_t. +Defines the character descriptor of the audio sample format. The value type is uint32_t. ### OH_MD_KEY_BITRATE @@ -422,7 +420,7 @@ Character descriptor of the audio sample format. The value type is uint32_t. const char* OH_MD_KEY_BITRATE ``` **Description**
-Character descriptor of the bit rate. The value type is uint32_t. +Defines the character descriptor of the bit rate. The value type is uint32_t. ### OH_MD_KEY_CODEC_MIME @@ -432,7 +430,7 @@ Character descriptor of the bit rate. The value type is uint32_t. const char* OH_MD_KEY_CODEC_MIME ``` **Description**
-Character descriptor of the MIME type. The value type is string. +Defines the character descriptor of the MIME type. The value type is string. ### OH_MD_KEY_DURATION @@ -442,7 +440,7 @@ Character descriptor of the MIME type. The value type is string. const char* OH_MD_KEY_DURATION ``` **Description**
-Character descriptor of duration. The value type is int64_t. +Defines the character descriptor of duration. The value type is int64_t. ### OH_MD_KEY_FRAME_RATE @@ -452,7 +450,7 @@ Character descriptor of duration. The value type is int64_t. const char* OH_MD_KEY_FRAME_RATE ``` **Description**
-Character descriptor of the video frame rate. The value type is double. +Defines the character descriptor of the video frame rate. The value type is double. ### OH_MD_KEY_HEIGHT @@ -462,7 +460,7 @@ Character descriptor of the video frame rate. The value type is double. const char* OH_MD_KEY_HEIGHT ``` **Description**
-Character descriptor of the video height. The value type is uint32_t. +Defines the character descriptor of the video height. The value type is uint32_t. ### OH_MD_KEY_I_FRAME_INTERVAL @@ -472,7 +470,7 @@ Character descriptor of the video height. The value type is uint32_t. const char* OH_MD_KEY_I_FRAME_INTERVAL ``` **Description**
-Character descriptor of the I-frame interval. The value type is int32_t, and the unit is ms. +Defines the character descriptor of the I-frame interval. The value type is int32_t, and the unit is ms. ### OH_MD_KEY_MAX_INPUT_SIZE @@ -482,7 +480,7 @@ Character descriptor of the I-frame interval. The value type is int32_t, and the const char* OH_MD_KEY_MAX_INPUT_SIZE ``` **Description**
-Character descriptor of the maximum input size. The value type is uint32_t. +Defines the character descriptor of the maximum input size. The value type is uint32_t. ### OH_MD_KEY_PIXEL_FORMAT @@ -492,7 +490,7 @@ Character descriptor of the maximum input size. The value type is uint32_t. const char* OH_MD_KEY_PIXEL_FORMAT ``` **Description**
-Character descriptor of the video pixel format. The value type is int32_t. For details, see [OH_AVPixelFormat](_core.md#oh_avpixelformat). +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_MD_KEY_PROFILE @@ -502,7 +500,7 @@ Character descriptor of the video pixel format. The value type is int32_t. For d const char* OH_MD_KEY_PROFILE ``` **Description**
-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). +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_MD_KEY_ROTATION @@ -512,7 +510,7 @@ Character descriptor of the audio/video encoding capability. The value type is i const char* OH_MD_KEY_ROTATION ``` **Description**
-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. +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_TRACK_TYPE @@ -522,9 +520,9 @@ Character descriptor of the surface rotation angle. The value type is int32_t. T const char* OH_MD_KEY_TRACK_TYPE ``` **Description**
-Provides unified character descriptors for the media playback framework. +Defines the unified character descriptors for the media playback framework. -\@syscap SystemCapability.Multimedia.Media.CodecBase +@syscap SystemCapability.Multimedia.Media.CodecBase ### OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE @@ -534,7 +532,7 @@ Provides unified character descriptors for the media playback framework. const char* OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE ``` **Description**
-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). +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_MD_KEY_WIDTH @@ -544,7 +542,7 @@ Character descriptor of the video encoding bit rate mode. The value type is int3 const char* OH_MD_KEY_WIDTH ``` **Description**
-Character descriptor of the video width. The value type is uint32_t. +Defines the character descriptor of the video width. The value type is uint32_t. ### pts @@ -554,7 +552,7 @@ Character descriptor of the video width. The value type is uint32_t. int64_t OH_AVCodecBufferAttr::pts ``` **Description**
-Presentation timestamp of the buffer, in microseconds. +Defines the presentation timestamp of the buffer, in microseconds. ### size @@ -564,4 +562,4 @@ Presentation timestamp of the buffer, in microseconds. int32_t OH_AVCodecBufferAttr::size ``` **Description**
-Size of the data contained in the buffer, in bytes. +Defines the size of the data contained in the buffer, in bytes. diff --git a/en/application-dev/reference/native-apis/_video_decoder.md b/en/application-dev/reference/native-apis/_video_decoder.md index 23fcefb0c6..c56dd9bfcb 100644 --- a/en/application-dev/reference/native-apis/_video_decoder.md +++ b/en/application-dev/reference/native-apis/_video_decoder.md @@ -3,11 +3,11 @@ ## Overview -Provides the functions for video decoding. +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. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder -**Since:** +**Since** 9 @@ -16,31 +16,31 @@ Provides the functions for video decoding. ### Files -| Name | Description | + | Name| Description| | -------- | -------- | -| [native_avcodec_videodecoder.h](native__avcodec__videodecoder_8h.md) | Declares the native APIs used for video decoding.
File to Include: | +| [native_avcodec_videodecoder.h](native__avcodec__videodecoder_8h.md) | Declares the native APIs used for video decoding.
File to include: | ### 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_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_Destroy](#oh_videodecoder_destroy) (OH_AVCodec \*codec) | Clears the internal resources of a video decoder and destroys the video 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_SetSurface](#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_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_Prepare](#oh_videodecoder_prepare) (OH_AVCodec \*codec) | Prepares internal resources for a video decoder. This API 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_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_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_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_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_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_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_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_FreeOutputData](#oh_videodecoder_freeoutputdata) (OH_AVCodec \*codec, uint32_t index) | Frees an output buffer of a video decoder. | +| [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_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_Destroy](#oh_videodecoder_destroy) (OH_AVCodec \*codec) | Clears the internal resources of a video decoder and destroys the video 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_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_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_Prepare](#oh_videodecoder_prepare) (OH_AVCodec \*codec) | Prepares internal resources for a video decoder. This API 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_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_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_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_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_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_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_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_FreeOutputData](#oh_videodecoder_freeoutputdata) (OH_AVCodec \*codec, uint32_t index) | Frees an output buffer of a video decoder. | ## Function Description @@ -55,14 +55,14 @@ OH_AVErrCode OH_VideoDecoder_Configure (OH_AVCodec * codec, OH_AVFormat * format **Description**
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**. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| format | Indicates the handle to an **OH_AVFormat** instance, which provides the attributes of the video track to be decoded. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| format | Indicates the handle to an **OH_AVFormat** instance, which provides the attributes of the video track to be decoded. | **Returns** @@ -80,13 +80,13 @@ OH_AVCodec* OH_VideoDecoder_CreateByMime (const char * mime) **Description**
Creates a video decoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This API is recommended in most cases. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| 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 | Indicates the pointer to a MIME type. For details, see [OH_AVCODEC_MIMETYPE_VIDEO_AVC](_codec_base.md#oh_avcodec_mimetype_video_avc).| **Returns** @@ -102,13 +102,13 @@ OH_AVCodec* OH_VideoDecoder_CreateByName (const char * name) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| name | Indicates the pointer to a video decoder name. | +| name | Indicates the pointer to a video decoder name. | **Returns** @@ -124,13 +124,13 @@ OH_AVErrCode OH_VideoDecoder_Destroy (OH_AVCodec * codec) **Description**
Clears the internal resources of a video decoder and destroys the video decoder instance. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -148,13 +148,13 @@ OH_AVErrCode OH_VideoDecoder_Flush (OH_AVCodec * codec) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -172,14 +172,14 @@ OH_AVErrCode OH_VideoDecoder_FreeOutputData (OH_AVCodec * codec, uint32_t index **Description**
Frees an output buffer of a video decoder. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| index | Indicates the index of an output buffer. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| index | Indicates the index of an output buffer. | **Returns** @@ -197,13 +197,13 @@ OH_AVFormat* OH_VideoDecoder_GetOutputDescription (OH_AVCodec * codec) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -219,13 +219,13 @@ OH_AVErrCode OH_VideoDecoder_Prepare (OH_AVCodec * codec) **Description**
Prepares internal resources for a video decoder. This API must be called after **Configure**. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -243,15 +243,15 @@ OH_AVErrCode OH_VideoDecoder_PushInputData (OH_AVCodec * codec, uint32_t index, **Description**
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. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| index | Indicates the index of an input buffer. | -| attr | Indicates the attributes of the data contained in the buffer. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| index | Indicates the index of an input buffer. | +| attr | Indicates the attributes of the data contained in the buffer. | **Returns** @@ -269,14 +269,14 @@ OH_AVErrCode OH_VideoDecoder_RenderOutputData (OH_AVCodec * codec, uint32_t inde **Description**
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. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| index | Indicates the index of an output buffer. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| index | Indicates the index of an output buffer. | **Returns** @@ -294,13 +294,13 @@ OH_AVErrCode OH_VideoDecoder_Reset (OH_AVCodec * codec) **Description**
Resets a video decoder. To continue decoding, you must call **Configure** and **Start** to configure and start the decoder again. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -318,15 +318,15 @@ OH_AVErrCode OH_VideoDecoder_SetCallback (OH_AVCodec * codec, OH_AVCodecAsyncCal **Description**
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**. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the 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). | -| userData | Indicates the pointer to user-specific data. | +| codec | Indicates the 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).| +| userData | Indicates the pointer to user-specific data. | **Returns** @@ -344,14 +344,14 @@ OH_AVErrCode OH_VideoDecoder_SetParameter (OH_AVCodec * codec, OH_AVFormat * for **Description**
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. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| format | Indicates the handle to an **OH_AVFormat** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| format | Indicates the pointer to an **OH_AVFormat** instance. | **Returns** @@ -369,14 +369,14 @@ OH_AVErrCode OH_VideoDecoder_SetSurface (OH_AVCodec * codec, OHNativeWindow * wi **Description**
Sets an output surface for a video decoder. This API must be called prior to **Prepare**. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| window | Indicates the pointer to an **OHNativeWindow** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| window | Indicates the pointer to an **OHNativeWindow** instance. | **Returns** @@ -394,13 +394,13 @@ OH_AVErrCode OH_VideoDecoder_Start (OH_AVCodec * codec) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -418,13 +418,13 @@ OH_AVErrCode OH_VideoDecoder_Stop (OH_AVCodec * codec) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.VideoDecoder +@syscap SystemCapability.Multimedia.Media.VideoDecoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** diff --git a/en/application-dev/reference/native-apis/_video_encoder.md b/en/application-dev/reference/native-apis/_video_encoder.md index c28d758c41..736adcdf7e 100644 --- a/en/application-dev/reference/native-apis/_video_encoder.md +++ b/en/application-dev/reference/native-apis/_video_encoder.md @@ -3,57 +3,56 @@ ## Overview -Provides the functions and enums for video encoding. +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. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder -**Since:** +**Since** 9 - ## Summary ### Files -| Name | Description | + | Name| Description| | -------- | -------- | -| [native_avcodec_videoencoder.h](native__avcodec__videoencoder_8h.md) | Declares the native APIs used for video encoding.
File to Include: | +| [native_avcodec_videoencoder.h](native__avcodec__videoencoder_8h.md) | Declares the native APIs used for video encoding.
File to include: | ### Types -| Name | Description | + | Name| Description| | -------- | -------- | -| [OH_VideoEncodeBitrateMode](#oh_videoencodebitratemode) | Enumerates the bit rate modes of video encoding. | +| [OH_VideoEncodeBitrateMode](#oh_videoencodebitratemode) | Enumerates the bit rate modes of video encoding. | ### 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 video encoding. | ### 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_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_Destroy](#oh_videoencoder_destroy) (OH_AVCodec \*codec) | Clears the internal resources of a video encoder and destroys the video 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_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_Prepare](#oh_videoencoder_prepare) (OH_AVCodec \*codec) | Prepares internal resources for a video encoder. This API 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_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_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_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_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_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_GetSurface](#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_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_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_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_Destroy](#oh_videoencoder_destroy) (OH_AVCodec \*codec) | Clears the internal resources of a video encoder and destroys the video 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_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_Prepare](#oh_videoencoder_prepare) (OH_AVCodec \*codec) | Prepares internal resources for a video encoder. This API 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_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_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_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_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_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_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_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. | ## Type Description @@ -68,7 +67,7 @@ typedef enum OH_VideoEncodeBitrateModeOH_VideoEncodeBitrateMode **Description**
Enumerates the bit rate modes of video encoding. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder ## Enum Description @@ -83,13 +82,13 @@ enum OH_VideoEncodeBitrateMode **Description**
Enumerates the bit rate modes of video encoding. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder -| Name | Description | + | Value| Description| | -------- | -------- | -| CBR | Constant bit rate. | -| VBR | Variable bit rate. | -| CQ | Constant quality. | +| CBR | Constant bit rate.| +| VBR | Variable bit rate.| +| CQ | Constant quality.| ## Function Description @@ -104,14 +103,14 @@ OH_AVErrCode OH_VideoEncoder_Configure (OH_AVCodec * codec, OH_AVFormat * format **Description**
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**. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| format | Indicates the handle to an **OH_AVFormat** instance, which provides the attributes of the video track to be encoded. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| format | Indicates the handle to an **OH_AVFormat** instance, which provides the attributes of the video track to be encoded. | **Returns** @@ -127,15 +126,15 @@ Returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) if the op OH_AVCodec* OH_VideoEncoder_CreateByMime (const char * mime) ``` **Description**
-Creates a video encoder instance based on a Multipurpose Internet Mail Extension (MIME) type. This API is recommended in most cases. +Creates a video encoder instance based on a MIME type. This API is recommended in most cases. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| 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 | Indicates the pointer to a MIME type. For details, see [OH_AVCODEC_MIMETYPE_VIDEO_AVC](_codec_base.md#oh_avcodec_mimetype_video_avc).| **Returns** @@ -151,13 +150,13 @@ OH_AVCodec* OH_VideoEncoder_CreateByName (const char * name) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| name | Indicates the pointer to a video encoder name. | +| name | Indicates the pointer to a video encoder name. | **Returns** @@ -173,13 +172,13 @@ OH_AVErrCode OH_VideoEncoder_Destroy (OH_AVCodec * codec) **Description**
Clears the internal resources of a video encoder and destroys the video encoder instance. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -197,13 +196,13 @@ OH_AVErrCode OH_VideoEncoder_Flush (OH_AVCodec * codec) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -221,14 +220,14 @@ OH_AVErrCode OH_VideoEncoder_FreeOutputData (OH_AVCodec * codec, uint32_t index **Description**
Frees an output buffer of a video encoder. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| index | Indicates the index of an output buffer. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| index | Indicates the index of an output buffer. | **Returns** @@ -246,13 +245,13 @@ OH_AVFormat* OH_VideoEncoder_GetOutputDescription (OH_AVCodec * codec) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -268,14 +267,14 @@ OH_AVErrCode OH_VideoEncoder_GetSurface (OH_AVCodec * codec, OHNativeWindow ** w **Description**
Obtains an input surface from a video encoder. This API must be called prior to **Prepare**. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| window | Indicates the double pointer to an **OHNativeWindow** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| window | Indicates the double pointer to an **OHNativeWindow** instance. | **Returns** @@ -293,13 +292,13 @@ OH_AVErrCode OH_VideoEncoder_NotifyEndOfStream (OH_AVCodec * codec) **Description**
Notifies a video encoder that input streams end. This API is recommended in surface mode. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -317,13 +316,13 @@ OH_AVErrCode OH_VideoEncoder_Prepare (OH_AVCodec * codec) **Description**
Prepares internal resources for a video encoder. This API must be called after **Configure**. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -341,13 +340,13 @@ OH_AVErrCode OH_VideoEncoder_Reset (OH_AVCodec * codec) **Description**
Resets a video encoder. To continue encoding, you must call **Configure** and **Start** to configure and start the encoder again. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -365,15 +364,15 @@ OH_AVErrCode OH_VideoEncoder_SetCallback (OH_AVCodec * codec, OH_AVCodecAsyncCal **Description**
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**. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the 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). | -| userData | Indicates the pointer to user-specific data. | +| codec | Indicates the 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).| +| userData | Indicates the pointer to user-specific data. | **Returns** @@ -391,14 +390,14 @@ OH_AVErrCode OH_VideoEncoder_SetParameter (OH_AVCodec * codec, OH_AVFormat * for **Description**
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. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | -| format | Indicates the handle to an **OH_AVFormat** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| format | Indicates the handle to an **OH_AVFormat** instance. | **Returns** @@ -416,13 +415,13 @@ OH_AVErrCode OH_VideoEncoder_Start (OH_AVCodec * codec) **Description**
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. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** @@ -440,13 +439,13 @@ OH_AVErrCode OH_VideoEncoder_Stop (OH_AVCodec * codec) **Description**
Stops a video encoder. After the encoder is stopped, you can call **Start** to start it again. -\@syscap SystemCapability.Multimedia.Media.VideoEncoder +@syscap SystemCapability.Multimedia.Media.VideoEncoder - **Parameters** +**Parameters** -| Name | Description | + | Name| Description| | -------- | -------- | -| codec | Indicates the pointer to an **OH_AVCodec** instance. | +| codec | Indicates the pointer to an **OH_AVCodec** instance. | **Returns** -- GitLab