C++SDK  1.0.0
combase.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:
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  */
404 
405  eo_video_localrender_lowfps, /* 这个参数主要是安卓系统系统下使用,值类型为int 值范围是[1,2,3] 默认是3,如果值为3,接受到帧数除以3后的数量来渲染。
406  */
415 };
416 
468  //only for windows
476 };
477 
483 };
490 };
495 };
503 };
511 };
512 
520 };
521 
527 };
528 
531  ft_none = 0,
532  ft_roommanager = (1 << 0),
533  ft_datachannel = (1 << 1),
534  ft_chat = (1 << 2),
535  ft_audio = (1 << 3),
536  ft_video = (1 << 4),
537  ft_video_hd = (1 << 5),
538  ft_screen = (1 << 6),
539  ft_annotation = (1 << 7),
540  ft_p2p = (1 << 10),
541  ft_outgoing = (1 << 11),
542  ft_avei = (1 << 12),
546  ft_record_audio = (1 << 16),
547  ft_record_video = (1 << 17),
548  ft_livebroadcast = (1 << 18),
549  ft_h265 = (1 << 19),
551  //
552  ft_platform_android = (1 << 20),
553  ft_platform_ios = (1 << 21),
554  ft_platform_win = (1 << 22),
555  ft_platform_mac = (1 << 23),
556  ft_platform_linux = (1 << 24),
557  ft_platform_web = (1 << 25),
563 };
564 
565 
572  int pltype;
573  char plname[32];
574  int plfreq;
575  int pacsize;
576  int channels;
577  int rate; // bits/sec unlike {start,min,max}Bitrate elsewhere in this file!
578 
579  bool operator==(const AudioCodecInst& other) const {
580  return pltype == other.pltype &&
581  plfreq == other.plfreq &&
582  pacsize == other.pacsize &&
583  channels == other.channels &&
584  rate == other.rate;
585  }
586 
587  bool operator!=(const AudioCodecInst& other) const {
588  return !(*this == other);
589  }
590 
592  if (*this != other) {
593  pltype = other.pltype;
594  //memcpy(plname, other.plname, 32);
595  for (uint32 i = 0; i < sizeof(plname); ++i) {
596  plname[i] = other.plname[i];
597  }
598  plfreq = other.plfreq;
599  pacsize = other.pacsize;
600  channels = other.channels;
601  rate = other.rate;
602  }
603  return *this;
604  }
605 };
611 const AudioCodecInst kTbPcm16Bwb = { 108, "L16", 16000, 320, 1, 256000 }; // default audio data
612 const AudioCodecInst kTbPcm44Bwb = { 130, "L16", 44100, 882, 1, 512000 }; // for aac encoder
613 const AudioCodecInst kTbPcm48Bwb = { 131, "L16", 48000, 960, 1, 512000 };
614 const AudioCodecInst kTbPcm16Stereo = { 112, "L16", 16000, 320, 2, 256000 };
615 const AudioCodecInst kTbPcm44Stereo = { 135, "L16", 44100, 882, 2, 512000 };
616 const AudioCodecInst kTbPcm48Stereo = { 136, "L16", 48000, 960, 2, 512000 };
617 const AudioCodecInst kTbPcmu = { 0, "PCMU", 8000, 160, 1, 64000 };
618 const AudioCodecInst kTbPcma = { 8, "PCMA", 8000, 160, 1, 64000 };
619 const AudioCodecInst kTbPcmuStereo = { 110, "PCMU", 8000, 160, 2, 64000 };
620 const AudioCodecInst kTbPcmaStereo = { 118, "PCMA", 8000, 160, 2, 64000 };
621 const AudioCodecInst kTbIsacWb = { 103, "ISAC", 16000, 480, 1, 32000 };
622 const AudioCodecInst kTbIsacSwb = { 104, "ISAC", 32000, 960, 1, 56000 };
623 const AudioCodecInst kTbIlbc = { 102, "ILBC", 8000, 240, 1, 13300 };
624 const AudioCodecInst kTbOpus = { 120, "opus", 48000, 960, 2, 64000 };
625 
631 struct NetworkStats {
633  int bps_sent;
645  NetworkStats() : bps_received(0), bps_sent(0), lostpercent(0)
646  , lostpercent_received(0), lostpercent_sent(), bytes_received(0), bytes_sent(0)
647  , packets_lost(0), packets_lost_received(0), packets_lost_sent(), packets_received(0), packets_sent(0) {
648  }
649  virtual void Clear() {
650  bps_received = 0;
651  bps_sent = 0;
652  lostpercent = 0;
653  bytes_received = 0;
654  lostpercent_received = 0;
655  lostpercent_sent = 0;
656  bytes_sent = 0;
657  packets_lost = 0;
658  packets_lost_received = 0;
659  packets_lost_sent = 0;
660  packets_received = 0;
661  packets_sent = 0;
662  }
663 };
664 
665 #define FOURCC(a, b, c, d) ( \
666  (static_cast<uint32>(a)) | (static_cast<uint32>(b) << 8) | \
667  (static_cast<uint32>(c) << 16) | (static_cast<uint32>(d) << 24))
668 
669 enum FourCC {
670  FOURCC_I420 = FOURCC('I', '4', '2', '0'),
671  FOURCC_YV12 = FOURCC('Y', 'V', '1', '2'),
672  FOURCC_NV21 = FOURCC('N', 'V', '2', '1'),
673  FOURCC_NV12 = FOURCC('N', 'V', '1', '2'),
674  FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'),
675  FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'),
676  FOURCC_MJPG = FOURCC('M', 'J', 'P', 'G'),
677  FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B'),
678  FOURCC_24BG = FOURCC('2', '4', 'B', 'G'),
679  // h264
680  FOURCC_H264 = FOURCC('H', '2', '6', '4'),
681  FOURCC_H265 = FOURCC('H', '2', '6', '5'),
682 };
683 
692 };
694  ART_NONE = 0,
695  ART_ALL = 1,
698 };
699 
701 
702 #endif//RT_COMMON_BASE_H
Definition: combase.h:402
Definition: combase.h:231
Definition: combase.h:697
Definition: combase.h:532
Definition: combase.h:383
Definition: combase.h:319
Definition: combase.h:508
Definition: combase.h:196
Definition: combase.h:510
int plfreq
Definition: combase.h:574
Definition: combase.h:471
Definition: combase.h:547
int pacsize
Definition: combase.h:575
Definition: combase.h:330
Definition: combase.h:526
Definition: combase.h:489
Definition: combase.h:208
Definition: combase.h:369
Definition: combase.h:552
void setStatus(Status flag)
Definition: combase.h:278
int64 packets_sent
Definition: combase.h:643
Definition: combase.h:157
#define FOURCC(a, b, c, d)
Definition: combase.h:665
Definition: combase.h:518
Definition: combase.h:393
~UserStatus()
Definition: combase.h:292
Definition: combase.h:255
Definition: combase.h:458
Definition: combase.h:691
Definition: combase.h:454
DeviceStatus
Definition: combase.h:132
Definition: combase.h:135
StreamType
Definition: combase.h:185
MediaFileType
Definition: combase.h:492
int64 bytes_received
Definition: combase.h:637
Definition: combase.h:209
Definition: combase.h:524
int AVDHandle
Definition: combase.h:11
Definition: combase.h:488
Definition: combase.h:156
Definition: combase.h:536
Definition: combase.h:327
Definition: combase.h:166
Definition: combase.h:212
Definition: combase.h:560
bool operator==(const AudioCodecInst &other) const
Definition: combase.h:579
Definition: combase.h:252
Definition: combase.h:474
Definition: combase.h:215
RecordStatus
Definition: combase.h:497
Definition: combase.h:232
Definition: combase.h:555
Definition: combase.h:631
Definition: combase.h:405
Definition: combase.h:378
LiveStatus
Definition: combase.h:505
const AudioCodecInst kTbPcm48Stereo
Definition: combase.h:616
#define NAMESPACE_TEE3_AVD_END
Definition: combase.h:121
void clearStatus(Status flag)
Definition: combase.h:286
Definition: combase.h:412
Definition: combase.h:537
Definition: combase.h:165
Definition: combase.h:366
Definition: combase.h:375
int Result
Definition: combase.h:13
Definition: combase.h:214
Definition: combase.h:248
Definition: combase.h:225
Definition: combase.h:399
bool operator==(const UserStatus &from) const
Definition: combase.h:293
const AudioCodecInst kTbIsacSwb
Definition: combase.h:622
UserStatus(uint32 val)
Definition: combase.h:290
Definition: combase.h:515
Definition: combase.h:202
const AudioCodecInst kTbPcmaStereo
Definition: combase.h:620
DeviceStatus MicrophoneStatus
Definition: combase.h:139
Definition: combase.h:465
Definition: combase.h:303
Definition: combase.h:688
Definition: combase.h:506
Definition: combase.h:200
Definition: combase.h:356
Definition: combase.h:316
Definition: combase.h:542
const AudioCodecInst kTbOpus
Definition: combase.h:624
Definition: combase.h:544
Definition: combase.h:557
Definition: combase.h:136
int64 packets_lost
Definition: combase.h:639
#define avd_isFlagSet(uValue, mask)
Definition: combase.h:63
unsigned int uint32
Definition: defines.h:393
RecordAudioType
Definition: combase.h:479
EngineOption
Definition: combase.h:302
Definition: combase.h:486
Definition: combase.h:175
Definition: combase.h:227
Definition: combase.h:310
VideoCodec
Definition: combase.h:174
bool operator!=(const AudioCodecInst &other) const
Definition: combase.h:587
Definition: combase.h:687
DeviceStatus ScreenStatus
Definition: combase.h:141
UserStatus()
Definition: combase.h:291
int bps_received
Definition: combase.h:632
Definition: combase.h:224
Definition: combase.h:516
Definition: combase.h:500
long long int64
Definition: defines.h:383
Definition: combase.h:487
MixerVideoLayoutType
Definition: combase.h:523
#define NAMESPACE_TEE3_AVD_BEGIN
Definition: combase.h:120
Definition: combase.h:322
Definition: combase.h:159
Definition: combase.h:461
CameraType
Definition: combase.h:193
Definition: combase.h:432
Definition: combase.h:194
Definition: combase.h:681
Definition: combase.h:219
bool isScreenOn() const
Definition: combase.h:270
char plname[32]
Definition: combase.h:573
Definition: combase.h:549
Definition: combase.h:216
int bps_sent
Definition: combase.h:633
Definition: combase.h:213
Definition: combase.h:352
Definition: combase.h:469
Definition: combase.h:254
const AudioCodecInst kTbPcmu
Definition: combase.h:617
Definition: combase.h:498
RecordVideoType
Definition: combase.h:485
ScreenType
Definition: combase.h:199
Definition: combase.h:313
int64 packets_lost_received
Definition: combase.h:640
Definition: combase.h:168
Definition: combase.h:689
Definition: combase.h:424
Definition: combase.h:499
uint32 status
Definition: combase.h:288
Definition: combase.h:676
Definition: combase.h:385
Definition: combase.h:548
Definition: combase.h:338
Definition: combase.h:187
Definition: combase.h:333
Definition: combase.h:541
Definition: combase.h:137
Definition: combase.h:546
RoomStatus
Definition: combase.h:223
Definition: combase.h:396
Definition: combase.h:535
FourCC
Definition: combase.h:669
Definition: combase.h:440
Definition: combase.h:178
Definition: combase.h:241
Definition: combase.h:678
Definition: combase.h:188
Definition: combase.h:517
Definition: combase.h:447
Definition: combase.h:562
Definition: combase.h:177
NetworkStats()
Definition: combase.h:645
Definition: combase.h:180
Definition: combase.h:561
LivecastStatus
Definition: combase.h:514
int64 bytes_sent
Definition: combase.h:638
Definition: combase.h:148
Definition: combase.h:240
int64 packets_lost_sent
Definition: combase.h:641
const AudioCodecInst kTbPcm48Bwb
Definition: combase.h:613
Definition: combase.h:253
const AudioCodecInst kTbPcm16Bwb
Definition: combase.h:611
Definition: combase.h:501
Definition: combase.h:673
Definition: combase.h:407
Definition: combase.h:670
int64 packets_received
Definition: combase.h:642
Definition: combase.h:186
Definition: combase.h:158
Definition: combase.h:672
const AudioCodecInst kTbPcm16Stereo
Definition: combase.h:614
Definition: combase.h:325
Definition: combase.h:149
Definition: combase.h:390
const AudioCodecInst kTbIsacWb
Definition: combase.h:621
Definition: combase.h:226
Definition: combase.h:677
const AudioCodecInst kTbPcm44Stereo
Definition: combase.h:615
Definition: combase.h:543
Definition: combase.h:150
bool isCameraOn() const
Definition: combase.h:268
const AudioCodecInst kTbPcmuStereo
Definition: combase.h:619
Status
Definition: combase.h:251
Definition: combase.h:179
Definition: combase.h:169
Definition: combase.h:195
Definition: combase.h:494
Definition: combase.h:450
VideoRatio
Definition: combase.h:155
Definition: combase.h:519
ConnectionStatus
Definition: combase.h:230
Definition: combase.h:256
Definition: combase.h:481
Definition: combase.h:207
Definition: combase.h:201
const AudioCodecInst kTbPcm44Bwb
Definition: combase.h:612
Definition: combase.h:674
Definition: combase.h:234
FileFormats
Definition: combase.h:237
Definition: combase.h:480
#define avd_setFlag(uValue, mask)
Definition: combase.h:69
int pltype
Definition: combase.h:572
Definition: combase.h:695
const AudioCodecInst kTbIlbc
Definition: combase.h:623
Definition: combase.h:413
Definition: combase.h:525
Definition: combase.h:531
Definition: combase.h:211
Definition: combase.h:176
AudioRecordedType
Definition: combase.h:693
#define avd_clearFlag(uValue, mask)
Definition: combase.h:75
Definition: combase.h:502
Definition: combase.h:553
Definition: combase.h:411
Definition: combase.h:554
Definition: combase.h:258
Definition: combase.h:134
Definition: combase.h:428
Definition: combase.h:239
Definition: combase.h:534
Definition: combase.h:538
Definition: combase.h:482
AudioCodec
Definition: combase.h:684
virtual void Clear()
Definition: combase.h:649
Definition: combase.h:387
Definition: combase.h:444
FunctionType
Definition: combase.h:530
Definition: combase.h:675
Definition: combase.h:685
Definition: combase.h:372
Definition: combase.h:341
Definition: combase.h:696
Definition: combase.h:690
Definition: combase.h:559
int lostpercent_sent
Definition: combase.h:636
Definition: combase.h:680
Definition: combase.h:671
int rate
Definition: combase.h:577
Definition: combase.h:571
AudioCodecInst & operator=(const AudioCodecInst &other)
Definition: combase.h:591
Definition: combase.h:238
Definition: combase.h:545
Definition: combase.h:437
const AudioCodecInst kTbPcma
Definition: combase.h:618
Definition: combase.h:539
RoomMode
Definition: combase.h:206
VideoQuality
Definition: combase.h:147
Definition: combase.h:686
bool hasCamera() const
Definition: combase.h:264
Definition: combase.h:509
VideoRotation
Definition: combase.h:164
Definition: combase.h:233
Definition: combase.h:493
bool isMicrophoneOn() const
Definition: combase.h:266
int lostpercent
Definition: combase.h:634
Definition: combase.h:556
DeviceStatus CameraStatus
Definition: combase.h:140
Definition: combase.h:167
RoomOption
Definition: combase.h:423
Definition: combase.h:220
Definition: combase.h:540
Definition: combase.h:363
int channels
Definition: combase.h:576
Definition: combase.h:307
Definition: combase.h:507
Definition: combase.h:533
bool hasMicrophone() const
Definition: combase.h:262
Definition: combase.h:694
int lostpercent_received
Definition: combase.h:635