流程
classDiagram
IZegoEventHandler <|-- ZegoStreamRelayCDNInfo : infoList
ZegoStreamRelayCDNInfo <|-- ZegoStreamRelayCDNState: state
ZegoStreamRelayCDNInfo <|-- ZegoStreamRelayCDNUpdateReason: updateReason
IZegoExpressEngine <|-- ZegoMixerTask
IZegoExpressEngine <|-- ZegoAutoMixerTask
IZegoExpressEngine : +startMixerTask(ZegoMixerTask task,ZegoMixerStartCallback callback)
IZegoExpressEngine : +stopMixerTask(ZegoMixerTask task,ZegoMixerStopCallback callback)
IZegoExpressEngine : +startAutoMixerTask(ZegoAutoMixerTask task,ZegoMixerStartCallback callback)
IZegoExpressEngine : +stopAutoMixerTask(ZegoAutoMixerTask task,ZegoMixerStopCallback callback)
ZegoMixerTask <|-- ZegoMixerAudioConfig : audioConfig
ZegoMixerTask <|-- ZegoMixerVideoConfig : videoConfig
ZegoMixerTask <|-- ZegoMixerInput : inputList
ZegoMixerTask <|-- ZegoMixerOutput : outputList
ZegoMixerTask <|-- ZegoStreamAlignmentMode : streamAlignmentMode
ZegoMixerTask <|-- ZegoWatermark: layout
ZegoWatermark <|-- ZegoRect: watermark
ZegoAutoMixerTask <|-- ZegoMixerAudioConfig : audioConfig
ZegoAutoMixerTask <|-- ZegoMixerOutput : outputList
ZegoAutoMixerTask <|-- ZegoStreamAlignmentMode : streamAlignmentMode
ZegoMixerInput <|-- ZegoMixerInputContentType : contentType
ZegoMixerInput <|-- ZegoRect : layout
ZegoMixerInput <|-- ZegoLabelInfo : label
ZegoMixerInput <|-- ZegoMixRenderMode: renderMode
ZegoLabelInfo <|-- ZegoFontStyle : font
ZegoFontStyle <|-- ZegoFontType : type
ZegoMixerOutput <|-- ZegoMixerOutputVideoConfig : videoConfig
ZegoMixerAudioConfig <|-- ZegoAudioChannel : channel
ZegoMixerAudioConfig <|-- ZegoAudioCodecID: codecID
ZegoMixerAudioConfig <|-- ZegoAudioMixMode: mixMode
ZegoMixerOutputVideoConfig <|-- ZegoVideoCodecID: ZegoVideoCodecID
ZegoMixerOutputVideoConfig <|-- ZegoEncodeProfile: encodeProfile
class ZegoMixerTask{
+String taskID
+int backgroundColor
+String backgroundImageURL
+bool enableSoundLevel
+const unsigned char* userData
+const unordered_map<std::string, std::string> advancedConfig
+ZegoMixerAudioConfig audioConfig
+ZegoMixerVideoConfig videoConfig
+ZegoMixerInput inputList
+ZegoMixerOutput outputList
+ZegoWatermark watermark
+ZegoStreamAlignmentMode streamAlignmentMode
+ZegoMixerTask(std::string taskID=""): taskID(taskID), watermark(nullptr),\n backgroundColor(0), enableSoundLevel(false), \nstreamAlignmentMode(ZEGO_STREAM_ALIGNMENT_MODE_NONE),\n userData(nullptr), userDataLength(0)
}
class ZegoAutoMixerTask{
+String taskID
+int roomID
+bool enableSoundLevel 默认值: "NO"\
+ZegoMixerAudioConfig audioConfig
+ZegoMixerOutput outputList
+ZegoStreamAlignmentMode streamAlignmentMode
+ZegoAutoMixerTask: taskID(), roomID(), outputList()\n ,audioConfig(),enableSoundLevel(false),\nstreamAlignmentMode(ZEGO_STREAM_ALIGNMENT_MODE_NONE)
}
class ZegoMixerAudioConfig{
+int bitrate -- default 48 kbps
+ZegoAudioChannel channel -- default Mono 单声道
+ZegoAudioCodecID codecID -- default ZegoAudioCodecIDDefault
+ZegoAudioMixMode mixMode
+ZegoMixerAudioConfig:bitrate(48), channel(ZEGO_AUDIO_CHANNEL_MONO),\n codecID(ZEGO_AUDIO_CODEC_ID_DEFAULT), mixMode(ZEGO_AUDIO_MIX_MODE_RAW)
+ZegoMixerAudioConfig(int bitrate, ZegoAudioChannel channel, ZegoAudioCodecID codecID): \nbitrate(bitrate), channel(channel), codecID(codecID), mixMode(ZEGO_AUDIO_MIX_MODE_RAW)
}
class ZegoMixerVideoConfig{
+int width
+int height
+int fps
+int bitrate
+ZegoMixerVideoConfig: width(640), height(360), fps(15), bitrate(600)
+ZegoMixerVideoConfig(int width, int height, int fps, int bitrate):\n width(width), height(height), fps(fps), bitrate(bitrate)
}
class ZegoMixerInput{
+String streamID
+ZegoMixerInputContentType contentType
+ZegoRect layout
+unsigned int soundLevelID
+unsigned int volume -- default 100 [0, 200]
+bool isAudioFocus
+int audioDirection 有效的朝向是 [0, 360]。-1 表示关闭该功能。默认是 -1
+unsigned int volume -- default 100 [0, 200]
+ZegoMixerVideoConfig: width(640), height(360), fps(15), bitrate(600)
+ZegoMixerVideoConfig(int width, int height, int fps, int bitrate):\n width(width), height(height), fps(fps), bitrate(bitrate)
}
class ZegoMixerOutput{
+String target
+ZegoMixerOutputVideoConfig videoConfig
+ZegoMixerOutput : videoConfig()
+ZegoMixerOutput(std::string target) : \ntarget(target), videoConfig())
}
class ZegoMixerOutputVideoConfig{
+ZegoVideoCodecID videoCodecID
+int bitrate
+ZegoEncodeProfile encodeProfile
+int encodeLatency
+ZegoMixerOutputVideoConfig():\n videoCodecID(ZEGO_VIDEO_CODEC_ID_DEFAULT), bitrate(0),\n encodeProfile(ZEGO_ENCODE_PROFILE_DEFAULT), encodeLatency(0): videoConfig()\n
+ZegoMixerOutputVideoConfig(ZegoVideoCodecID codecID, int bitrate):\n videoCodecID(codecID), bitrate(bitrate),\n encodeProfile(ZEGO_ENCODE_PROFILE_DEFAULT), encodeLatency(0)\n
+ ZegoMixerOutputVideoConfig(ZegoVideoCodecID codecID, int bitrate,\n ZegoEncodeProfile profile, int encodeLatency):\n videoCodecID(codecID), bitrate(bitrate),\n encodeProfile(profile), encodeLatency(encodeLatency)
}
class ZegoWatermark{
+String imageURL
+ZegoRect layout
+ZegoWatermark()
+ZegoWatermark(std::string imageURL, ZegoRect layout) \n:imageURL(imageURL), layout(layout)
}
class ZegoStreamAlignmentMode{
<<enumeration>>
ZegoStreamAlignmentModeNone=(0)
ZegoStreamAlignmentModeTry=(1)
}
class ZegoAudioChannel{
<<enumeration>>
ZegoAudioChannelUnknown=(0)
ZegoAudioChannelMono=(1)
ZegoAudioChannelStereo=(2)
}
class ZegoAudioCodecID{
<<enumeration>>
ZegoAudioCodecIDDefault=(0)
ZegoAudioCodecIDNormal=(1)
ZegoAudioCodecIDNormal2=(2)
ZegoAudioCodecIDNormal3=(3)
ZegoAudioCodecIDLow=(4)
ZegoAudioCodecIDLow2=(5)
ZegoAudioCodecIDLow3=(6)
}
class ZegoAudioMixMode{
<<enumeration>>
ZegoAudioMixModeRaw=(0)
ZegoAudioMixModeFocused=(1)
}
class ZegoMixerInputContentType{
<<enumeration>>
ZegoMixerInputContentTypeAudio=(0)
ZegoMixerInputContentTypeVideo=(1)
ZegoMixerInputContentTypeVideoOnly=(2)
}
class ZegoRect{
+int x
+int y
+int width
+int height
+ZegoRect() : x(0), y(0), width(0), height(0)
+ZegoRect(int x, int y, int w, int h) : x(x), y(y), width(w), height(h)
}
class ZegoLabelInfo{
+string text -- max100 en 300cn
+int left -- default 0
+int top -- default 0
+ZegoFontStyle font
+ZegoLabelInfo(std::string text):text(text),left(0),top(0),font()
}
class ZegoFontStyle{
+ZegoFontType type --d:ZegoFontTypeSourceHanSans
+int size -- default 24 [12,100]
+int color -- default 16777215(白色)[0,16777215]
+int transparency -- default 0 [0,100],100 为完全不透明,0 为完全透明。
+bool border-- default false
+int color -- default 16777215(白色)[0,16777215]
+ZegoFontStyle:type(ZEGO_FONT_TYPE_SOURCE_HAN_SANS),\nsize(24),color(16777215),transparency(0),border(false),borderColor(0)
}
class ZegoFontType{
<<enumeration>>
ZegoFontTypeSourceHanSans=(0)思源黑体
ZegoFontTypeAlibabaSans=(1)阿里巴巴普惠体
ZegoFontTypePangMenZhengDaoTitle=(2)庞门正道
ZegoFontTypeHappyZcool=(3)站酷快乐体
}
class ZegoMixRenderMode{
<<enumeration>>
ZegoMixRenderModeFill=(0)
ZegoMixRenderModeFit=(1)
}
class ZegoVideoCodecID{
<<enumeration>>
ZegoVideoCodecIDDefault=(0)默认编码 (H.264)
ZegoVideoCodecIDSvc=(1)分层编码 (H.264 SVC)
ZegoVideoCodecIDVp8=(2)
ZegoVideoCodecIDH265=(3)
ZegoVideoCodecIDUnknown=(100)
}
class ZegoEncodeProfile{
<<enumeration>>
ZegoEncodeProfileDefault=(0)默认Main
ZegoEncodeProfileBaseline=(1)
ZegoEncodeProfileMain=(2)
ZegoEncodeProfileHigh=(3)
}
class ZegoExpressDefinese{
+ZegoMixerStartCallback(int errorCode, string extendedData)
+ZegoMixerStopCallback(int errorCode)
}
class IZegoEventHandler{
+onMixerRelayCDNStateUpdate(string taskID, ZegoStreamRelayCDNInfo infoList)
+onMixerSoundLevelUpdate(const std::unordered_map<unsigned int, float>& soundLevels)
+onAutoMixerSoundLevelUpdate(const std::unordered_map<std::string, float>& soundLevels)
}
class ZegoStreamRelayCDNInfo{
+string url
+ZegoStreamRelayCDNState state
+ZegoStreamRelayCDNUpdateReason updateReason
+ZegoStreamRelayCDNState state
+long stateTime
}
class ZegoStreamRelayCDNState{
<<enumeration>>
ZegoStreamRelayCDNStateNoRelay=(0)
ZegoStreamRelayCDNStateRelayRequesting=(1)
ZegoStreamRelayCDNStateRelaying=(2)
}
class ZegoStreamRelayCDNUpdateReason{
<<enumeration>>
ZegoStreamRelayCDNUpdateReasonNone=(0)无
ZegoStreamRelayCDNUpdateReasonServerError=(1)
ZegoStreamRelayCDNUpdateReasonHandshakeFailed=(2)
ZegoStreamRelayCDNUpdateReasonAccessPointError=(3)
ZegoStreamRelayCDNUpdateReasonCreateStreamFailed=(4)
ZegoStreamRelayCDNUpdateReasonBadName=(5)
ZegoStreamRelayCDNUpdateReasonCDNServerDisconnected=(6)
ZegoStreamRelayCDNUpdateReasonDisconnected=(7)
ZegoStreamRelayCDNUpdateReasonMixStreamAllInputStreamClosed=(8)
ZegoStreamRelayCDNUpdateReasonMixStreamAllInputStreamNoData=(9)
ZegoStreamRelayCDNUpdateReasonMixStreamServerInternalError=(10)
}
flowchart LR
A[视频采集] -->|上传服务器| B[视频格式转换] -->C[视频编码] -->D[VMAF评分] -->E[数据分析整理] -->F[生成报告]