• AnyChatCoreSDK.h


      1 #ifndef ANYCHATCORESDK_H
      2 #define ANYCHATCORESDK_H
      3 
      4 #include <windows.h>
      5 #include <stdlib.h>
      6 #include <stdio.h>
      7 #include "BRAnyChatCoreSDK.h"
      8 
      9 // 初始化系统
     10 BRAC_API DWORD BRAC_InitSDK(HWND hWnd, DWORD dwFuncMode);
     11 typedef DWORD (_cdecl * BRAC_InitSDK_Func)(HWND hWnd, DWORD dwFuncMode);
     12 
     13 // 获取SDK版本信息
     14 BRAC_API DWORD BRAC_GetSDKVersion(DWORD& dwMainVer, DWORD& dwSubVer, LPSTR lpCompileTime, DWORD dwBufLen);
     15 typedef DWORD(_cdecl * BRAC_GetSDKVersion_Func)(DWORD& dwMainVer, DWORD& dwSubVer, LPSTR lpCompileTime, DWORD dwBufLen);
     16 
     17 // 激活(关闭)SDK调用日志
     18 BRAC_API DWORD BRAC_ActiveCallLog(BOOL bActive);
     19 typedef DWORD(_cdecl * BRAC_ActiveCallLog_Func)(BOOL bActive);
     20 
     21 // SDK内核参数设置
     22 BRAC_API DWORD BRAC_SetSDKOption(int optname, const char FAR* optval, int optlen);
     23 typedef DWORD(_cdecl * BRAC_SetSDKOption_Func)(int optname, const char FAR* optval, int optlen);
     24 
     25 // 设置服务器验证密码(可用于阻止非法用户用SDK连接服务器,合法用户可正常连接)
     26 BRAC_API DWORD BRAC_SetServerAuthPass(LPCTSTR lpPassword);
     27 typedef DWORD(_cdecl * BRAC_SetServerAuthPass_Func)(LPCTSTR lpPassword);
     28 
     29 
     30 // 设置视频数据回调函数
     31 BRAC_API DWORD BRAC_SetVideoDataCallBack(BRAC_PixelFormat pixFmt, BRAC_VideoData_CallBack lpFunction, LPVOID lpUserValue);
     32 typedef DWORD(_cdecl * BRAC_SetVideoDataCallBack_Func)(BRAC_PixelFormat pixFmt, BRAC_VideoData_CallBack lpFunction, LPVOID lpUserValue);
     33 // 设置音频数据回调函数
     34 BRAC_API DWORD BRAC_SetAudioDataCallBack(BRAC_AudioData_CallBack lpFunction, LPVOID lpUserValue);
     35 typedef DWORD(_cdecl * BRAC_SetAudioDataCallBack_Func)(BRAC_AudioData_CallBack lpFunction, LPVOID lpUserValue);
     36 // 设置音量变化回调函数
     37 BRAC_API DWORD BRAC_SetVolumeChangeCallBack(BRAC_VolumeChange_CallBack lpFunction, LPVOID lpUserValue);
     38 typedef DWORD(_cdecl * BRAC_SetVolumeChangeCallBack_Func)(BRAC_VolumeChange_CallBack lpFunction, LPVOID lpUserValue);
     39 // 设置透明通道数据扩展回调函数
     40 BRAC_API DWORD BRAC_SetTransBufferExCallBack(BRAC_TransBufferEx_CallBack lpFunction, LPVOID lpUserValue);
     41 typedef DWORD(_cdecl * BRAC_SetTransBufferExCallBack_Func)(BRAC_TransBufferEx_CallBack lpFunction, LPVOID lpUserValue);
     42 // 设置透明通道数据回调函数
     43 BRAC_API DWORD BRAC_SetTransBufferCallBack(BRAC_TransBuffer_CallBack lpFunction, LPVOID lpUserValue);
     44 typedef DWORD(_cdecl * BRAC_SetTransBufferCallBack_Func)(BRAC_TransBuffer_CallBack lpFunction, LPVOID lpUserValue);
     45 // 设置文件传输回调函数
     46 BRAC_API DWORD BRAC_SetTransFileCallBack(BRAC_TransFile_CallBack lpFunction, LPVOID lpUserValue);
     47 typedef DWORD(_cdecl * BRAC_SetTransFileCallBack_Func)(BRAC_TransFile_CallBack lpFunction, LPVOID lpUserValue);
     48 // 设置录像快照任务完成通知回调函数
     49 BRAC_API DWORD BRAC_SetRecordSnapShotCallBack(BRAC_RecordSnapShot_CallBack lpFunction, LPVOID lpUserValue);
     50 typedef DWORD(_cdecl * BRAC_SetRecordSnapShotCallBack_Func)(BRAC_RecordSnapShot_CallBack lpFunction, LPVOID lpUserValue);
     51 // 设置SDK Filter通信数据回调函数定义
     52 BRAC_API DWORD BRAC_SetSDKFilterDataCallBack(BRAC_SDKFilterData_CallBack lpFunction, LPVOID lpUserValue);
     53 typedef DWORD(_cdecl * BRAC_SetSDKFilterDataCallBack_Func)(BRAC_SDKFilterData_CallBack lpFunction, LPVOID lpUserValue);
     54 // 设置异步消息通知回调函数
     55 BRAC_API DWORD BRAC_SetNotifyMessageCallBack(BRAC_NotifyMessage_CallBack lpFunction, LPVOID lpUserValue);
     56 typedef DWORD(_cdecl * BRAC_SetNotifyMessageCallBack_Func)(BRAC_NotifyMessage_CallBack lpFunction, LPVOID lpUserValue);
     57 // 设置文字消息回调函数
     58 BRAC_API DWORD BRAC_SetTextMessageCallBack(BRAC_TextMessage_CallBack lpFunction, LPVOID lpUserValue);
     59 typedef DWORD(_cdecl * BRAC_SetTextMessageCallBack_Func)(BRAC_TextMessage_CallBack lpFunction, LPVOID lpUserValue);
     60 
     61 
     62 
     63 
     64 // 连接服务器
     65 BRAC_API DWORD BRAC_Connect(LPCTSTR lpServerAddr, DWORD dwPort);
     66 typedef DWORD(_cdecl * BRAC_Connect_Func)(LPCTSTR lpServerAddr, DWORD dwPort);
     67 // 登录系统
     68 BRAC_API DWORD BRAC_Login(LPCTSTR lpUserName, LPCTSTR lpPassword, DWORD dwPassEncType);
     69 typedef DWORD(_cdecl * BRAC_Login_Func)(LPCTSTR lpUserName, LPCTSTR lpPassword, DWORD dwPassEncType);
     70 // 进入房间
     71 BRAC_API DWORD BRAC_EnterRoom(DWORD dwRoomid, LPCTSTR lpRoomPass, DWORD dwPassEncType);
     72 typedef DWORD(_cdecl * BRAC_EnterRoom_Func)(DWORD dwRoomid, LPCTSTR lpRoomPass, DWORD dwPassEncType);
     73 // 进入房间
     74 BRAC_API DWORD BRAC_EnterRoomEx(LPCTSTR lpRoomName, LPCTSTR lpRoomPass);
     75 typedef DWORD(_cdecl * BRAC_EnterRoomEx_Func)(LPCTSTR lpRoomName, LPCTSTR lpRoomPass);
     76 // 离开房间
     77 BRAC_API DWORD BRAC_LeaveRoom(DWORD dwRoomid);
     78 typedef DWORD(_cdecl * BRAC_LeaveRoom_Func)(DWORD dwRoomid);
     79 // 注销系统
     80 BRAC_API DWORD BRAC_Logout(VOID);
     81 typedef DWORD(_cdecl * BRAC_Logout_Func)(VOID);
     82 
     83 
     84 // 操作用户视频
     85 BRAC_API DWORD BRAC_UserCameraControl(DWORD dwUserid, BOOL bOpen);
     86 typedef DWORD(_cdecl * BRAC_UserCameraControl_Func)(DWORD dwUserid, BOOL bOpen);
     87 // 操作用户语音
     88 BRAC_API DWORD BRAC_UserSpeakControl(DWORD dwUserid, BOOL bOpen);
     89 typedef DWORD(_cdecl * BRAC_UserSpeakControl_Func)(DWORD dwUserid, BOOL bOpen);
     90 // 设置视频显示位置
     91 BRAC_API DWORD BRAC_SetVideoPos(DWORD dwUserid, HWND hWnd, DWORD dwLeft, DWORD dwTop, DWORD dwRight, DWORD dwBottom);
     92 typedef DWORD(_cdecl * BRAC_SetVideoPos_Func)(DWORD dwUserid, HWND hWnd, DWORD dwLeft, DWORD dwTop, DWORD dwRight, DWORD dwBottom);
     93 // 获取指定音频设备的当前音量
     94 BRAC_API DWORD BRAC_AudioGetVolume(BRAC_AudioDevice device, DWORD& dwVolume);
     95 typedef DWORD(_cdecl * BRAC_AudioGetVolume_Func)(BRAC_AudioDevice device, DWORD& dwVolume);
     96 // 设置指定音频设备的音量
     97 BRAC_API DWORD BRAC_AudioSetVolume(BRAC_AudioDevice device, DWORD dwVolume);
     98 typedef DWORD(_cdecl * BRAC_AudioSetVolume_Func)(BRAC_AudioDevice device, DWORD dwVolume);
     99 
    100 // 获取当前房间在线用户列表
    101 BRAC_API DWORD BRAC_GetOnlineUser(LPDWORD lpUserIDArray, DWORD& dwUserNum);
    102 typedef DWORD(_cdecl * BRAC_GetOnlineUser_Func)(LPDWORD lpUserIDArray, DWORD& dwUserNum);
    103 // 查询用户摄像头的状态
    104 BRAC_API DWORD BRAC_GetCameraState(DWORD dwUserid, DWORD& dwState);
    105 typedef DWORD(_cdecl * BRAC_GetCameraState_Func)(DWORD dwUserid, DWORD& dwState);
    106 // 查询用户名称
    107 BRAC_API DWORD BRAC_GetUserName(DWORD dwUserid, CHAR* lpUserName, DWORD dwLen);
    108 typedef DWORD(_cdecl * BRAC_GetUserName_Func)(DWORD dwUserid, CHAR* lpUserName, DWORD dwLen);
    109 // 查询房间名称
    110 BRAC_API DWORD BRAC_GetRoomName(DWORD dwRoomId, CHAR* lpRoomName, DWORD dwLen);
    111 typedef DWORD(_cdecl * BRAC_GetRoomName_Func)(DWORD dwRoomId, CHAR* lpRoomName, DWORD dwLen);
    112 // 显示本地视频画面调节对话框
    113 BRAC_API DWORD BRAC_ShowLVProperty(HWND hParent, LPCTSTR szCaption, DWORD dwX ,DWORD dwY);
    114 typedef DWORD(_cdecl * BRAC_ShowLVProperty_Func)(HWND hParent, LPCTSTR szCaption, DWORD dwX ,DWORD dwY);
    115 
    116 // 枚举本地视频采集设备
    117 BRAC_API DWORD BRAC_EnumVideoCapture(CHAR** lpDeviceName, DWORD& dwDeviceNum);
    118 typedef DWORD(_cdecl * BRAC_EnumVideoCapture_Func)(CHAR** lpDeviceName, DWORD& dwDeviceNum);
    119 // 枚举本地音频采集设备
    120 BRAC_API DWORD BRAC_EnumAudioCapture(CHAR** lpDeviceName, DWORD& dwDeviceNum);
    121 typedef DWORD(_cdecl * BRAC_EnumAudioCapture_Func)(CHAR** lpDeviceName, DWORD& dwDeviceNum);
    122 // 选择指定的视频采集设备
    123 BRAC_API DWORD BRAC_SelectVideoCapture(LPCTSTR szCaptureName);
    124 typedef DWORD(_cdecl *BRAC_SelectVideoCapture_Func)(LPCTSTR szCaptureName);
    125 // 选择指定的音频采集设备
    126 BRAC_API DWORD BRAC_SelectAudioCapture(LPCTSTR szCaptureName);
    127 typedef DWORD(_cdecl * BRAC_SelectAudioCapture_Func)(LPCTSTR szCaptureName);
    128 // 获取当前使用的视频采集设备
    129 BRAC_API DWORD BRAC_GetCurVideoCapture(CHAR* lpDeviceName, DWORD dwLen);
    130 typedef DWORD(_cdecl * BRAC_GetCurVideoCapture_Func)(CHAR* lpDeviceName, DWORD dwLen);
    131 // 获取当前使用的音频采集设备
    132 BRAC_API DWORD BRAC_GetCurAudioCapture(CHAR* lpDeviceName, DWORD dwLen);
    133 typedef DWORD(_cdecl * BRAC_GetCurAudioCapture_Func)(CHAR* lpDeviceName, DWORD dwLen);
    134 
    135 // 用户音、视频录制
    136 BRAC_API DWORD BRAC_StreamRecordCtrl(DWORD dwUserId, BOOL bStartRecord, DWORD dwFlags, DWORD dwParam);
    137 typedef DWORD(_cdecl* BRAC_StreamRecordCtrl_Func)(DWORD dwUserId, BOOL bStartRecord, DWORD dwFlags, DWORD dwParam);
    138 // 对用户的视频进行抓拍(快照)
    139 BRAC_API DWORD BRAC_SnapShot(DWORD dwUserId, DWORD dwFlags, DWORD dwParam);
    140 typedef DWORD(_cdecl* BRAC_SnapShot_Func)(DWORD dwUserId, DWORD dwFlags, DWORD dwParam);
    141 
    142 // 透明通道传送缓冲区
    143 BRAC_API DWORD BRAC_TransBuffer(DWORD dwUserid, LPBYTE lpBuf, DWORD dwLen);
    144 typedef DWORD(_cdecl * BRAC_TransBuffer_Func)(DWORD dwUserid, LPBYTE lpBuf, DWORD dwLen);
    145 // 透明通道传送缓冲区扩展
    146 BRAC_API DWORD BRAC_TransBufferEx(DWORD dwUserid, LPBYTE lpBuf, DWORD dwLen, DWORD wParam, DWORD lParam, DWORD dwFlags, DWORD& dwTaskId);
    147 typedef DWORD(_cdecl * BRAC_TransBufferEx_Func)(DWORD dwUserid, LPBYTE lpBuf, DWORD dwLen, DWORD wParam, DWORD lParam, DWORD dwFlags, DWORD& dwTaskId);
    148 // 传送文件
    149 BRAC_API DWORD BRAC_TransFile(DWORD dwUserid, LPCTSTR lpLocalPathName, DWORD wParam, DWORD lParam, DWORD dwFlags, DWORD& dwTaskId);
    150 typedef DWORD(_cdecl * BRAC_TransFile_Func)(DWORD dwUserid, LPCTSTR lpLocalPathName, DWORD wParam, DWORD lParam, DWORD dwFlags, DWORD& dwTaskId);
    151 // 取消传输任务
    152 BRAC_API DWORD BRAC_CancelTransTask(DWORD dwUserid, DWORD dwTaskId);
    153 typedef DWORD(_cdecl * BRAC_CancelTransTask_Func)(DWORD dwUserid, DWORD dwTaskId);
    154 // 传送文本消息
    155 BRAC_API DWORD BRAC_SendTextMessage(DWORD dwUserid, BOOL bSecret, LPCTSTR lpMsgBuf, DWORD dwLen);
    156 typedef DWORD(_cdecl * BRAC_SendTextMessage_Func)(DWORD dwUserid, BOOL bSecret, LPCTSTR lpMsgBuf, DWORD dwLen);
    157 // 查询传输任务相关信息
    158 BRAC_API DWORD BRAC_QueryTransTaskInfo(DWORD dwUserid, DWORD dwTaskId, int infoname, char FAR* infoval, int infolen);
    159 typedef DWORD(_cdecl * BRAC_QueryTransTaskInfo_Func)(DWORD dwUserid, DWORD dwTaskId, int infoname, char FAR* infoval, int infolen);
    160 // 发送SDK Filter 通信数据
    161 BRAC_API DWORD BRAC_SendSDKFilterData(LPBYTE lpBuf, DWORD dwLen);
    162 typedef DWORD(_cdecl * BRAC_SendSDKFilterData_Func)(LPBYTE lpBuf, DWORD dwLen);
    163 
    164 // 查询指定用户相关状态
    165 BRAC_API DWORD BRAC_QueryUserState(DWORD dwUserId, int infoname, char FAR* infoval, int infolen);
    166 typedef DWORD(_cdecl * BRAC_QueryUserState_Func)(DWORD dwUserId, int infoname, char FAR* infoval, int infolen);
    167 
    168 // 释放所有资源
    169 BRAC_API DWORD BRAC_Release(VOID);
    170 typedef DWORD(_cdecl * BRAC_Release_Func)(VOID);
    171 
    172 
    173 #ifdef __cplusplus
    174 extern "C"
    175 {
    176 #endif /* __cplusplus */
    177 
    178         static HINSTANCE  g_BRACModule=NULL;
    179         static DWORD    g_dwBRACModule_Count = 0;
    180 
    181         static BRAC_InitSDK_Func                    g_BRAC_InitSDK_Func = NULL;
    182         static BRAC_GetSDKVersion_Func                g_BRAC_GetSDKVersion_Func = NULL;
    183         static BRAC_ActiveCallLog_Func                g_BRAC_ActiveCallLog_Func = NULL;
    184         static BRAC_SetSDKOption_Func                g_BRAC_SetSDKOption_Func = NULL;
    185         static BRAC_SetVideoDataCallBack_Func        g_BRAC_SetVideoDataCallBack_Func = NULL;
    186         static BRAC_SetAudioDataCallBack_Func        g_BRAC_SetAudioDataCallBack_Func = NULL;
    187         static BRAC_SetVolumeChangeCallBack_Func    g_BRAC_SetVolumeChangeCallBack_Func = NULL;
    188         static BRAC_SetTransBufferExCallBack_Func    g_BRAC_SetTransBufferExCallBack_Func = NULL;
    189         static BRAC_SetTransBufferCallBack_Func        g_BRAC_SetTransBufferCallBack_Func = NULL;
    190         static BRAC_SetTransFileCallBack_Func        g_BRAC_SetTransFileCallBack_Func = NULL;
    191         static BRAC_SetRecordSnapShotCallBack_Func  g_BRAC_SetRecordSnapShotCallBack_Func = NULL;
    192         static BRAC_SetSDKFilterDataCallBack_Func   g_BRAC_SetSDKFilterDataCallBack_Func = NULL;
    193         static BRAC_AudioGetVolume_Func                g_BRAC_AudioGetVolume_Func = NULL;
    194         static BRAC_SetServerAuthPass_Func            g_BRAC_SetServerAuthPass_Func = NULL;
    195         static BRAC_Connect_Func                    g_BRAC_Connect_Func = NULL;
    196         static BRAC_Login_Func                        g_BRAC_Login_Func = NULL;
    197         static BRAC_SetNotifyMessageCallBack_Func    g_BRAC_SetNotifyMessageCallBack_Func = NULL;
    198         static BRAC_SetTextMessageCallBack_Func        g_BRAC_SetTextMessageCallBack_Func = NULL;
    199         static BRAC_GetUserName_Func                g_BRAC_GetUserName_Func = NULL;
    200         static BRAC_GetRoomName_Func                g_BRAC_GetRoomName_Func = NULL;
    201         static BRAC_EnterRoom_Func                    g_BRAC_EnterRoom_Func = NULL;
    202         static BRAC_SetVideoPos_Func                g_BRAC_SetVideoPos_Func = NULL;
    203         static BRAC_UserCameraControl_Func            g_BRAC_UserCameraControl_Func = NULL;
    204         static BRAC_UserSpeakControl_Func            g_BRAC_UserSpeakControl_Func = NULL;
    205         static BRAC_AudioSetVolume_Func                g_BRAC_AudioSetVolume_Func = NULL;
    206         static BRAC_Release_Func                    g_BRAC_Release_Func = NULL;
    207         static BRAC_EnterRoomEx_Func                g_BRAC_EnterRoomEx_Func = NULL;
    208         static BRAC_LeaveRoom_Func                    g_BRAC_LeaveRoom_Func = NULL;
    209         static BRAC_GetOnlineUser_Func                g_BRAC_GetOnlineUser_Func = NULL;
    210         static BRAC_GetCameraState_Func                g_BRAC_GetCameraState_Func = NULL;
    211         static BRAC_Logout_Func                        g_BRAC_Logout_Func = NULL;
    212         static BRAC_TransFile_Func                    g_BRAC_TransFile_Func = NULL;
    213         static BRAC_QueryTransTaskInfo_Func            g_BRAC_QueryTransTaskInfo_Func = NULL;
    214         static BRAC_QueryUserState_Func                g_BRAC_QueryUserState_Func = NULL;
    215         static BRAC_TransBufferEx_Func                g_BRAC_TransBufferEx_Func = NULL;
    216         static BRAC_TransBuffer_Func                g_BRAC_TransBuffer_Func = NULL;
    217         static BRAC_CancelTransTask_Func            g_BRAC_CancelTransTask_Func = NULL;
    218         static BRAC_SendTextMessage_Func            g_BRAC_SendTextMessage_Func = NULL;
    219         static BRAC_ShowLVProperty_Func                g_BRAC_ShowLVProperty_Func = NULL;
    220         static BRAC_SelectVideoCapture_Func            g_BRAC_SelectVideoCapture_Func = NULL;
    221         static BRAC_SelectAudioCapture_Func            g_BRAC_SelectAudioCapture_Func = NULL;
    222         static BRAC_EnumVideoCapture_Func            g_BRAC_EnumVideoCapture_Func = NULL;
    223         static BRAC_GetCurVideoCapture_Func            g_BRAC_GetCurVideoCapture_Func = NULL;
    224         static BRAC_EnumAudioCapture_Func            g_BRAC_EnumAudioCapture_Func = NULL;
    225         static BRAC_GetCurAudioCapture_Func            g_BRAC_GetCurAudioCapture_Func = NULL;
    226         static BRAC_SendSDKFilterData_Func            g_BRAC_SendSDKFilterData_Func = NULL;
    227         static BRAC_StreamRecordCtrl_Func            g_BRAC_StreamRecordCtrl_Func = NULL;
    228         static BRAC_SnapShot_Func                    g_BRAC_SnapShot_Func = NULL;
    229 
    230 
    231 
    232 #ifdef WIN32
    233     #define BRAC_DLL_ASSIGN(_Name) 
    234     g_BRAC_##_Name##_Func = (BRAC_##_Name##_Func)GetProcAddress(g_BRACModule,"BRAC_"#_Name); 
    235         if (g_BRAC_##_Name##_Func == NULL) Errors++;
    236 #else
    237     #define BRAC_DLL_ASSIGN(_Name) 
    238     g_BRAC_##_Name##_Func = (BRAC_##_Name##_Func)dlsym(g_BRACModule,"BRAC_"#_Name); 
    239         if (g_BRAC_##_Name##_Func == NULL) Errors++;
    240 #endif
    241 
    242         static BOOL BRAC_DLL_Load(LPCTSTR szPathName)
    243         {
    244                 if (g_dwBRACModule_Count > 0)
    245                 {
    246                         g_dwBRACModule_Count++;
    247                         return TRUE;
    248                 }
    249 
    250                 /* Load library */
    251 #ifdef WIN32
    252                 g_BRACModule = LoadLibraryEx(szPathName,NULL,LOAD_WITH_ALTERED_SEARCH_PATH);
    253 #else
    254         g_BRACModule = dlopen(szPathName,RTLD_NOW);
    255 #endif
    256                 if (!g_BRACModule)
    257                 {
    258                         CHAR szErrorMsg[1024] = {0};
    259 #ifdef WIN32
    260                         _snprintf(szErrorMsg,sizeof(szErrorMsg),"LoadLibrary %s Error:%d",szPathName,GetLastError());
    261 #else
    262                         _snprintf(szErrorMsg,sizeof(szErrorMsg),"LoadLibrary %s Error:%s",szPathName,dlerror());
    263 #endif
    264 //...            TRACE(szErrorMsg);
    265                         return FALSE;
    266                 }
    267 
    268                 DWORD Errors=0;
    269                 BRAC_DLL_ASSIGN(InitSDK);
    270                 BRAC_DLL_ASSIGN(GetSDKVersion);
    271                 BRAC_DLL_ASSIGN(ActiveCallLog);
    272                 BRAC_DLL_ASSIGN(SetSDKOption);
    273                 BRAC_DLL_ASSIGN(SetVideoDataCallBack);
    274                 BRAC_DLL_ASSIGN(SetAudioDataCallBack);
    275                 BRAC_DLL_ASSIGN(SetVolumeChangeCallBack);
    276                 BRAC_DLL_ASSIGN(SetTransBufferExCallBack);
    277                 BRAC_DLL_ASSIGN(SetTransBufferCallBack);
    278                 BRAC_DLL_ASSIGN(SetTransFileCallBack);
    279                 BRAC_DLL_ASSIGN(SetRecordSnapShotCallBack);
    280                 BRAC_DLL_ASSIGN(SetSDKFilterDataCallBack);
    281                 BRAC_DLL_ASSIGN(AudioGetVolume);
    282                 BRAC_DLL_ASSIGN(SetServerAuthPass);
    283                 BRAC_DLL_ASSIGN(Connect);
    284                 BRAC_DLL_ASSIGN(Login);
    285                 BRAC_DLL_ASSIGN(SetNotifyMessageCallBack);
    286                 BRAC_DLL_ASSIGN(SetTextMessageCallBack);
    287                 BRAC_DLL_ASSIGN(GetUserName);
    288                 BRAC_DLL_ASSIGN(GetRoomName);
    289                 BRAC_DLL_ASSIGN(EnterRoom);
    290                 BRAC_DLL_ASSIGN(SetVideoPos);
    291                 BRAC_DLL_ASSIGN(UserCameraControl);
    292                 BRAC_DLL_ASSIGN(UserSpeakControl);
    293                 BRAC_DLL_ASSIGN(AudioSetVolume);
    294                 BRAC_DLL_ASSIGN(Release);
    295                 BRAC_DLL_ASSIGN(EnterRoomEx);
    296                 BRAC_DLL_ASSIGN(LeaveRoom);
    297                 BRAC_DLL_ASSIGN(GetOnlineUser);
    298                 BRAC_DLL_ASSIGN(GetCameraState);
    299                 BRAC_DLL_ASSIGN(Logout);
    300                 BRAC_DLL_ASSIGN(TransFile);
    301                 BRAC_DLL_ASSIGN(QueryTransTaskInfo);
    302                 BRAC_DLL_ASSIGN(QueryUserState);
    303                 BRAC_DLL_ASSIGN(TransBufferEx);
    304                 BRAC_DLL_ASSIGN(TransBuffer);
    305                 BRAC_DLL_ASSIGN(CancelTransTask);
    306                 BRAC_DLL_ASSIGN(SendTextMessage);
    307                 BRAC_DLL_ASSIGN(ShowLVProperty);
    308                 BRAC_DLL_ASSIGN(SelectVideoCapture);
    309                 BRAC_DLL_ASSIGN(SelectAudioCapture);
    310                 BRAC_DLL_ASSIGN(EnumVideoCapture);
    311                 BRAC_DLL_ASSIGN(GetCurVideoCapture);
    312                 BRAC_DLL_ASSIGN(EnumAudioCapture);
    313                 BRAC_DLL_ASSIGN(GetCurAudioCapture);
    314                 BRAC_DLL_ASSIGN(SendSDKFilterData);
    315                 BRAC_DLL_ASSIGN(StreamRecordCtrl);
    316                 BRAC_DLL_ASSIGN(SnapShot);
    317 
    318                 if(Errors>0)
    319                     return FALSE;
    320 
    321                 g_dwBRACModule_Count++;
    322                 return TRUE;
    323         }
    324 
    325         static BOOL BRAC_DLL_IsLoaded()
    326         {
    327                 return g_BRACModule ? TRUE : FALSE;
    328         }
    329 
    330         static void BRAC_DLL_UnLoad()
    331         {
    332                 g_dwBRACModule_Count--;
    333                 if (g_dwBRACModule_Count > 0)
    334                         return;
    335 #ifdef WIN32
    336                 FreeLibrary(g_BRACModule);
    337 #else
    338                 dlclose(g_BRACModule);
    339 #endif
    340                 g_BRACModule=NULL;
    341         }
    342 
    343 #ifdef __cplusplus
    344 }
    345 #endif /*__cplusplus*/
    346 
    347 
    348 #ifdef __cplusplus
    349 
    350 
    351 #define BRAC_TEST_VOID 
    352         if (!IsReady()) return
    353 #define BRAC_TEST_INT 
    354         if (!IsReady()) return -1
    355 #define BRAC_TEST_BOOL 
    356         if (!IsReady()) return FALSE
    357 
    358 
    359 class CAnyChatCoreSDK
    360 {
    361 public:
    362         CAnyChatCoreSDK()
    363         {
    364             m_bSuccessLoadDll = FALSE;
    365         }
    366         CAnyChatCoreSDK(LPCTSTR szPathName)
    367         {
    368             m_bSuccessLoadDll = BRAC_DLL_Load(szPathName);
    369         }
    370         ~CAnyChatCoreSDK()
    371         {
    372             BRAC_TEST_VOID;
    373             BRAC_DLL_UnLoad();
    374             m_bSuccessLoadDll = FALSE;
    375         }
    376         BOOL LoadFilterDll(LPCTSTR szPathName)
    377         {
    378             return (m_bSuccessLoadDll = BRAC_DLL_Load(szPathName));
    379         }
    380         BOOL IsReady()
    381         {
    382             return m_bSuccessLoadDll;
    383         }
    384 
    385         // 初始化系统
    386         DWORD InitSDK(HWND hWnd, DWORD dwFuncMode)
    387         {
    388             BRAC_TEST_INT;
    389             return g_BRAC_InitSDK_Func(hWnd, dwFuncMode);
    390         }
    391         // 获取版本信息
    392         DWORD GetSDKVersion(DWORD& dwMainVer, DWORD& dwSubVer, LPSTR lpCompileTime, DWORD dwBufLen)
    393         {
    394             BRAC_TEST_INT;
    395             return g_BRAC_GetSDKVersion_Func(dwMainVer, dwSubVer, lpCompileTime, dwBufLen);
    396         }
    397         // 激活(关闭)SDK调用日志
    398         DWORD ActiveCallLog(BOOL bActive)
    399         {
    400             BRAC_TEST_INT;
    401             return g_BRAC_ActiveCallLog_Func(bActive);
    402         }
    403         // SDK内核参数设置
    404         DWORD SetSDKOption(int optname, const char FAR* optval, int optlen)
    405         {
    406             BRAC_TEST_INT;
    407             return g_BRAC_SetSDKOption_Func(optname, optval, optlen);
    408         }
    409         // 设置服务器验证密码(可用于阻止非法用户用SDK连接服务器,合法用户可正常连接)
    410         DWORD SetServerAuthPass(LPCTSTR lpPassword)
    411         {
    412             BRAC_TEST_INT;
    413             return g_BRAC_SetServerAuthPass_Func(lpPassword);
    414         }
    415 
    416         // 设置视频数据回调函数
    417         DWORD SetVideoDataCallBack(BRAC_PixelFormat pixFmt, BRAC_VideoData_CallBack lpFunction, LPVOID lpUserValue)
    418         {
    419             BRAC_TEST_INT;
    420             return g_BRAC_SetVideoDataCallBack_Func(pixFmt, lpFunction, lpUserValue);
    421         }
    422         // 设置音频数据回调函数
    423         DWORD SetAudioDataCallBack(BRAC_AudioData_CallBack lpFunction, LPVOID lpUserValue)
    424         {
    425             BRAC_TEST_INT;
    426             return g_BRAC_SetAudioDataCallBack_Func(lpFunction, lpUserValue);
    427         }
    428         // 设置音量变化回调函数
    429         DWORD SetVolumeChangeCallBack(BRAC_VolumeChange_CallBack lpFunction, LPVOID lpUserValue)
    430         {
    431             BRAC_TEST_INT;
    432             return g_BRAC_SetVolumeChangeCallBack_Func(lpFunction, lpUserValue);
    433         }
    434         // 设置透明通道数据扩展回调函数
    435        DWORD SetTransBufferExCallBack(BRAC_TransBufferEx_CallBack lpFunction, LPVOID lpUserValue)
    436        {
    437            BRAC_TEST_INT;
    438            return g_BRAC_SetTransBufferExCallBack_Func(lpFunction, lpUserValue);
    439        }
    440        //设置透明通道数据回调函数
    441        DWORD SetTransBufferCallBack(BRAC_TransBuffer_CallBack lpFunction, LPVOID lpUserValue)
    442        {
    443            BRAC_TEST_INT;
    444            return g_BRAC_SetTransBufferCallBack_Func(lpFunction, lpUserValue);
    445        }
    446        // 设置文件传输回调函数
    447        DWORD SetTransFileCallBack(BRAC_TransFile_CallBack lpFunction, LPVOID lpUserValue)
    448        {
    449            BRAC_TEST_INT;
    450            return g_BRAC_SetTransFileCallBack_Func(lpFunction, lpUserValue);
    451        }
    452        // 设置录像快照任务完成通知回调函数
    453        DWORD SetRecordSnapShotCallBack(BRAC_RecordSnapShot_CallBack lpFunction, LPVOID lpUserValue)
    454        {
    455            BRAC_TEST_INT;
    456            return g_BRAC_SetRecordSnapShotCallBack_Func(lpFunction, lpUserValue);
    457        }
    458        // 设置SDK Filter通信数据回调函数定义
    459        DWORD SetSDKFilterDataCallBack(BRAC_SDKFilterData_CallBack lpFunction, LPVOID lpUserValue)
    460        {
    461            BRAC_TEST_INT;
    462            return g_BRAC_SetSDKFilterDataCallBack_Func(lpFunction, lpUserValue);
    463        }
    464        // 设置异步消息通知回调函数
    465        DWORD SetNotifyMessageCallBack(BRAC_NotifyMessage_CallBack lpFunction, LPVOID lpUserValue)
    466        {
    467            BRAC_TEST_INT;
    468            return g_BRAC_SetNotifyMessageCallBack_Func(lpFunction, lpUserValue);
    469        }
    470        // 设置文字消息回调函数
    471        DWORD SetTextMessageCallBack(BRAC_TextMessage_CallBack lpFunction, LPVOID lpUserValue)
    472        {
    473            BRAC_TEST_INT;
    474            return g_BRAC_SetTextMessageCallBack_Func(lpFunction, lpUserValue);
    475        }
    476 
    477 
    478        // 连接服务器
    479        DWORD Connect(LPCTSTR lpServerAddr, DWORD dwPort)
    480        {
    481            BRAC_TEST_INT;
    482            return g_BRAC_Connect_Func(lpServerAddr, dwPort);
    483        }
    484        // 登录系统
    485        DWORD Login(LPCTSTR lpUserName, LPCTSTR lpPassword, DWORD dwPassEncType)
    486        {
    487            BRAC_TEST_INT;
    488            return g_BRAC_Login_Func(lpUserName, lpPassword, dwPassEncType);
    489        }
    490        // 进入房间
    491        DWORD EnterRoom(DWORD dwRoomid, LPCTSTR lpRoomPass, DWORD dwPassEncType)
    492        {
    493            BRAC_TEST_INT;
    494            return g_BRAC_EnterRoom_Func(dwRoomid, lpRoomPass, dwPassEncType);
    495        }
    496        // 进入房间
    497        DWORD EnterRoomEx(LPCTSTR lpRoomName, LPCTSTR lpRoomPass)
    498        {
    499            BRAC_TEST_INT;
    500            return g_BRAC_EnterRoomEx_Func(lpRoomName, lpRoomPass);
    501        }
    502        // 离开房间
    503        DWORD LeaveRoom(DWORD dwRoomid)
    504        {
    505            BRAC_TEST_INT;
    506            return g_BRAC_LeaveRoom_Func(dwRoomid);
    507        }
    508        // 注销系统
    509        DWORD Logout(VOID)
    510        {
    511            BRAC_TEST_INT;
    512            return g_BRAC_Logout_Func();
    513        }
    514 
    515        // 操作用户视频
    516        DWORD UserCameraControl(DWORD dwUserid, BOOL bOpen)
    517        {
    518            BRAC_TEST_INT;
    519            return g_BRAC_UserCameraControl_Func(dwUserid, bOpen);
    520        }
    521        // 操作用户语音
    522        DWORD UserSpeakControl(DWORD dwUserid, BOOL bOpen)
    523        {
    524            BRAC_TEST_INT;
    525            return g_BRAC_UserSpeakControl_Func(dwUserid, bOpen);
    526        }
    527        // 设置视频显示位置
    528        DWORD SetVideoPos(DWORD dwUserid, HWND hWnd, DWORD dwLeft, DWORD dwTop, DWORD dwRight, DWORD dwBottom)
    529        {
    530            BRAC_TEST_INT;
    531            return g_BRAC_SetVideoPos_Func(dwUserid, hWnd, dwLeft, dwTop, dwRight,dwBottom);
    532        }
    533        // 获取指定音频设备的当前音量
    534        DWORD AudioGetVolume(BRAC_AudioDevice device, DWORD& dwVolume)
    535        {
    536            BRAC_TEST_INT;
    537            return g_BRAC_AudioGetVolume_Func(device, dwVolume);
    538        }
    539        // 设置指定音频设备的音量
    540        DWORD AudioSetVolume(BRAC_AudioDevice device, DWORD dwVolume)
    541        {
    542            BRAC_TEST_INT;
    543            return g_BRAC_AudioSetVolume_Func(device,dwVolume);
    544        }
    545 
    546        // 枚举本地视频采集设备
    547        DWORD EnumVideoCapture(CHAR** lpDeviceName, DWORD& dwDeviceNum)
    548        {
    549            BRAC_TEST_INT;
    550            return g_BRAC_EnumVideoCapture_Func(lpDeviceName, dwDeviceNum);
    551        }
    552        // 枚举本地音频采集设备
    553        DWORD EnumAudioCapture(CHAR** lpDeviceName, DWORD& dwDeviceNum)
    554        {
    555            BRAC_TEST_INT;
    556            return g_BRAC_EnumAudioCapture_Func(lpDeviceName, dwDeviceNum);
    557        }
    558        // 选择指定的视频采集设备
    559        DWORD SelectVideoCapture(LPCTSTR szCaptureName)
    560        {
    561            BRAC_TEST_INT;
    562            return g_BRAC_SelectVideoCapture_Func(szCaptureName);
    563        }
    564        // 选择指定的音频采集设备
    565        DWORD SelectAudioCapture(LPCTSTR szCaptureName)
    566        {
    567            BRAC_TEST_INT;
    568            return g_BRAC_SelectAudioCapture_Func(szCaptureName);
    569        }
    570        // 获取当前使用的视频采集设备
    571        DWORD GetCurVideoCapture(CHAR* lpDeviceName, DWORD dwLen)
    572        {
    573            BRAC_TEST_INT;
    574            return g_BRAC_GetCurVideoCapture_Func(lpDeviceName, dwLen);
    575        }
    576        // 获取当前使用的音频采集设备
    577        DWORD GetCurAudioCapture(CHAR* lpDeviceName, DWORD dwLen)
    578        {
    579            BRAC_TEST_INT;
    580            return g_BRAC_GetCurAudioCapture_Func(lpDeviceName, dwLen);
    581        }
    582 
    583        // 获取当前房间在线用户列表
    584        DWORD GetOnlineUser(LPDWORD lpUserIDArray, DWORD& dwUserNum)
    585        {
    586            BRAC_TEST_INT;
    587            return g_BRAC_GetOnlineUser_Func(lpUserIDArray, dwUserNum);
    588        }
    589        // 查询用户摄像头的状态
    590        DWORD GetCameraState(DWORD dwUserid, DWORD& dwState)
    591        {
    592            BRAC_TEST_INT;
    593            return g_BRAC_GetCameraState_Func(dwUserid, dwState);
    594        }
    595        // 查询用户名称
    596        DWORD GetUserName(DWORD dwUserid, CHAR* lpUserName, DWORD dwLen)
    597        {
    598            BRAC_TEST_INT;
    599            return g_BRAC_GetUserName_Func(dwUserid, lpUserName, dwLen);
    600        }
    601        // 查询房间名称
    602        DWORD GetRoomName(DWORD dwRoomId, CHAR* lpRoomName, DWORD dwLen)
    603        {
    604            BRAC_TEST_INT;
    605            return g_BRAC_GetRoomName_Func(dwRoomId, lpRoomName, dwLen);
    606        }
    607        // 显示本地视频画面调节对话框
    608        DWORD ShowLVProperty(HWND hParent, LPCTSTR szCaption, DWORD dwX ,DWORD dwY)
    609        {
    610            BRAC_TEST_INT;
    611            return g_BRAC_ShowLVProperty_Func(hParent, szCaption, dwX, dwY);
    612        }
    613 
    614        // 用户音、视频录制
    615        DWORD StreamRecordCtrl(DWORD dwUserId, BOOL bStartRecord, DWORD dwFlags, DWORD dwParam)
    616        {
    617            BRAC_TEST_INT;
    618            return g_BRAC_StreamRecordCtrl_Func(dwUserId, bStartRecord, dwFlags, dwParam);
    619        }
    620        // 对用户的视频进行抓拍(快照)
    621        DWORD SnapShot(DWORD dwUserId, DWORD dwFlags, DWORD dwParam)
    622        {
    623            BRAC_TEST_INT;
    624            return g_BRAC_SnapShot_Func(dwUserId, dwFlags, dwParam);
    625        }
    626 
    627        // 透明通道传送缓冲区
    628        DWORD TransBuffer(DWORD dwUserid, LPBYTE lpBuf, DWORD dwLen)
    629        {
    630            BRAC_TEST_INT;
    631            return g_BRAC_TransBuffer_Func(dwUserid, lpBuf, dwLen);
    632        }
    633        // 透明通道传送缓冲区扩展
    634        DWORD TransBufferEx(DWORD dwUserid, LPBYTE lpBuf, DWORD dwLen, DWORD wParam, DWORD lParam, DWORD dwFlags, DWORD& dwTaskId)
    635        {
    636            BRAC_TEST_INT;
    637            return g_BRAC_TransBufferEx_Func(dwUserid, lpBuf, dwLen, wParam, lParam, dwFlags, dwTaskId);
    638        }
    639        // 传送文件
    640        DWORD TransFile(DWORD dwUserid, LPCTSTR lpLocalPathName, DWORD wParam, DWORD lParam, DWORD dwFlags, DWORD& dwTaskId)
    641        {
    642            BRAC_TEST_INT;
    643            return g_BRAC_TransFile_Func(dwUserid, lpLocalPathName, wParam, lParam, dwFlags, dwTaskId);
    644        }
    645        // 取消传输任务
    646        DWORD  CancelTransTask(DWORD dwUserid, DWORD dwTaskId)
    647        {
    648            BRAC_TEST_INT;
    649            return g_BRAC_CancelTransTask_Func(dwUserid, dwTaskId);
    650        }
    651        // 传送文本消息
    652        DWORD SendTextMessage(DWORD dwUserid, BOOL bSecret, LPCTSTR lpMsgBuf, DWORD dwLen)
    653        {
    654            BRAC_TEST_INT;
    655            return g_BRAC_SendTextMessage_Func(dwUserid, bSecret, lpMsgBuf, dwLen);
    656        }
    657        // 查询传输任务相关信息
    658        DWORD QueryTransTaskInfo(DWORD dwUserid, DWORD dwTaskId, int infoname, char FAR* infoval, int infolen)
    659        {
    660            BRAC_TEST_INT;
    661            return g_BRAC_QueryTransTaskInfo_Func(dwUserid, dwTaskId, infoname, infoval, infolen);
    662        }
    663        // 发送SDK Filter 通信数据
    664        DWORD SendSDKFilterData(LPBYTE lpBuf, DWORD dwLen)
    665        {
    666            BRAC_TEST_INT;
    667            return g_BRAC_SendSDKFilterData_Func(lpBuf, dwLen);
    668        }
    669 
    670        // 查询指定用户相关状态
    671        DWORD QueryUserState(DWORD dwUserId, int infoname, char FAR* infoval, int infolen)
    672        {
    673            BRAC_TEST_INT;
    674            return g_BRAC_QueryUserState_Func(dwUserId, infoname, infoval, infolen);
    675        }
    676 
    677        // 释放所有资源
    678        DWORD Release(VOID)
    679        {
    680            BRAC_TEST_INT;
    681            return g_BRAC_Release_Func();
    682        }
    683 
    684 private:
    685         BOOL    m_bSuccessLoadDll;
    686 };
    687 
    688 
    689 
    690 
    691 #endif /*__cplusplus*/
    692 
    693 
    694 
    695 
    696 
    697 
    698 #endif // ANYCHATCORESDK_H

    http://newalitest.csdn.net/99263/anychat/blob/master/client/windows/qt/AnyChatQt/AnyChatCoreSDK.h

  • 相关阅读:
    使用Angular2建立项目
    你不知道的JavaScript-0
    项目从0到1
    登录页跳转时保存用户信息-遇坑记
    robotframework-ride快捷方式打不开
    win10 python3.8 wxpython.whl 安装步骤
    QPS
    xmind 文件 打开后会在当前目录生成 configuration,p2和workspace目录,artifacts.xml文件 解决
    JMeter进行压力测试时查看服务器的资源使用
    JMeter和JMeterPlugin的下载安装
  • 原文地址:https://www.cnblogs.com/endv/p/5940768.html
Copyright © 2020-2023  润新知