NIM 跨平台 C++ SDK
载入中...
搜索中...
未找到
nim_cpp_vchat.h
浏览该文件的文档.
1
7#ifndef _NIM_SDK_CPP_VCHAT_H_
8#define _NIM_SDK_CPP_VCHAT_H_
9
10#include <functional>
11#include <string>
13#include "nim_define_include.h"
18namespace nim {
22 int32_t res_code_;
23 int32_t loss_;
24 int32_t rtt_max_;
25 int32_t rtt_min_;
26 int32_t rtt_avg_;
27 int32_t rtt_mdev_;
28 std::string expand_info_;
29
31 res_code_ = 0;
32 loss_ = 0;
33 rtt_max_ = 0;
34 rtt_min_ = 0;
35 rtt_avg_ = 0;
36 rtt_mdev_ = 0;
37 }
38};
40public:
42 typedef std::function<void(int, NetDetectCbInfo)> NetDetectCallback;
44 typedef std::function<void(bool ret, int code, const std::string& file, int64_t time)> Mp4OptCallback;
48 typedef std::function<void(bool ret, int code, const std::string& json_extension)> OptCallback;
50 typedef std::function<void(int code, int64_t channel_id, const std::string& json_extension)> Opt2Callback;
52 typedef std::function<void(int id, bool ret, int code, const std::string& json_extension)> EffectOptCallback;
53 typedef std::function<void(const std::string& accid, uint64_t time, const char* data, uint32_t size, int32_t channels, int32_t rate)>
56
62 static bool Init(const std::string& server_setting_path);
63
73 static void SetProxy(NIMProxyType type, const std::string& host, int port, const std::string& user, const std::string& password);
74
79 static void Cleanup();
80
95 static uint64_t NetDetect(NetDetectCallback cb);
96
114 static uint64_t NetDetectEx(int32_t ms_limit, nim::NIMNetDetectType type, nim::NIMNetDetectVideoQuality quality_type, NetDetectCallback cb);
115
123 static void VChatRate(int rating, const std::string& description, OptCallback cb);
124
131 static void EnumDeviceDevpath(nim::NIMDeviceType type, nim_vchat_enum_device_devpath_sync_cb_func cb);
132
143 static void StartDevice(nim::NIMDeviceType type,
144 const std::string& device_path,
145 unsigned fps,
146 int width,
147 int height,
149
155 static void EndDevice(nim::NIMDeviceType type);
156
163 static void AddDeviceStatusCb(nim::NIMDeviceType type, nim_vchat_device_status_cb_func cb);
164
170 static void RemoveDeviceStatusCb(nim::NIMDeviceType type);
171
178 static void SetAudioDataCb(bool capture, nim_vchat_audio_data_cb_func cb);
179
187 static void SetAudioDataCbEx(int type, std::string json_extension, nim_vchat_audio_data_cb_func_ex cb);
188
195 static void SetVideoDataCb(bool capture, nim_vchat_video_data_cb_func cb);
196
203 static void SetAudioVolumn(unsigned char volumn, bool capture);
204
210 static unsigned char GetAudioVolumn(bool capture);
211
217 static void SetAudioInputAutoVolumn(bool auto_volumn);
218
223 static bool GetAudioInputAutoVolumn();
224
232 static void SetAudioProcess(bool aec, bool ns, bool vad);
233
241 static void PreloadEffect(int id, const std::string& path, EffectOptCallback cb);
242
250 static void PlayEffect(int id, int loop_count, EffectOptCallback cb);
251
258 static void StopEffect(int id, EffectOptCallback cb);
259
268 static void SetCbFunc(nim_vchat_cb_func cb);
269
279 static bool Start(NIMVideoChatMode mode, const std::string& apns_text, const std::string& custom_info, const std::string& json_info);
280
287 static bool SetTalkingMode(NIMVideoChatMode mode, const std::string& json_extension);
288
297 static bool CalleeAck(uint64_t channel_id, bool accept, const std::string& json_extension);
298
305 static bool Control(uint64_t channel_id, NIMVChatControlType type);
306
318 static void StartRecord(const std::string& path, const std::string& uid, Mp4OptCallback cb);
319
328 static void StopRecord(const std::string& uid, Mp4OptCallback cb);
329
340 static void StartAudioRecord(const std::string& path, AudioRecordCallback cb);
341
349 static void StopAudioRecord(AudioRecordCallback cb);
350
356 static void End(const std::string& json_extension);
357
364 static void Relogin(const std::string& session_id, OptCallback cb);
365
373 static void SetVideoQuality(int video_quality);
374
382 static void SetVideoBitrate(int video_bitrate);
383
391 static void SetFrameRate(NIMVChatVideoFrameRate frame_rate);
392
401 static void SetCustomData(bool custom_audio, bool custom_video);
402
411 static bool CustomAudioData(uint64_t time, const char* data, unsigned int size, const char* json_extension);
412
428 static bool CustomVideoData(uint64_t time,
429 const char* data,
430 unsigned int size,
431 unsigned int width,
432 unsigned int height,
433 const char* json_extension);
434
452 static bool AccompanyingSound(unsigned char id,
453 uint64_t time,
454 const char* data,
455 unsigned int size,
456 unsigned int rate,
457 unsigned int channels,
458 const char* json_extension);
459
465 static void SetViewerMode(bool viewer);
466
471 static bool GetViewerMode();
472
478
484 static void SetAudioMuted(bool muted);
485
490 static bool GetAudioMuteEnabled();
491
497 static void SetAudioPlayMuted(bool muted);
498
503 static bool GetAudioMutePlayEnabled();
504
510 static void SetRotateRemoteVideo(bool rotate);
511
516 static bool IsRotateRemoteVideo();
517
523 static void SetVideoFrameScaleType(NIMVChatVideoFrameScaleType type);
524
529 static int GetVideoFrameScaleType();
530
542 static void SetMemberBlacklist(const std::string& uid, bool add, bool audio, const std::string& json_extension, OptCallback cb);
543
555 static void CreateRoom(const std::string& room_name, const std::string& custom_info, const std::string& json_extension, Opt2Callback cb);
556
566 static bool JoinRoom(NIMVideoChatMode mode, const std::string& room_name, const std::string& json_extension, Opt2Callback cb);
567
576 static void UpdateRtmpUrl(const std::string& rtmp_url, OptCallback cb);
577
586 static void SelectVideoAdaptiveStrategy(NIMVChatVideoEncodeMode mode, const std::string& json_extension, OptCallback cb);
587
604 static void SetUidAsMainPicture(const std::string& uid, const std::string& json_extension, OptCallback cb);
605
606 // 订阅
613 static bool SetAutoPublish(bool auto_pub, bool auto_sub);
614
619 static bool IsAutoPublishVideo();
620
625 static bool IsAutoSubscribeVideo();
626
631 static bool IsAutoSubscribeAudio();
632
638 static bool SetLocalVideoSimulcastMode(NIMVChatPublishVideoStreamMode video_stream_mode);
639
646 static void PublishVideo(OptCallback cb);
647
654 static void UnpublishVideo(OptCallback cb);
655
663 static void SubscribeVideo(const std::string& uid, OptCallback cb);
664
672 static void UnsubscribeVideo(const std::string& uid, OptCallback cb);
673
681 static void SubscribeAudio(bool sub, OptCallback cb);
682
689 static void SetRemoteAudioDataCb(RemoteAudioDataCallback cb);
690
698 static void AddRemoteAudioDataCb(const std::string& uid, OptCallback cb);
699
707 static void RemoveRemoteAudioDataCb(const std::string& uid, OptCallback cb);
708};
709} // namespace nim
710
711#endif //_NIM_SDK_CPP_VCHAT_H_
Definition: nim_cpp_vchat.h:39
Mp4OptCallback AudioRecordCallback
音频录制事件通知回调模板
Definition: nim_cpp_vchat.h:46
std::function< void(int code, int64_t channel_id, const std::string &json_extension)> Opt2Callback
操作回调模板
Definition: nim_cpp_vchat.h:50
std::function< void(int, NetDetectCbInfo)> NetDetectCallback
网络探测回调模板
Definition: nim_cpp_vchat.h:42
std::function< void(bool ret, int code, const std::string &json_extension)> OptCallback
操作回调模板
Definition: nim_cpp_vchat.h:48
std::function< void(bool ret, int code, const std::string &file, int64_t time)> Mp4OptCallback
MP4录制事件通知回调模板
Definition: nim_cpp_vchat.h:44
std::function< void(int id, bool ret, int code, const std::string &json_extension)> EffectOptCallback
操作回调模板
Definition: nim_cpp_vchat.h:52
static NIMVChatConnectStatus GetConnectStatus()
std::function< void(const std::string &accid, uint64_t time, const char *data, uint32_t size, int32_t channels, int32_t rate)> RemoteAudioDataCallback
远端音频数据回调
Definition: nim_cpp_vchat.h:55
namespace nim
NIM 公共数据类型定义总的包含文件
void(* nim_vchat_audio_data_cb_func_ex)(uint64_t time, const char *data, uint32_t size, int channels, int rate, int volume, const char *json_extension, const void *user_data)
Definition: nim_device_def.h:146
void(* nim_vchat_device_status_cb_func)(enum NIMDeviceType type, uint32_t status, const char *device_path, const char *json_extension, const void *user_data)
Definition: nim_device_def.h:121
void(* nim_vchat_enum_device_devpath_sync_cb_func)(bool ret, enum NIMDeviceType type, const char *json_extension, const void *user_data)
Definition: nim_device_def.h:105
void(* nim_vchat_start_device_cb_func)(enum NIMDeviceType type, bool ret, const char *json_extension, const void *user_data)
Definition: nim_device_def.h:163
void(* nim_vchat_audio_data_cb_func)(uint64_t time, const char *data, uint32_t size, const char *json_extension, const void *user_data)
Definition: nim_device_def.h:175
void(* nim_vchat_video_data_cb_func)(uint64_t time, const char *data, uint32_t size, uint32_t width, uint32_t height, const char *json_extension, const void *user_data)
Definition: nim_device_def.h:190
NIMProxyType
Definition: nim_global_def.h:204
定义导出宏
#define NIM_SDK_CPPWRAPPER_DLL_API
Definition: nim_sdk_cpp_wrapper.h:38
NIMVChatVideoFrameRate
Definition: nim_vchat_def.h:129
NIMVChatVideoEncodeMode
Definition: nim_vchat_def.h:145
NIMVChatVideoFrameScaleType
Definition: nim_vchat_def.h:157
void(* nim_vchat_cb_func)(enum NIMVideoChatSessionType type, int64_t channel_id, int code, const char *json_extension, const void *user_data)
Definition: nim_vchat_def.h:694
NIMVChatControlType
Definition: nim_vchat_def.h:57
NIMVChatPublishVideoStreamMode
Definition: nim_vchat_def.h:408
NIMVideoChatMode
Definition: nim_vchat_def.h:89
NIMVChatConnectStatus
Definition: nim_vchat_def.h:97
网络探测回调信息
Definition: nim_cpp_vchat.h:20
int32_t rtt_max_
Definition: nim_cpp_vchat.h:24
NetDetectCbInfo()
Definition: nim_cpp_vchat.h:30
int32_t rtt_avg_
Definition: nim_cpp_vchat.h:26
int32_t res_code_
返回的错误码
Definition: nim_cpp_vchat.h:22
int32_t rtt_min_
Definition: nim_cpp_vchat.h:25
std::string expand_info_
Definition: nim_cpp_vchat.h:28
int32_t rtt_mdev_
Definition: nim_cpp_vchat.h:27
int32_t loss_
Definition: nim_cpp_vchat.h:23