C++SDK  1.0.0
combase_1.h
浏览该文件的文档.
1 #ifndef RT_COMMON_BASE_H
2 #define RT_COMMON_BASE_H
3 #define __BUILD_LIVECAST__
4 
5 #include "defines.h"
6 #include "errorcode.h"
7 
8 #if (defined(RT_LINUX) || defined(RT_IOS) || defined(RT_ANDROID))
9 typedef uint64_t AVDHandle;
10 #else
11 typedef int AVDHandle;
12 #endif
13 typedef int Result;
15 #define Max_RoomId 64
16 #define Max_UserId 40
17 #define Max_UserData 128
18 #define Max_DeviceId 256
19 #define Max_StreamId 64
20 #define Max_UserName 32
21 #define Max_DeviceName 64
22 #define Max_DeviceDescription 128
23 #define Max_RoomName 256
24 #define Max_Password 16
25 #define Max_Message 256
26 #define Max_Address 64
27 #define Max_StringEnum 32
28 #define Max_UrlLen 256
29 #define Max_TimeLen 64
31 #if defined(RT_LINUX) && !defined(RT_ANDROID)
33 typedef unsigned long Window; // Avoid include <X11/Xlib.h>.
34 #elif defined(RT_WIN32)
35 // We commonly include win32.h in webrtc/base so just include it here.
36 #ifndef NOMINMAX
37  #define NOMINMAX
38 #endif
39 #ifndef WIN32_LEAN_AND_MEAN
40  #define WIN32_LEAN_AND_MEAN
41 #endif
42 #include <windows.h> // Include HWND, HMONITOR.
43 #elif defined(RT_MAC) && !defined(RT_IOS)
44 typedef unsigned int CGWindowID;
45 typedef unsigned int CGDirectDisplayID;
46 #endif
47 
49 
55 #define avd_testFlagChange(oldValue,newValue,mask) \
56  (0 != ((oldValue^newValue) & mask))
57 
63 #define avd_isFlagSet(uValue,mask) \
64  (0 != (uValue & mask))
65 
69 #define avd_setFlag(uValue,mask) \
70  uValue |= mask;
71 
75 #define avd_clearFlag(uValue,mask) \
76  uValue &= ~mask;
77 
82 #define avd_getFlag(uValue,mask) \
83  uValue &mask;
84 
89 #define avd_xorFlag(uValue,mask) \
90  uValue ^= mask;
91 
92 
94 #if defined(__cplusplus) || defined(WEBRTC_IOS)
95 
96 #define NAMESPACE_TEE3_BEGIN \
97 namespace tee3 {
98 
99 #define NAMESPACE_TEE3_END \
100 }
101 
102 #define NAMESPACE_TEE3_AVD_BEGIN\
103  NAMESPACE_TEE3_BEGIN \
104  namespace avd {
105 
106 #define NAMESPACE_TEE3_AVD_END \
107  } \
108  NAMESPACE_TEE3_END
109 
110 
111 #define USE_NAMESPACE_TEE3 \
112  using namespace tee3;
113 
114 #define USE_NAMESPACE_TEE3_AVD \
115  using namespace tee3::avd;
116 
117 #else
118  #define NAMESPACE_TEE3_BEGIN
119  #define NAMESPACE_TEE3_END
120  #define NAMESPACE_TEE3_AVD_BEGIN
121  #define NAMESPACE_TEE3_AVD_END
122  #define USE_NAMESPACE_TEE3
123  #define USE_NAMESPACE_TEE3_AVD
124 
125 #endif //__cplusplus
126 
128 
133 {
138 };
148  quality_low = (1 << 0),
149  quality_normal = (1 << 1),
150  quality_high = (1 << 2),
151 };
160 };
166  rotation_90 = 90,
167  rotation_180 = 180,
168  rotation_270 = 270,
170 };
181 };
189 };
197 };
198 
203 };
204 
206 enum RoomMode { // 0位内部使用;1-20为房间属性;21-32为其他;
207  clear_set = (1 << 0), // use uint32ernal
208  rm_mcu = (1 << 31),
210  // for room attribute
213  rm_attr_netacc = (1 << 2),
215  rm_attr_hostcontrol = (1 << 3),
218  // use uint32ernal
219  rm_modes = 0xFFF00000,
220  rm_attributes = 0x000FFFFE,
221 };
228 };
235 };
242 };
248 struct UserStatus {
249 public:
251  enum Status {
252  microphone_has = 1 << 31,
253  microphone_on = 1 << 30,
254  camera_has = 1 << 29,
255  camera_on = 1 << 28,
256  screen_on = 1 << 25,
258  status_all = 0xFFFFFFFF,
259  };
260 public:
264  bool hasCamera() const { return avd_isFlagSet(status, camera_has); }
268  bool isCameraOn() const { return avd_isFlagSet(status, camera_on); }
270  bool isScreenOn() const { return avd_isFlagSet(status, screen_on); }
278  void setStatus(Status flag) { avd_setFlag(status, flag); }
286  void clearStatus(Status flag) { avd_clearFlag(status, flag); }
287 public:
288  uint32 status;
289 public:
290  UserStatus(uint32 val) : status(val) {}
291  UserStatus() : status(0) {}
293  bool operator==(const UserStatus& from) const { return status == from.status; };
294 };
295 
402  eo_video_resolution_lowNosupported, /* 值类型为bool, 字符类型"true" or "false",默认:false 支持低分辨率
403  */
412 };
413 
465  //only for windows
473 };
474 
480 };
487 };
492 };
500 };
508 };
509 
517 };
518 
524 };
525 
528  ft_none = 0,
529  ft_roommanager = (1 << 0),
530  ft_datachannel = (1 << 1),
531  ft_chat = (1 << 2),
532  ft_audio = (1 << 3),
533  ft_video = (1 << 4),
534  ft_video_hd = (1 << 5),
535  ft_screen = (1 << 6),
536  ft_annotation = (1 << 7),
537  ft_p2p = (1 << 10),
538  ft_outgoing = (1 << 11),
539  ft_avei = (1 << 12),
543  ft_record_audio = (1 << 16),
544  ft_record_video = (1 << 17),
545  ft_livebroadcast = (1 << 18),
546  ft_h265 = (1 << 19),
548  //
549  ft_platform_android = (1 << 20),
550  ft_platform_ios = (1 << 21),
551  ft_platform_win = (1 << 22),
552  ft_platform_mac = (1 << 23),
553  ft_platform_linux = (1 << 24),
554  ft_platform_web = (1 << 25),
560 };
561 
562 
568 struct AudioCodecInst {
569  int pltype;
570  char plname[32];
571  int plfreq;
572  int pacsize;
573  int channels;
574  int rate; // bits/sec unlike {start,min,max}Bitrate elsewhere in this file!
575 
576  bool operator==(const AudioCodecInst& other) const {
577  return pltype == other.pltype &&
578  plfreq == other.plfreq &&
579  pacsize == other.pacsize &&
580  channels == other.channels &&
581  rate == other.rate;
582  }
583 
584  bool operator!=(const AudioCodecInst& other) const {
585  return !(*this == other);
586  }
587 
589  if (*this != other) {
590  pltype = other.pltype;
591  //memcpy(plname, other.plname, 32);
592  for (uint32 i = 0; i < sizeof(plname); ++i) {
593  plname[i] = other.plname[i];
594  }
595  plfreq = other.plfreq;
596  pacsize = other.pacsize;
597  channels = other.channels;
598  rate = other.rate;
599  }
600  return *this;
601  }
602 };
608 const AudioCodecInst kTbPcm16Bwb = { 108, "L16", 16000, 320, 1, 256000 }; // default audio data
609 const AudioCodecInst kTbPcm44Bwb = { 130, "L16", 44100, 882, 1, 512000 }; // for aac encoder
610 const AudioCodecInst kTbPcm48Bwb = { 131, "L16", 48000, 960, 1, 512000 };
611 const AudioCodecInst kTbPcm16Stereo = { 112, "L16", 16000, 320, 2, 256000 };
612 const AudioCodecInst kTbPcm44Stereo = { 135, "L16", 44100, 882, 2, 512000 };
613 const AudioCodecInst kTbPcm48Stereo = { 136, "L16", 48000, 960, 2, 512000 };
614 const AudioCodecInst kTbPcmu = { 0, "PCMU", 8000, 160, 1, 64000 };
615 const AudioCodecInst kTbPcma = { 8, "PCMA", 8000, 160, 1, 64000 };
616 const AudioCodecInst kTbPcmuStereo = { 110, "PCMU", 8000, 160, 2, 64000 };
617 const AudioCodecInst kTbPcmaStereo = { 118, "PCMA", 8000, 160, 2, 64000 };
618 const AudioCodecInst kTbIsacWb = { 103, "ISAC", 16000, 480, 1, 32000 };
619 const AudioCodecInst kTbIsacSwb = { 104, "ISAC", 32000, 960, 1, 56000 };
620 const AudioCodecInst kTbIlbc = { 102, "ILBC", 8000, 240, 1, 13300 };
621 const AudioCodecInst kTbOpus = { 120, "opus", 48000, 960, 2, 64000 };
622 
628 struct NetworkStats {
629  int bps_received;
630  int bps_sent;
631  int lostpercent;
633  int lostpercent_sent;
635  int64 bytes_sent;
642  NetworkStats() : bps_received(0), bps_sent(0), lostpercent(0)
643  , lostpercent_received(0), lostpercent_sent(), bytes_received(0), bytes_sent(0)
644  , packets_lost(0), packets_lost_received(0), packets_lost_sent(), packets_received(0), packets_sent(0) {
645  }
646  virtual void Clear() {
647  bps_received = 0;
648  bps_sent = 0;
649  lostpercent = 0;
650  bytes_received = 0;
651  lostpercent_received = 0;
652  lostpercent_sent = 0;
653  bytes_sent = 0;
654  packets_lost = 0;
655  packets_lost_received = 0;
656  packets_lost_sent = 0;
657  packets_received = 0;
658  packets_sent = 0;
659  }
660 };
661 
662 #define FOURCC(a, b, c, d) ( \
663  (static_cast<uint32>(a)) | (static_cast<uint32>(b) << 8) | \
664  (static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24))
665 
666 enum FourCC {
667  FOURCC_I420 = FOURCC('I', '4', '2', '0'),
668  FOURCC_YV12 = FOURCC('Y', 'V', '1', '2'),
669  FOURCC_NV21 = FOURCC('N', 'V', '2', '1'),
670  FOURCC_NV12 = FOURCC('N', 'V', '1', '2'),
671  FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'),
672  FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'),
673  FOURCC_MJPG = FOURCC('M', 'J', 'P', 'G'),
674  FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B'),
675  FOURCC_24BG = FOURCC('2', '4', 'B', 'G'),
676  // h264
677  FOURCC_H264 = FOURCC('H', '2', '6', '4'),
678  FOURCC_H265 = FOURCC('H', '2', '6', '5'),
679 };
680 
689 };
691  ART_NONE = 0,
692  ART_ALL = 1,
695 };
696 
698 
699 #endif//RT_COMMON_BASE_H
Definition: combase_1.h:530
Definition: combase_1.h:225
Definition: combase_1.h:543
const AudioCodecInst kTbPcm44Bwb
Definition: combase_1.h:609
int plfreq
Definition: combase.h:574
Definition: combase_1.h:549
int pacsize
Definition: combase.h:575
const AudioCodecInst kTbPcma
Definition: combase_1.h:615
Definition: combase_1.h:200
Definition: combase_1.h:303
void setStatus(Status flag)
Definition: combase_1.h:278
Definition: combase_1.h:134
int64 packets_sent
Definition: combase.h:643
Definition: combase_1.h:220
~UserStatus()
Definition: combase_1.h:292
Definition: combase.h:255
Definition: combase_1.h:514
Definition: combase_1.h:178
DeviceStatus
Definition: combase.h:132
Definition: combase_1.h:136
StreamType
Definition: combase.h:185
const AudioCodecInst kTbPcmu
Definition: combase_1.h:614
MediaFileType
Definition: combase.h:492
int64 bytes_received
Definition: combase.h:637
Definition: combase_1.h:238
Definition: combase_1.h:239
Definition: combase_1.h:375
DeviceStatus ScreenStatus
Definition: combase_1.h:141
Definition: combase_1.h:539
Definition: combase_1.h:187
bool operator==(const AudioCodecInst &other) const
Definition: combase_1.h:576
Definition: combase.h:252
Definition: combase_1.h:437
RecordStatus
Definition: combase.h:497
Definition: combase_1.h:310
Definition: combase_1.h:528
Definition: combase.h:631
Definition: combase_1.h:688
Definition: combase_1.h:180
#define NAMESPACE_TEE3_AVD_END
Definition: combase_1.h:121
LiveStatus
Definition: combase.h:505
Definition: combase_1.h:176
Definition: combase_1.h:675
Definition: combase_1.h:485
Definition: combase_1.h:535
void clearStatus(Status flag)
Definition: combase_1.h:286
Definition: combase_1.h:477
Definition: combase_1.h:521
const AudioCodecInst kTbPcmuStereo
Definition: combase_1.h:616
Definition: combase_1.h:541
Definition: combase_1.h:227
Definition: combase_1.h:201
Definition: combase.h:248
Definition: combase_1.h:240
Definition: combase_1.h:533
Definition: combase_1.h:158
Definition: combase_1.h:507
bool operator==(const UserStatus &from) const
Definition: combase_1.h:293
Definition: combase_1.h:313
Definition: combase_1.h:369
UserStatus(uint32 val)
Definition: combase_1.h:290
Definition: combase_1.h:232
Definition: combase_1.h:208
Definition: combase_1.h:505
Definition: combase_1.h:234
const AudioCodecInst kTbIsacWb
Definition: combase_1.h:618
Definition: combase_1.h:447
Definition: combase_1.h:532
Definition: combase_1.h:536
Definition: combase_1.h:168
Definition: combase_1.h:209
Definition: combase_1.h:552
Definition: combase_1.h:207
int64 packets_lost
Definition: combase.h:639
Definition: combase_1.h:684
Definition: combase_1.h:188
unsigned int uint32
Definition: defines.h:393
RecordAudioType
Definition: combase.h:479
EngineOption
Definition: combase.h:302
Definition: combase_1.h:484
Definition: combase_1.h:165
Definition: combase_1.h:557
Definition: combase_1.h:486
Definition: combase_1.h:687
VideoCodec
Definition: combase.h:174
bool operator!=(const AudioCodecInst &other) const
Definition: combase_1.h:584
Definition: combase_1.h:497
int Result
Definition: combase_1.h:13
Definition: combase_1.h:559
UserStatus()
Definition: combase_1.h:291
int bps_received
Definition: combase.h:632
const AudioCodecInst kTbIsacSwb
Definition: combase_1.h:619
const AudioCodecInst kTbPcmaStereo
Definition: combase_1.h:617
long long int64
Definition: defines.h:383
MixerVideoLayoutType
Definition: combase.h:523
Definition: combase_1.h:179
Definition: combase_1.h:429
Definition: combase_1.h:372
Definition: combase_1.h:673
Definition: combase_1.h:387
Definition: combase_1.h:537
Definition: combase_1.h:669
Definition: combase_1.h:551
CameraType
Definition: combase.h:193
Definition: combase_1.h:216
Definition: combase_1.h:186
Definition: combase_1.h:468
Definition: combase_1.h:444
Definition: combase_1.h:515
bool isScreenOn() const
Definition: combase_1.h:270
Definition: combase_1.h:137
char plname[32]
Definition: combase.h:573
int bps_sent
Definition: combase.h:633
Definition: combase_1.h:231
Definition: combase_1.h:674
Definition: combase_1.h:451
Definition: combase_1.h:425
Definition: combase_1.h:409
Definition: combase_1.h:506
Definition: combase.h:254
RecordVideoType
Definition: combase.h:485
Definition: combase_1.h:333
Definition: combase_1.h:383
Definition: combase_1.h:522
ScreenType
Definition: combase.h:199
int64 packets_lost_received
Definition: combase.h:640
Definition: combase_1.h:556
Definition: combase_1.h:396
const AudioCodecInst kTbPcm44Stereo
Definition: combase_1.h:612
uint32 status
Definition: combase.h:288
Definition: combase_1.h:325
Definition: combase_1.h:224
Definition: combase_1.h:540
Definition: combase_1.h:471
Definition: combase_1.h:148
Definition: combase_1.h:498
Definition: combase_1.h:462
Definition: combase_1.h:322
Definition: combase_1.h:150
RoomStatus
Definition: combase.h:223
#define avd_clearFlag(uValue, mask)
Definition: combase_1.h:75
Definition: combase_1.h:545
Definition: combase_1.h:671
FourCC
Definition: combase.h:669
Definition: combase_1.h:503
int AVDHandle
Definition: combase_1.h:11
Definition: combase_1.h:156
#define NAMESPACE_TEE3_AVD_BEGIN
Definition: combase_1.h:120
Definition: combase_1.h:211
NetworkStats()
Definition: combase_1.h:642
const AudioCodecInst kTbOpus
Definition: combase_1.h:621
Definition: combase_1.h:686
LivecastStatus
Definition: combase.h:514
int64 bytes_sent
Definition: combase.h:638
int64 packets_lost_sent
Definition: combase.h:641
Definition: combase_1.h:496
Definition: combase.h:253
Definition: combase_1.h:410
Definition: combase_1.h:159
int64 packets_received
Definition: combase.h:642
Definition: combase_1.h:215
Definition: combase_1.h:366
Definition: combase_1.h:546
Definition: combase_1.h:682
Definition: combase_1.h:434
Definition: combase_1.h:691
Definition: combase_1.h:177
Definition: combase_1.h:458
#define avd_isFlagSet(uValue, mask)
Definition: combase_1.h:63
Definition: combase_1.h:352
Definition: combase_1.h:169
Definition: combase_1.h:513
bool isCameraOn() const
Definition: combase_1.h:268
#define avd_setFlag(uValue, mask)
Definition: combase_1.h:69
Definition: combase_1.h:466
Definition: combase_1.h:672
Definition: combase_1.h:219
Definition: combase_1.h:683
Definition: combase_1.h:213
Status
Definition: combase.h:251
Definition: combase_1.h:226
Definition: combase_1.h:194
Definition: combase_1.h:399
Definition: combase_1.h:196
Definition: combase_1.h:212
VideoRatio
Definition: combase.h:155
Definition: combase_1.h:402
ConnectionStatus
Definition: combase.h:230
Definition: combase_1.h:667
Definition: combase_1.h:385
Definition: combase_1.h:512
Definition: combase.h:256
Definition: combase_1.h:341
const AudioCodecInst kTbPcm16Bwb
Definition: combase_1.h:608
FileFormats
Definition: combase.h:237
Definition: combase_1.h:233
Definition: combase_1.h:175
Definition: combase_1.h:356
const AudioCodecInst kTbPcm48Bwb
Definition: combase_1.h:610
int pltype
Definition: combase.h:572
Definition: combase_1.h:499
Definition: combase_1.h:157
Definition: combase_1.h:529
Definition: combase_1.h:330
const AudioCodecInst kTbPcm48Stereo
Definition: combase_1.h:613
Definition: combase_1.h:404
Definition: combase_1.h:550
AudioRecordedType
Definition: combase.h:693
Definition: combase_1.h:393
Definition: combase_1.h:455
Definition: combase_1.h:554
Definition: combase.h:258
Definition: combase_1.h:307
Definition: combase_1.h:544
Definition: combase_1.h:490
Definition: combase_1.h:534
Definition: combase_1.h:338
DeviceStatus MicrophoneStatus
Definition: combase_1.h:139
Definition: combase_1.h:135
Definition: combase_1.h:316
Definition: combase_1.h:692
AudioCodec
Definition: combase.h:684
virtual void Clear()
Definition: combase_1.h:646
Definition: combase_1.h:670
Definition: combase_1.h:504
DeviceStatus CameraStatus
Definition: combase_1.h:140
Definition: combase_1.h:538
Definition: combase_1.h:195
FunctionType
Definition: combase.h:530
#define FOURCC(a, b, c, d)
Definition: combase_1.h:662
Definition: combase_1.h:685
Definition: combase_1.h:166
Definition: combase_1.h:478
Definition: combase_1.h:319
Definition: combase_1.h:558
int lostpercent_sent
Definition: combase.h:636
Definition: combase_1.h:677
Definition: combase_1.h:678
Definition: combase_1.h:553
int rate
Definition: combase.h:577
Definition: combase.h:571
Definition: combase_1.h:167
AudioCodecInst & operator=(const AudioCodecInst &other)
Definition: combase_1.h:588
const AudioCodecInst kTbIlbc
Definition: combase_1.h:620
Definition: combase_1.h:491
Definition: combase_1.h:408
RoomMode
Definition: combase.h:206
Definition: combase_1.h:241
Definition: combase_1.h:363
Definition: combase_1.h:693
Definition: combase_1.h:523
Definition: combase_1.h:390
VideoQuality
Definition: combase.h:147
Definition: combase_1.h:202
bool hasCamera() const
Definition: combase_1.h:264
VideoRotation
Definition: combase.h:164
Definition: combase_1.h:441
Definition: combase_1.h:421
bool isMicrophoneOn() const
Definition: combase_1.h:266
const AudioCodecInst kTbPcm16Stereo
Definition: combase_1.h:611
int lostpercent
Definition: combase.h:634
Definition: combase_1.h:495
Definition: combase_1.h:694
Definition: combase_1.h:479
RoomOption
Definition: combase.h:423
Definition: combase_1.h:378
Definition: combase_1.h:327
int channels
Definition: combase.h:576
bool hasMicrophone() const
Definition: combase_1.h:262
Definition: combase_1.h:531
Definition: combase_1.h:542
Definition: combase_1.h:345
Definition: combase_1.h:483
Definition: combase_1.h:214
Definition: combase_1.h:149
int lostpercent_received
Definition: combase.h:635
Definition: combase_1.h:516
Definition: combase_1.h:668