基于webrtc的gips 语音引擎库及测试程序

测试程序源代码下载地址:http://download.csdn.net/detail/dotphoenix/3674515

gips库头文件解释:

#pragma once


#ifdef LIBGIPS_WEBRTC_EXPORTS
#define LIB_GIPSVE_API extern "C" __declspec(dllexport)
#else
#define LIB_GIPSVE_API extern "C" __declspec(dllimport)
#endif




/*
所有的函数都应该返回true,否则出错,应该使用GIPSVE_LastError来取得出错的原因。
不需返回true的函数包括:
*/


struct PPCodec
{
int pltype;
char plname[32];
int plfreq;
int pacsize;
int channels;
int rate;
};




//必需先调用这个函数,并且确保返回值是0,否则以后所有的调用都可能引起异常.本函数多次调用不会有异常
LIB_GIPSVE_API bool GIPSVE_Init(char* szAuthtication, int iYear, int iMonth, int iDay);


//如果调用了GIPSVE_Init(),则最后必须调用这个函数,否则会有大量的资源泄露
LIB_GIPSVE_API void GIPSVE_UnInit();


//创建一个Channel,Channel的值必须>= 0 ,否则出错
LIB_GIPSVE_API int GIPSVE_CreateChannel();


//删除一个Channel
LIB_GIPSVE_API bool GIPSVE_DeleteChannel(int channel);




//设置目的地址的ip和port
LIB_GIPSVE_API bool GIPSVE_SetSendDestination(int channel, char* ip, unsigned short port);


//设置本地的port
LIB_GIPSVE_API bool GIPSVE_SetLocalReceiver(int channel, unsigned short port);


//取得当前的codec类型
LIB_GIPSVE_API bool GIPSVE_GetSendCodec(int channel, PPCodec& codec);


//设置codec的类型
LIB_GIPSVE_API bool GIPSVE_SetSendCodec(int channel, const PPCodec& codec);


//开始播放声音
LIB_GIPSVE_API bool GIPSVE_StartPlayout(int channel);


//停止播放声音
LIB_GIPSVE_API bool GIPSVE_StopPlayout(int channel);


//开始发送数据
LIB_GIPSVE_API bool GIPSVE_StartSend(int channel);


//停止发送数据
LIB_GIPSVE_API bool GIPSVE_StopSend(int channel);


//开始接收数据
LIB_GIPSVE_API bool GIPSVE_StartListen(int channel);


//停止接收数据
LIB_GIPSVE_API bool GIPSVE_StopListen(int channel);


//使用自定义的传输方式,Free版不支持
LIB_GIPSVE_API bool GIPSVE_UseExternalTransport(int channel, int use, void* externalTransport = NULL);
//Free版不支持
LIB_GIPSVE_API bool GIPSVE_UseExternalMediaProcessIn(int channel, int use, void* externalMedia = NULL);


//使用自定义媒体处理方式,Free版不支持
LIB_GIPSVE_API bool GIPSVE_UseExternalMediaProcessOut(int channel, int use, void* externalMedia = NULL);
//
LIB_GIPSVE_API bool GIPSVE_UseExternalEncryption(int channel, int use, void* externalEncryption);




//用文件里面的声音代替 microphone, 文件内容必须是 16kHz的PCM
//Free版不支持
LIB_GIPSVE_API bool GIPSVE_PlayFileIn(int channel, char* filepath);
//
LIB_GIPSVE_API bool GIPSVE_StopPlayFileIn(int channel);


//用文件里的内容代替收到的远端数据, 文件内容必须是 16kHz的PCM
//Free版不支持
LIB_GIPSVE_API bool GIPSVE_PlayFileOut(int channel, char* filepath);
//
LIB_GIPSVE_API bool GIPSVE_StopPlayFileOut(int channel);




/*
设置degree of bandwidth reduction
0 lowest reduction
1
2
3 means highest reduction
set = false means not set, true means set.
*/


LIB_GIPSVE_API bool GIPSVE_SetVadMode(int channel, bool set, int mode);
LIB_GIPSVE_API bool GIPSVE_GetVadMode(int channel, bool& enabled, int& mode);
//设置静音
LIB_GIPSVE_API bool GIPSVE_SetMute(int channel, bool mute);


//使用SRTP,Free版不支持
LIB_GIPSVE_API bool GIPSVE_UseSRTPTx(int channel, int useForRTP, int useForRTCP);
//Free版不支持
LIB_GIPSVE_API bool GIPSVE_UseSRTPRx(int channel, int useForRTP, int useForRTCP);




//0 holds  all, 1 holds send, 2 holds play
//Free版不支持,Commercial支持
LIB_GIPSVE_API bool GIPSVE_SetHoldMode(int channel, bool held, int mode);


//
LIB_GIPSVE_API bool GIPSVE_GetHoldMode( int channel, bool& held, int& mode);








