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