harmony 鸿蒙native_avcodec_audiocodec.h

  • 2025-06-12
  • 浏览 (4)

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 the audio description. The audio codec is usually configured based on the audio description.
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 after it 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. The configured parameters and input and output data are cleared.
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) Notifies the audio codec that the input data has been written to the buffer identified by index.
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 detect the codec status when a background fault is rectified or an application is switched from the background.
OH_AVErrCode OH_AudioCodec_SetDecryptionConfig (OH_AVCodec *codec, MediaKeySession *mediaKeySession, bool secureAudio) Sets the decryption information.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙AVCodec Kit

harmony 鸿蒙AVCapability

harmony 鸿蒙AVDemuxer

harmony 鸿蒙AVMuxer

harmony 鸿蒙AVSource

harmony 鸿蒙AudioCodec

harmony 鸿蒙AudioDecoder

harmony 鸿蒙AudioEncoder

harmony 鸿蒙CodecBase

harmony 鸿蒙Core

0  赞