Commit 4876e9ff by xiongziliang

完成mp4/hls录制代码适配

parent b2ebd848
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "RtspMuxer/RtspMediaSourceMuxer.h" #include "RtspMuxer/RtspMediaSourceMuxer.h"
#include "RtmpMuxer/RtmpMediaSourceMuxer.h" #include "RtmpMuxer/RtmpMediaSourceMuxer.h"
#include "MediaFile/MediaRecorder.h"
class MultiMediaSourceMuxer : public FrameWriterInterface{ class MultiMediaSourceMuxer : public FrameWriterInterface{
public: public:
...@@ -37,9 +38,13 @@ public: ...@@ -37,9 +38,13 @@ public:
MultiMediaSourceMuxer(const string &vhost, MultiMediaSourceMuxer(const string &vhost,
const string &strApp, const string &strApp,
const string &strId, const string &strId,
float dur_sec = 0.0){ float dur_sec = 0.0,
bool bEanbleHls = true,
bool bEnableMp4 = false){
_rtmp = std::make_shared<RtmpMediaSourceMuxer>(vhost,strApp,strId,std::make_shared<TitleMete>(dur_sec)); _rtmp = std::make_shared<RtmpMediaSourceMuxer>(vhost,strApp,strId,std::make_shared<TitleMete>(dur_sec));
_rtsp = std::make_shared<RtspMediaSourceMuxer>(vhost,strApp,strId,std::make_shared<TitleSdp>(dur_sec)); _rtsp = std::make_shared<RtspMediaSourceMuxer>(vhost,strApp,strId,std::make_shared<TitleSdp>(dur_sec));
_record = std::make_shared<MediaRecorder>(vhost,strApp,strId,bEanbleHls,bEnableMp4);
} }
virtual ~MultiMediaSourceMuxer(){} virtual ~MultiMediaSourceMuxer(){}
...@@ -51,6 +56,7 @@ public: ...@@ -51,6 +56,7 @@ public:
void addTrack(const Track::Ptr & track) { void addTrack(const Track::Ptr & track) {
_rtmp->addTrack(track); _rtmp->addTrack(track);
_rtsp->addTrack(track); _rtsp->addTrack(track);
_record->addTrack(track);
} }
/** /**
...@@ -60,6 +66,7 @@ public: ...@@ -60,6 +66,7 @@ public:
void inputFrame(const Frame::Ptr &frame) override { void inputFrame(const Frame::Ptr &frame) override {
_rtmp->inputFrame(frame); _rtmp->inputFrame(frame);
_rtsp->inputFrame(frame); _rtsp->inputFrame(frame);
_record->inputFrame(frame);
} }
/** /**
...@@ -85,6 +92,7 @@ public: ...@@ -85,6 +92,7 @@ public:
private: private:
RtmpMediaSourceMuxer::Ptr _rtmp; RtmpMediaSourceMuxer::Ptr _rtmp;
RtspMediaSourceMuxer::Ptr _rtsp; RtspMediaSourceMuxer::Ptr _rtsp;
MediaRecorder::Ptr _record;
}; };
......
...@@ -123,22 +123,8 @@ private: ...@@ -123,22 +123,8 @@ private:
}; };
#endif //0 #endif //0
class DevChannelNew : public MultiMediaSourceMuxer
{
public:
typedef std::shared_ptr<DevChannelNew> 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 */ } /* namespace mediakit */
......
...@@ -48,7 +48,7 @@ public: ...@@ -48,7 +48,7 @@ public:
bool enableHls = true, bool enableHls = true,
bool enableMp4 = false); bool enableMp4 = false);
virtual ~MediaRecorder(); virtual ~MediaRecorder();
protected:
/** /**
* 输入frame * 输入frame
* @param frame * @param frame
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论