diff --git a/3rdpart/media-server b/3rdpart/media-server index 729de4b2..82a48c57 160000 --- a/3rdpart/media-server +++ b/3rdpart/media-server @@ -1 +1 @@ -Subproject commit 729de4b2eebad09457202656ee5b7ee68b1390c5 +Subproject commit 82a48c57ae5269aaa70a8c3df8a67dc06b05d0cd diff --git a/src/Common/MultiMediaSourceMuxer.h b/src/Common/MultiMediaSourceMuxer.h index 83638f88..7e38a4f8 100644 --- a/src/Common/MultiMediaSourceMuxer.h +++ b/src/Common/MultiMediaSourceMuxer.h @@ -10,12 +10,14 @@ #ifndef ZLMEDIAKIT_MULTIMEDIASOURCEMUXER_H #define ZLMEDIAKIT_MULTIMEDIASOURCEMUXER_H + +#include "Common/Stamp.h" +#include "Rtp/PSRtpSender.h" +#include "Record/Recorder.h" +#include "Record/HlsRecorder.h" +#include "Record/HlsMediaSource.h" #include "Rtsp/RtspMediaSourceMuxer.h" #include "Rtmp/RtmpMediaSourceMuxer.h" -#include "Record/Recorder.h" -#include "Record/HlsMediaSource.h" -#include "Record/HlsRecorder.h" -#include "Rtp/PSRtpSender.h" namespace mediakit{ diff --git a/src/Record/HlsRecorder.h b/src/Record/HlsRecorder.h index 88c1e066..8b1c4495 100644 --- a/src/Record/HlsRecorder.h +++ b/src/Record/HlsRecorder.h @@ -15,11 +15,7 @@ #include "TsMuxer.h" namespace mediakit { -class HlsRecorder : public MediaSourceEventInterceptor, public std::enable_shared_from_this -#if defined(ENABLE_HLS) - , public TsMuxer -#endif - { +class HlsRecorder : public MediaSourceEventInterceptor, public TsMuxer, public std::enable_shared_from_this { public: typedef std::shared_ptr Ptr; HlsRecorder(const string &m3u8_file, const string ¶ms){ @@ -63,7 +59,6 @@ public: return _clear_cache ? true : _enabled; } -#if defined(ENABLE_HLS) void inputFrame(const Frame::Ptr &frame) override{ if (_clear_cache) { _clear_cache = false; @@ -78,7 +73,6 @@ private: void onTs(const void *packet, int bytes, uint32_t timestamp, bool is_idr_fast_packet) override { _hls->inputData((char *) packet, bytes, timestamp, is_idr_fast_packet); } -#endif private: //默认不生成hls文件,有播放器时再生成 diff --git a/src/Record/TsMuxer.cpp b/src/Record/TsMuxer.cpp index ebb7bf65..e71fa9c7 100644 --- a/src/Record/TsMuxer.cpp +++ b/src/Record/TsMuxer.cpp @@ -8,8 +8,8 @@ * may be found in the AUTHORS file in the root of the source tree. */ -#include "TsMuxer.h" #if defined(ENABLE_HLS) +#include "TsMuxer.h" #include "mpeg-ts-proto.h" #include "mpeg-ts.h" #include "Extension/H264.h" @@ -183,5 +183,4 @@ void TsMuxer::uninit() { } }//namespace mediakit - #endif// defined(ENABLE_HLS) \ No newline at end of file diff --git a/src/Record/TsMuxer.h b/src/Record/TsMuxer.h index 5a16f1cf..74c97da2 100644 --- a/src/Record/TsMuxer.h +++ b/src/Record/TsMuxer.h @@ -11,6 +11,7 @@ #ifndef TSMUXER_H #define TSMUXER_H +#if defined(ENABLE_HLS) #include #include "Extension/Frame.h" #include "Extension/Track.h" @@ -72,4 +73,25 @@ private: }; }//namespace mediakit + +#else + +#include "Common/MediaSink.h" + +namespace mediakit { +class TsMuxer : public MediaSinkInterface { +public: + TsMuxer() {} + ~TsMuxer() override {} + void addTrack(const Track::Ptr &track) override {} + void resetTracks() override {} + void inputFrame(const Frame::Ptr &frame) override {} + +protected: + virtual void onTs(const void *packet, int bytes,uint32_t timestamp,bool is_idr_fast_packet) = 0; +}; +}//namespace mediakit + +#endif// defined(ENABLE_HLS) + #endif //TSMUXER_H \ No newline at end of file diff --git a/src/Rtp/PSRtpSender.cpp b/src/Rtp/PSRtpSender.cpp index 5f24a775..5f80efdf 100644 --- a/src/Rtp/PSRtpSender.cpp +++ b/src/Rtp/PSRtpSender.cpp @@ -8,6 +8,7 @@ * may be found in the AUTHORS file in the root of the source tree. */ +#if defined(ENABLE_RTPPROXY) #include "PSRtpSender.h" #include "Rtsp/RtspSession.h" #include "Thread/WorkThreadPool.h" @@ -162,4 +163,5 @@ void PSRtpSender::onErr(const SockException &ex, bool is_connect) { }, _poller); } -}//namespace mediakit \ No newline at end of file +}//namespace mediakit +#endif// defined(ENABLE_RTPPROXY) \ No newline at end of file