TCCC Agent API
ITCCCDeviceManager.h
1
8
9#ifndef ITCCCDeviceManager_h
10# define ITCCCDeviceManager_h
11
12# include <stdint.h>
13# ifdef __APPLE__
14# include <TargetConditionals.h>
15# endif
16
17namespace tccc {
19//
20// 音视频设备相关的类型定义
21//
23
32enum TCCCAudioRoute {
33
35 TCCCAudioRouteSpeakerphone = 0,
36
38 TCCCAudioRouteEarpiece = 1,
39
40};
41
47enum TCCCMediaDeviceType {
48
50 TCCCMediaDeviceTypeUnknown = -1,
51
53 TCCCMediaDeviceTypeMic = 0,
54
56 TCCCMediaDeviceTypeSpeaker = 1,
57
59 TCCCMediaDeviceTypeCamera = 2,
60
61};
62
68enum TCCCMediaDeviceState {
69
71 TCCCMediaDeviceStateAdd = 0,
72
74 TCCCMediaDeviceStateRemove = 1,
75
77 TCCCMediaDeviceStateActive = 2,
78
79};
80
86# ifdef _WIN32
87
88# endif
89
96 protected:
97 virtual ~ITCCCDeviceInfo() {}
98
99 public:
100 virtual void release() = 0;
101
103 virtual const char* getDevicePID() = 0;
104
106 virtual const char* getDeviceName() = 0;
107};
108
115 protected:
116 virtual ~ITCCCDeviceCollection() {}
117
118 public:
120 virtual uint32_t getCount() = 0;
121
123 virtual const char* getDeviceName(uint32_t index) = 0;
124
126 virtual const char* getDevicePID(uint32_t index) = 0;
127
132 virtual const char* getDeviceProperties(uint32_t index) = 0;
133
135 virtual void release() = 0;
136};
137
138# if (__APPLE__ && TARGET_OS_MAC && !TARGET_OS_IPHONE) || _WIN32
139class ITXDeviceObserver {
140 public:
141 virtual ~ITXDeviceObserver() {}
142
151 virtual void onDeviceChanged(const char* deviceId, TCCCMediaDeviceType type, TCCCMediaDeviceState state) {}
152};
153# endif
154
156 public:
157 virtual ~ITCCCDeviceManager() {}
158
160 //
161 // 音频、音量相关接口
162 //
166
174 virtual void setAudioCaptureVolume(int volume) = 0;
175
179 virtual int getAudioCaptureVolume() = 0;
180
191 virtual void setAudioPlayoutVolume(int volume) = 0;
192
196 virtual int getAudioPlayoutVolume() = 0;
197
199
201//
202// 移动端设备操作接口(iOS Android)
203//
207# if __ANDROID__ || (__APPLE__ && TARGET_OS_IOS)
211 // virtual bool isFrontCamera() = 0;
212 //
213 // /**
214 // * 1.2 切换前置或后置摄像头(仅适用于移动端)
215 // */
216 // virtual int switchCamera(bool frontCamera) = 0;
217
225 virtual int setAudioRoute(TCCCAudioRoute route) = 0;
226# endif
229//
230// 桌面端设备操作接口(Windows Mac)
231//
235# if (__APPLE__ && TARGET_OS_MAC && !TARGET_OS_IPHONE) || _WIN32
236
247 virtual ITCCCDeviceCollection* getDevicesList(TCCCMediaDeviceType type) = 0;
248
256 virtual int setCurrentDevice(TCCCMediaDeviceType type, const char* deviceId) = 0;
257
261 virtual ITCCCDeviceInfo* getCurrentDevice(TCCCMediaDeviceType type) = 0;
262
271 virtual int setCurrentDeviceVolume(TCCCMediaDeviceType type, uint32_t volume) = 0;
272
278 virtual uint32_t getCurrentDeviceVolume(TCCCMediaDeviceType type) = 0;
279
285 virtual int setCurrentDeviceMute(TCCCMediaDeviceType type, bool mute) = 0;
286
292 virtual bool getCurrentDeviceMute(TCCCMediaDeviceType type) = 0;
293
304 virtual int enableFollowingDefaultAudioDevice(TCCCMediaDeviceType type, bool enable) = 0;
305
306# endif
308};
309
310} // namespace tccc
311
312#endif /* ITCCCDeviceManager_h */
313
Definition: ITCCCDeviceManager.h:114
virtual const char * getDeviceProperties(uint32_t index)=0
virtual void release()=0
释放设备列表,请不要使用 delete 释放资源 !!!
virtual uint32_t getCount()=0
设备数量
virtual const char * getDeviceName(uint32_t index)=0
设备名字 (UTF-8),index 为设备索引,值为 [0,getCount)。返回值为设备名称 (UTF-8)
virtual const char * getDevicePID(uint32_t index)=0
设备唯一标识 (UTF-8) index 为设备索引,值为 [0,getCount)
Definition: ITCCCDeviceManager.h:95
virtual const char * getDevicePID()=0
设备 id (UTF-8)
virtual const char * getDeviceName()=0
设备名称 (UTF-8)
Definition: ITCCCDeviceManager.h:155
virtual int getAudioCaptureVolume()=0
virtual void setAudioCaptureVolume(int volume)=0
virtual void setAudioPlayoutVolume(int volume)=0
virtual int getAudioPlayoutVolume()=0