ZegoLiveRoom
LiveRoom-Publisher.h
Go to the documentation of this file.
1//
2// LiveRoom-Publisher.h
3// zegoliveroom
4//
5// Created by Randy Qiu on 2017/1/23.
6//
7//
8
9#ifndef LiveRoom_Publisher_h
10#define LiveRoom_Publisher_h
11
14#include "./LiveRoomDefines.h"
15
16namespace AVE
17{
18 class VideoCaptureFactory;
19 class MediaCaptureFactory;
20 class VideoFilterFactory;
21 struct AudioFrame;
22 struct ExtAudioProcSet;
23 typedef ExtAudioProcSet ExtPrepSet;
24
32 typedef void (*OnAudioProcCallback)(const AudioFrame& inFrame, AudioFrame& outFrame);
33
35
43 typedef void (*OnAudioPcmDataCallback)(void *callbackContext, int channelIndex,
44 const AudioFrame &outFrame);
45
56}
57
58namespace ZEGO
59{
60 namespace LIVEROOM
61 {
68
76
85
94
103
112
121
128 ZEGO_API void SetCustomPublishTarget(const char *pszCustomPublishTarget, AV::PublishChannelIndex idx = AV::PUBLISH_CHN_MAIN);
129
138 ZEGO_API int AddPublishTarget(const char *strTarget, const char* pszStreamID, int timeout = 0);
139
147 ZEGO_API int DeletePublishTarget(const char *strTarget, const char* pszStreamID);
148
155 ZEGO_API void SetCDNPublishTarget(const char *pszCDNPublishTarget, AV::PublishChannelIndex idx = AV::PUBLISH_CHN_MAIN);
156
165
174 ZEGO_API void SetPublishEncryptKey(const unsigned char *pKey, int nkeyLen, AV::PublishChannelIndex idx = AV::PUBLISH_CHN_MAIN);
175
195
215
229
247 ZEGO_API bool StartPublishing(const char* pszTitle, const char* pszStreamID, int flag, const char* pszParams = 0);
248
268 ZEGO_API bool StartPublishing2(const char* pszTitle, const char* pszStreamID, int flag, const char* pszParams = 0, AV::PublishChannelIndex idx = AV::PUBLISH_CHN_MAIN);
269
286
297
307
316 ZEGO_API bool StopPublishing(int flag = 0, const char* pszMsg = 0, AV::PublishChannelIndex idx = AV::PUBLISH_CHN_MAIN);
317
329 ZEGO_API bool RespondJoinLiveReq(int seq, int rspResult, const char* pszRoomID = nullptr);
330
342 ZEGO_API int InviteJoinLive(const char* pszUserID, const char* pszRoomID = nullptr);
343
353 ZEGO_API int EndJoinLive(const char* pszUserID, const char* pszRoomID = nullptr);
354
368 ZEGO_API bool RequireHardwareEncoder(bool bRequired);
369
386
395
405
415
425
435
445
455
465
475
485
495
506
517
526
536
546
556
565
575
585
593 ZEGO_API bool EnableMic(bool bEnable);
594
603
612
619 ZEGO_API bool EnableAGC(bool bEnable);
620
625
631 ZEGO_API bool EnableAEC(bool bEnable);
632
633
638
643
653
661
670 ZEGO_API bool EnableLoopback(bool bEnable);
671
678 ZEGO_API void SetLoopbackVolume(int volume);
679
686 ZEGO_API void SetCaptureVolume(int volume);
687
694
704
714
723
734 ZEGO_API void SetPublishWaterMarkRect(int left, int top, int right, int bottom, AV::PublishChannelIndex idx = AV::PUBLISH_CHN_MAIN);
735
746 ZEGO_API void SetPreviewWaterMarkRect(int left, int top, int right, int bottom, AV::PublishChannelIndex idx = AV::PUBLISH_CHN_MAIN);
747
755
765
775
786 void *callbackContext);
787
798 ZEGO_API void EnableAlignedAudioAuxData(bool enable, int sampleRate, int channels);
799
808
814 ZEGO_API void EnableCheckPoc(bool bEnable);
815
823
831
840
850
861
872 ZEGO_API void EnableDTX(bool bEnable);
873
880 ZEGO_API void EnableVAD(bool bEnable);
881
894
907
919
931
942
949 ZEGO_API bool EnableNoiseSuppress(bool bEnable);
950
956
962
967
975 ZEGO_API bool SetPublishQualityMonitorCycle(unsigned int timeInMS);
976
986 ZEGO_API bool SetAudioEqualizerGain(int bandIndex, float bandGain);
987
1000
1011
1022
1032
1039
1049
1060
1072
1084
1097
1108
1109#if TARGET_OS_IPHONE
1113 ZEGO_API void RecoverAudioSessionMode();
1114
1115
1124 ZEGO_API void SetPreviewCropRect(AV::ZegoRect cropRect, AV::ZegoSize originalSize, AV::PublishChannelIndex idx = AV::PUBLISH_CHN_MAIN);
1125#endif // TARGET_OS_IOS
1126
1135
1142
1150 ZEGO_API void EnableCapturedAudioVADStableStateMonitor(bool enable, int period=3000);
1151
1159 ZEGO_API void EnableAudioPrepVADStableStateMonitor(bool enable, int period=3000);
1160
1174
1188
1199
1200
1208
1219
1228
1238 ZEGO_API void EnableBeforeAudioPrepCallback(bool enable, int sampleRate, int channel);
1239
1249
1258 }
1259}
1260#endif /* LiveRoom_Publisher_h */
#define ZEGO_API
Definition: RoomDefines.h:19
Definition: AVDefines.h:240
Definition: AVDefines.h:187
Definition: LiveRoomCallback-Publisher.h:20
Definition: audio_capture.h:4
OnAudioPcmDataCallback OnAlignedAudioAuxCallback
Definition: LiveRoom-Publisher.h:55
OnAudioProcCallback OnPrepCallback
Definition: audio_in_output.h:140
void(* OnAudioProcCallback)(const AudioFrame &inFrame, AudioFrame &outFrame)
Definition: audio_in_output.h:109
struct ExtAudioProcSet ExtPrepSet
Definition: audio_in_output.h:139
void(* OnAudioPcmDataCallback)(void *callbackContext, int channelIndex, const AudioFrame &outFrame)
Definition: LiveRoom-Publisher.h:43
ZegoAVAPIAudioDeviceMode
Definition: zego-api-defines.h:726
ZegoVideoEncoderRateControlStrategy
Definition: zego-api-defines.h:712
ZegoTrafficControlMinVideoBitrateMode
Definition: zego-api-defines.h:770
@ ZEGO_TRAFFIC_CONTROL_MIN_VIDEO_BITRATE_NO_VIDEO
Definition: zego-api-defines.h:772
ZegoAVAPILatencyMode
Definition: zego-api-defines.h:743
ZegoANSMode
Definition: zego-api-defines.h:1069
ChannelExtraParamKey
Definition: zego-api-defines.h:1202
ZegoCapturePipelineScaleMode
Definition: zego-api-defines.h:720
ZegoAlphaLayoutType
Definition: zego-api-defines.h:1558
ZegoObjectSegmentationType
Definition: zego-api-defines.h:1574
ZegoNotifyDeviceStateMode
Definition: zego-api-defines.h:1156
@ ZEGO_NOTIFY_DEVICE_STATE_MODE_OPEN
Definition: zego-api-defines.h:1158
ZegoTrafficControlFocusOn
Definition: zego-api-defines.h:1284
ZegoLowlightEnhanceMode
低照度增强模式
Definition: zego-api-defines.h:1856
ZegoVideoMirrorMode
Definition: zego-api-defines.h:86
ZegoVideoSourceType
Definition: zego-api-defines.h:1294
PublishChannelIndex
Definition: zego-api-defines.h:976
@ PUBLISH_CHN_AUX
Definition: zego-api-defines.h:978
@ PUBLISH_CHN_MAIN
Definition: zego-api-defines.h:977
ZegoAudioSourceType
Definition: zego-api-defines.h:1313
ZegoVideoEncodeMode
Definition: zego-api-defines.h:1325
ZegoVideoCodecBackend
Definition: zego-api-defines.h:104
ZegoAECMode
Definition: zego-api-defines.h:1050
ZegoVideoCodecAvc
Definition: zego-api-defines.h:93
ZEGOAVKIT_API void SetMinVideoFpsForTrafficControl(int nFps, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetMinVideoBitrateForTrafficControl(int nBitrate, AV::ZegoTrafficControlMinVideoBitrateMode mode=AV::ZEGO_TRAFFIC_CONTROL_MIN_VIDEO_BITRATE_NO_VIDEO, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetLatencyMode(AV::ZegoAVAPILatencyMode mode)
ZEGO_API void EnableVAD(bool bEnable)
ZegoVideoViewMode
Definition: LiveRoomDefines.h:33
ZEGO_API void SetAudioVADStableStateCallback(AV::IZegoCheckAudioVADCallback *callback)
ZEGO_API float GetCaptureSoundLevel()
ZEGO_API bool SetPolishStep(float step, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool SetPreviewRotation(int nRotation, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetAudioDeviceMode(AV::ZegoAVAPIAudioDeviceMode mode)
ZEGO_API void SetAudioChannelCountByChannel(int count, AV::PublishChannelIndex idx)
ZEGO_API int EndJoinLive(const char *pszUserID, const char *pszRoomID=nullptr)
ZEGO_API bool SetVideoKeyFrameInterval(int nIntervalSecond, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetTrafficControlFocusOn(enum AV::ZegoTrafficControlFocusOn focusOn, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void EnableAlignedAudioAuxData(bool enable, int sampleRate, int channels)
ZEGO_API void SetBeforeAudioPrepCallback(AV::IZegoBeforeAudioPrepCallback *callback)
设置音频前处理前的音频数据回调。
ZEGO_API void EnableBeforeAudioPrepCallback(bool enable, int sampleRate, int channel)
开启或关闭音频前处理前的音频数据回调。
ZEGO_API void ResetAEC()
ZEGOAVKIT_API void SetMinVideoResolutionForTrafficControl(int nWidth, int nHeight, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetAudioPrepAfterLoopbackCallback(AVE::OnAudioProcCallback callback, const AVE::ExtPrepSet &config)
ZEGO_API void EnableVideoObjectSegmentation(bool enable, AV::ZegoObjectSegmentationType type, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool SetNoiseSuppressMode(AV::ZegoANSMode mode)
ZEGO_API int EnablePublishStreamAlignment(bool enable)
ZEGO_API bool SetAudioEqualizerGain(int bandIndex, float bandGain)
ZEGO_API bool SetVideoFPS(int nFps, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool TakeSnapshotPreview(AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API int MuteAudioPublish(bool mute, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool SetCustomCDNPublishTarget(const AV::ZegoCDNPublishTarget target, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void EnableCapturedAudioVADStableStateMonitor(bool enable, int period=3000)
ZEGO_API void SetAlignedAudioAuxDataCallback(AVE::OnAlignedAudioAuxCallback callback, void *callbackContext)
ZEGO_API bool SetLowlightEnhancementParams(const AV::ZegoLowlightEnhanceParams &params, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
设置低照度增强
ZEGO_API int SetStreamAlignmentProperty(int alignment, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool EnableCamera(bool bEnable, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN, AV::ZegoNotifyDeviceStateMode notifyMode=AV::ZEGO_NOTIFY_DEVICE_STATE_MODE_OPEN)
ZEGO_API void * GetChannelExtraParam(AV::ChannelExtraParamKey key, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool RequireHardwareEncoder(bool bRequired)
ZEGO_API AV::ZegoCodecCapabilityInfo * GetVideoCodecCapabilityList(int &len)
ZEGO_API bool SetPreviewViewMode(ZegoVideoViewMode mode, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool SetAudioBitrate(int bitrate, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetVideoEncodeMode(AV::ZegoVideoEncodeMode mode, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool RespondJoinLiveReq(int seq, int rspResult, const char *pszRoomID=nullptr)
ZEGO_API void SetCapturePipelineScaleMode(AV::ZegoCapturePipelineScaleMode mode)
ZEGO_API void SetAECMode(AV::ZegoAECMode mode)
ZEGO_API void SetAudioCaptureShiftOnMix(int shiftMS)
ZEGO_API bool StartPublishing2(const char *pszTitle, const char *pszStreamID, int flag, const char *pszParams=0, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetChannelExtraParam(const char *param_config, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool EnableMic(bool bEnable)
ZEGO_API bool SetLowlightEnhancement(AV::ZegoLowlightEnhanceMode mode, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
设置低照度增强
ZEGO_API bool SetPreviewViewBackgroundColor(int color, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetPublishDualStreamConfig(const AV::ZegoPublishDualStreamConfig *configList, int configListCount, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API int DeletePublishTarget(const char *strTarget, const char *pszStreamID)
ZEGO_API bool SetFilter(int nIndex, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool SetVideoMirrorMode(AV::ZegoVideoMirrorMode mode, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API int GetMaxPublishChannelCount()
ZEGO_API void SetPublishWaterMarkRect(int left, int top, int right, int bottom, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void EnableColorEnhancement(bool enable, AV::ZegoColorEnhancementParams params, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
开启色彩增强
ZEGO_API bool EnableBeautifying(int nFeature, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetLoopbackVolume(int volume)
ZEGO_API bool SetPreviewView(void *pView, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetCDNPublishTarget(const char *pszCDNPublishTarget, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetVideoEncoderRateControlConfig(AV::ZegoVideoEncoderRateControlStrategy strategy, int encoderCRF, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool EnableTransientNoiseSuppress(bool bEnable)
ZEGO_API bool EnableAGC(bool bEnable)
ZEGO_API bool SetVideoCodecId(AV::ZegoVideoCodecAvc codecId, AV::PublishChannelIndex nChannel=AV::PUBLISH_CHN_MAIN)
ZEGO_API void FreeVideoCodecCapabilityList(AV::ZegoCodecCapabilityInfo *parrCodecCapability)
ZEGO_API void SetDummyCaptureImagePath(const char *filePath, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetAudioPrepCallback(AVE::OnPrepCallback callback, const AVE::ExtPrepSet &config)
ZEGO_API bool SetVideoSource(AV::ZegoVideoSourceType srcType, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_AUX)
ZEGO_API bool SetLivePublisherCallback(ILivePublisherCallback *pCB)
ZEGO_API bool EnablePreviewMirror(bool bEnabasle, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool SetPublishQualityMonitorCycle(unsigned int timeInMS)
ZEGO_API void EnableDTX(bool bEnable)
ZEGO_API void SetWaterMarkImagePath(const char *filePath, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGOAVKIT_API void SetVideoDenoiseParams(const AV::ZegoVideoDenoiseParams &params, AV::PublishChannelIndex idx)
设置视频降噪参数
ZEGO_API void ResetAGC()
ZEGO_API void SetPreviewWaterMarkRect(int left, int top, int right, int bottom, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool StartPreview(AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void EnableTrafficControl(int properties, bool bEnable, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetDummyCaptureImageParams(AV::ZegoDummyCaptureImageParams params, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool SetAudioSource(AV::ZegoAudioSourceType srcType, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_AUX)
ZEGO_API void SetLatencyModeByChannel(AV::ZegoAVAPILatencyMode mode, AV::PublishChannelIndex idx)
ZEGO_API void EnableScreenCaptureEncodeOptimization(bool enable, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API int AddPublishTarget(const char *strTarget, const char *pszStreamID, int timeout=0)
ZEGO_API bool EnableAEC(bool bEnable)
ZEGO_API bool SetVideoCaptureResolution(int nWidth, int nHeight, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void EnableAlphaChannelVideoEncoder(bool enable, AV::ZegoAlphaLayoutType layoutType, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool IsVideoEncoderSupported(AV::ZegoVideoCodecAvc codecID)
ZEGO_API bool SetCaptureFrameRotation(int nRotation, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool SetVideoEncodeResolution(int nWidth, int nHeight, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool EnableNoiseSuppress(bool bEnable)
ZEGO_API bool SetVideoBitrate(int nBitrate, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool StartPublishing(const char *pszTitle, const char *pszStreamID, int flag, const char *pszParams=0)
ZEGO_API bool SetSharpenFactor(float factor, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetAudioChannelCount(int count)
ZEGO_API bool SetPublishStreamExtraInfo(const char *pszStreamExtraInfo, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API int MuteVideoPublish(bool mute, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool StopPublishing(int flag=0, const char *pszMsg=0, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool StartPublishingWithParams(const ZegoPublishStreamParams *streamParams)
ZEGO_API void SetCaptureVolume(int volume)
ZEGO_API void EnableCheckPoc(bool bEnable)
ZEGO_API bool StopPreview(AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API bool SetWhitenFactor(float factor, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void SetCustomPublishTarget(const char *pszCustomPublishTarget, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void ResetNoiseSuppress()
ZEGO_API bool RequireHardwareEncoderByChannel(bool enable, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void EnableAudioPrepVADStableStateMonitor(bool enable, int period=3000)
ZEGOAVKIT_API void EnableAuxBgmBalance(bool enable)
开启或关闭自适应根据伴奏音量,调整人声音量,使人声与伴奏音量均衡
ZEGO_API bool EnableLoopback(bool bEnable)
ZEGO_API void SetPublishEncryptKey(const unsigned char *pKey, int nkeyLen, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API void EnableFaceDetection(bool enable, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
开启或关闭人脸检测
ZEGO_API bool EnableH265EncodeFallback(bool enable)
ZEGO_API bool SetPolishFactor(float factor, AV::PublishChannelIndex idx=AV::PUBLISH_CHN_MAIN)
ZEGO_API int InviteJoinLive(const char *pszUserID, const char *pszRoomID=nullptr)
Definition: AVDefines.h:17
Definition: audio_in_output.h:42
Definition: audio_in_output.h:84
Definition: zego-api-defines.h:1432
Definition: zego-api-defines.h:1226
色彩增强参数
Definition: zego-api-defines.h:1753
Definition: zego-api-defines.h:1839
Definition: zego-api-defines.h:1874
Definition: zego-api-defines.h:1635
Definition: zego-api-defines.h:1657
Definition: zego-api-defines.h:1332
Definition: zego-api-defines.h:1346
Definition: zego-api-defines.h:1817
Definition: zego-api-defines.h:1545
Definition: LiveRoomDefines.h:218
#define ZEGOAVKIT_API
Definition: zego-api-defines.h:59