From f41f7e28ecd87b24e937f17b1c512ccf2680ef2b Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Wed, 24 Oct 2018 18:09:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/Factory.h | 2 +- src/Device/Device.h | 6 +++--- src/Http/HttpSession.h | 2 +- src/Rtmp/RtmpMediaSource.h | 4 ++-- src/Rtmp/RtmpPlayerImp.h | 6 +++--- src/Rtmp/RtmpToRtspMediaSource.h | 11 +++++----- src/{RtmpCodec => RtmpMuxer}/AACRtmpCodec.cpp | 0 src/{RtmpCodec => RtmpMuxer}/AACRtmpCodec.h | 0 src/{Rtmp => RtmpMuxer}/FlvMuxer.cpp | 4 ++-- src/{Rtmp => RtmpMuxer}/FlvMuxer.h | 4 ++-- .../H264RtmpCodec.cpp | 0 src/{RtmpCodec => RtmpMuxer}/H264RtmpCodec.h | 0 src/{RtmpCodec => RtmpMuxer}/RtmpCodec.cpp | 0 src/{RtmpCodec => RtmpMuxer}/RtmpCodec.h | 0 .../RtmpDemuxer.cpp} | 20 +++++++++---------- .../RtmpParser.h => RtmpMuxer/RtmpDemuxer.h} | 12 +++++------ src/Rtsp/RtspMediaSource.h | 2 +- src/Rtsp/RtspPlayerImp.h | 6 +++--- src/Rtsp/RtspToRtmpMediaSource.h | 6 +++--- src/{RtpCodec => RtspMuxer}/AACRtpCodec.cpp | 0 src/{RtpCodec => RtspMuxer}/AACRtpCodec.h | 0 src/{RtpCodec => RtspMuxer}/H264RtpCodec.cpp | 0 src/{RtpCodec => RtspMuxer}/H264RtpCodec.h | 0 src/{RtpCodec => RtspMuxer}/RtpCodec.h | 0 src/{RtpCodec => RtspMuxer}/RtpMaker.h | 0 src/{RtpCodec => RtspMuxer}/RtpMakerAAC.cpp | 0 src/{RtpCodec => RtspMuxer}/RtpMakerAAC.h | 0 src/{RtpCodec => RtspMuxer}/RtpMakerH264.cpp | 0 src/{RtpCodec => RtspMuxer}/RtpMakerH264.h | 0 .../RtspDemuxer.cpp} | 12 +++++------ .../RtpParser.h => RtspMuxer/RtspDemuxer.h} | 10 +++++----- .../RtspMaker.cpp => RtspMuxer/RtspMuxer.cpp} | 4 ++-- .../RtspMaker.h => RtspMuxer/RtspMuxer.h} | 6 +++--- src/{Rtsp => RtspMuxer}/RtspSdp.cpp | 0 src/{Rtsp => RtspMuxer}/RtspSdp.h | 4 ++-- 35 files changed, 60 insertions(+), 61 deletions(-) rename src/{RtmpCodec => RtmpMuxer}/AACRtmpCodec.cpp (100%) rename src/{RtmpCodec => RtmpMuxer}/AACRtmpCodec.h (100%) rename src/{Rtmp => RtmpMuxer}/FlvMuxer.cpp (99%) rename src/{Rtmp => RtmpMuxer}/FlvMuxer.h (96%) rename src/{RtmpCodec => RtmpMuxer}/H264RtmpCodec.cpp (100%) rename src/{RtmpCodec => RtmpMuxer}/H264RtmpCodec.h (100%) rename src/{RtmpCodec => RtmpMuxer}/RtmpCodec.cpp (100%) rename src/{RtmpCodec => RtmpMuxer}/RtmpCodec.h (100%) rename src/{Rtmp/RtmpParser.cpp => RtmpMuxer/RtmpDemuxer.cpp} (91%) rename src/{Rtmp/RtmpParser.h => RtmpMuxer/RtmpDemuxer.h} (94%) rename src/{RtpCodec => RtspMuxer}/AACRtpCodec.cpp (100%) rename src/{RtpCodec => RtspMuxer}/AACRtpCodec.h (100%) rename src/{RtpCodec => RtspMuxer}/H264RtpCodec.cpp (100%) rename src/{RtpCodec => RtspMuxer}/H264RtpCodec.h (100%) rename src/{RtpCodec => RtspMuxer}/RtpCodec.h (100%) rename src/{RtpCodec => RtspMuxer}/RtpMaker.h (100%) rename src/{RtpCodec => RtspMuxer}/RtpMakerAAC.cpp (100%) rename src/{RtpCodec => RtspMuxer}/RtpMakerAAC.h (100%) rename src/{RtpCodec => RtspMuxer}/RtpMakerH264.cpp (100%) rename src/{RtpCodec => RtspMuxer}/RtpMakerH264.h (100%) rename src/{Rtsp/RtpParser.cpp => RtspMuxer/RtspDemuxer.cpp} (91%) rename src/{Rtsp/RtpParser.h => RtspMuxer/RtspDemuxer.h} (93%) rename src/{Rtsp/RtspMaker.cpp => RtspMuxer/RtspMuxer.cpp} (81%) rename src/{Rtsp/RtspMaker.h => RtspMuxer/RtspMuxer.h} (96%) rename src/{Rtsp => RtspMuxer}/RtspSdp.cpp (100%) rename src/{Rtsp => RtspMuxer}/RtspSdp.h (98%) diff --git a/src/Common/Factory.h b/src/Common/Factory.h index d9f2bd5f..f92f65f6 100644 --- a/src/Common/Factory.h +++ b/src/Common/Factory.h @@ -7,7 +7,7 @@ #include #include "Player/Track.h" -#include "Rtsp/RtspSdp.h" +#include "RtspMuxer/RtspSdp.h" using namespace std; using namespace toolkit; diff --git a/src/Device/Device.h b/src/Device/Device.h index 20c2f232..d180ace7 100644 --- a/src/Device/Device.h +++ b/src/Device/Device.h @@ -32,10 +32,10 @@ #include #include "Util/util.h" #include "Player/Player.h" -#include "RtpCodec/RtpMakerAAC.h" -#include "RtpCodec/RtpMakerH264.h" +#include "RtspMuxer/RtpMakerAAC.h" +#include "RtspMuxer/RtpMakerH264.h" #include "Rtsp/RtspToRtmpMediaSource.h" -#include "Rtsp/RtspSdp.h" +#include "RtspMuxer/RtspSdp.h" #include "Util/TimeTicker.h" using namespace std; diff --git a/src/Http/HttpSession.h b/src/Http/HttpSession.h index 16cd23a4..59107975 100644 --- a/src/Http/HttpSession.h +++ b/src/Http/HttpSession.h @@ -32,7 +32,7 @@ #include "Network/TcpSession.h" #include "Network/TcpServer.h" #include "Rtmp/RtmpMediaSource.h" -#include "Rtmp/FlvMuxer.h" +#include "RtmpMuxer/FlvMuxer.h" #include "HttpRequestSplitter.h" #include "WebSocketSplitter.h" diff --git a/src/Rtmp/RtmpMediaSource.h b/src/Rtmp/RtmpMediaSource.h index 9716a4c1..842fd734 100644 --- a/src/Rtmp/RtmpMediaSource.h +++ b/src/Rtmp/RtmpMediaSource.h @@ -34,7 +34,7 @@ #include #include "amf.h" #include "Rtmp.h" -#include "RtmpParser.h" +#include "RtmpMuxer/RtmpDemuxer.h" #include "Common/config.h" #include "Common/MediaSource.h" #include "Util/util.h" @@ -79,7 +79,7 @@ public: virtual void onGetMetaData(const AMFValue &metadata) { lock_guard lock(_mtxMap); _metadata = metadata; - RtmpParser parser(metadata); + RtmpDemuxer parser(metadata); _iCfgFrameSize = parser.getTracks().size(); if(ready()){ MediaSource::regist(); diff --git a/src/Rtmp/RtmpPlayerImp.h b/src/Rtmp/RtmpPlayerImp.h index c55c6b0c..fa093e01 100644 --- a/src/Rtmp/RtmpPlayerImp.h +++ b/src/Rtmp/RtmpPlayerImp.h @@ -31,15 +31,15 @@ #include #include "Common/config.h" #include "RtmpPlayer.h" -#include "RtmpParser.h" #include "RtmpMediaSource.h" +#include "RtmpMuxer/RtmpDemuxer.h" #include "Poller/Timer.h" #include "Util/TimeTicker.h" using namespace toolkit; namespace mediakit { -class RtmpPlayerImp: public PlayerImp { +class RtmpPlayerImp: public PlayerImp { public: typedef std::shared_ptr Ptr; RtmpPlayerImp(){}; @@ -65,7 +65,7 @@ private: _pRtmpMediaSrc->onGetMetaData(val); } try { - _parser.reset(new RtmpParser(val)); + _parser.reset(new RtmpDemuxer(val)); //todo(xzl) 修复此处 // _parser->setOnVideoCB(_onGetVideoCB); // _parser->setOnAudioCB(_onGetAudioCB); diff --git a/src/Rtmp/RtmpToRtspMediaSource.h b/src/Rtmp/RtmpToRtspMediaSource.h index 6628a356..63aca468 100644 --- a/src/Rtmp/RtmpToRtspMediaSource.h +++ b/src/Rtmp/RtmpToRtspMediaSource.h @@ -34,11 +34,10 @@ #include #include "amf.h" #include "Rtmp.h" -#include "RtmpParser.h" #include "RtmpMediaSource.h" -#include "RtpCodec/RtpMakerH264.h" -#include "RtpCodec/RtpMakerAAC.h" -#include "Rtsp/RtpParser.h" +#include "RtspMuxer/RtpMakerH264.h" +#include "RtspMuxer/RtpMakerAAC.h" +#include "RtmpMuxer/RtmpDemuxer.h" #include "Rtsp/RtspMediaSource.h" #include "Util/util.h" #include "Util/logger.h" @@ -61,7 +60,7 @@ public: void onGetMetaData(const AMFValue &_metadata) override { try { - _pParser.reset(new RtmpParser(_metadata)); + _pParser.reset(new RtmpDemuxer(_metadata)); _pRecorder.reset(new MediaRecorder(getVhost(),getApp(),getId(),_pParser,_bEnableHls,_bEnableMp4)); //todo(xzl) 修复此处 @@ -84,7 +83,7 @@ public: } private: - RtmpParser::Ptr _pParser; + RtmpDemuxer::Ptr _pParser; RtspMediaSource::Ptr _pRtspSrc; RtpMaker_AAC::Ptr _pRtpMaker_aac; RtpMaker_H264::Ptr _pRtpMaker_h264; diff --git a/src/RtmpCodec/AACRtmpCodec.cpp b/src/RtmpMuxer/AACRtmpCodec.cpp similarity index 100% rename from src/RtmpCodec/AACRtmpCodec.cpp rename to src/RtmpMuxer/AACRtmpCodec.cpp diff --git a/src/RtmpCodec/AACRtmpCodec.h b/src/RtmpMuxer/AACRtmpCodec.h similarity index 100% rename from src/RtmpCodec/AACRtmpCodec.h rename to src/RtmpMuxer/AACRtmpCodec.h diff --git a/src/Rtmp/FlvMuxer.cpp b/src/RtmpMuxer/FlvMuxer.cpp similarity index 99% rename from src/Rtmp/FlvMuxer.cpp rename to src/RtmpMuxer/FlvMuxer.cpp index fac7de0f..9cc6d8ef 100644 --- a/src/Rtmp/FlvMuxer.cpp +++ b/src/RtmpMuxer/FlvMuxer.cpp @@ -2,9 +2,9 @@ // Created by xzl on 2018/8/30. // -#include "Util/File.h" #include "FlvMuxer.h" -#include "utils.h" +#include "Util/File.h" +#include "Rtmp/utils.h" #define FILE_BUF_SIZE (64 * 1024) diff --git a/src/Rtmp/FlvMuxer.h b/src/RtmpMuxer/FlvMuxer.h similarity index 96% rename from src/Rtmp/FlvMuxer.h rename to src/RtmpMuxer/FlvMuxer.h index 1f57a4c2..3369105b 100644 --- a/src/Rtmp/FlvMuxer.h +++ b/src/RtmpMuxer/FlvMuxer.h @@ -5,8 +5,8 @@ #ifndef ZLMEDIAKIT_FLVRECORDER_H #define ZLMEDIAKIT_FLVRECORDER_H -#include "Rtmp.h" -#include "RtmpMediaSource.h" +#include "Rtmp/Rtmp.h" +#include "Rtmp/RtmpMediaSource.h" #include "Network/Socket.h" using namespace toolkit; diff --git a/src/RtmpCodec/H264RtmpCodec.cpp b/src/RtmpMuxer/H264RtmpCodec.cpp similarity index 100% rename from src/RtmpCodec/H264RtmpCodec.cpp rename to src/RtmpMuxer/H264RtmpCodec.cpp diff --git a/src/RtmpCodec/H264RtmpCodec.h b/src/RtmpMuxer/H264RtmpCodec.h similarity index 100% rename from src/RtmpCodec/H264RtmpCodec.h rename to src/RtmpMuxer/H264RtmpCodec.h diff --git a/src/RtmpCodec/RtmpCodec.cpp b/src/RtmpMuxer/RtmpCodec.cpp similarity index 100% rename from src/RtmpCodec/RtmpCodec.cpp rename to src/RtmpMuxer/RtmpCodec.cpp diff --git a/src/RtmpCodec/RtmpCodec.h b/src/RtmpMuxer/RtmpCodec.h similarity index 100% rename from src/RtmpCodec/RtmpCodec.h rename to src/RtmpMuxer/RtmpCodec.h diff --git a/src/Rtmp/RtmpParser.cpp b/src/RtmpMuxer/RtmpDemuxer.cpp similarity index 91% rename from src/Rtmp/RtmpParser.cpp rename to src/RtmpMuxer/RtmpDemuxer.cpp index fe48a6ef..beb1cd8c 100644 --- a/src/Rtmp/RtmpParser.cpp +++ b/src/RtmpMuxer/RtmpDemuxer.cpp @@ -24,11 +24,11 @@ * SOFTWARE. */ -#include "RtmpParser.h" +#include "RtmpDemuxer.h" namespace mediakit { -RtmpParser::RtmpParser(const AMFValue &val) { +RtmpDemuxer::RtmpDemuxer(const AMFValue &val) { auto videoCodec = val["videocodecid"]; auto audioCodec = val["audiocodecid"]; @@ -62,10 +62,10 @@ RtmpParser::RtmpParser(const AMFValue &val) { onCheckMedia(val); } -RtmpParser::~RtmpParser() { +RtmpDemuxer::~RtmpDemuxer() { } -bool RtmpParser::inputRtmp(const RtmpPacket::Ptr &pkt) { +bool RtmpDemuxer::inputRtmp(const RtmpPacket::Ptr &pkt) { switch (pkt->typeId) { case MSG_VIDEO:{ if(_iVideoCodecID == 0){ @@ -100,7 +100,7 @@ bool RtmpParser::inputRtmp(const RtmpPacket::Ptr &pkt) { } } -inline bool RtmpParser::inputVideo(const RtmpPacket::Ptr &pkt) { +inline bool RtmpDemuxer::inputVideo(const RtmpPacket::Ptr &pkt) { if (pkt->isCfgFrame()) { //WarnL << " got h264 cfg"; if (_strSPS.size()) { @@ -133,7 +133,7 @@ inline bool RtmpParser::inputVideo(const RtmpPacket::Ptr &pkt) { } return pkt->isVideoKeyFrame(); } -inline void RtmpParser::_onGetH264(const char* pcData, int iLen, uint32_t ui32TimeStamp) { +inline void RtmpDemuxer::_onGetH264(const char* pcData, int iLen, uint32_t ui32TimeStamp) { switch (pcData[0] & 0x1F) { case 5: { onGetH264(_strSPS.data() + 4, _strSPS.length() - 4, ui32TimeStamp); @@ -148,7 +148,7 @@ inline void RtmpParser::_onGetH264(const char* pcData, int iLen, uint32_t ui32Ti break; } } -inline void RtmpParser::onGetH264(const char* pcData, int iLen, uint32_t ui32TimeStamp) { +inline void RtmpDemuxer::onGetH264(const char* pcData, int iLen, uint32_t ui32TimeStamp) { _h264frame.type = pcData[0] & 0x1F; _h264frame.timeStamp = ui32TimeStamp; _h264frame.buffer.assign("\x0\x0\x0\x1", 4); //添加264头 @@ -162,7 +162,7 @@ inline void RtmpParser::onGetH264(const char* pcData, int iLen, uint32_t ui32Tim _h264frame.buffer.clear(); } -inline bool RtmpParser::inputAudio(const RtmpPacket::Ptr &pkt) { +inline bool RtmpDemuxer::inputAudio(const RtmpPacket::Ptr &pkt) { if (pkt->isCfgFrame()) { if (_strAudioCfg.size()) { return false; @@ -178,7 +178,7 @@ inline bool RtmpParser::inputAudio(const RtmpPacket::Ptr &pkt) { } return false; } -inline void RtmpParser::onGetAAC(const char* pcData, int iLen, uint32_t ui32TimeStamp) { +inline void RtmpDemuxer::onGetAAC(const char* pcData, int iLen, uint32_t ui32TimeStamp) { if(iLen + 7 > sizeof(_adts.buffer)){ WarnL << "Illegal adts data, exceeding the length limit."; return; @@ -197,7 +197,7 @@ inline void RtmpParser::onGetAAC(const char* pcData, int iLen, uint32_t ui32Time _adts.aac_frame_length = 7; } -inline void RtmpParser::onCheckMedia(const AMFValue& obj) { +inline void RtmpDemuxer::onCheckMedia(const AMFValue& obj) { obj.object_for_each([&](const string &key ,const AMFValue& val) { if(key == "duration") { _fDuration = val.as_number(); diff --git a/src/Rtmp/RtmpParser.h b/src/RtmpMuxer/RtmpDemuxer.h similarity index 94% rename from src/Rtmp/RtmpParser.h rename to src/RtmpMuxer/RtmpDemuxer.h index a3888f24..de4fe865 100644 --- a/src/Rtmp/RtmpParser.h +++ b/src/RtmpMuxer/RtmpDemuxer.h @@ -29,8 +29,8 @@ #include #include -#include "amf.h" -#include "Rtmp.h" +#include "Rtmp/amf.h" +#include "Rtmp/Rtmp.h" #include "Player/Player.h" #include "Util/TimeTicker.h" #include "Player/PlayerBase.h" @@ -41,11 +41,11 @@ using namespace toolkit; namespace mediakit { -class RtmpParser : public PlayerBase{ +class RtmpDemuxer : public PlayerBase{ public: - typedef std::shared_ptr Ptr; - RtmpParser(const AMFValue &val); - virtual ~RtmpParser(); + typedef std::shared_ptr Ptr; + RtmpDemuxer(const AMFValue &val); + virtual ~RtmpDemuxer(); bool inputRtmp(const RtmpPacket::Ptr &pkt); diff --git a/src/Rtsp/RtspMediaSource.h b/src/Rtsp/RtspMediaSource.h index 4d1884dc..5d4494cb 100644 --- a/src/Rtsp/RtspMediaSource.h +++ b/src/Rtsp/RtspMediaSource.h @@ -35,7 +35,7 @@ #include "Rtsp.h" #include "Common/config.h" #include "Common/MediaSource.h" -#include "RtpCodec/RtpCodec.h" +#include "RtspMuxer/RtpCodec.h" #include "Util/logger.h" #include "Util/RingBuffer.h" diff --git a/src/Rtsp/RtspPlayerImp.h b/src/Rtsp/RtspPlayerImp.h index ff646a03..dcf2c154 100644 --- a/src/Rtsp/RtspPlayerImp.h +++ b/src/Rtsp/RtspPlayerImp.h @@ -31,8 +31,8 @@ #include #include #include "Common/config.h" -#include "RtpParser.h" #include "RtspPlayer.h" +#include "RtspMuxer/RtspDemuxer.h" #include "Poller/Timer.h" #include "Util/TimeTicker.h" @@ -41,7 +41,7 @@ using namespace toolkit; namespace mediakit { -class RtspPlayerImp: public PlayerImp { +class RtspPlayerImp: public PlayerImp { public: typedef std::shared_ptr Ptr; RtspPlayerImp(){}; @@ -68,7 +68,7 @@ private: _pRtspMediaSrc->onGetSDP(sdp); } try { - _parser.reset(new RtpParser(sdp)); + _parser.reset(new RtspDemuxer(sdp)); //todo(xzl) 修复此处 // _parser->setOnVideoCB(_onGetVideoCB); // _parser->setOnAudioCB(_onGetAudioCB); diff --git a/src/Rtsp/RtspToRtmpMediaSource.h b/src/Rtsp/RtspToRtmpMediaSource.h index 7147bff7..8bfc2943 100644 --- a/src/Rtsp/RtspToRtmpMediaSource.h +++ b/src/Rtsp/RtspToRtmpMediaSource.h @@ -27,10 +27,10 @@ #ifndef SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_ #define SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_ -#include "RtpParser.h" #include "RtspMediaSource.h" #include "Rtmp/amf.h" #include "Rtmp/RtmpMediaSource.h" +#include "RtspMuxer/RtspDemuxer.h" #include "MediaFile/MediaRecorder.h" using namespace toolkit; @@ -50,7 +50,7 @@ public: virtual void onGetSDP(const string& strSdp) override{ try { - _pParser.reset(new RtpParser(strSdp)); + _pParser.reset(new RtspDemuxer(strSdp)); _pRecorder.reset(new MediaRecorder(getVhost(),getApp(),getId(),_pParser,_bEnableHls,_bEnableMp4)); //todo(xzl) 修复此处 // _pParser->setOnAudioCB( std::bind(&RtspToRtmpMediaSource::onGetAAC, this, placeholders::_1)); @@ -98,7 +98,7 @@ private: void makeAudioConfigPkt(); void makeMetaData(); private: - RtpParser::Ptr _pParser; + RtspDemuxer::Ptr _pParser; RtmpMediaSource::Ptr _pRtmpSrc; uint8_t _ui8AudioFlags = 0; MediaRecorder::Ptr _pRecorder; diff --git a/src/RtpCodec/AACRtpCodec.cpp b/src/RtspMuxer/AACRtpCodec.cpp similarity index 100% rename from src/RtpCodec/AACRtpCodec.cpp rename to src/RtspMuxer/AACRtpCodec.cpp diff --git a/src/RtpCodec/AACRtpCodec.h b/src/RtspMuxer/AACRtpCodec.h similarity index 100% rename from src/RtpCodec/AACRtpCodec.h rename to src/RtspMuxer/AACRtpCodec.h diff --git a/src/RtpCodec/H264RtpCodec.cpp b/src/RtspMuxer/H264RtpCodec.cpp similarity index 100% rename from src/RtpCodec/H264RtpCodec.cpp rename to src/RtspMuxer/H264RtpCodec.cpp diff --git a/src/RtpCodec/H264RtpCodec.h b/src/RtspMuxer/H264RtpCodec.h similarity index 100% rename from src/RtpCodec/H264RtpCodec.h rename to src/RtspMuxer/H264RtpCodec.h diff --git a/src/RtpCodec/RtpCodec.h b/src/RtspMuxer/RtpCodec.h similarity index 100% rename from src/RtpCodec/RtpCodec.h rename to src/RtspMuxer/RtpCodec.h diff --git a/src/RtpCodec/RtpMaker.h b/src/RtspMuxer/RtpMaker.h similarity index 100% rename from src/RtpCodec/RtpMaker.h rename to src/RtspMuxer/RtpMaker.h diff --git a/src/RtpCodec/RtpMakerAAC.cpp b/src/RtspMuxer/RtpMakerAAC.cpp similarity index 100% rename from src/RtpCodec/RtpMakerAAC.cpp rename to src/RtspMuxer/RtpMakerAAC.cpp diff --git a/src/RtpCodec/RtpMakerAAC.h b/src/RtspMuxer/RtpMakerAAC.h similarity index 100% rename from src/RtpCodec/RtpMakerAAC.h rename to src/RtspMuxer/RtpMakerAAC.h diff --git a/src/RtpCodec/RtpMakerH264.cpp b/src/RtspMuxer/RtpMakerH264.cpp similarity index 100% rename from src/RtpCodec/RtpMakerH264.cpp rename to src/RtspMuxer/RtpMakerH264.cpp diff --git a/src/RtpCodec/RtpMakerH264.h b/src/RtspMuxer/RtpMakerH264.h similarity index 100% rename from src/RtpCodec/RtpMakerH264.h rename to src/RtspMuxer/RtpMakerH264.h diff --git a/src/Rtsp/RtpParser.cpp b/src/RtspMuxer/RtspDemuxer.cpp similarity index 91% rename from src/Rtsp/RtpParser.cpp rename to src/RtspMuxer/RtspDemuxer.cpp index 3f148e61..b9c81f60 100644 --- a/src/Rtsp/RtpParser.cpp +++ b/src/RtspMuxer/RtspDemuxer.cpp @@ -26,7 +26,7 @@ #include #include -#include "RtpParser.h" +#include "RtspDemuxer.h" #include "Util/base64.h" #include "H264/SPSParser.h" #include "Common/Factory.h" @@ -50,7 +50,7 @@ static int getTimeInSDP(const string &sdp) { } return atof(strEnd.data()) - atof(strStart.data()); } -RtpParser::RtpParser(const string& sdp) { +RtspDemuxer::RtspDemuxer(const string& sdp) { RtspTrack tmp[2]; int cnt = parserSDP(sdp, tmp); for (int i = 0; i < cnt; i++) { @@ -70,7 +70,7 @@ RtpParser::RtpParser(const string& sdp) { _fDuration = getTimeInSDP(sdp); } -bool RtpParser::inputRtp(const RtpPacket::Ptr & rtp) { +bool RtspDemuxer::inputRtp(const RtpPacket::Ptr & rtp) { switch (rtp->getTrackType()) { case TrackVideo:{ if(_videoRtpDecoder){ @@ -88,7 +88,7 @@ bool RtpParser::inputRtp(const RtpPacket::Ptr & rtp) { } -inline void RtpParser::onGetAudioTrack(const RtspTrack& audio) { +inline void RtspDemuxer::onGetAudioTrack(const RtspTrack& audio) { //生成Track对象 _audioTrack = dynamic_pointer_cast(Factory::getTrackBySdp(audio.trackSdp)); if(_audioTrack){ @@ -101,7 +101,7 @@ inline void RtpParser::onGetAudioTrack(const RtspTrack& audio) { } } -inline void RtpParser::onGetVideoTrack(const RtspTrack& video) { +inline void RtspDemuxer::onGetVideoTrack(const RtspTrack& video) { //生成Track对象 _videoTrack = dynamic_pointer_cast(Factory::getTrackBySdp(video.trackSdp)); if(_videoTrack){ @@ -114,7 +114,7 @@ inline void RtpParser::onGetVideoTrack(const RtspTrack& video) { } } -vector RtpParser::getTracks() const { +vector RtspDemuxer::getTracks() const { vector ret; if(_videoTrack){ ret.emplace_back(_videoTrack); diff --git a/src/Rtsp/RtpParser.h b/src/RtspMuxer/RtspDemuxer.h similarity index 93% rename from src/Rtsp/RtpParser.h rename to src/RtspMuxer/RtspDemuxer.h index 7c2d9af4..6a70ea66 100644 --- a/src/Rtsp/RtpParser.h +++ b/src/RtspMuxer/RtspDemuxer.h @@ -32,18 +32,18 @@ #include "Player/Player.h" #include "Player/PlayerBase.h" #include "Util/TimeTicker.h" -#include "RtpCodec/RtpCodec.h" +#include "RtspMuxer/RtpCodec.h" using namespace std; using namespace toolkit; namespace mediakit { -class RtpParser : public PlayerBase{ +class RtspDemuxer : public PlayerBase{ public: - typedef std::shared_ptr Ptr; - RtpParser(const string &sdp); - virtual ~RtpParser(){}; + typedef std::shared_ptr Ptr; + RtspDemuxer(const string &sdp); + virtual ~RtspDemuxer(){}; //返回值:true 代表是i帧第一个rtp包 bool inputRtp(const RtpPacket::Ptr &rtp); diff --git a/src/Rtsp/RtspMaker.cpp b/src/RtspMuxer/RtspMuxer.cpp similarity index 81% rename from src/Rtsp/RtspMaker.cpp rename to src/RtspMuxer/RtspMuxer.cpp index c854643f..2b56fdd4 100644 --- a/src/Rtsp/RtspMaker.cpp +++ b/src/RtspMuxer/RtspMuxer.cpp @@ -2,12 +2,12 @@ // Created by xzl on 2018/10/24. // -#include "RtspMaker.h" +#include "RtspMuxer.h" #include "Common/Factory.h" namespace mediakit { -void RtspMaker::addTrack(const Track::Ptr &track, uint32_t ssrc, int mtu) { +void RtspMuxer::addTrack(const Track::Ptr &track, uint32_t ssrc, int mtu) { if (track->getCodecId() == CodecInvalid) { addTrack(std::make_shared(), ssrc, mtu); } else { diff --git a/src/Rtsp/RtspMaker.h b/src/RtspMuxer/RtspMuxer.h similarity index 96% rename from src/Rtsp/RtspMaker.h rename to src/RtspMuxer/RtspMuxer.h index e384ff7a..7111274a 100644 --- a/src/Rtsp/RtspMaker.h +++ b/src/RtspMuxer/RtspMuxer.h @@ -11,16 +11,16 @@ namespace mediakit{ /** * rtsp生成器 */ -class RtspMaker : public FrameRingInterface , public RtpRingInterface{ +class RtspMuxer : public FrameRingInterface , public RtpRingInterface{ public: /** * 构成函数 */ - RtspMaker(){ + RtspMuxer(){ _rtpRing = std::make_shared(); _frameRing = std::make_shared(); } - virtual ~RtspMaker(){} + virtual ~RtspMuxer(){} /** * 添加音视频或title 媒体 diff --git a/src/Rtsp/RtspSdp.cpp b/src/RtspMuxer/RtspSdp.cpp similarity index 100% rename from src/Rtsp/RtspSdp.cpp rename to src/RtspMuxer/RtspSdp.cpp diff --git a/src/Rtsp/RtspSdp.h b/src/RtspMuxer/RtspSdp.h similarity index 98% rename from src/Rtsp/RtspSdp.h rename to src/RtspMuxer/RtspSdp.h index 46e56c94..3444592e 100644 --- a/src/Rtsp/RtspSdp.h +++ b/src/RtspMuxer/RtspSdp.h @@ -5,8 +5,8 @@ #ifndef ZLMEDIAKIT_RTSPSDP_H #define ZLMEDIAKIT_RTSPSDP_H -#include "RtpCodec/H264RtpCodec.h" -#include "RtpCodec/AACRtpCodec.h" +#include "RtspMuxer/H264RtpCodec.h" +#include "RtspMuxer/AACRtpCodec.h" #include "Util/base64.h" #include "Player/Track.h"