1# native_avcodec_audioencoder.h 2 3 4## Overview 5 6The **native_avcodec_audioencoder.h** file declares the native APIs used for audio encoding. 7 8**Library**: libnative_media_aenc.so 9 10**Since**: 9 11 12**Related module**: [AudioEncoder](_audio_encoder.md) 13 14 15## Summary 16 17 18### Functions 19 20| Name| Description| 21| -------- | -------- | 22| OH_AVCodec \* [OH_AudioEncoder_CreateByMime](_audio_encoder.md#oh_audioencoder_createbymime) (const char \*mime) | Creates an audio encoder instance based on a Multipurpose Internet Mail Extension (MIME) type.| 23| OH_AVCodec \* [OH_AudioEncoder_CreateByName](_audio_encoder.md#oh_audioencoder_createbyname) (const char \*name) | Creates an audio encoder instance based on an encoder name.| 24| [OH_AVErrCode](_core.md#oh_averrcode) [OH_AudioEncoder_Destroy](_audio_encoder.md#oh_audioencoder_destroy) (OH_AVCodec \*codec) | Clears the internal resources of an audio encoder and destroys the encoder instance.| 25| [OH_AVErrCode](_core.md#oh_averrcode) [OH_AudioEncoder_SetCallback](_audio_encoder.md#oh_audioencoder_setcallback) (OH_AVCodec \*codec, [OH_AVCodecAsyncCallback](_o_h___a_v_codec_async_callback.md) callback, void \*userData) | Sets an asynchronous callback so that your application can respond to events generated by an audio encoder.| 26| [OH_AVErrCode](_core.md#oh_averrcode) [OH_AudioEncoder_Configure](_audio_encoder.md#oh_audioencoder_configure) (OH_AVCodec \*codec, OH_AVFormat \*format) | Configures an audio encoder. Typically, you need to configure the description information about the audio track to be encoded.| 27| [OH_AVErrCode](_core.md#oh_averrcode) [OH_AudioEncoder_Prepare](_audio_encoder.md#oh_audioencoder_prepare) (OH_AVCodec \*codec) | Prepares internal resources for an audio encoder.| 28| [OH_AVErrCode](_core.md#oh_averrcode) [OH_AudioEncoder_Start](_audio_encoder.md#oh_audioencoder_start) (OH_AVCodec \*codec) | Starts an audio encoder after it is prepared successfully.| 29| [OH_AVErrCode](_core.md#oh_averrcode) [OH_AudioEncoder_Stop](_audio_encoder.md#oh_audioencoder_stop) (OH_AVCodec \*codec) | Stops an audio encoder.| 30| [OH_AVErrCode](_core.md#oh_averrcode) [OH_AudioEncoder_Flush](_audio_encoder.md#oh_audioencoder_flush) (OH_AVCodec \*codec) | Clears the input and output data in the internal buffer of an audio encoder.| 31| [OH_AVErrCode](_core.md#oh_averrcode) [OH_AudioEncoder_Reset](_audio_encoder.md#oh_audioencoder_reset) (OH_AVCodec \*codec) | Resets an audio encoder.| 32| OH_AVFormat \* [OH_AudioEncoder_GetOutputDescription](_audio_encoder.md#oh_audioencoder_getoutputdescription) (OH_AVCodec \*codec) | Obtains the description information about the output data of an audio encoder.| 33| [OH_AVErrCode](_core.md#oh_averrcode) [OH_AudioEncoder_SetParameter](_audio_encoder.md#oh_audioencoder_setparameter) (OH_AVCodec \*codec, OH_AVFormat \*format) | Sets dynamic parameters for an audio encoder.| 34| [OH_AVErrCode](_core.md#oh_averrcode) [OH_AudioEncoder_PushInputData](_audio_encoder.md#oh_audioencoder_pushinputdata) (OH_AVCodec \*codec, uint32_t index, [OH_AVCodecBufferAttr](_o_h___a_v_codec_buffer_attr.md) attr) | Pushes the input buffer filled with data to an audio encoder.| 35| [OH_AVErrCode](_core.md#oh_averrcode) [OH_AudioEncoder_FreeOutputData](_audio_encoder.md#oh_audioencoder_freeoutputdata) (OH_AVCodec \*codec, uint32_t index) | Frees an output buffer of an audio encoder.| 36| [OH_AVErrCode](_core.md#oh_averrcode) [OH_AudioEncoder_IsValid](_audio_encoder.md#oh_audioencoder_isvalid) (OH_AVCodec \*codec, bool \*isValid) | Checks whether an audio encoder instance is valid. This function is used to check the encoder validity when the background recovers from a fault or an application is switched from the background.| 37