native_avcodec_audiodecoder.h

Overview

Declares the native APIs used for audio decoding.

Since: 9

Related Modules:

AudioDecoder

Summary

Functions

Name Description
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 (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_AVCodec *codec) Clears the internal resources of an audio decoder and destroys the audio decoder instance.
OH_AudioDecoder_SetCallback (OH_AVCodec *codec, OH_AVCodecAsyncCallback callback, void *userData) Sets an asynchronous callback so that your application can respond to events generated by an audio decoder. This API must be called prior to Prepare.
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_AVCodec *codec) Prepares internal resources for an audio decoder. This API must be called after Configure.
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 event.
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_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_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_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_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_AVCodec *codec, uint32_t index, OH_AVCodecBufferAttr attr) Pushes the input buffer filled with data to an audio decoder. The 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 callback. In addition, some decoders require the input of codec-specific data to initialize the decoding process.
OH_AudioDecoder_FreeOutputData (OH_AVCodec *codec, uint32_t index) Frees an output buffer of an audio decoder.