ZegoLiveRoom
zego-api-media-publisher.h
Go to the documentation of this file.
1//
2// zego-api-media-publisher.h
3// 该模块可以直推经过特殊处理的本地 mp4 文件。如果要推在线多媒体资源,请使用 MEDIAPLAYER 模块
4//
5// mp4 文件要求:只包含 I 帧和 P 帧,不能侌有 B 帧,gop 值为 2s, 音频格式为 AAC
6// 视频的帧率、码率、分辨率与初始化 SDK 时设置的帧率、码率、分辨率保持一致;
7//
8// 相较于使用 MEDIAPLAYER 推本地 mp4 文件有如下几个优点:
9// 1. 减少系统资源开销,无需经过本地解码再编码的过程;
10// 2. 无须关注外部采集接口,简化 API 调用逻辑;
11//
12// Copyright © 2018年 Zego. All rights reserved.
13//
14
15#ifndef zego_api_media_publisher_h
16#define zego_api_media_publisher_h
17
18#include "zego-api-defines.h"
19
20namespace ZEGO
21{
22namespace MEDIAPUBLISHER
23{
27 enum
28 {
57 };
58
63 {
72 };
73
78 {
79 // 推流器的模式
81 };
82
87 public:
92 virtual void OnStart(AV::PublishChannelIndex channelIdx) = 0;
93
98 virtual void OnStop(AV::PublishChannelIndex channelIdx) = 0;
99
105 virtual void OnFileOpen(const char* path, AV::PublishChannelIndex channelIdx) = 0;
106
113 virtual void OnFileClose(const char* path, int code, AV::PublishChannelIndex channelIdx) = 0;
114
120 virtual void OnFileDataBegin(const char* path, AV::PublishChannelIndex channelIdx) = 0;
121
127 virtual void OnFileDataEnd(const char* path, AV::PublishChannelIndex channelIdx) = 0;
128 };
129
140
152
158
169
179
188
197
206
217
225}
226}
227
228#endif
Definition: zego-api-media-publisher.h:86
virtual void OnStop(AV::PublishChannelIndex channelIdx)=0
virtual void OnFileOpen(const char *path, AV::PublishChannelIndex channelIdx)=0
virtual void OnFileDataEnd(const char *path, AV::PublishChannelIndex channelIdx)=0
virtual void OnStart(AV::PublishChannelIndex channelIdx)=0
virtual void OnFileClose(const char *path, int code, AV::PublishChannelIndex channelIdx)=0
virtual void OnFileDataBegin(const char *path, AV::PublishChannelIndex channelIdx)=0
PublishChannelIndex
Definition: zego-api-defines.h:976
@ PUBLISH_CHN_MAIN
Definition: zego-api-defines.h:977
@ ERROR_SAMPLERATE
Definition: zego-api-media-publisher.h:56
@ ERROR_NONE
Definition: zego-api-media-publisher.h:32
@ ERROR_DELAY_QUEUE_FULL
Definition: zego-api-media-publisher.h:52
@ ERROR_FILE
Definition: zego-api-media-publisher.h:36
@ ERROR_CODEC
Definition: zego-api-media-publisher.h:44
@ ERROR_PATH
Definition: zego-api-media-publisher.h:40
@ ERROR_TS_GO_BACK
Definition: zego-api-media-publisher.h:48
ZEGOAVKIT_API void Create(AV::PublishChannelIndex channelIdx=AV::PublishChannelIndex::PUBLISH_CHN_MAIN)
ZEGOAVKIT_API void Reset(AV::PublishChannelIndex channelIdx=AV::PublishChannelIndex::PUBLISH_CHN_MAIN)
ZEGOAVKIT_API long GetDuration(AV::PublishChannelIndex channelIdx=AV::PublishChannelIndex::PUBLISH_CHN_MAIN)
ZEGOAVKIT_API void AddPath(const char *path, bool clear, AV::PublishChannelIndex channelIdx=AV::PublishChannelIndex::PUBLISH_CHN_MAIN)
ZEGOAVKIT_API void SetVideoPtsDelay(int delay_ms, AV::PublishChannelIndex channelIdx=AV::PublishChannelIndex::PUBLISH_CHN_MAIN)
ZEGOAVKIT_API void CreateWithConfig(MediaPublisherConfig *config, AV::PublishChannelIndex channelIdx=AV::PublishChannelIndex::PUBLISH_CHN_MAIN)
ZEGOAVKIT_API void SetEventCallback(PublisherEventCallback *callback, AV::PublishChannelIndex channelIdx=AV::PublishChannelIndex::PUBLISH_CHN_MAIN)
ZEGOAVKIT_API long GetCurrentDuration(AV::PublishChannelIndex channelIdx=AV::PublishChannelIndex::PUBLISH_CHN_MAIN)
ZEGOAVKIT_API void SeekTo(long timestamp_ms, AV::PublishChannelIndex channelIdx=AV::PublishChannelIndex::PUBLISH_CHN_MAIN)
MediaPublishMode
Definition: zego-api-media-publisher.h:63
@ MediaPublishModeBothVideoAndAudio
Definition: zego-api-media-publisher.h:67
@ MediaPublishModeOnlyVideo
Definition: zego-api-media-publisher.h:71
ZEGOAVKIT_API void Destroy(AV::PublishChannelIndex channelIdx=AV::PublishChannelIndex::PUBLISH_CHN_MAIN)
Definition: AVDefines.h:17
Definition: zego-api-media-publisher.h:78
MediaPublishMode mode
Definition: zego-api-media-publisher.h:80
#define ZEGOAVKIT_API
Definition: zego-api-defines.h:59