From 4876e9ff5cfe3be0abb8dfe4abc89733700e7af0 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 28 Oct 2018 00:26:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90mp4/hls=E5=BD=95=E5=88=B6?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/MultiMediaSourceMuxer.h | 10 +++++++++- src/Device/Device.h | 16 +--------------- src/MediaFile/MediaRecorder.h | 2 +- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/Common/MultiMediaSourceMuxer.h b/src/Common/MultiMediaSourceMuxer.h index 859110f1..20ab6f49 100644 --- a/src/Common/MultiMediaSourceMuxer.h +++ b/src/Common/MultiMediaSourceMuxer.h @@ -29,6 +29,7 @@ #include "RtspMuxer/RtspMediaSourceMuxer.h" #include "RtmpMuxer/RtmpMediaSourceMuxer.h" +#include "MediaFile/MediaRecorder.h" class MultiMediaSourceMuxer : public FrameWriterInterface{ public: @@ -37,9 +38,13 @@ public: MultiMediaSourceMuxer(const string &vhost, const string &strApp, const string &strId, - float dur_sec = 0.0){ + float dur_sec = 0.0, + bool bEanbleHls = true, + bool bEnableMp4 = false){ _rtmp = std::make_shared(vhost,strApp,strId,std::make_shared(dur_sec)); _rtsp = std::make_shared(vhost,strApp,strId,std::make_shared(dur_sec)); + _record = std::make_shared(vhost,strApp,strId,bEanbleHls,bEnableMp4); + } virtual ~MultiMediaSourceMuxer(){} @@ -51,6 +56,7 @@ public: void addTrack(const Track::Ptr & track) { _rtmp->addTrack(track); _rtsp->addTrack(track); + _record->addTrack(track); } /** @@ -60,6 +66,7 @@ public: void inputFrame(const Frame::Ptr &frame) override { _rtmp->inputFrame(frame); _rtsp->inputFrame(frame); + _record->inputFrame(frame); } /** @@ -85,6 +92,7 @@ public: private: RtmpMediaSourceMuxer::Ptr _rtmp; RtspMediaSourceMuxer::Ptr _rtsp; + MediaRecorder::Ptr _record; }; diff --git a/src/Device/Device.h b/src/Device/Device.h index 8fb93061..c595eacd 100644 --- a/src/Device/Device.h +++ b/src/Device/Device.h @@ -123,22 +123,8 @@ private: }; #endif //0 -class DevChannelNew : public MultiMediaSourceMuxer -{ -public: - typedef std::shared_ptr Ptr; - DevChannelNew(const char *strVhost, - const char *strApp, - const char *strId, - float fDuration = 0, - bool bEanbleHls = true, - bool bEnableMp4 = false): - MultiMediaSourceMuxer(strVhost,strApp,strId,fDuration){}; - virtual ~DevChannelNew(){} -}; - -typedef DevChannelNew DevChannel; +typedef MultiMediaSourceMuxer DevChannel; } /* namespace mediakit */ diff --git a/src/MediaFile/MediaRecorder.h b/src/MediaFile/MediaRecorder.h index 9e9183f9..33b7c363 100644 --- a/src/MediaFile/MediaRecorder.h +++ b/src/MediaFile/MediaRecorder.h @@ -48,7 +48,7 @@ public: bool enableHls = true, bool enableMp4 = false); virtual ~MediaRecorder(); -protected: + /** * 输入frame * @param frame