ISVP-SDK  3.12.0
Ingenic Smart Video Platform SDK
imp_audio.h
浏览该文件的文档.
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 
79 #define MAX_AUDIO_FRAME_NUM 50
80 
84 typedef enum {
85  BLOCK = 0,
86  NOBLOCK = 1,
87 } IMPBlock;
88 
92 typedef enum {
100 
104 typedef enum {
107 
111 typedef enum {
115 
119 typedef enum {
120  PT_PCM = 0,
121  PT_G711A = 1,
122  PT_G711U = 2,
123  PT_G726 = 3,
124  PT_AEC = 4,
125  PT_ADPCM = 5,
126  PT_MAX = 6,
128 
132 typedef enum {
136 
140 typedef struct {
144  int frmNum;
145  int numPerFrm;
146  int chnCnt;
148 
152 typedef struct {
155  uint32_t *virAddr;
156  uint32_t phyAddr;
157  int64_t timeStamp;
158  int seq;
159  int len;
160 } IMPAudioFrame;
161 
165 typedef struct {
167  int Rev;
169 
173 typedef struct {
178 
182 typedef struct {
183  uint8_t *stream;
184  uint32_t phyAddr;
185  int len;
186  int64_t timeStamp;
187  int seq;
189 
193 typedef struct {
195  int bufSize;
196  uint32_t *value;
198 
202 typedef struct {
204  int maxFrmLen;
205  char name[16];
206  int (*openEncoder)(void *encoderAttr, void
207  *encoder);
208  int (*encoderFrm)(void *encoder, IMPAudioFrame
209  *data, unsigned char *outbuf,int *outLen);
210  int (*closeEncoder)(void *encoder);
212 
216 typedef struct {
218  int bufSize;
220  void *value;
222 
226 typedef struct {
228  char name[16];
229  int (*openDecoder)(void *decoderAttr, void
230  *decoder);
231  int (*decodeFrm)(void *decoder, unsigned char
232  *inbuf,int inLen, unsigned short *outbuf,int
233  *outLen,int *chns);
234  int (*getFrmInfo)(void *decoder, void *info);
235  int (*closeDecoder)(void *decoder);
237 
241 typedef struct {
245 
249 enum Level_ns {
254 };
255 
286 int IMP_AI_SetPubAttr(int audioDevId, IMPAudioIOAttr *attr);
287 
303 int IMP_AI_GetPubAttr(int audioDevId, IMPAudioIOAttr *attr);
304 
319 int IMP_AI_Enable(int audioDevId);
320 
335 int IMP_AI_Disable(int audioDevId);
336 
352 int IMP_AI_EnableChn(int audioDevId, int aiChn);
353 
369 int IMP_AI_DisableChn(int audioDevId, int aiChn);
370 
388 int IMP_AI_PollingFrame(int audioDevId, int aiChn, unsigned int timeout_ms);
389 
425 int IMP_AI_GetFrame(int audioDevId, int aiChn, IMPAudioFrame *frm, IMPBlock block);
426 
443 int IMP_AI_ReleaseFrame(int audioDevId, int aiChn, IMPAudioFrame *frm);
444 
471 int IMP_AI_SetChnParam(int audioDevId, int aiChn, IMPAudioIChnParam *chnParam);
472 
489 int IMP_AI_GetChnParam(int audioDevId, int aiChn, IMPAudioIChnParam *chnParam);
490 
525 int IMP_AI_EnableAec(int aiDevId, int aiChn, int aoDevId, int aoChn);
526 
542 int IMP_AI_DisableAec(int aiDevId, int aiChn);
543 
561 int IMP_AI_EnableNs(IMPAudioIOAttr *attr, int mode);
562 
577 int IMP_AI_DisableNs(void);
578 
596 
611 int IMP_AI_DisableAgc(void);
612 
630 
645 int IMP_AO_DisableAgc(void);
646 
662 
677 int IMP_AI_DisableHpf(void);
678 
694 
709 int IMP_AO_DisableHpf(void);
710 
726 int IMP_AO_SetPubAttr(int audioDevId, IMPAudioIOAttr *attr);
727 
743 int IMP_AO_GetPubAttr(int audioDevId, IMPAudioIOAttr *attr);
744 
759 int IMP_AO_Enable(int audioDevId);
760 
775 int IMP_AO_Disable(int audioDevId);
776 
792 int IMP_AO_EnableChn(int audioDevId, int aoChn);
793 
809 int IMP_AO_DisableChn(int audioDevId, int aoChn);
810 
844 int IMP_AO_SendFrame(int audioDevId, int aoChn, IMPAudioFrame *data, IMPBlock block);
845 
861 int IMP_AO_PauseChn(int audioDevId, int aoChn);
862 
878 int IMP_AO_ResumeChn(int audioDevId, int aoChn);
879 
895 int IMP_AO_ClearChnBuf(int audioDevId, int aoChn);
896 
913 int IMP_AO_QueryChnStat(int audioDevId, int aoChn, IMPAudioOChnState *status);
914 
943  int IMP_AENC_CreateChn(int aeChn, IMPAudioEncChnAttr *attr);
944 
959  int IMP_AENC_DestroyChn(int aeChn);
960 
1012  int IMP_AENC_SendFrame(int aeChn, IMPAudioFrame *frm);
1013 
1030 int IMP_AENC_PollingStream(int AeChn, unsigned int timeout_ms);
1031 
1048  int IMP_AENC_GetStream(int aeChn, IMPAudioStream *stream ,IMPBlock block);
1049 
1065  int IMP_AENC_ReleaseStream(int aeChn,IMPAudioStream *stream);
1066 
1108  int IMP_AENC_RegisterEncoder(int *handle, IMPAudioEncEncoder *encoder);
1109 
1124  int IMP_AENC_ReleaseEncoder(int *handle);
1125 
1153  int IMP_ADEC_CreateChn(int adChn, IMPAudioDecChnAttr *attr);
1154 
1169  int IMP_ADEC_DestroyChn(int adChn);
1170 
1223  int IMP_ADEC_SendStream(int adChn, IMPAudioStream *stream, IMPBlock block);
1224 
1241 int IMP_ADEC_PollingStream(int AdChn, unsigned int timeout_ms);
1242 
1259 int IMP_ADEC_GetStream(int adChn, IMPAudioStream *stream ,IMPBlock block);
1260 
1276 int IMP_ADEC_ReleaseStream(int adChn,IMPAudioStream *stream);
1277 
1292  int IMP_ADEC_ClearChnBuf(int adChn);
1293 
1338  int IMP_ADEC_RegisterDecoder(int *handle, IMPAudioDecDecoder *decoder);
1339 
1354  int IMP_ADEC_ReleaseDecoder(int *handle);
1355 
1385  int IMP_AI_SetVol(int audioDevId, int aiChn, int aiVol);
1386 
1403  int IMP_AI_GetVol(int audioDevId, int aiChn, int *vol);
1404 
1421  int IMP_AI_SetVolMute(int audioDevId, int aiChn, int mute);
1422 
1440  int IMP_AO_SetVol(int audioDevId, int aoChn, int aoVol);
1441 
1458  int IMP_AO_GetVol(int audioDevId, int aoChn, int *vol);
1459 
1476  int IMP_AO_SetVolMute(int audioDevId, int aoChn, int mute);
1477 
1496  int IMP_AI_SetGain(int audioDevId, int aiChn, int aiGain);
1497 
1514  int IMP_AI_GetGain(int audioDevId, int aiChn, int *aiGain);
1515 
1534  int IMP_AO_SetGain(int audioDevId, int aoChn, int aoGain);
1535 
1552  int IMP_AO_GetGain(int audioDevId, int aoChn, int *aoGain);
1553 
1569  int IMP_AO_Soft_Mute(int audioDevId, int aoChn);
1570 
1586  int IMP_AO_Soft_UNMute(int audioDevId, int aoChn);
1587 
1626  int IMP_AI_GetFrameAndRef(int audioDevId, int aiChn, IMPAudioFrame *frm, IMPAudioFrame *ref, IMPBlock block);
1627 
1644  int IMP_AI_EnableAecRefFrame(int audioDevId, int aiChn, int audioAoDevId, int aoChn);
1645 
1662  int IMP_AI_DisableAecRefFrame(int audioDevId, int aiChn, int audioAoDevId, int aoChn);
1663 
1677  int IMP_AO_CacheSwitch(int audioDevId, int aoChn, int cache_en);
1678 
1691  int IMP_AO_FlushChnBuf(int audioDevId, int aoChn);
1692 
1693 #ifdef __cplusplus
1694 #if __cplusplus
1695 }
1696 #endif
1697 #endif /* __cplusplus */
1698 
1699 #endif /* __IMP_AUDIO_H__ */
uint8_t * stream
数据流指针
Definition: imp_audio.h:183
int bufSize
buf 大小,以帧为单位,[2~MAX_AUDIO_FRAME_NUM]
Definition: imp_audio.h:195
中等级级别噪声抑制
Definition: imp_audio.h:251
int IMP_AI_EnableHpf(IMPAudioIOAttr *attr)
启用音频输入的高通滤波.
44.1KHz采样率
Definition: imp_audio.h:96
定义音频编码通道属性结构体.
Definition: imp_audio.h:193
int IMP_AO_FlushChnBuf(int audioDevId, int aoChn)
等待最后一段音频数据播完;
Level_ns
定义噪声抑制级别.
Definition: imp_audio.h:249
IMPAudioSoundMode soundmode
音频声道模式
Definition: imp_audio.h:143
int TargetLevelDbfs
增益级别,取值为[0, 31], 这指目标音量级别,单位为db,为负值.
Definition: imp_audio.h:242
int IMP_AO_Soft_Mute(int audioDevId, int aoChn)
输出软静音控制.
int seq
音频帧序号
Definition: imp_audio.h:158
int IMP_ADEC_DestroyChn(int adChn)
销毁音频解码通道.
int usrFrmDepth
音频帧缓存深度
Definition: imp_audio.h:166
16KHz采样率
Definition: imp_audio.h:94
void * value
具体协议属性指针
Definition: imp_audio.h:220
定义解码通道属性结构体.
Definition: imp_audio.h:216
int IMP_AO_ClearChnBuf(int audioDevId, int aoChn)
清除音频输出通道中当前的音频数据缓存.
int IMP_AO_SetPubAttr(int audioDevId, IMPAudioIOAttr *attr)
设置音频输入输出设备属性.
int IMP_AI_GetVol(int audioDevId, int aiChn, int *vol)
获取音频输入音量.
int IMP_AO_SetVolMute(int audioDevId, int aoChn, int mute)
设置音频输出静音.
int IMP_AENC_SendFrame(int aeChn, IMPAudioFrame *frm)
发送音频编码音频帧.
int IMP_AO_ResumeChn(int audioDevId, int aoChn)
恢复音频输出通道.
int IMP_AI_DisableAgc(void)
禁用AI自动增益功能.
int chnCnt
支持的通道数目
Definition: imp_audio.h:146
int IMP_AI_DisableNs(void)
禁用噪声抑制功能.
IMPAudioDecMode mode
解码方式
Definition: imp_audio.h:219
Pack 方式解码
Definition: imp_audio.h:133
int IMP_AO_SendFrame(int audioDevId, int aoChn, IMPAudioFrame *data, IMPBlock block)
发送音频输出帧.
阻塞
Definition: imp_audio.h:85
int IMP_AI_PollingFrame(int audioDevId, int aiChn, unsigned int timeout_ms)
Polling音频流缓存.
int frmNum
缓存帧的数目, 取值范围:[2, MAX_AUDIO_FRAME_NUM]
Definition: imp_audio.h:144
int IMP_AO_GetGain(int audioDevId, int aoChn, int *aoGain)
获取音频输出增益.
int IMP_AI_DisableAecRefFrame(int audioDevId, int aiChn, int audioAoDevId, int aoChn)
关闭获取参考帧.
int IMP_ADEC_ReleaseDecoder(int *handle)
注销解码器.
int IMP_AO_QueryChnStat(int audioDevId, int aoChn, IMPAudioOChnState *status)
查询音频输出通道中当前的音频数据缓存状态.
int IMP_AO_EnableChn(int audioDevId, int aoChn)
启用音频输出通道.
int IMP_ADEC_ClearChnBuf(int adChn)
清除音频解码通道中当前的音频数据缓存.
int IMP_AI_EnableChn(int audioDevId, int aiChn)
启用音频输入通道.
int IMP_AENC_PollingStream(int AeChn, unsigned int timeout_ms)
Polling编码音频流缓存.
int IMP_AENC_CreateChn(int aeChn, IMPAudioEncChnAttr *attr)
创建音频编码通道.
int IMP_AI_SetPubAttr(int audioDevId, IMPAudioIOAttr *attr)
设置音频输入设备属性.
int IMP_AI_EnableAgc(IMPAudioIOAttr *attr, IMPAudioAgcConfig agcConfig)
启用音频输入的自动增益功能.
int IMP_AO_Disable(int audioDevId)
禁用音频输出设备.
int IMP_AI_SetChnParam(int audioDevId, int aiChn, IMPAudioIChnParam *chnParam)
设置音频输入通道参数.
int IMP_AO_DisableAgc(void)
禁用AO自动增益功能.
int IMP_AO_PauseChn(int audioDevId, int aoChn)
暂停音频输出通道.
int IMP_AI_GetPubAttr(int audioDevId, IMPAudioIOAttr *attr)
获取音频输入设备属性.
IMPAudioPalyloadType type
音频净荷数据类型
Definition: imp_audio.h:194
int IMP_AO_Enable(int audioDevId)
启用音频输出设备.
48KHz采样率
Definition: imp_audio.h:97
int IMP_AO_DisableChn(int audioDevId, int aoChn)
禁用音频输出通道.
uint32_t * value
协议属性指针
Definition: imp_audio.h:196
int IMP_AO_SetVol(int audioDevId, int aoChn, int aoVol)
设置音频输出通道音量.
低等级级别噪声抑制
Definition: imp_audio.h:250
定义编码器属性结构体.
Definition: imp_audio.h:202
8KHz采样率
Definition: imp_audio.h:93
int IMP_ADEC_PollingStream(int AdChn, unsigned int timeout_ms)
Polling解码音频流缓存.
IMPAudioDecMode
定义解码方式.
Definition: imp_audio.h:132
int IMP_AI_GetGain(int audioDevId, int aiChn, int *aiGain)
获取AI增益值.
音频帧结构体.
Definition: imp_audio.h:152
int IMP_AI_EnableAec(int aiDevId, int aiChn, int aoDevId, int aoChn)
启用指定音频输入和音频输出的回声抵消功能.
IMPBlock
音频流阻塞类型
Definition: imp_audio.h:84
int IMP_AENC_DestroyChn(int aeChn)
销毁音频编码通道.
24KHz采样率
Definition: imp_audio.h:95
int IMP_ADEC_RegisterDecoder(int *handle, IMPAudioDecDecoder *decoder)
注册解码器.
int chnTotalNum
输出通道总的缓存块数
Definition: imp_audio.h:174
int IMP_AI_DisableAec(int aiDevId, int aiChn)
禁用回声抵消功能.
int IMP_AENC_ReleaseEncoder(int *handle)
注销编码器.
int IMP_AI_ReleaseFrame(int audioDevId, int aiChn, IMPAudioFrame *frm)
释放音频帧.
int IMP_AI_SetGain(int audioDevId, int aiChn, int aiGain)
设置音频输入增益.
int maxFrmLen
最大码流长度
Definition: imp_audio.h:204
IMPAudioPalyloadType
定义音频净荷类型枚举.
Definition: imp_audio.h:119
int IMP_AI_GetFrame(int audioDevId, int aiChn, IMPAudioFrame *frm, IMPBlock block)
获取音频帧.
int IMP_AI_Disable(int audioDevId)
禁用音频输入设备.
定义AGC增益结构体.
Definition: imp_audio.h:241
16bit采样精度
Definition: imp_audio.h:105
int IMP_AI_DisableChn(int audioDevId, int aiChn)
禁用音频输入通道.
int IMP_AO_Soft_UNMute(int audioDevId, int aoChn)
输出软撤销静音控制.
定义解码器属性结构体.
Definition: imp_audio.h:226
定义音频码流结构体.
Definition: imp_audio.h:182
音频输出通道的数据缓存状态结构体.
Definition: imp_audio.h:173
int IMP_ADEC_SendStream(int adChn, IMPAudioStream *stream, IMPBlock block)
发送音频码流到音频解码通道.
Stream 方式解码
Definition: imp_audio.h:134
IMPAudioSoundMode
音频声道模式定义.
Definition: imp_audio.h:111
int CompressionGaindB
设置最大的增益值,[0, 90],0代表无增益,值越大,增益越高.
Definition: imp_audio.h:243
int IMP_AENC_RegisterEncoder(int *handle, IMPAudioEncEncoder *encoder)
注册编码器.
IMPAudioBitWidth
音频采样精度定义.
Definition: imp_audio.h:104
int IMP_AI_GetChnParam(int audioDevId, int aiChn, IMPAudioIChnParam *chnParam)
获取音频输入通道参数.
int IMP_AENC_ReleaseStream(int aeChn, IMPAudioStream *stream)
释放从音频编码通道获取的码流.
高等级级别噪声抑制
Definition: imp_audio.h:252
int IMP_AO_CacheSwitch(int audioDevId, int aoChn, int cache_en)
关闭音频播放缓存机制
int IMP_AO_EnableAgc(IMPAudioIOAttr *attr, IMPAudioAgcConfig agcConfig)
启用音频输出的自动增益功能.
int IMP_ADEC_CreateChn(int adChn, IMPAudioDecChnAttr *attr)
创建音频解码通道.
IMPAudioSampleRate
音频采样率定义.
Definition: imp_audio.h:92
int IMP_AO_EnableHpf(IMPAudioIOAttr *attr)
启用音频输出的高通滤波.
int IMP_AI_SetVolMute(int audioDevId, int aiChn, int mute)
设置音频输入静音.
96KHz采样率
Definition: imp_audio.h:98
双声道
Definition: imp_audio.h:113
int Rev
保留
Definition: imp_audio.h:167
int len
音频帧长度
Definition: imp_audio.h:159
int IMP_AO_GetPubAttr(int audioDevId, IMPAudioIOAttr *attr)
获取音频输入输出设备属性.
int IMP_AENC_GetStream(int aeChn, IMPAudioStream *stream, IMPBlock block)
获取编码后码流.
音频输入输出设备属性.
Definition: imp_audio.h:140
int IMP_AI_GetFrameAndRef(int audioDevId, int aiChn, IMPAudioFrame *frm, IMPAudioFrame *ref, IMPBlock block)
获取音频帧和输出参考帧.
uint32_t * virAddr
音频帧数据虚拟地址
Definition: imp_audio.h:155
int chnBusyNum
被占用的缓存块数
Definition: imp_audio.h:176
int IMP_AI_DisableHpf(void)
禁用AI高通滤波功能.
int IMP_AO_GetVol(int audioDevId, int aoChn, int *vol)
获取音频输出通道音量.
int IMP_ADEC_GetStream(int adChn, IMPAudioStream *stream, IMPBlock block)
获取解码后码流.
uint32_t phyAddr
音频帧数据物理地址
Definition: imp_audio.h:156
int numPerFrm
每帧的采样点个数
Definition: imp_audio.h:145
int64_t timeStamp
音频帧数据时间戳
Definition: imp_audio.h:157
int IMP_AI_Enable(int audioDevId)
启用音频输入设备.
单声道
Definition: imp_audio.h:112
int chnFreeNum
空闲缓存块数
Definition: imp_audio.h:175
最高等级级别噪声抑制
Definition: imp_audio.h:253
int IMP_ADEC_ReleaseStream(int adChn, IMPAudioStream *stream)
释放从音频解码通道获取的码流.
int IMP_AO_SetGain(int audioDevId, int aoChn, int aoGain)
设置音频输出增益.
非阻塞
Definition: imp_audio.h:86
int IMP_AI_EnableNs(IMPAudioIOAttr *attr, int mode)
启用指定音频输入的噪声抑制功能.
IMPAudioBitWidth bitwidth
音频采样精度
Definition: imp_audio.h:142
int IMP_AO_DisableHpf(void)
禁用AO高通滤波功能.
int IMP_AI_EnableAecRefFrame(int audioDevId, int aiChn, int audioAoDevId, int aoChn)
打开获取参考帧.
音频通道参数结构体.
Definition: imp_audio.h:165
IMPAudioSampleRate samplerate
音频采样率
Definition: imp_audio.h:141
int IMP_AI_SetVol(int audioDevId, int aiChn, int aiVol)
ACODEC配置.