CNLivePlayerDefines.h
10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
//
// CNLivePlayerDefines.h
// CNLivePlayer
//
// Created by CNLive-zxw on 2019/8/14.
// Copyright © 2019 153993236@qq.com. All rights reserved.
//
#ifndef CNLivePlayerDefines_h
#define CNLivePlayerDefines_h
/*
* 播放器类型
*/
typedef NS_ENUM(NSUInteger, CNLivePlayerType) {
CNLivePlayerVod, //点播
CNLivePlayerLive, //直播
CNLivePlayerAudio //音频
};
/**
* 主播直播状态
*/
typedef NS_ENUM(NSUInteger, CNLiveHostStatus) {
//主播直播中
CNLiveHostStatusLiving = 1,
//直播已结束
CNLiveHostStatusEnd = 2,
//主播已离开
CNLiveHostStatusLeaving = 3
};
/**
* PlayerDownloader任务状态
*/
typedef NS_ENUM(NSInteger, CNLivePlayerDownloaderState) {
CNLivePlayerDownloaderUnknown = 0, //未知
CNLivePlayerDownloaderPause, //暂停
CNLivePlayerDownloaderDownloading, //下载中
CNLivePlayerDownloaderInvalid, //无效
CNLivePlayerDownloaderFinished //完成
};
#pragma mark - 音频播放状态
typedef NS_ENUM(NSUInteger, CNLiveBgmPlayerState) {
/// 初始状态
CNLiveBgmPlayerStateInit,
/// 背景音正在播放
CNLiveBgmPlayerStateStarting,
/// 背景音停止
CNLiveBgmPlayerStateStopped,
/// 背景音正在播放
CNLiveBgmPlayerStatePlaying,
/// 背景音暂停
CNLiveBgmPlayerStatePaused,
/// 背景音播放出错
CNLiveBgmPlayerStateError,
/// 背景音被打断
CNLiveBgmPlayerStateInterrupted
};
#pragma mark - 美颜
typedef NS_ENUM(NSUInteger, CNLiveBeautyType) {
///无
CNLiveBeautyTypeNone = 0,
///旧美颜
CNLiveBeautyTypeOld,
///红润美颜
CNLiveBeautyTypeRuddy,
///美颜特效
CNLiveBeautyTypeSpecial
};
typedef NS_ENUM(NSUInteger, CNLiveSpecialEffects) {
///小清新
CNLiveSpecialEffectsFresh = 0,
///靓丽
CNLiveSpecialEffectsPretty,
///甜美可人
CNLiveSpecialEffectsSweet,
///怀旧
CNLiveSpecialEffectsNostalgia,
///蓝调
CNLiveSpecialEffectsBlues,
///老照片
CNLiveSpecialEffectsOldPicture,
///樱花
CNLiveSpecialEffectsCherry,
///樱花(光线较暗)
CNLiveSpecialEffectsCherryDark,
///红润(光线较暗)
CNLiveSpecialEffectsRuddyDark,
///阳光(光线较暗)
CNLiveSpecialEffectsSunlightDark,
///红润
CNLiveSpecialEffectsRuddy,
///阳光
CNLiveSpecialEffectsSunlight,
///自然
CNLiveSpecialEffectsNature
};
#pragma mark - Video Codec ID
/*!
* @abstract 视频编码器类型
*/
typedef NS_ENUM(NSUInteger, CNLiveVideoCodec) {
/// 视频编码器 - h264 软件编码器
CNLiveVideoCodec_X264 = 0,
/// 视频编码器 - CNLive265 软件编码器
CNLiveVideoCodec_QY265,
/// 视频编码器 - iOS VT264硬件编码器 (iOS 8.0以上支持)
CNLiveVideoCodec_VT264,
/// 视频编码器 - iOS VT265硬件编码器 (iOS 11.0 以上)
CNLiveVideoCodec_VT265,
/// 视频编码器 - 由SDK自动选择( VT264 > X264)
CNLiveVideoCodec_AUTO = 100,
/// 视频编码器 - gif
CNLiveVideoCodec_GIF,
};
/*!
* @abstract 音频编码器类型
*/
typedef NS_ENUM(NSUInteger, CNLiveAudioCodec) {
/// aac音频软件编码器 - AAC_HE
CNLiveAudioCodec_AAC_HE = 0,
/// aac音频软件编码器 - AAC_LC
CNLiveAudioCodec_AAC,
/// iOS自带的audiotoolbox音频编码器 - AAC_LC (CPU占用较低,但推荐码率:64kbps单声道,128kbps双声道)
CNLiveAudioCodec_AT_AAC,
/// aac软件编码器 - AAC_HE_V2 (仅双声道音频可用;如果输入数据为单声道,则自动退化为 AAC_HE)
CNLiveAudioCodec_AAC_HE_V2,
};
/*!
* @abstract 网络自适应模式类型
*/
typedef NS_ENUM(NSUInteger, CNLiveBWEstimateMode) {
/// 默认模式 (综合模式,比较平稳)
CNLiveBWEstMode_Default = 0,
/// 流畅优先模式(消极上调, 极速下调)
CNLiveBWEstMode_Negtive,
/// 禁用网络自适应网络调整
CNLiveBWEstMode_Disable = 1000,
};
/// 直播场景 (CNLive内部会根据场景的特征进行参数调优)
typedef NS_ENUM(NSUInteger, CNLiveLiveScene) {
/// 默认通用场景(不确定场景时使用)
CNLiveLiveScene_Default = 0,
/// 秀场场景, 主播上半身为主
CNLiveLiveScene_Showself,
/// 游戏场景
CNLiveLiveScene_Game,
// others comming soon
};
/// 录制场景
typedef NS_ENUM(NSUInteger, CNLiveRecScene) {
/// 恒定码率场景
CNLiveRecScene_ConstantBitRate = 0,
/// 恒定质量场景
CNLiveRecScene_ConstantQuality,
};
/// 视频编码性能档次 (视频质量 和 设备资源之间的权衡)
typedef NS_ENUM(NSUInteger, CNLiveVideoEncodePerformance) {
/// 低功耗: cpu资源消耗低一些,视频质量差一些
CNLiveVideoEncodePer_LowPower= 0,
/// 均衡档次: 性价比比较高
CNLiveVideoEncodePer_Balance,
/// 高性能: 画面质量高
CNLiveVideoEncodePer_HighPerformance,
};
#pragma mark - QYPublisher State
/*!
* @abstract 采集设备状态
*/
typedef NS_ENUM(NSUInteger, CNLiveCaptureState) {
/// 设备空闲中
CNLiveCaptureStateIdle,
/// 设备工作中
CNLiveCaptureStateCapturing,
/// 设备授权被拒绝
CNLiveCaptureStateDevAuthDenied,
/// 关闭采集设备中
CNLiveCaptureStateClosingCapture,
/// 参数错误,无法打开(比如设置的分辨率,码率当前设备不支持)
CNLiveCaptureStateParameterError,
/// 设备正忙,请稍后尝试 ( 该状态在发出通知0.5秒后被清除 )
CNLiveCaptureStateDevBusy,
};
/*!
* @abstract 推流状态
*/
typedef NS_ENUM(NSUInteger, CNLiveStreamState) {
/// 初始化时状态为空闲
CNLiveStreamStateIdle = 0,
/// 连接中
CNLiveStreamStateConnecting,
/// 已连接
CNLiveStreamStateConnected,
/// 断开连接中
CNLiveStreamStateDisconnecting,
/// 推流出错
CNLiveStreamStateError,
/// 结束推流成功
CNLiveStopStreamSuccess,
/// 结束推流失败
CNLiveStopStreamFailure,
};
/*!
* @abstract 推流错误码,用于指示推流失败的原因
*/
typedef NS_ENUM(NSUInteger, CNLiveStreamErrorCode) {
/// 正常无错误
CNLiveStreamErrorCode_NONE = 0,
/// (obsolete)
CNLiveStreamErrorCode_CNLiveAUTHFAILED __deprecated_enum_msg("auth removed"),
/// 当前帧编码失败
CNLiveStreamErrorCode_ENCODE_FRAMES_FAILED,
/// 无法打开配置指示的CODEC
CNLiveStreamErrorCode_CODEC_OPEN_FAILED,
/// 连接出错,检查地址
CNLiveStreamErrorCode_CONNECT_FAILED,
/// 网络连接中断
CNLiveStreamErrorCode_CONNECT_BREAK = 5,
/// rtmp 推流域名不存在 (CNLive 自定义)
CNLiveStreamErrorCode_RTMP_NonExistDomain,
/// rtmp 应用名不存在(CNLive 自定义)
CNLiveStreamErrorCode_RTMP_NonExistApplication,
/// rtmp 流名已存在(CNLive 自定义)
CNLiveStreamErrorCode_RTMP_AlreadyExistStreamName,
/// rtmp 被黑名单拒绝(CNLive 自定义)
CNLiveStreamErrorCode_RTMP_ForbiddenByBlacklist,
/// rtmp 内部错误(CNLive 自定义)
CNLiveStreamErrorCode_RTMP_InternalError = 10,
/// rtmp URL 地址已过期(CNLive 自定义)
CNLiveStreamErrorCode_RTMP_URLExpired,
/// rtmp URL 地址签名错误(CNLive 自定义)
CNLiveStreamErrorCode_RTMP_SignatureDoesNotMatch,
/// rtmp URL 中AccessKeyId非法(CNLive 自定义)
CNLiveStreamErrorCode_RTMP_InvalidAccessKeyId,
/// rtmp URL 中参数错误(CNLive 自定义)
CNLiveStreamErrorCode_RTMP_BadParams,
/// rtmp URL 中的推流不在发布点内(CNLive 自定义)
CNLiveStreamErrorCode_RTMP_ForbiddenByRegion = 15,
/// (obsolete)
CNLiveStreamErrorCode_FRAMES_THRESHOLD,
/// (obsolete)
CNLiveStreamErrorCode_NO_INPUT_SAMPLE,
/// 对于URL中的域名解析失败
CNLiveStreamErrorCode_DNS_Parse_failed,
/// 对于URL对应的服务器连接失败(无法建立TCP连接)
CNLiveStreamErrorCode_Connect_Server_failed,
/// 跟RTMP服务器完成握手后,向{appname}/{streamname} 推流失败
CNLiveStreamErrorCode_RTMP_Publish_failed = 20,
/// 音视频同步失败 (输入的音频和视频的时间戳的差值超过5s)
CNLiveStreamErrorCode_AV_SYNC_ERROR,
/// 非法地址(地址为空或url中的协议或本地文件的后缀SDK不支持, 请检查)
CNLiveStreamErrorCode_INVALID_ADDRESS,
/// 网络不通
CNLiveStreamErrorCode_NETWORK_UNREACHABLE,
/// 获取user id失败 (CNLive 自定义)
CNLiveStreamErrorCode_RTMP_GetUserIdFailed,
/// AK和user id不匹配 (CNLive 自定义)
CNLiveStreamErrorCode_RTMP_AkAndUserIsNotMatch = 25,
/// 获取服务器信息失败 (CNLive 自定义)
CNLiveStreamErrorCode_RTMP_GetServerInfoFailed,
/// 非法的外部url (CNLive 自定义)
CNLiveStreamErrorCode_RTMP_IllegalOutsideUrl,
/// 外部鉴权失败 (CNLive 自定义)
CNLiveStreamErrorCode_RTMP_OutsideAuthFailed,
/// 简单鉴权失败(CNLive 自定义)
CNLiveStreamErrorCode_RTMP_SimpleAuthFailed,
/// 无效的鉴权类型 (CNLive 自定义)
CNLiveStreamErrorCode_RTMP_InvalidAuthType = 30,
/// 非法的user id (CNLive 自定义)
CNLiveStreamErrorCode_RTMP_IllegalUserId,
/// 异常
CNLiveStreamErrorCode_ABNORMAL,
};
typedef NS_ENUM(NSUInteger, CNLiveReconnectStatus) {
CNLiveReconnectStatusStart = 0,
CNLiveReconnectStatusSuccess,
CNLiveReconnectStatusFailed
};
#pragma mark - 旁路录制
/*
* @abstract 旁路录制状态
*/
typedef NS_ENUM(NSInteger, CNLiveRecordState) {
/// 初始状态
CNLiveRecordStateIdle,
/// 录像中
CNLiveRecordStateRecording,
/// 录像停止
CNLiveRecordStateStopped,
/// 录像失败
CNLiveRecordStateError,
};
/*!
* @abstract 旁路录制错误码
*/
typedef NS_ENUM(NSInteger, CNLiveRecordError) {
/// 无错误
CNLiveRecordErrorNone,
/// 地址错误
CNLiveRecordErrorPathInvalid,
/// 格式不支持
CNLiveRecordErrorFormatNotSupport,
/// 内部错误
CNLiveRecordErrorInternal,
};
/*
* 播放器类型
*/
typedef NS_ENUM(NSUInteger, CNLiveStreamerType) {
CNLiveStreamerVod, //视频
CNLiveStreamerAudio //音频
};
#endif /* CNLivePlayerDefines_h */