ZegoLiveRoom
zego-api-mediaplayer-defines.h
Go to the documentation of this file.
1//
2// zego-api-mediaplayer-defines.h
3// ZegoLiveRoom
4//
5// Copyright © 2018年 Zego. All rights reserved.
6//
7
8#ifndef zego_api_mediaplayer_defines_h
9#define zego_api_mediaplayer_defines_h
10
11#include "zego-api-defines.h"
12
13namespace ZEGO
14{
15namespace MEDIAPLAYER
16{
17
19 {
22 };
23
25 {
34 };
35
37 {
42 };
43
45 {
49 };
50
52 {
54 ZegoMediaPlayerAudioTrackModeMultiple = 1 // 多音轨模式
55 };
56
61 {
82 };
83
90
93
96 };
97
102
105
108
111 };
112
119
122
125 };
126
134
137
140
143
146
149
152 };
153
155 {
156 int width;
158 int strides[4];
160 long pts;
162
164 {
165 width = 0;
166 height = 0;
167 strides[0] = strides[1] = strides[2] = strides[3] = 0;
168 rotation = 0;
170 }
171
173 {
174 this->width = width;
175 this->height = height;
176 this->pixelFormat = pixelFormat;
177 this->strides[0] = this->strides[1] = this->strides[2] = this->strides[3] = 0;
178 this->rotation = 0;
179 }
180 };
181
183 {
184 char szKey[512];
185 char szValue[512];
186
188 {
189 szKey[0] = '\0';
190 szValue[0] = '\0';
191 }
192 };
193
195 {
196 /* 加载资源类型 */
198 /* 开始播放位置 */
200 /* 开始播放位置 */
202 /* 普通资源路径 */
203 char filePath[2048];
204 /* 二进制数据缓存 */
205 unsigned char *memory;
206 /* 二进制数据缓存长度 */
208 /* 版权音乐资源ID */
209 char resourceID[512];
210 /* 是否立即开始播放 */
212 /* 在线资源缓存路径,utf8 编码格式。使用限制:不能与 SetMediaPlayerFileReader 一起使用,仅支持 http/htpps 协议 */
214 /* 在线资源最大的缓存待使用长度,单位 byte,最小设置 10M(10 * 1024 * 1024),默认0-不做限制,尝试缓存整个文件 */
216
218 {
220 startPosition = 0;
222 filePath[0] = '\0';
223 memory = nullptr;
224 memoryLength = 0;
225 resourceID[0] = '\0';
226 instantPlay = false;
227 onlineResourceCachePath[0] = '\0';
229 }
230 };
231
233 {
235 int width;
240
242 {
243 width = 0;
244 height = 0;
245 frameRate = 0;
246 }
247 };
248
255
258
261
264
267
270
272 videoSourceFps = 0;
273 videoDecodeFps = 0;
274 videoRenderFps = 0;
275 audioSourceFps = 0;
276 audioDecodeFps = 0;
277 audioRenderFps = 0;
278 }
279 };
280
282 {
283 public:
287 virtual void OnPlayStart(ZegoMediaPlayerIndex index) = 0;
292 virtual void OnPlayError(const int errCode, ZegoMediaPlayerIndex index) = 0;
296 virtual void OnVideoBegin(ZegoMediaPlayerIndex index) {}
300 virtual void OnAudioBegin(ZegoMediaPlayerIndex index) {}
304 virtual void OnPlayEnd(ZegoMediaPlayerIndex index) = 0;
311 virtual void OnSeekComplete(const int state, const long duration, ZegoMediaPlayerIndex index) {}
315 virtual void OnPlayPause(ZegoMediaPlayerIndex index) {}
319 virtual void OnPlayResume(ZegoMediaPlayerIndex index) {}
323 virtual void OnPlayStop(ZegoMediaPlayerIndex index) {}
327 virtual void OnBufferBegin(ZegoMediaPlayerIndex index) {}
331 virtual void OnBufferEnd(ZegoMediaPlayerIndex index) {}
332
336 virtual void OnSnapshot(void *image, ZegoMediaPlayerIndex index) {}
337
342
349 virtual void OnProcessInterval(long timestamp, ZegoMediaPlayerIndex index) {}
350
357 virtual void OnRenderingProcessInterval(long timestamp, ZegoMediaPlayerIndex index) {}
358
362 virtual void OnReadEOF(ZegoMediaPlayerIndex index) {}
363
371 virtual void OnMediaPlayerVideoSizeChanged(int width, int height, ZegoMediaPlayerIndex index) {}
372
381 virtual void OnLocalCache(int error, const char *resource, const char *cached_file, ZegoMediaPlayerIndex index) {}
382
390 };
391
399 {
400 public:
410 virtual void OnPlayVideoData(const char* data, int len, ZegoMediaPlayerVideoDataFormat& format, ZegoMediaPlayerIndex index) {}
411
421 virtual void OnPlayVideoData2(const char **pData, int* len, ZegoMediaPlayerVideoDataFormat& format, ZegoMediaPlayerIndex index) {}
422 };
423
428 {
429 public:
442 virtual void OnPlayAudioData(unsigned char *const data, int length, int sample_rate, int channels, int bit_depth, ZegoMediaPlayerIndex index) = 0;
443 };
444
449 {
450 public:
458 virtual void OnMediaSideInfo(const unsigned char *data, int length, ZegoMediaPlayerIndex index) = 0;
459 };
460
465 {
466 public:
467
474 virtual void OnPlayerSoundLevelUpdate(float soundLevel, ZegoMediaPlayerIndex index) = 0;
475
483 virtual void OnPlayerFrequencySpectrumUpdate(float *spectrumList, unsigned spectrumCount, ZegoMediaPlayerIndex index) = 0;
484 };
485
490 {
491 public:
498 virtual int Open(const char *path, ZegoMediaPlayerIndex index) = 0;
499
503 virtual void Close(ZegoMediaPlayerIndex index) = 0;
504
512 virtual int Read(unsigned char *buf, int size, ZegoMediaPlayerIndex index) = 0;
513
521 virtual long long Seek(long long pos, int seekMode, ZegoMediaPlayerIndex index) = 0;
522
528 virtual long long GetSize(ZegoMediaPlayerIndex index) = 0; //返回文件的大小
529 };
530
535 {
536 public:
537
544 virtual void OnBlockBegin(const char *path, ZegoMediaPlayerIndex index) = 0;
545
554 virtual int OnBlockData(unsigned char *const buf, int size, ZegoMediaPlayerIndex index) = 0;
555 };
556
557} // MEDIAPLAYER
558} // ZEGO
559
560
561#endif /* zego_api_mediaplayer_defines_h */
Definition: zego-api-mediaplayer-defines.h:428
virtual void OnPlayAudioData(unsigned char *const data, int length, int sample_rate, int channels, int bit_depth, ZegoMediaPlayerIndex index)=0
Definition: zego-api-mediaplayer-defines.h:535
virtual int OnBlockData(unsigned char *const buf, int size, ZegoMediaPlayerIndex index)=0
播放器将块数据回调出来,会同步等待用户解密修改完毕,再进行播放
virtual void OnBlockBegin(const char *path, ZegoMediaPlayerIndex index)=0
开始抛出块数据通知
Definition: zego-api-mediaplayer-defines.h:282
virtual void OnBufferBegin(ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:327
virtual void OnVideoBegin(ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:296
virtual void OnProcessInterval(long timestamp, ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:349
virtual void OnSeekComplete(const int state, const long duration, ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:311
virtual void OnPlayError(const int errCode, ZegoMediaPlayerIndex index)=0
virtual void OnAudioBegin(ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:300
virtual void OnPlayStop(ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:323
virtual void OnPlayPause(ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:315
virtual void OnReadEOF(ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:362
virtual void OnPlayEnd(ZegoMediaPlayerIndex index)=0
virtual void OnMediaPlayerVideoSizeChanged(int width, int height, ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:371
virtual void OnPlayStart(ZegoMediaPlayerIndex index)=0
virtual void OnMonitorEvent(ZegoMediaPlayerExceptionEvent event, ZegoMediaPlayerIndex index)
播放器异常事件
Definition: zego-api-mediaplayer-defines.h:389
virtual void OnRenderingProcessInterval(long timestamp, ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:357
virtual void OnBufferEnd(ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:331
virtual void OnSnapshot(void *image, ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:336
virtual void OnPlayResume(ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:319
virtual void OnLoadComplete(ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:341
virtual void OnLocalCache(int error, const char *resource, const char *cached_file, ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:381
Definition: zego-api-mediaplayer-defines.h:449
virtual void OnMediaSideInfo(const unsigned char *data, int length, ZegoMediaPlayerIndex index)=0
Definition: zego-api-mediaplayer-defines.h:465
virtual void OnPlayerSoundLevelUpdate(float soundLevel, ZegoMediaPlayerIndex index)=0
音浪更新回调,回调频率由 EnableSoundLevelMonitor 指定
virtual void OnPlayerFrequencySpectrumUpdate(float *spectrumList, unsigned spectrumCount, ZegoMediaPlayerIndex index)=0
频谱更新回调,回调频率由 EnableFrequencySpectrumMonitor 指定
Definition: zego-api-mediaplayer-defines.h:399
virtual void OnPlayVideoData(const char *data, int len, ZegoMediaPlayerVideoDataFormat &format, ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:410
virtual void OnPlayVideoData2(const char **pData, int *len, ZegoMediaPlayerVideoDataFormat &format, ZegoMediaPlayerIndex index)
Definition: zego-api-mediaplayer-defines.h:421
Definition: zego-api-mediaplayer-defines.h:490
virtual long long Seek(long long pos, int seekMode, ZegoMediaPlayerIndex index)=0
virtual void Close(ZegoMediaPlayerIndex index)=0
virtual int Open(const char *path, ZegoMediaPlayerIndex index)=0
virtual long long GetSize(ZegoMediaPlayerIndex index)=0
virtual int Read(unsigned char *buf, int size, ZegoMediaPlayerIndex index)=0
ZegoAlphaLayoutType
Definition: zego-api-defines.h:1558
@ ZEGO_ALPHA_LAYOUT_TYPE_NONE
Definition: zego-api-defines.h:1560
ZegoMediaPlayerExceptionEvent
播放器异常事件类型
Definition: zego-api-mediaplayer-defines.h:131
@ ZEGO_MEDIA_PLAYER_EXCEPTION_EVENT_SEEK_TIMEOUT
Definition: zego-api-mediaplayer-defines.h:136
@ ZEGO_MEDIA_PLAYER_EXCEPTION_EVENT_FLOW_ERROR
Definition: zego-api-mediaplayer-defines.h:151
@ ZEGO_MEDIA_PLAYER_EXCEPTION_EVENT_LOAD_TIMEOUT
Definition: zego-api-mediaplayer-defines.h:133
@ ZEGO_MEDIA_PLAYER_EXCEPTION_EVENT_DECODE_FAILED
Definition: zego-api-mediaplayer-defines.h:145
@ ZEGO_MEDIA_PLAYER_EXCEPTION_EVENT_SYNC_ERROR
Definition: zego-api-mediaplayer-defines.h:148
@ ZEGO_MEDIA_PLAYER_EXCEPTION_EVENT_SEEK_FAILED
Definition: zego-api-mediaplayer-defines.h:139
@ ZEGO_MEDIA_PLAYER_EXCEPTION_EVENT_AUDIORND_ERROR
Definition: zego-api-mediaplayer-defines.h:142
ZegoMultimediaLoadType
Definition: zego-api-mediaplayer-defines.h:87
@ ZEGO_MULTIMEDIA_LOAD_TYPE_MEMORY
Definition: zego-api-mediaplayer-defines.h:92
@ ZEGO_MULTIMEDIA_LOAD_TYPE_RESOURCE_ID
Definition: zego-api-mediaplayer-defines.h:95
@ ZEGO_MULTIMEDIA_LOAD_TYPE_FILE_PATH
Definition: zego-api-mediaplayer-defines.h:89
ZegoMediaPlayerIndex
Definition: zego-api-mediaplayer-defines.h:37
@ ZegoMediaPlayerIndexFirst
Definition: zego-api-mediaplayer-defines.h:38
@ ZegoMediaPlayerIndexThird
Definition: zego-api-mediaplayer-defines.h:40
@ ZegoMediaPlayerIndexFourth
Definition: zego-api-mediaplayer-defines.h:41
@ ZegoMediaPlayerIndexSecond
Definition: zego-api-mediaplayer-defines.h:39
ZegoMediaPlayerAudioTrackMode
Definition: zego-api-mediaplayer-defines.h:52
@ ZegoMediaPlayerAudioTrackModeNormal
Definition: zego-api-mediaplayer-defines.h:53
@ ZegoMediaPlayerAudioTrackModeMultiple
Definition: zego-api-mediaplayer-defines.h:54
ZegoMediaPlayerVideoPixelFormat
Definition: zego-api-mediaplayer-defines.h:25
@ ZegoMediaPlayerVideoPixelFormatUnknown
Definition: zego-api-mediaplayer-defines.h:26
@ ZegoMediaPlayerVideoPixelFormatABGR32
Definition: zego-api-mediaplayer-defines.h:33
@ ZegoMediaPlayerVideoPixelFormatBGRA32
Definition: zego-api-mediaplayer-defines.h:30
@ ZegoMediaPlayerVideoPixelFormatRGBA32
Definition: zego-api-mediaplayer-defines.h:31
@ ZegoMediaPlayerVideoPixelFormatNV21
Definition: zego-api-mediaplayer-defines.h:29
@ ZegoMediaPlayerVideoPixelFormatI420
Definition: zego-api-mediaplayer-defines.h:27
@ ZegoMediaPlayerVideoPixelFormatARGB32
Definition: zego-api-mediaplayer-defines.h:32
@ ZegoMediaPlayerVideoPixelFormatNV12
Definition: zego-api-mediaplayer-defines.h:28
ZegoMediaPlayerError
Definition: zego-api-mediaplayer-defines.h:61
@ ZegoMediaPlayerErrorExpired
Definition: zego-api-mediaplayer-defines.h:79
@ ZegoMediaPlayerErrorResourceIDExpired
Definition: zego-api-mediaplayer-defines.h:81
@ ZegoMediaPlayerErrorLoadTimeout
Definition: zego-api-mediaplayer-defines.h:77
@ ZegoMediaPlayerErrorNoSupportStream
Definition: zego-api-mediaplayer-defines.h:71
@ ZegoMediaPlayerErrorPath
Definition: zego-api-mediaplayer-defines.h:67
@ ZegoMediaPlayerErrorFile
Definition: zego-api-mediaplayer-defines.h:65
@ ZegoMediaPlayerErrorDemux
Definition: zego-api-mediaplayer-defines.h:73
@ ZegoMediaPlayerErrorOK
Definition: zego-api-mediaplayer-defines.h:63
@ ZegoMediaPlayerErrorFrameDrop
Definition: zego-api-mediaplayer-defines.h:75
@ ZegoMediaPlayerErrorCodec
Definition: zego-api-mediaplayer-defines.h:69
ZegoMediaPlayerAudioChannel
Definition: zego-api-mediaplayer-defines.h:45
@ ZegoMediaPlayerAudioChannelLeft
Definition: zego-api-mediaplayer-defines.h:46
@ ZegoMediaPlayerAudioChannelAll
Definition: zego-api-mediaplayer-defines.h:48
@ ZegoMediaPlayerAudioChannelRight
Definition: zego-api-mediaplayer-defines.h:47
ZegoMediaPlayerType
Definition: zego-api-mediaplayer-defines.h:19
@ ZegoMediaPlayerTypeAux
Definition: zego-api-mediaplayer-defines.h:21
@ ZegoMediaPlayerTypePlayer
Definition: zego-api-mediaplayer-defines.h:20
ZegoLiveAudioEffectMode
Live audio effect mode.
Definition: zego-api-mediaplayer-defines.h:99
@ ZEGO_LIVE_AUDIO_EFFECT_MODE_LOCAL
Definition: zego-api-mediaplayer-defines.h:104
@ ZEGO_LIVE_AUDIO_EFFECT_MODE_ALL
Definition: zego-api-mediaplayer-defines.h:110
@ ZEGO_LIVE_AUDIO_EFFECT_MODE_NONE
Definition: zego-api-mediaplayer-defines.h:101
@ ZEGO_LIVE_AUDIO_EFFECT_MODE_PUBLISH
Definition: zego-api-mediaplayer-defines.h:107
ZegoMediaStreamType
Definition: zego-api-mediaplayer-defines.h:116
@ ZEGO_MEDIA_STREAM_TYPE_AUDIO
Definition: zego-api-mediaplayer-defines.h:118
@ ZEGO_MEDIA_STREAM_TYPE_AV
Definition: zego-api-mediaplayer-defines.h:124
@ ZEGO_MEDIA_STREAM_TYPE_VIDEO
Definition: zego-api-mediaplayer-defines.h:121
Definition: AVDefines.h:17
Definition: zego-api-mediaplayer-defines.h:183
char szValue[512]
Definition: zego-api-mediaplayer-defines.h:185
char szKey[512]
Definition: zego-api-mediaplayer-defines.h:184
ZegoMediaPlayerHttpHeader()
Definition: zego-api-mediaplayer-defines.h:187
Definition: zego-api-mediaplayer-defines.h:233
int height
Definition: zego-api-mediaplayer-defines.h:237
ZegoMediaPlayerMediaInfo()
Definition: zego-api-mediaplayer-defines.h:241
int width
Definition: zego-api-mediaplayer-defines.h:235
int frameRate
Definition: zego-api-mediaplayer-defines.h:239
Definition: zego-api-mediaplayer-defines.h:195
ZegoMultimediaLoadType loadType
Definition: zego-api-mediaplayer-defines.h:197
unsigned char * memory
Definition: zego-api-mediaplayer-defines.h:205
char filePath[2048]
Definition: zego-api-mediaplayer-defines.h:203
long startPosition
Definition: zego-api-mediaplayer-defines.h:199
AV::ZegoAlphaLayoutType alphaLayout
Definition: zego-api-mediaplayer-defines.h:201
bool instantPlay
Definition: zego-api-mediaplayer-defines.h:211
int memoryLength
Definition: zego-api-mediaplayer-defines.h:207
char onlineResourceCachePath[2048]
Definition: zego-api-mediaplayer-defines.h:213
char resourceID[512]
Definition: zego-api-mediaplayer-defines.h:209
long long maxCachePendingLength
Definition: zego-api-mediaplayer-defines.h:215
ZegoMediaPlayerResource()
Definition: zego-api-mediaplayer-defines.h:217
Definition: zego-api-mediaplayer-defines.h:252
double audioDecodeFps
Definition: zego-api-mediaplayer-defines.h:266
double audioSourceFps
Definition: zego-api-mediaplayer-defines.h:263
double videoDecodeFps
Definition: zego-api-mediaplayer-defines.h:257
double videoRenderFps
Definition: zego-api-mediaplayer-defines.h:260
double videoSourceFps
Definition: zego-api-mediaplayer-defines.h:254
double audioRenderFps
Definition: zego-api-mediaplayer-defines.h:269
ZegoMediaPlayerStatisticsInfo()
Definition: zego-api-mediaplayer-defines.h:271
Definition: zego-api-mediaplayer-defines.h:155
long pts
Definition: zego-api-mediaplayer-defines.h:160
ZegoMediaPlayerVideoDataFormat()
Definition: zego-api-mediaplayer-defines.h:163
ZegoMediaPlayerVideoDataFormat(int width, int height, ZegoMediaPlayerVideoPixelFormat pixelFormat)
Definition: zego-api-mediaplayer-defines.h:172
int rotation
Definition: zego-api-mediaplayer-defines.h:159
int height
Definition: zego-api-mediaplayer-defines.h:157
ZegoMediaPlayerVideoPixelFormat pixelFormat
Definition: zego-api-mediaplayer-defines.h:161
int width
Definition: zego-api-mediaplayer-defines.h:156
int strides[4]
Definition: zego-api-mediaplayer-defines.h:158