/*
设置接收端的Automatic Gain Control(AGC)的类型
0 预设模式
1 平台默认
2 adaptive mode for use when analog volume control exists (e.g. for PC softphone)
3 scaling takes place in the digital domain (e.g. for conference servers and embedded devices)
4 can be used on embedded devices where the the capture signal is level is predictable
*/
LIB_GIPSVE_API bool GIPSVE_SetRxAgcMode(int channel, bool enabled, int mode);


//取得接收端的Automatic Gain Control(AGC)的类型
LIB_GIPSVE_API bool GIPSVE_GetRxAgcMode(int channel, bool& enabled, int mode);


/*
设置接收端的Noise Suppression级别


0  previously set mode
1,         // platform default
2,      // conferencing default
3,  // lowest suppression
4,
5,
6,     // highest suppression
*/
LIB_GIPSVE_API bool GIPSVE_SetRxNsMode(int channel, bool enabled, int mode);


//
LIB_GIPSVE_API bool GIPSVE_GetRxNsMode(int channel, bool& enabled, int& mode);


//Free版不支持
LIB_GIPSVE_API bool GIPSVE_StartRecordingMicrophone(char* filepath); //默认为mono 16kHz pcm


//Free版不支持
LIB_GIPSVE_API bool GIPSVE_StopRecrodingMicrophone();
//当前不支持
LIB_GIPSVE_API bool GIPSVE_StartRecordingPlayout(int channel, char* filepath);
//
LIB_GIPSVE_API bool GIPSVE_StopRecordingPlayout(int channel);






LIB_GIPSVE_API bool GIPSVE_SetAgcMode(bool enabled, int mode);


LIB_GIPSVE_API bool GIPSVE_GetAgcMode(bool& enabled, int& mode);
LIB_GIPSVE_API bool GIPSVE_SetNsMode(bool enabled, int mode);


LIB_GIPSVE_API bool GIPSVE_GetNsMode(bool& enabled, int& mode);
/*
设置发送方的Echo Control (EC)类型
0  previously set mode
1  platform default
2  conferencing default (aggressive AEC)
3  Acoustic Echo Cancellation
4  AEC mobile
*/
LIB_GIPSVE_API bool GIPSVE_SetEcMode(bool enabled, int mode);


LIB_GIPSVE_API bool GIPSVE_GetEcMode(bool& enabled, int& mode);




LIB_GIPSVE_API bool GIPSVE_GetCPULoad(int& loadPercent);


//
LIB_GIPSVE_API bool GIPSVE_GetSystemCPULoad(int& loadPercent);




LIB_GIPSVE_API int GIPSVE_GetNumberOfCodecs();


//取得指定index的Codec
LIB_GIPSVE_API bool GIPSVE_GetCodec(int index, PPCodec& codec);


//取得Playout设备的数目
LIB_GIPSVE_API bool GIPSVE_GetNumberOfPlayoutDevice(int& nb);


//取得指定index的Playout设备的名字
LIB_GIPSVE_API bool GIPSVE_GetPlayoutDeviceName(int index, char name[128], char guid[128]);


//取得Recording设备的数目
LIB_GIPSVE_API bool GIPSVE_GetNumberOfRecordingDevice(int& nb);


//取得指定index的Recording设备的名字
LIB_GIPSVE_API bool GIPSVE_GetRecordingDeviceName(int index, char name[128], char guid[128]);




//设置想要使用的Playout设备的index,index值位于0到GetNumberOfPlayoutDevice()之间
//Free版不支持,Commercial支持
LIB_GIPSVE_API bool GIPSVE_SetPlayoutDevice(int index);


//设置想要使用的Recording设备的index,index值位于0到GetNumberOfRecordingDevice()之间
//Free版不支持,Commercial支持
LIB_GIPSVE_API bool GIPSVE_SetRecordingDevice(int index);




//取得当前speaker的volume,值位于0-255之间
LIB_GIPSVE_API bool GIPSVE_GetMicVolume(unsigned int& volume);


//设置Speaker的音量,volume必须位于0-255之间
LIB_GIPSVE_API bool GIPSVE_SetMicVolume(unsigned int volume);


//取得当前speaker的volume,值位于0-255之间
LIB_GIPSVE_API bool GIPSVE_GIPSVE_GetSpeakerVolume(unsigned int& volume);


//设置Speaker的音量,volume必须位于0-255之间
LIB_GIPSVE_API bool GIPSVE_SetSpeakerVolume(unsigned int volume);


//暂不支持该函数
LIB_GIPSVE_API bool GIPSVE_GetInnerVersionInfo(char version[1024]);


//返回版本(该版本的编译时间)
LIB_GIPSVE_API bool GIPSVE_GetVersionInfo(char version[64]);


//如果任何函数的调用返回了非0值,可以调用这个函数来取得错误的原因
LIB_GIPSVE_API int GIPSVE_LastError();
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值