Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
FileName |
Description |
|---|---|
dmsdp_audio_encoder_api.h |
Contains southbound audio encoder APIs. |
The DMSDPGetAudioEncoderHandler method obtains the functions of the audio decoder, and stores them in the DMSDPAudioEncoderHandler structure.
Format: int32_t DMSDPGetAudioEncoderHandler(DMSDPAudioEncoderHandler* audioEncoderHandler)
Parameter: [in] na [out] audioEncoderHandler
Output: The value 0 indicates success and negative values indicate failure.
Description: Obtains the functions of the audio encoder, and stores them in the DMSDPAudioEncoderHandler structure.
Type |
Method |
|---|---|
int32_t |
(*AudioEncoderGetAbility)( AEncAbility* audioEncAbility, int32_t maxEncNum, int* audioEncCnt) Obtains the audio encoder capability of a device. The specific parameters are stored in the audioEncAbility structure. If audioEncCnt supports multiple audio encoders, multiple encoders are returned. |
int32_t |
(*AudioEncoderCreate)( AEncHandle* handle, AEncInitParams* initEncParams) Creates an audio encoder based on initialization parameters. handle indicates the handle of the decoder, and initEncParams indicates the set of initialization parameters of the encoder. |
int32_t |
(*AudioEncoderConfigure)( AEncHandle handle, AEncCfgParams* cfgEncParams) Configures the encoder according to the configuration parameters. handle indicates the handle of the encoder, and cfgEncParams indicates the set of the configuration parameters of the encoder. |
int32_t |
(*AudioEncoderProcess)( AEncHandle handle, AEncInputData* inputData, AEncOutputData* outputData) Compresses the input audio data based on the configurations of the audio encoder, and outputs compressed streams. handle indicates the handle of the encoder, inputData indicates the audio data to be encoded, and outputData indicates the output stream and parameter set. |
int32_t |
(*AudioEncoderDestroy)( AEncHandle* handle) Destroys an audio encoder. |
Method |
|---|
int32_t (*AudioEncoderGetAbility)( AEncAbility *audioEncAbility, int32_t maxEncNum, int *audioEncCnt) Obtains the audio encoder capability of a device. The specific parameters are stored in the audioEncAbility structure. If audioEncCnt supports multiple audio encoders, multiple encoders are returned. |
Parameters
Name |
Description |
|---|---|
audioEncAbility |
Audio encoding capability. typedef struct { /* Encoder type. 0: AAC; 1: G.711A. Currently, AAC LC is supported. */ int32_t codecType; /* Maximum number of audio channels. Currently, the maximum value is 2. */ int32_t maxChannel; /* Minimum number of audio channels. Currently, the minimum value is 1. */ int32_t minChannel; /* Maximum sampling rate. Currently, the maximum supported sampling rate is 48 KHz. */ int32_t maxSampleRate; /* Minimum sampling rate. Currently, the minimum sampling rate is 8 KHz. */ int32_t minSampleRate; /* Maximum sampling precision. Currently, the supported value is 16 bits. */ int32_t maxSampleDepth; /* Minimum sampling precision. Currently, the supported value is 16 bits. */ int32_t minSampleDepth; /* Storage type of the mask type. bit0: interleaved storage; bit1: plane storage. Currently, only interleaved storage is supported. */ int32_t pcmStoreTypeMask; /* Maximum number of encoders that can be created at the same time */ int32_t maxCodecNum; /* Whether asynchronous output is supported. If yes, output the result using the registered callback function. */ bool isAsynOutput; } AEncAbility; |
audioEncCnt |
Number of supported encoders. |
maxEncNum |
Maximum number of supported encoders. |
Return
Type |
Description |
|---|---|
int32_t |
0: Success; <0: Failure. |
Method |
|---|
int32_t (*AudioEncoderCreate)( AEncHandle *handle, AEncInitParams *initEncParams) Creates an audio encoder based on initialization parameters. handle indicates the handle of the decoder, and initEncParams indicates the set of initialization parameters of the encoder. |
Parameters
Name |
Description |
|---|---|
handle |
Creates an encoder handle. |
initEncParams |
Encoder initialization parameter set. typedef void (*AEncOutputDataCB)(AEncOutputData *outputDataEnc, void *privateData); typedef struct { /* Encoder type. 0: AAC; 1: G.711A. Currently, AAC LC is supported. */ int32_t codecType; /* Number of audio channels */ int32_t channel; /* Sampling rate */ int32_t sampleRate; /* Sampling precision */ int32_t sampleDepth; /* PCM storage type. 0: interleaved storage; 1: plane storage. Currently, only interleaved storage is supported. */ int32_t pcmStoreType; /* Private data, which is transparently transmitted by using the pfnOutput callback function. */ void *privateData; /* Output callback. If the value is not null, it is output through callback. Otherwise, the output is synchronous. */ AEncOutputDataCB pfnOutput; } AEncInitParams; |
Return
Type |
Description |
|---|---|
int32_t |
0: Success; <0: Failure. |
Method |
|---|
int32_t (*AudioEncoderConfigure)( AEncHandle handle, AEncCfgParams *cfgEncParams) Configures the encoder according to the configuration parameters. handle indicates the handle of the encoder, and cfgEncParams indicates the set of the configuration parameters of the encoder. |
Parameters
Name |
Description |
|---|---|
handle |
Encoder handle. |
cfgEncParams |
Encoder configuration parameter set. AEncCfgParams *cfgEncParams typedef struct { /* Bit rate (bps) */ int32_t bitrate; /* Maximum bit rate (bps) */ int32_t maxbitrate; /* Bit rate control type. 0: CBR; 1: ABR; 2: VBR. CBR must be supported. */ int32_t rcType; } AEncCfgParams; |
Return
Type |
Description |
|---|---|
int32_t |
0: Success; <0: Failure. |
Method |
|---|
int32_t (*AudioEncoderProcess)( AEncHandle handle, AEncInputData *inputData, AEncOutputData *outputData) Compresses the input audio data based on the configurations of the audio encoder, and outputs compressed streams. handle indicates the handle of the encoder, inputData indicates the audio data to be encoded, and outputData indicates the output stream and parameter set. |
Parameters
Name |
Description |
|---|---|
handle |
Encoder handle. |
inputData |
Audio data to be encoded. typedef struct { /* Audio data memory */ uint8_t *pcmDataBuf; /* Frame length (byte) */ int32_t pcmLength; /* Timestamp, in microseconds */ int64_t timeStamp; } AEncInputData; |
outputData |
Output stream and parameter set. typedef struct { /* Code stream data */ uint8_t *bsBuf; /* Code stream length */ int32_t bsLength; /* Timestamp, in microseconds */ int64_t timeStamp; } AEncOutputData; |
Return
Type |
Description |
|---|---|
int32_t |
0: Success; <0: Failure. |
Method |
|---|
int32_t (*AudioEncoderDestroy)( AEncHandle *handle) Destroys an audio encoder. |
Parameters
Name |
Description |
|---|---|
handle |
Encoder handle. |
Return
Type |
Description |
|---|---|
int32_t |
0: Success; <0: Failure. |