native_avcodec_audiocodec.h

Overview

The native_avcodec_audiocodec.h file declares the native APIs used for audio encoding and decoding.

Library: libnative_media_acodec.so

Since: 11

Related module: AudioCodec

Summary

Functions

Name Description
OH_AVCodec * OH_AudioCodec_CreateByMime (const char *mime, bool isEncoder) Creates an audio codec instance based on a Multipurpose Internet Mail Extension (MIME) type.
OH_AVCodec * OH_AudioCodec_CreateByName (const char *name) Creates an audio codec instance based on a codec name.
OH_AVErrCode OH_AudioCodec_Destroy (OH_AVCodec *codec) Clears the internal resources of an audio codec and destroys the codec instance.
OH_AVErrCode OH_AudioCodec_RegisterCallback (OH_AVCodec *codec, OH_AVCodecCallback callback, void *userData) Sets an asynchronous callback so that your application can respond to events generated by an audio codec. This function must be called prior to Prepare.
OH_AVErrCode OH_AudioCodec_Configure (OH_AVCodec *codec, const OH_AVFormat *format) Configures an audio codec. Typically, you need to configure the audio description information.
OH_AVErrCode OH_AudioCodec_Prepare (OH_AVCodec *codec) Prepares internal resources for an audio codec.
OH_AVErrCode OH_AudioCodec_Start (OH_AVCodec *codec) Starts an audio codec. This function can be called only after the codec is prepared successfully.
OH_AVErrCode OH_AudioCodec_Stop (OH_AVCodec *codec) Stops an audio codec.
OH_AVErrCode OH_AudioCodec_Flush (OH_AVCodec *codec) Clears the input and output data in the internal buffer of an audio codec.
OH_AVErrCode OH_AudioCodec_Reset (OH_AVCodec *codec) Resets an audio codec. To continue encoding or decoding, you must call Configure to configure the codec again.
OH_AVFormat * OH_AudioCodec_GetOutputDescription (OH_AVCodec *codec) Obtains the description information about the output data of an audio codec.
OH_AVErrCode OH_AudioCodec_SetParameter (OH_AVCodec *codec, const OH_AVFormat *format) Sets dynamic parameters for an audio codec.
OH_AVErrCode OH_AudioCodec_PushInputBuffer (OH_AVCodec *codec, uint32_t index) Pushes the input buffer filled with data to an audio codec.
OH_AVErrCode OH_AudioCodec_FreeOutputBuffer (OH_AVCodec *codec, uint32_t index) Frees an output buffer of an audio codec.
OH_AVErrCode OH_AudioCodec_IsValid (OH_AVCodec *codec, bool *isValid) Checks whether an audio codec instance is valid. This function is used to check the codec validity when the background recovers from a fault or an application is switched from the background.