KRtcTypeDef.h
1#ifndef __KRTCTYPEDEF_H__
2#define __KRTCTYPEDEF_H__
3
4#include <stdint.h>
5
6#ifdef _WIN32
7#ifdef KDV_RTC_SDK_EXPORTS
8#define KDV_RTC_SDK_API __declspec(dllexport)
9#else
10#define KDV_RTC_SDK_API __declspec(dllimport)
11#endif
12#else
13#ifdef KDV_RTC_SDK_EXPORTS
14#define KDV_RTC_SDK_API __attribute__((visibility("default")))
15#endif
16#endif
17
18#ifndef KDV_RTC_SDK_API
19#define KDV_RTC_SDK_API
20#endif
21
22namespace KRTCSDK {
26 enum KRTC_LOG_LEVEL
27 {
28 KRTC_LOG_LEVEL_ALL,
29 KRTC_LOG_LEVEL_TRACE,
30 KRTC_LOG_LEVEL_DEBUG,
31 KRTC_LOG_LEVEL_INFO,
32 KRTC_LOG_LEVEL_WARN,
33 KRTC_LOG_LEVEL_ERROR,
34 KRTC_LOG_LEVEL_FATAL,
35 KRTC_LOG_LEVEL_OFF
36 };
37
38 enum VIDEO_TYPE
39 {
40 VIDEO_TYPE_RGBA8888,
41 };
42
43 typedef const char* userId;
44
45 typedef void* winId; // 窗口id,Android平台请将GLSurfaceView转为winId传入
46
47 typedef void (*onLog)(const char* module, KRTC_LOG_LEVEL logLevel, const char* log);
48
49 enum RTC_SDK_WARNING
50 {
51 };
52
53 enum RTC_SDK_ERROR
54 {
55 };
56
58 {
65#if __ANDROID__
66 void* jvm;
67 void* jappContext;
68#endif
69 };
70
72 {
73 bool enableLog;
74 const char* logPath;
75 onLog callback;
76 };
77
79 {
80 const char* serverAddr;
81 userId id;
82 const char* token;
83 const char* nickName;
84 };
85
87 {
88 const char* roomId;
89 uint32_t bitrate;
90 const char* roomPwd;
91 };
92
94 {
95 const char* roomId;
96 const char* roomName;
97 uint32_t bitrate;
98 };
99
101 {
104 };
105
107 {
108 const char* buffer;
109 uint32_t length;
110 uint32_t width;
111 uint32_t height;
112 };
113
115 {
116 int32_t count;
117 uint32_t* screenId;
118 };
119
120 enum RESOLUTION
121 {
122 RESOLUTION_320x180,
123 RESOLUTION_640x360,
124 RESOLUTION_1280x720,
125 RESOLUTION_480x270,
126 RESOLUTION_960x540,
127 RESOLUTION_1920x1080,
128 };
129
131 {
132 uint8_t layerCount;
133 RESOLUTION maxResolution;
134 uint8_t maxFps;
135 uint32_t bitrate[3];
136 uint8_t mediaIndex;
137 };
138
140 {
141 uint32_t maxBitrate;
142 uint32_t minBitrate;
143 };
144
146 {
147 STREAM_TYPE_MAIN_VIDEO,
152 };
153
155 {
156 STREAM_TYPE type;
157 uint8_t mediaIndex;
158 uint8_t layerIndex;
159 };
160
162 {
163 STREAM_TYPE type;
164 uint8_t mediaIndex;
165 uint8_t layerCount;
166 int32_t width;
167 int32_t height;
168 uint8_t maxFps;
169 uint32_t maxBitrate;
170 };
171
172 // 视频帧数据(YUV420格式)
174 {
175 int32_t width;
176 int32_t height;
177 int32_t strideY;
178 int32_t strideU;
179 int32_t strideV;
180 uint8_t* dataY;
181 uint8_t* dataU;
182 uint8_t* dataV;
183 int64_t timestampMs;
184 };
185
187 {
188 uint8_t* data;
189 uint32_t dataSize;
190 uint32_t channelCount;
191 uint32_t sampleRate;
192 uint32_t bitWidth;
193 };
194
195 enum H264_PROFILE
196 {
197 H264_PROFILE_BASELINE,
198 };
199
201 {
202 uint8_t* data;
203 uint32_t dataSize;
204 uint32_t width;
205 uint32_t height;
206 uint32_t frameId;
207 int64_t timestampMs;
209 H264_PROFILE profile;
210 };
211
213 {
214 uint32_t width;
215 uint32_t height;
216 uint32_t frameRate;
217 double bitrate;
218 double lossRate;
219 uint32_t freezeCount;
221 };
222
224 {
225 double bitrate;
226 double lossRate;
227 };
228
230 {
231 uint32_t bytesSent;
232 uint32_t bytesReceived;
233 double bitrateSend;
234 double bitrateRecv;
237 };
238
239 enum DEVICETYPE
240 {
241 DEVICETYPE_MIC,
242 DEVICETYPE_SPEAKER,
243 DEVICETYPE_CAMERA,
244 };
245
247 {
248 const char* deviceName;
249 const char* deviceId;
250 };
251
253 {
254 DEVICETYPE type;
255 int32_t count;
256 DeviceInfo* devices;
257 };
258
259 enum CAMERA_CAPTURE_ORIENTATION
260 {
261 CAMERA_CAPTURE_ORIENTATION_0,
262 CAMERA_CAPTURE_ORIENTATION_90,
263 CAMERA_CAPTURE_ORIENTATION_180,
264 CAMERA_CAPTURE_ORIENTATION_270,
265 CAMERA_CAPTURE_ORIENTATION_SYSTEM,
266 };
267
269 {
270 userId id;
271 int8_t level;
272 };
273
274 // 视频编码参数
276 {
277 uint32_t width;
278 uint32_t height;
279 uint32_t bitrate;
280 uint32_t frameRate;
282 H264_PROFILE profile;
283 };
284
286 {
287 uint32_t channelCount;
288 uint32_t sampleRate;
289 };
290
291 //采集原始视频数据
292 typedef struct
293 {
294 uint8_t* data;
295 uint32_t dataSize;
296 int32_t width;
297 int32_t height;
298 VIDEO_TYPE videoType;
300
301 typedef void (*onLocalVideoData)(const char* deviceId, VideoFrameData* data);
302
303 typedef void (*onLocalAudioData)(const char* deviceId, AudioFrameData* data);
304
305 typedef void (*onLocalAudioLevel)(const char* deviceId, int8_t level);
306
307
309};
310
312enum KRTC_CUSTOM_CALLBACK
313{
314 KRTC_CUSTOM_CALLBACK_NONE = 0,
315 KRTC_CUSTOM_CALLBACK_SIMPLECONFINFO = 1,
316 KRTC_CUSTOM_CALLBACK_DELAYCONFITIME,
317 KRTC_CUSTOM_CALLBACK_TERMSTATUSLIST_NOTIFY,
318 KRTC_CUSTOM_CALLBACK_CONFINFO_IND,
319 KRTC_CUSTOM_CALLBACK_CONFWILLEND_IND,
320 //KRTC_CUSTOM_CALLBACK_ONCONFPASSWORD_REQ, ///< data struct refer to onConfPasswordReq
321 KRTC_CUSTOM_CALLBACK_APPLYSPEAKER_RSP,
322 KRTC_CUSTOM_CALLBACK_APPLYSPEADER_IND,
323 KRTC_CUSTOM_CALLBACK_SPECSPEAKER_RSP,
324 KRTC_CUSTOM_CALLBACK_SPECSPEAKER_IND,
325 KRTC_CUSTOM_CALLBACK_INVITETERMINAL_ERROR,
326 KRTC_CUSTOM_CALLBACK_MAKETERMUTE_CMD,
327 KRTC_CUSTOM_CALLBACK_TRANSPARENTMSG_IND,
328};
329
330typedef void(*ONCUSTOMIZEDCALLBACK)(KRTC_CUSTOM_CALLBACK emEvent, const char* pszData, unsigned int dwSize, void* lpUser);
331
332
333#endif
WINDOW_TYPE
Definition: KRtcTypeDef.h:101
STREAM_TYPE
Definition: KRtcTypeDef.h:146
@ WINDOW_TYPE_WINDOW
应用窗口
Definition: KRtcTypeDef.h:102
@ WINDOW_TYPE_SCREEN
屏幕
Definition: KRtcTypeDef.h:103
@ STREAM_TYPE_AUDIO
1< 辅流视频
Definition: KRtcTypeDef.h:149
@ STREAM_TYPE_MIX_AUDIO
3< 画面合成码流
Definition: KRtcTypeDef.h:151
@ STREAM_TYPE_DUAL_VIDEO
0< 主流视频
Definition: KRtcTypeDef.h:148
@ STREAM_TYPE_VMP
2< 音频
Definition: KRtcTypeDef.h:150
Definition: KRtcTypeDef.h:286
uint32_t channelCount
声道数
Definition: KRtcTypeDef.h:287
uint32_t sampleRate
采样率
Definition: KRtcTypeDef.h:288
Definition: KRtcTypeDef.h:187
uint32_t channelCount
声道数
Definition: KRtcTypeDef.h:190
uint32_t bitWidth
采样位宽
Definition: KRtcTypeDef.h:192
uint32_t sampleRate
采样频率
Definition: KRtcTypeDef.h:191
uint32_t dataSize
数据长度
Definition: KRtcTypeDef.h:189
uint8_t * data
音频数据
Definition: KRtcTypeDef.h:188
Definition: KRtcTypeDef.h:269
int8_t level
0~127
Definition: KRtcTypeDef.h:271
Definition: KRtcTypeDef.h:224
double lossRate
丢包率()
Definition: KRtcTypeDef.h:226
double bitrate
音频码率(bps)
Definition: KRtcTypeDef.h:225
Definition: KRtcTypeDef.h:94
const char * roomName
房间别名
Definition: KRtcTypeDef.h:96
uint32_t bitrate
房间码率
Definition: KRtcTypeDef.h:97
Definition: KRtcTypeDef.h:247
Definition: KRtcTypeDef.h:253
Definition: KRtcTypeDef.h:140
uint32_t maxBitrate
最大码率(bps)
Definition: KRtcTypeDef.h:141
uint32_t minBitrate
最小码率(bps)
Definition: KRtcTypeDef.h:142
Definition: KRtcTypeDef.h:201
H264_PROFILE profile
H264画质级别
Definition: KRtcTypeDef.h:209
uint32_t dataSize
数据长度(字节数)
Definition: KRtcTypeDef.h:203
uint8_t * data
已编码数据
Definition: KRtcTypeDef.h:202
uint32_t frameId
帧ID
Definition: KRtcTypeDef.h:206
uint32_t height
帧高
Definition: KRtcTypeDef.h:205
uint32_t width
帧宽
Definition: KRtcTypeDef.h:204
bool isKeyFrame
是否关键帧(IDR帧)
Definition: KRtcTypeDef.h:208
int64_t timestampMs
采集/渲染时间(毫秒)
Definition: KRtcTypeDef.h:207
Definition: KRtcTypeDef.h:107
const char * buffer
图像内容(BGRA)
Definition: KRtcTypeDef.h:108
uint32_t width
图像宽
Definition: KRtcTypeDef.h:110
uint32_t height
图像高
Definition: KRtcTypeDef.h:111
uint32_t length
图像缓存大小
Definition: KRtcTypeDef.h:109
Definition: KRtcTypeDef.h:87
const char * roomId
房间id
Definition: KRtcTypeDef.h:88
const char * roomPwd
房间密码
Definition: KRtcTypeDef.h:90
uint32_t bitrate
呼叫码率 0表示使用默认值,单位bps
Definition: KRtcTypeDef.h:89
Definition: KRtcTypeDef.h:58
bool customAudioCapture
启用或关闭自定义音频采集,启用后需用户手动调用sendRecordVideoData发送音频帧,发送间隔必须为20ms
Definition: KRtcTypeDef.h:61
bool customVideoDecode
启用或关闭自定义视频解码
Definition: KRtcTypeDef.h:64
bool customVideoCapture
启用或关闭自定义视频采集
Definition: KRtcTypeDef.h:59
bool customVideoEncode
启用或关闭自定义视频编码
Definition: KRtcTypeDef.h:63
bool customAudioPlayout
启用或关闭自定义音频输出
Definition: KRtcTypeDef.h:62
bool customVideoRender
启用或关闭自定义视频渲染
Definition: KRtcTypeDef.h:60
Definition: KRtcTypeDef.h:72
const char * logPath
log路径,设nullptr表示不写入log文件
Definition: KRtcTypeDef.h:74
onLog callback
log回调,设nullptr不需要回调
Definition: KRtcTypeDef.h:75
Definition: KRtcTypeDef.h:79
const char * nickName
用户别名(utf-8)
Definition: KRtcTypeDef.h:83
const char * serverAddr
ipv4, ipv6, domain name
Definition: KRtcTypeDef.h:80
userId id
用户id,匿名登录时填nullptr即可
Definition: KRtcTypeDef.h:81
const char * token
token:appKey + userId + ExpiredTs + assignment
Definition: KRtcTypeDef.h:82
Definition: KRtcTypeDef.h:131
uint8_t layerCount
同一条主流最多允许同时发送三层分辨率,双流仅允许发一层
Definition: KRtcTypeDef.h:132
uint32_t bitrate[3]
每层流的码率(bps),0 1 2 分别代表 低 中 高
Definition: KRtcTypeDef.h:135
RESOLUTION maxResolution
最高层分辨率,中低层分辨率为 maxResolution/2,maxResolution/4
Definition: KRtcTypeDef.h:133
uint8_t maxFps
最大帧率
Definition: KRtcTypeDef.h:134
uint8_t mediaIndex
发布多条主流时每个视频源的索引号
Definition: KRtcTypeDef.h:136
Definition: KRtcTypeDef.h:115
uint32_t * screenId
屏幕id
Definition: KRtcTypeDef.h:117
int32_t count
屏幕个数
Definition: KRtcTypeDef.h:116
Definition: KRtcTypeDef.h:230
uint32_t bytesReceived
累计接收(Byte)
Definition: KRtcTypeDef.h:232
double bitrateRecv
下行总码率(bps)
Definition: KRtcTypeDef.h:234
double lossRateSend
上行总丢包率(%)
Definition: KRtcTypeDef.h:235
uint32_t bytesSent
累计发送(Byte)
Definition: KRtcTypeDef.h:231
double bitrateSend
上行总码率(bps)
Definition: KRtcTypeDef.h:233
double lossRateRecv
下行总丢包率(%)
Definition: KRtcTypeDef.h:236
Definition: KRtcTypeDef.h:162
uint32_t maxBitrate
最大码率
Definition: KRtcTypeDef.h:169
uint8_t maxFps
最大帧率
Definition: KRtcTypeDef.h:168
uint8_t layerCount
分辨率层数
Definition: KRtcTypeDef.h:165
uint8_t mediaIndex
发布多条辅流时每个视频源的索引号
Definition: KRtcTypeDef.h:164
int32_t height
最大分辨率高度
Definition: KRtcTypeDef.h:167
int32_t width
最大分辨率宽度
Definition: KRtcTypeDef.h:166
Definition: KRtcTypeDef.h:155
uint8_t mediaIndex
多流时每个视频源的索引号,音频填0即可
Definition: KRtcTypeDef.h:157
uint8_t layerIndex
订阅的分辨率层,辅流及音频填0即可
Definition: KRtcTypeDef.h:158
Definition: KRtcTypeDef.h:293
uint8_t * data
采集数据
Definition: KRtcTypeDef.h:294
VIDEO_TYPE videoType
视频类型
Definition: KRtcTypeDef.h:298
int32_t width
帧宽
Definition: KRtcTypeDef.h:296
int32_t height
帧高
Definition: KRtcTypeDef.h:297
uint32_t dataSize
数据长度(字节数)
Definition: KRtcTypeDef.h:295
Definition: KRtcTypeDef.h:276
H264_PROFILE profile
H264画质级别
Definition: KRtcTypeDef.h:282
uint32_t bitrate
码率,kbps
Definition: KRtcTypeDef.h:279
uint32_t frameRate
帧率
Definition: KRtcTypeDef.h:280
uint32_t height
帧高
Definition: KRtcTypeDef.h:278
uint32_t width
帧宽
Definition: KRtcTypeDef.h:277
uint32_t keyframeInterval
关键帧间隔
Definition: KRtcTypeDef.h:281
Definition: KRtcTypeDef.h:174
uint8_t * dataU
U数据
Definition: KRtcTypeDef.h:181
uint8_t * dataY
Y数据
Definition: KRtcTypeDef.h:180
int32_t height
帧高
Definition: KRtcTypeDef.h:176
int32_t strideU
U跨距
Definition: KRtcTypeDef.h:178
int32_t width
帧宽
Definition: KRtcTypeDef.h:175
uint8_t * dataV
V数据
Definition: KRtcTypeDef.h:182
int32_t strideV
V跨距
Definition: KRtcTypeDef.h:179
int64_t timestampMs
采集时间
Definition: KRtcTypeDef.h:183
int32_t strideY
Y跨距
Definition: KRtcTypeDef.h:177
Definition: KRtcTypeDef.h:213
uint32_t width
视频宽度
Definition: KRtcTypeDef.h:214
uint32_t frameRate
视频帧率(fps)
Definition: KRtcTypeDef.h:216
uint32_t freezeCount
视频卡顿帧数
Definition: KRtcTypeDef.h:219
double lossRate
丢包率()
Definition: KRtcTypeDef.h:218
uint32_t totalFreezesDuration
视频卡顿时长
Definition: KRtcTypeDef.h:220
uint32_t height
视频高度
Definition: KRtcTypeDef.h:215
double bitrate
视频码率(bps)
Definition: KRtcTypeDef.h:217