ISVP-SDK  3.12.0
Ingenic Smart Video Platform SDK
imp_audio.h
Go to the documentation of this file.
1 /*
2  * Audio utils header file.
3  *
4  * Copyright (C) 2014 Ingenic Semiconductor Co.,Ltd
5  */
6 
7 #ifndef __IMP_AUDIO_H__
8 #define __IMP_AUDIO_H__
9 
10 #include <stdint.h>
11 
12 #ifdef __cplusplus
13 #if __cplusplus
14 extern "C"
15 {
16 #endif
17 #endif /* __cplusplus */
18 
85 #define MAX_AUDIO_FRAME_NUM 50
86 
90 typedef enum {
91  BLOCK = 0,
92  NOBLOCK = 1,
93 } IMPBlock;
94 
98 typedef enum {
106 
110 typedef enum {
113 
117 typedef enum {
121 
125 typedef enum {
126  PT_PCM = 0,
127  PT_G711A = 1,
128  PT_G711U = 2,
129  PT_G726 = 3,
130  PT_AEC = 4,
131  PT_ADPCM = 5,
132  PT_MAX = 6,
134 
138 typedef enum {
142 
146 typedef struct {
150  int frmNum;
151  int numPerFrm;
152  int chnCnt;
154 
158 typedef struct {
161  uint32_t *virAddr;
162  uint32_t phyAddr;
163  int64_t timeStamp;
164  int seq;
165  int len;
166 } IMPAudioFrame;
167 
171 typedef struct {
173  int Rev;
175 
179 typedef struct {
184 
188 typedef struct {
189  uint8_t *stream;
190  uint32_t phyAddr;
191  int len;
192  int64_t timeStamp;
193  int seq;
195 
199 typedef struct {
201  int bufSize;
202  uint32_t *value;
204 
208 typedef struct {
210  int maxFrmLen;
211  char name[16];
212  int (*openEncoder)(void *encoderAttr, void
213  *encoder);
214  int (*encoderFrm)(void *encoder, IMPAudioFrame
215  *data, unsigned char *outbuf,int *outLen);
216  int (*closeEncoder)(void *encoder);
218 
222 typedef struct {
224  int bufSize;
226  void *value;
228 
232 typedef struct {
234  char name[16];
235  int (*openDecoder)(void *decoderAttr, void
236  *decoder);
237  int (*decodeFrm)(void *decoder, unsigned char
238  *inbuf,int inLen, unsigned short *outbuf,int
239  *outLen,int *chns);
240  int (*getFrmInfo)(void *decoder, void *info);
241  int (*closeDecoder)(void *decoder);
243 
247 typedef struct {
251 
255 enum Level_ns {
260 };
261 
292 int IMP_AI_SetPubAttr(int audioDevId, IMPAudioIOAttr *attr);
293 
309 int IMP_AI_GetPubAttr(int audioDevId, IMPAudioIOAttr *attr);
310 
325 int IMP_AI_Enable(int audioDevId);
326 
341 int IMP_AI_Disable(int audioDevId);
342 
358 int IMP_AI_EnableChn(int audioDevId, int aiChn);
359 
375 int IMP_AI_DisableChn(int audioDevId, int aiChn);
376 
393 int IMP_AI_PollingFrame(int audioDevId, int aiChn, unsigned int timeout_ms);
394 
430 int IMP_AI_GetFrame(int audioDevId, int aiChn, IMPAudioFrame *frm, IMPBlock block);
431 
448 int IMP_AI_ReleaseFrame(int audioDevId, int aiChn, IMPAudioFrame *frm);
449 
476 int IMP_AI_SetChnParam(int audioDevId, int aiChn, IMPAudioIChnParam *chnParam);
477 
494 int IMP_AI_GetChnParam(int audioDevId, int aiChn, IMPAudioIChnParam *chnParam);
495 
531 int IMP_AI_EnableAec(int aiDevId, int aiChn, int aoDevId, int aoChn);
532 
548 int IMP_AI_DisableAec(int aiDevId, int aiChn);
549 
566 int IMP_AI_EnableNs(IMPAudioIOAttr *attr, int mode);
567 
582 int IMP_AI_DisableNs(void);
583 
601 
616 int IMP_AI_DisableAgc(void);
617 
635 
650 int IMP_AO_DisableAgc(void);
651 
667 
682 int IMP_AI_DisableHpf(void);
683 
699 
714 int IMP_AO_DisableHpf(void);
715 
731 int IMP_AO_SetPubAttr(int audioDevId, IMPAudioIOAttr *attr);
732 
748 int IMP_AO_GetPubAttr(int audioDevId, IMPAudioIOAttr *attr);
749 
764 int IMP_AO_Enable(int audioDevId);
765 
780 int IMP_AO_Disable(int audioDevId);
781 
797 int IMP_AO_EnableChn(int audioDevId, int aoChn);
798 
814 int IMP_AO_DisableChn(int audioDevId, int aoChn);
815 
849 int IMP_AO_SendFrame(int audioDevId, int aoChn, IMPAudioFrame *data, IMPBlock block);
850 
866 int IMP_AO_PauseChn(int audioDevId, int aoChn);
867 
883 int IMP_AO_ResumeChn(int audioDevId, int aoChn);
884 
900 int IMP_AO_ClearChnBuf(int audioDevId, int aoChn);
901 
918 int IMP_AO_QueryChnStat(int audioDevId, int aoChn, IMPAudioOChnState *status);
919 
948  int IMP_AENC_CreateChn(int aeChn, IMPAudioEncChnAttr *attr);
949 
964  int IMP_AENC_DestroyChn(int aeChn);
965 
1017  int IMP_AENC_SendFrame(int aeChn, IMPAudioFrame *frm);
1018 
1034 int IMP_AENC_PollingStream(int AeChn, unsigned int timeout_ms);
1035 
1052  int IMP_AENC_GetStream(int aeChn, IMPAudioStream *stream ,IMPBlock block);
1053 
1069  int IMP_AENC_ReleaseStream(int aeChn,IMPAudioStream *stream);
1070 
1112  int IMP_AENC_RegisterEncoder(int *handle, IMPAudioEncEncoder *encoder);
1113 
1128  int IMP_AENC_ReleaseEncoder(int *handle);
1129 
1157  int IMP_ADEC_CreateChn(int adChn, IMPAudioDecChnAttr *attr);
1158 
1173  int IMP_ADEC_DestroyChn(int adChn);
1174 
1227  int IMP_ADEC_SendStream(int adChn, IMPAudioStream *stream, IMPBlock block);
1228 
1244 int IMP_ADEC_PollingStream(int AdChn, unsigned int timeout_ms);
1245 
1262 int IMP_ADEC_GetStream(int adChn, IMPAudioStream *stream ,IMPBlock block);
1263 
1279 int IMP_ADEC_ReleaseStream(int adChn,IMPAudioStream *stream);
1280 
1295  int IMP_ADEC_ClearChnBuf(int adChn);
1296 
1342  int IMP_ADEC_RegisterDecoder(int *handle, IMPAudioDecDecoder *decoder);
1343 
1358  int IMP_ADEC_ReleaseDecoder(int *handle);
1359 
1389  int IMP_AI_SetVol(int audioDevId, int aiChn, int aiVol);
1390 
1407  int IMP_AI_GetVol(int audioDevId, int aiChn, int *vol);
1408 
1425  int IMP_AI_SetVolMute(int audioDevId, int aiChn, int mute);
1426 
1444  int IMP_AO_SetVol(int audioDevId, int aoChn, int aoVol);
1445 
1462  int IMP_AO_GetVol(int audioDevId, int aoChn, int *vol);
1463 
1480  int IMP_AO_SetVolMute(int audioDevId, int aoChn, int mute);
1481 
1499  int IMP_AI_SetGain(int audioDevId, int aiChn, int aiGain);
1500 
1517  int IMP_AI_GetGain(int audioDevId, int aiChn, int *aiGain);
1518 
1537  int IMP_AO_SetGain(int audioDevId, int aoChn, int aoGain);
1538 
1555  int IMP_AO_GetGain(int audioDevId, int aoChn, int *aoGain);
1556 
1572  int IMP_AO_Soft_Mute(int audioDevId, int aoChn);
1573 
1589  int IMP_AO_Soft_UNMute(int audioDevId, int aoChn);
1590 
1629  int IMP_AI_GetFrameAndRef(int audioDevId, int aiChn, IMPAudioFrame *frm, IMPAudioFrame *ref, IMPBlock block);
1630 
1647  int IMP_AI_EnableAecRefFrame(int audioDevId, int aiChn, int audioAoDevId, int aoChn);
1648 
1665  int IMP_AI_DisableAecRefFrame(int audioDevId, int aiChn, int audioAoDevId, int aoChn);
1666 
1680  int IMP_AO_CacheSwitch(int audioDevId, int aoChn, int cache_en);
1681 
1682  /* @fn int IMP_AO_FlushChnBuf(int audioDevId, int aoChn);
1683  * Wait for last audio data to play.
1684  * @param[in] audioDevId audio device number.
1685  * @param[in] aoChn audio output channel number.
1686  *
1687  * @retval 0 success
1688  * @retval non-0 failure.
1689  *
1690  * @remarks no
1691  * @attention no.
1692  */
1693  int IMP_AO_FlushChnBuf(int audioDevId, int aoChn);
1694 
1695 #ifdef __cplusplus
1696 #if __cplusplus
1697 }
1698 #endif
1699 #endif /* __cplusplus */
1700 
1701 #endif /* __IMP_AUDIO_H__ */
uint8_t * stream
Data stream pointer.
Definition: imp_audio.h:189
int bufSize
buf size, in order to frame the unit, [2 ~ MAX_AUDIO_FRAME_NUM]
Definition: imp_audio.h:201
Medium level noise suppression.
Definition: imp_audio.h:257
int IMP_AI_EnableHpf(IMPAudioIOAttr *attr)
Enable audio input for high pass filtering.
44.1KHz sampling rate
Definition: imp_audio.h:102
Define audio encoding channel attribute structure.
Definition: imp_audio.h:199
Level_ns
Defines level of noise suppression.
Definition: imp_audio.h:255
IMPAudioSoundMode soundmode
Audio channel mode.
Definition: imp_audio.h:149
int TargetLevelDbfs
Gain level, the value of [0, 31], this refers to the target volume level, the unit is dB...
Definition: imp_audio.h:248
int IMP_AO_Soft_Mute(int audioDevId, int aoChn)
Output soft mute control.
int seq
Audio frame data serial number.
Definition: imp_audio.h:164
int IMP_ADEC_DestroyChn(int adChn)
Destory audio decoding channel.
int usrFrmDepth
Audio frame buffer depth.
Definition: imp_audio.h:172
16KHz sampling rate
Definition: imp_audio.h:100
void * value
Specific protocol attribute pointer.
Definition: imp_audio.h:226
Define the decoded channel attribute structure.
Definition: imp_audio.h:222
int IMP_AO_ClearChnBuf(int audioDevId, int aoChn)
Clear the current audio data cache in the audio output channel.
int IMP_AO_SetPubAttr(int audioDevId, IMPAudioIOAttr *attr)
Set audio input and output device attribute.
int IMP_AI_GetVol(int audioDevId, int aiChn, int *vol)
Get the volume of the audio input.
int IMP_AO_SetVolMute(int audioDevId, int aoChn, int mute)
Set audio output mute.
int IMP_AENC_SendFrame(int aeChn, IMPAudioFrame *frm)
Send audio encoding audio frame.
int IMP_AO_ResumeChn(int audioDevId, int aoChn)
Resume audio output channel.
int IMP_AI_DisableAgc(void)
Disable AI automatic gain feature.
int chnCnt
Number of channels supported.
Definition: imp_audio.h:152
int IMP_AI_DisableNs(void)
Disable noise suppression.
IMPAudioDecMode mode
Decoding mode.
Definition: imp_audio.h:225
Pack decoding.
Definition: imp_audio.h:139
int IMP_AO_SendFrame(int audioDevId, int aoChn, IMPAudioFrame *data, IMPBlock block)
Send audio output frame.
block
Definition: imp_audio.h:91
int IMP_AI_PollingFrame(int audioDevId, int aiChn, unsigned int timeout_ms)
Polling audio stream cache.
int frmNum
Number of cached frames, range: [2, MAX_AUDIO_FRAME_NUM].
Definition: imp_audio.h:150
int IMP_AO_GetGain(int audioDevId, int aoChn, int *aoGain)
Get audio output gain.
int IMP_AI_DisableAecRefFrame(int audioDevId, int aiChn, int audioAoDevId, int aoChn)
Close access to the reference frame.
int IMP_ADEC_ReleaseDecoder(int *handle)
Unregister Decoder.
int IMP_AO_QueryChnStat(int audioDevId, int aoChn, IMPAudioOChnState *status)
Query the current audio data cache status in the audio output channel.
int IMP_AO_EnableChn(int audioDevId, int aoChn)
Enable audio output channel.
int IMP_ADEC_ClearChnBuf(int adChn)
Clears the current audio data cache in the audio decode channel.
int IMP_AI_EnableChn(int audioDevId, int aiChn)
Enable audio input channel.
int IMP_AENC_PollingStream(int AeChn, unsigned int timeout_ms)
Polling encoded audio stream cache.
int IMP_AENC_CreateChn(int aeChn, IMPAudioEncChnAttr *attr)
Create audio encode channel.
int IMP_AI_SetPubAttr(int audioDevId, IMPAudioIOAttr *attr)
Set audio input device attribute.
int IMP_AI_EnableAgc(IMPAudioIOAttr *attr, IMPAudioAgcConfig agcConfig)
Enable automatic gain of audio input.
int IMP_AO_Disable(int audioDevId)
Disable audio output device.
int IMP_AI_SetChnParam(int audioDevId, int aiChn, IMPAudioIChnParam *chnParam)
Set audio input channel parameters.
int IMP_AO_DisableAgc(void)
Disable AO automatic gain feature.
int IMP_AO_PauseChn(int audioDevId, int aoChn)
Pause audio output channel.
int IMP_AI_GetPubAttr(int audioDevId, IMPAudioIOAttr *attr)
Get the attribute of the audio input device.
IMPAudioPalyloadType type
Audio payload data type.
Definition: imp_audio.h:200
int IMP_AO_Enable(int audioDevId)
Enable audio output device.
48KHz sampling rate
Definition: imp_audio.h:103
int IMP_AO_DisableChn(int audioDevId, int aoChn)
Disable audio output channel.
uint32_t * value
Protocol attribute pointer.
Definition: imp_audio.h:202
int IMP_AO_SetVol(int audioDevId, int aoChn, int aoVol)
Set audio output channel volume.
Low level noise suppression.
Definition: imp_audio.h:256
Define the encoder attribute structure.
Definition: imp_audio.h:208
8KHz sampling rate
Definition: imp_audio.h:99
int IMP_ADEC_PollingStream(int AdChn, unsigned int timeout_ms)
Polling decode audio stream cache.
IMPAudioDecMode
Define the decoding method.
Definition: imp_audio.h:138
int IMP_AI_GetGain(int audioDevId, int aiChn, int *aiGain)
Get AI gain value.
Audio frame structure.
Definition: imp_audio.h:158
int IMP_AI_EnableAec(int aiDevId, int aiChn, int aoDevId, int aoChn)
Enable audio echo cancellation feature of the specified audio input and audio output.
IMPBlock
Audio stream blocking type.
Definition: imp_audio.h:90
int IMP_AENC_DestroyChn(int aeChn)
Destory audio encode channel.
24KHz sampling rate
Definition: imp_audio.h:101
int IMP_ADEC_RegisterDecoder(int *handle, IMPAudioDecDecoder *decoder)
Register decoder.
int chnTotalNum
The total number of cached output channel.
Definition: imp_audio.h:180
int IMP_AI_DisableAec(int aiDevId, int aiChn)
Disable audio echo cancellation feature.
int IMP_AENC_ReleaseEncoder(int *handle)
Release encoder.
int IMP_AI_ReleaseFrame(int audioDevId, int aiChn, IMPAudioFrame *frm)
Release audio frame.
int IMP_AI_SetGain(int audioDevId, int aiChn, int aiGain)
Set audio input gain.
int maxFrmLen
Maximum code stream length.
Definition: imp_audio.h:210
IMPAudioPalyloadType
Define audio payload type enumeration.
Definition: imp_audio.h:125
int IMP_AI_GetFrame(int audioDevId, int aiChn, IMPAudioFrame *frm, IMPBlock block)
Get audio frame.
int IMP_AI_Disable(int audioDevId)
Disable audio input device.
Define AGC gain structure.
Definition: imp_audio.h:247
16bit sampling precision
Definition: imp_audio.h:111
int IMP_AI_DisableChn(int audioDevId, int aiChn)
Disable audio input channel.
int IMP_AO_Soft_UNMute(int audioDevId, int aoChn)
Output soft unmute control.
Define decoder attribute structure.
Definition: imp_audio.h:232
Define audio stream structure.
Definition: imp_audio.h:188
Data cache state structure of audio output channel.
Definition: imp_audio.h:179
int IMP_ADEC_SendStream(int adChn, IMPAudioStream *stream, IMPBlock block)
Send audio stream to audio decoding channel.
Stream decoding.
Definition: imp_audio.h:140
IMPAudioSoundMode
Audio channel mode definition.
Definition: imp_audio.h:117
int CompressionGaindB
Set the maximum gain value, [0, 90], 0 represents no gain, the greater the value, the higher the gain...
Definition: imp_audio.h:249
int IMP_AENC_RegisterEncoder(int *handle, IMPAudioEncEncoder *encoder)
Register encoder.
IMPAudioBitWidth
Audio sampling precision definition.
Definition: imp_audio.h:110
int IMP_AI_GetChnParam(int audioDevId, int aiChn, IMPAudioIChnParam *chnParam)
Set audio input channel parameters.
int IMP_AENC_ReleaseStream(int aeChn, IMPAudioStream *stream)
Releases the stream from the audio encoding channel.
High level noise suppression.
Definition: imp_audio.h:258
int IMP_AO_CacheSwitch(int audioDevId, int aoChn, int cache_en)
close audio play cache
int IMP_AO_EnableAgc(IMPAudioIOAttr *attr, IMPAudioAgcConfig agcConfig)
Enable audio output automatic gain feature.
int IMP_ADEC_CreateChn(int adChn, IMPAudioDecChnAttr *attr)
Create audio decode channel.
IMPAudioSampleRate
Audio sampling rate definition.
Definition: imp_audio.h:98
int IMP_AO_EnableHpf(IMPAudioIOAttr *attr)
Enable audio output for high pass filtering.
int IMP_AI_SetVolMute(int audioDevId, int aiChn, int mute)
Set audio input mute.
96KHz sampling rate
Definition: imp_audio.h:104
Double channel.
Definition: imp_audio.h:119
int Rev
retain
Definition: imp_audio.h:173
int len
Audio frame data length.
Definition: imp_audio.h:165
int IMP_AO_GetPubAttr(int audioDevId, IMPAudioIOAttr *attr)
Get audio input and output device attribute.
int IMP_AENC_GetStream(int aeChn, IMPAudioStream *stream, IMPBlock block)
Get the encoded stream.
Audio input and output device attribute.
Definition: imp_audio.h:146
int IMP_AI_GetFrameAndRef(int audioDevId, int aiChn, IMPAudioFrame *frm, IMPAudioFrame *ref, IMPBlock block)
Get audio frame and output reference frame.
uint32_t * virAddr
Audio frame data virtual address.
Definition: imp_audio.h:161
int chnBusyNum
The number of cache be used.
Definition: imp_audio.h:182
int IMP_AI_DisableHpf(void)
Disable AI high pass filtering function.
int IMP_AO_GetVol(int audioDevId, int aoChn, int *vol)
Get audio output channel volume.
int IMP_ADEC_GetStream(int adChn, IMPAudioStream *stream, IMPBlock block)
Get the decoded stream.
uint32_t phyAddr
Audio frame data physical address.
Definition: imp_audio.h:162
int numPerFrm
Number of sample points per frame.
Definition: imp_audio.h:151
int64_t timeStamp
Audio frame data time stamp.
Definition: imp_audio.h:163
int IMP_AI_Enable(int audioDevId)
Enable audio input device.
Single channel.
Definition: imp_audio.h:118
int chnFreeNum
Free cache blocks.
Definition: imp_audio.h:181
Maximum level noise suppression.
Definition: imp_audio.h:259
int IMP_ADEC_ReleaseStream(int adChn, IMPAudioStream *stream)
Release of the stream from the audio decoding channel.
int IMP_AO_SetGain(int audioDevId, int aoChn, int aoGain)
Set audio output gain.
not block
Definition: imp_audio.h:92
int IMP_AI_EnableNs(IMPAudioIOAttr *attr, int mode)
Enable specified audio input noise suppression.
IMPAudioBitWidth bitwidth
Audio sampling precision.
Definition: imp_audio.h:148
int IMP_AO_DisableHpf(void)
Disable AO high pass filtering function.
int IMP_AI_EnableAecRefFrame(int audioDevId, int aiChn, int audioAoDevId, int aoChn)
Open access reference frame.
Audio channel parameter structure.
Definition: imp_audio.h:171
IMPAudioSampleRate samplerate
Audio sampling rate.
Definition: imp_audio.h:147
int IMP_AI_SetVol(int audioDevId, int aiChn, int aiVol)
ACODEC configuration.