mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-03 00:47:34 +08:00
mp4录制支持作为观看者参与播放人数统计 (#1880)
This commit is contained in:
@@ -26,14 +26,15 @@ ProtocolOption::ProtocolOption() {
|
||||
GET_CONFIG(bool, s_to_mp4, General::kPublishToMP4);
|
||||
GET_CONFIG(bool, s_enabel_audio, General::kEnableAudio);
|
||||
GET_CONFIG(bool, s_add_mute_audio, General::kAddMuteAudio);
|
||||
GET_CONFIG(bool, s_mp4_as_player, Record::kMP4AsPlayer);
|
||||
GET_CONFIG(uint32_t, s_continue_push_ms, General::kContinuePushMS);
|
||||
|
||||
|
||||
enable_hls = s_to_hls;
|
||||
enable_mp4 = s_to_mp4;
|
||||
enable_audio = s_enabel_audio;
|
||||
add_mute_audio = s_add_mute_audio;
|
||||
continue_push_ms = s_continue_push_ms;
|
||||
mp4_as_player = s_mp4_as_player;
|
||||
}
|
||||
|
||||
static std::shared_ptr<MediaSinkInterface> makeRecorder(MediaSource &sender, const vector<Track::Ptr> &tracks, Recorder::type type, const string &custom_path, size_t max_second){
|
||||
@@ -75,6 +76,7 @@ static string getTrackInfoStr(const TrackSource *track_src){
|
||||
}
|
||||
|
||||
MultiMediaSourceMuxer::MultiMediaSourceMuxer(const string &vhost, const string &app, const string &stream, float dur_sec, const ProtocolOption &option) {
|
||||
_option = option;
|
||||
_get_origin_url = [this, vhost, app, stream]() {
|
||||
auto ret = getOriginUrl(*MediaSource::NullMediaSource);
|
||||
if (!ret.empty()) {
|
||||
@@ -146,6 +148,7 @@ int MultiMediaSourceMuxer::totalReaderCount() const {
|
||||
#if defined(ENABLE_MP4)
|
||||
(_fmp4 ? _fmp4->readerCount() : 0) +
|
||||
#endif
|
||||
(_mp4 ? _option.mp4_as_player : 0) +
|
||||
(hls ? hls->readerCount() : 0);
|
||||
|
||||
#if defined(ENABLE_RTPPROXY)
|
||||
|
||||
@@ -31,6 +31,8 @@ public:
|
||||
bool enable_hls = false;
|
||||
//是否开启MP4录制
|
||||
bool enable_mp4 = false;
|
||||
//是否将mp4录制当做观看者
|
||||
bool mp4_as_player = false;
|
||||
//是否开启转换为rtsp/webrtc
|
||||
bool enable_rtsp = true;
|
||||
//是否开启转换为rtmp/flv
|
||||
@@ -175,6 +177,7 @@ protected:
|
||||
|
||||
private:
|
||||
bool _is_enable = false;
|
||||
ProtocolOption _option;
|
||||
toolkit::Ticker _last_check;
|
||||
Stamp _stamp[2];
|
||||
std::weak_ptr<Listener> _track_listener;
|
||||
|
||||
@@ -238,6 +238,7 @@ const string kFilePath = RECORD_FIELD "filePath";
|
||||
const string kFileBufSize = RECORD_FIELD "fileBufSize";
|
||||
const string kFastStart = RECORD_FIELD "fastStart";
|
||||
const string kFileRepeat = RECORD_FIELD "fileRepeat";
|
||||
const string kMP4AsPlayer = RECORD_FIELD "mp4_as_player";
|
||||
|
||||
static onceToken token([]() {
|
||||
mINI::Instance()[kAppName] = "record";
|
||||
@@ -247,6 +248,7 @@ static onceToken token([]() {
|
||||
mINI::Instance()[kFileBufSize] = 64 * 1024;
|
||||
mINI::Instance()[kFastStart] = false;
|
||||
mINI::Instance()[kFileRepeat] = false;
|
||||
mINI::Instance()[kMP4AsPlayer] = false;
|
||||
});
|
||||
} // namespace Record
|
||||
|
||||
|
||||
@@ -295,6 +295,8 @@ extern const std::string kFileBufSize;
|
||||
extern const std::string kFastStart;
|
||||
// mp4文件是否重头循环读取
|
||||
extern const std::string kFileRepeat;
|
||||
//MP4录制是否当做播放器参与播放人数统计
|
||||
extern const std::string kMP4AsPlayer;
|
||||
} // namespace Record
|
||||
|
||||
////////////HLS相关配置///////////
|
||||
|
||||
Reference in New Issue
Block a user