From d3db5e0ce067cb09ce6444718360c4d37acce44c Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 5 Apr 2020 09:48:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=BD=95=E5=88=B6=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/MediaSource.h | 4 ++-- src/Rtmp/RtmpMediaSourceImp.h | 27 +++++++++++++++++++++++++++ src/Rtsp/RtspMediaSourceImp.h | 27 +++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/Common/MediaSource.h b/src/Common/MediaSource.h index 36a0ea59..f3d6e140 100644 --- a/src/Common/MediaSource.h +++ b/src/Common/MediaSource.h @@ -126,9 +126,9 @@ public: // 该流无人观看 void onNoneReader(); // 开启或关闭录制 - bool setupRecord(Recorder::type type, bool start, const string &custom_path); + virtual bool setupRecord(Recorder::type type, bool start, const string &custom_path); // 获取录制状态 - bool isRecording(Recorder::type type); + virtual bool isRecording(Recorder::type type); // 同步查找流 static Ptr find(const string &schema, const string &vhost, const string &app, const string &id, bool bMake = true) ; diff --git a/src/Rtmp/RtmpMediaSourceImp.h b/src/Rtmp/RtmpMediaSourceImp.h index e3c74963..954180b9 100644 --- a/src/Rtmp/RtmpMediaSourceImp.h +++ b/src/Rtmp/RtmpMediaSourceImp.h @@ -79,6 +79,33 @@ public: return readerCount() + (_muxer ? _muxer->totalReaderCount() : 0); } + /** + * 设置录制状态 + * @param type 录制类型 + * @param start 开始或停止 + * @param custom_path 开启录制时,指定自定义路径 + * @return 是否设置成功 + */ + bool setupRecord(Recorder::type type, bool start, const string &custom_path) override{ + if(_muxer){ + return _muxer->setupRecord(*this,type, start, custom_path); + } + return RtmpMediaSource::setupRecord(type, start, custom_path); + } + + /** + * 获取录制状态 + * @param type 录制类型 + * @return 录制状态 + */ + bool isRecording(Recorder::type type) override{ + if(_muxer){ + return _muxer->isRecording(*this,type); + } + return RtmpMediaSource::isRecording(type); + } + + /** * 设置协议转换 * @param enableRtsp 是否转换成rtsp diff --git a/src/Rtsp/RtspMediaSourceImp.h b/src/Rtsp/RtspMediaSourceImp.h index 57913235..495158f3 100644 --- a/src/Rtsp/RtspMediaSourceImp.h +++ b/src/Rtsp/RtspMediaSourceImp.h @@ -70,6 +70,33 @@ public: return readerCount() + (_muxer ? _muxer->totalReaderCount() : 0); } + /** + * 设置录制状态 + * @param type 录制类型 + * @param start 开始或停止 + * @param custom_path 开启录制时,指定自定义路径 + * @return 是否设置成功 + */ + bool setupRecord(Recorder::type type, bool start, const string &custom_path) override{ + if(_muxer){ + return _muxer->setupRecord(*this,type, start, custom_path); + } + return RtspMediaSource::setupRecord(type, start, custom_path); + } + + /** + * 获取录制状态 + * @param type 录制类型 + * @return 录制状态 + */ + bool isRecording(Recorder::type type) override{ + if(_muxer){ + return _muxer->isRecording(*this,type); + } + return RtspMediaSource::isRecording(type); + } + + /** * 设置协议转换 * @param enableRtmp 是否转换成rtmp