mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-23 03:10:04 +08:00
整理文件 规范命名
This commit is contained in:
parent
2c413e0742
commit
f41f7e28ec
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Player/Track.h"
|
#include "Player/Track.h"
|
||||||
#include "Rtsp/RtspSdp.h"
|
#include "RtspMuxer/RtspSdp.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace toolkit;
|
using namespace toolkit;
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include "Util/util.h"
|
#include "Util/util.h"
|
||||||
#include "Player/Player.h"
|
#include "Player/Player.h"
|
||||||
#include "RtpCodec/RtpMakerAAC.h"
|
#include "RtspMuxer/RtpMakerAAC.h"
|
||||||
#include "RtpCodec/RtpMakerH264.h"
|
#include "RtspMuxer/RtpMakerH264.h"
|
||||||
#include "Rtsp/RtspToRtmpMediaSource.h"
|
#include "Rtsp/RtspToRtmpMediaSource.h"
|
||||||
#include "Rtsp/RtspSdp.h"
|
#include "RtspMuxer/RtspSdp.h"
|
||||||
#include "Util/TimeTicker.h"
|
#include "Util/TimeTicker.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include "Network/TcpSession.h"
|
#include "Network/TcpSession.h"
|
||||||
#include "Network/TcpServer.h"
|
#include "Network/TcpServer.h"
|
||||||
#include "Rtmp/RtmpMediaSource.h"
|
#include "Rtmp/RtmpMediaSource.h"
|
||||||
#include "Rtmp/FlvMuxer.h"
|
#include "RtmpMuxer/FlvMuxer.h"
|
||||||
#include "HttpRequestSplitter.h"
|
#include "HttpRequestSplitter.h"
|
||||||
#include "WebSocketSplitter.h"
|
#include "WebSocketSplitter.h"
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "amf.h"
|
#include "amf.h"
|
||||||
#include "Rtmp.h"
|
#include "Rtmp.h"
|
||||||
#include "RtmpParser.h"
|
#include "RtmpMuxer/RtmpDemuxer.h"
|
||||||
#include "Common/config.h"
|
#include "Common/config.h"
|
||||||
#include "Common/MediaSource.h"
|
#include "Common/MediaSource.h"
|
||||||
#include "Util/util.h"
|
#include "Util/util.h"
|
||||||
@ -79,7 +79,7 @@ public:
|
|||||||
virtual void onGetMetaData(const AMFValue &metadata) {
|
virtual void onGetMetaData(const AMFValue &metadata) {
|
||||||
lock_guard<recursive_mutex> lock(_mtxMap);
|
lock_guard<recursive_mutex> lock(_mtxMap);
|
||||||
_metadata = metadata;
|
_metadata = metadata;
|
||||||
RtmpParser parser(metadata);
|
RtmpDemuxer parser(metadata);
|
||||||
_iCfgFrameSize = parser.getTracks().size();
|
_iCfgFrameSize = parser.getTracks().size();
|
||||||
if(ready()){
|
if(ready()){
|
||||||
MediaSource::regist();
|
MediaSource::regist();
|
||||||
|
@ -31,15 +31,15 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include "Common/config.h"
|
#include "Common/config.h"
|
||||||
#include "RtmpPlayer.h"
|
#include "RtmpPlayer.h"
|
||||||
#include "RtmpParser.h"
|
|
||||||
#include "RtmpMediaSource.h"
|
#include "RtmpMediaSource.h"
|
||||||
|
#include "RtmpMuxer/RtmpDemuxer.h"
|
||||||
#include "Poller/Timer.h"
|
#include "Poller/Timer.h"
|
||||||
#include "Util/TimeTicker.h"
|
#include "Util/TimeTicker.h"
|
||||||
using namespace toolkit;
|
using namespace toolkit;
|
||||||
|
|
||||||
namespace mediakit {
|
namespace mediakit {
|
||||||
|
|
||||||
class RtmpPlayerImp: public PlayerImp<RtmpPlayer,RtmpParser> {
|
class RtmpPlayerImp: public PlayerImp<RtmpPlayer,RtmpDemuxer> {
|
||||||
public:
|
public:
|
||||||
typedef std::shared_ptr<RtmpPlayerImp> Ptr;
|
typedef std::shared_ptr<RtmpPlayerImp> Ptr;
|
||||||
RtmpPlayerImp(){};
|
RtmpPlayerImp(){};
|
||||||
@ -65,7 +65,7 @@ private:
|
|||||||
_pRtmpMediaSrc->onGetMetaData(val);
|
_pRtmpMediaSrc->onGetMetaData(val);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
_parser.reset(new RtmpParser(val));
|
_parser.reset(new RtmpDemuxer(val));
|
||||||
//todo(xzl) 修复此处
|
//todo(xzl) 修复此处
|
||||||
// _parser->setOnVideoCB(_onGetVideoCB);
|
// _parser->setOnVideoCB(_onGetVideoCB);
|
||||||
// _parser->setOnAudioCB(_onGetAudioCB);
|
// _parser->setOnAudioCB(_onGetAudioCB);
|
||||||
|
@ -34,11 +34,10 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "amf.h"
|
#include "amf.h"
|
||||||
#include "Rtmp.h"
|
#include "Rtmp.h"
|
||||||
#include "RtmpParser.h"
|
|
||||||
#include "RtmpMediaSource.h"
|
#include "RtmpMediaSource.h"
|
||||||
#include "RtpCodec/RtpMakerH264.h"
|
#include "RtspMuxer/RtpMakerH264.h"
|
||||||
#include "RtpCodec/RtpMakerAAC.h"
|
#include "RtspMuxer/RtpMakerAAC.h"
|
||||||
#include "Rtsp/RtpParser.h"
|
#include "RtmpMuxer/RtmpDemuxer.h"
|
||||||
#include "Rtsp/RtspMediaSource.h"
|
#include "Rtsp/RtspMediaSource.h"
|
||||||
#include "Util/util.h"
|
#include "Util/util.h"
|
||||||
#include "Util/logger.h"
|
#include "Util/logger.h"
|
||||||
@ -61,7 +60,7 @@ public:
|
|||||||
|
|
||||||
void onGetMetaData(const AMFValue &_metadata) override {
|
void onGetMetaData(const AMFValue &_metadata) override {
|
||||||
try {
|
try {
|
||||||
_pParser.reset(new RtmpParser(_metadata));
|
_pParser.reset(new RtmpDemuxer(_metadata));
|
||||||
_pRecorder.reset(new MediaRecorder(getVhost(),getApp(),getId(),_pParser,_bEnableHls,_bEnableMp4));
|
_pRecorder.reset(new MediaRecorder(getVhost(),getApp(),getId(),_pParser,_bEnableHls,_bEnableMp4));
|
||||||
//todo(xzl) 修复此处
|
//todo(xzl) 修复此处
|
||||||
|
|
||||||
@ -84,7 +83,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RtmpParser::Ptr _pParser;
|
RtmpDemuxer::Ptr _pParser;
|
||||||
RtspMediaSource::Ptr _pRtspSrc;
|
RtspMediaSource::Ptr _pRtspSrc;
|
||||||
RtpMaker_AAC::Ptr _pRtpMaker_aac;
|
RtpMaker_AAC::Ptr _pRtpMaker_aac;
|
||||||
RtpMaker_H264::Ptr _pRtpMaker_h264;
|
RtpMaker_H264::Ptr _pRtpMaker_h264;
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
// Created by xzl on 2018/8/30.
|
// Created by xzl on 2018/8/30.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "Util/File.h"
|
|
||||||
#include "FlvMuxer.h"
|
#include "FlvMuxer.h"
|
||||||
#include "utils.h"
|
#include "Util/File.h"
|
||||||
|
#include "Rtmp/utils.h"
|
||||||
|
|
||||||
#define FILE_BUF_SIZE (64 * 1024)
|
#define FILE_BUF_SIZE (64 * 1024)
|
||||||
|
|
@ -5,8 +5,8 @@
|
|||||||
#ifndef ZLMEDIAKIT_FLVRECORDER_H
|
#ifndef ZLMEDIAKIT_FLVRECORDER_H
|
||||||
#define ZLMEDIAKIT_FLVRECORDER_H
|
#define ZLMEDIAKIT_FLVRECORDER_H
|
||||||
|
|
||||||
#include "Rtmp.h"
|
#include "Rtmp/Rtmp.h"
|
||||||
#include "RtmpMediaSource.h"
|
#include "Rtmp/RtmpMediaSource.h"
|
||||||
#include "Network/Socket.h"
|
#include "Network/Socket.h"
|
||||||
using namespace toolkit;
|
using namespace toolkit;
|
||||||
|
|
@ -24,11 +24,11 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "RtmpParser.h"
|
#include "RtmpDemuxer.h"
|
||||||
|
|
||||||
namespace mediakit {
|
namespace mediakit {
|
||||||
|
|
||||||
RtmpParser::RtmpParser(const AMFValue &val) {
|
RtmpDemuxer::RtmpDemuxer(const AMFValue &val) {
|
||||||
auto videoCodec = val["videocodecid"];
|
auto videoCodec = val["videocodecid"];
|
||||||
auto audioCodec = val["audiocodecid"];
|
auto audioCodec = val["audiocodecid"];
|
||||||
|
|
||||||
@ -62,10 +62,10 @@ RtmpParser::RtmpParser(const AMFValue &val) {
|
|||||||
onCheckMedia(val);
|
onCheckMedia(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
RtmpParser::~RtmpParser() {
|
RtmpDemuxer::~RtmpDemuxer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RtmpParser::inputRtmp(const RtmpPacket::Ptr &pkt) {
|
bool RtmpDemuxer::inputRtmp(const RtmpPacket::Ptr &pkt) {
|
||||||
switch (pkt->typeId) {
|
switch (pkt->typeId) {
|
||||||
case MSG_VIDEO:{
|
case MSG_VIDEO:{
|
||||||
if(_iVideoCodecID == 0){
|
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()) {
|
if (pkt->isCfgFrame()) {
|
||||||
//WarnL << " got h264 cfg";
|
//WarnL << " got h264 cfg";
|
||||||
if (_strSPS.size()) {
|
if (_strSPS.size()) {
|
||||||
@ -133,7 +133,7 @@ inline bool RtmpParser::inputVideo(const RtmpPacket::Ptr &pkt) {
|
|||||||
}
|
}
|
||||||
return pkt->isVideoKeyFrame();
|
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) {
|
switch (pcData[0] & 0x1F) {
|
||||||
case 5: {
|
case 5: {
|
||||||
onGetH264(_strSPS.data() + 4, _strSPS.length() - 4, ui32TimeStamp);
|
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;
|
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.type = pcData[0] & 0x1F;
|
||||||
_h264frame.timeStamp = ui32TimeStamp;
|
_h264frame.timeStamp = ui32TimeStamp;
|
||||||
_h264frame.buffer.assign("\x0\x0\x0\x1", 4); //添加264头
|
_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();
|
_h264frame.buffer.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool RtmpParser::inputAudio(const RtmpPacket::Ptr &pkt) {
|
inline bool RtmpDemuxer::inputAudio(const RtmpPacket::Ptr &pkt) {
|
||||||
if (pkt->isCfgFrame()) {
|
if (pkt->isCfgFrame()) {
|
||||||
if (_strAudioCfg.size()) {
|
if (_strAudioCfg.size()) {
|
||||||
return false;
|
return false;
|
||||||
@ -178,7 +178,7 @@ inline bool RtmpParser::inputAudio(const RtmpPacket::Ptr &pkt) {
|
|||||||
}
|
}
|
||||||
return false;
|
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)){
|
if(iLen + 7 > sizeof(_adts.buffer)){
|
||||||
WarnL << "Illegal adts data, exceeding the length limit.";
|
WarnL << "Illegal adts data, exceeding the length limit.";
|
||||||
return;
|
return;
|
||||||
@ -197,7 +197,7 @@ inline void RtmpParser::onGetAAC(const char* pcData, int iLen, uint32_t ui32Time
|
|||||||
_adts.aac_frame_length = 7;
|
_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) {
|
obj.object_for_each([&](const string &key ,const AMFValue& val) {
|
||||||
if(key == "duration") {
|
if(key == "duration") {
|
||||||
_fDuration = val.as_number();
|
_fDuration = val.as_number();
|
@ -29,8 +29,8 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "amf.h"
|
#include "Rtmp/amf.h"
|
||||||
#include "Rtmp.h"
|
#include "Rtmp/Rtmp.h"
|
||||||
#include "Player/Player.h"
|
#include "Player/Player.h"
|
||||||
#include "Util/TimeTicker.h"
|
#include "Util/TimeTicker.h"
|
||||||
#include "Player/PlayerBase.h"
|
#include "Player/PlayerBase.h"
|
||||||
@ -41,11 +41,11 @@ using namespace toolkit;
|
|||||||
|
|
||||||
namespace mediakit {
|
namespace mediakit {
|
||||||
|
|
||||||
class RtmpParser : public PlayerBase{
|
class RtmpDemuxer : public PlayerBase{
|
||||||
public:
|
public:
|
||||||
typedef std::shared_ptr<RtmpParser> Ptr;
|
typedef std::shared_ptr<RtmpDemuxer> Ptr;
|
||||||
RtmpParser(const AMFValue &val);
|
RtmpDemuxer(const AMFValue &val);
|
||||||
virtual ~RtmpParser();
|
virtual ~RtmpDemuxer();
|
||||||
|
|
||||||
bool inputRtmp(const RtmpPacket::Ptr &pkt);
|
bool inputRtmp(const RtmpPacket::Ptr &pkt);
|
||||||
|
|
@ -35,7 +35,7 @@
|
|||||||
#include "Rtsp.h"
|
#include "Rtsp.h"
|
||||||
#include "Common/config.h"
|
#include "Common/config.h"
|
||||||
#include "Common/MediaSource.h"
|
#include "Common/MediaSource.h"
|
||||||
#include "RtpCodec/RtpCodec.h"
|
#include "RtspMuxer/RtpCodec.h"
|
||||||
|
|
||||||
#include "Util/logger.h"
|
#include "Util/logger.h"
|
||||||
#include "Util/RingBuffer.h"
|
#include "Util/RingBuffer.h"
|
||||||
|
@ -31,8 +31,8 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "Common/config.h"
|
#include "Common/config.h"
|
||||||
#include "RtpParser.h"
|
|
||||||
#include "RtspPlayer.h"
|
#include "RtspPlayer.h"
|
||||||
|
#include "RtspMuxer/RtspDemuxer.h"
|
||||||
#include "Poller/Timer.h"
|
#include "Poller/Timer.h"
|
||||||
#include "Util/TimeTicker.h"
|
#include "Util/TimeTicker.h"
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ using namespace toolkit;
|
|||||||
|
|
||||||
namespace mediakit {
|
namespace mediakit {
|
||||||
|
|
||||||
class RtspPlayerImp: public PlayerImp<RtspPlayer,RtpParser> {
|
class RtspPlayerImp: public PlayerImp<RtspPlayer,RtspDemuxer> {
|
||||||
public:
|
public:
|
||||||
typedef std::shared_ptr<RtspPlayerImp> Ptr;
|
typedef std::shared_ptr<RtspPlayerImp> Ptr;
|
||||||
RtspPlayerImp(){};
|
RtspPlayerImp(){};
|
||||||
@ -68,7 +68,7 @@ private:
|
|||||||
_pRtspMediaSrc->onGetSDP(sdp);
|
_pRtspMediaSrc->onGetSDP(sdp);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
_parser.reset(new RtpParser(sdp));
|
_parser.reset(new RtspDemuxer(sdp));
|
||||||
//todo(xzl) 修复此处
|
//todo(xzl) 修复此处
|
||||||
// _parser->setOnVideoCB(_onGetVideoCB);
|
// _parser->setOnVideoCB(_onGetVideoCB);
|
||||||
// _parser->setOnAudioCB(_onGetAudioCB);
|
// _parser->setOnAudioCB(_onGetAudioCB);
|
||||||
|
@ -27,10 +27,10 @@
|
|||||||
#ifndef SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_
|
#ifndef SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_
|
||||||
#define SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_
|
#define SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_
|
||||||
|
|
||||||
#include "RtpParser.h"
|
|
||||||
#include "RtspMediaSource.h"
|
#include "RtspMediaSource.h"
|
||||||
#include "Rtmp/amf.h"
|
#include "Rtmp/amf.h"
|
||||||
#include "Rtmp/RtmpMediaSource.h"
|
#include "Rtmp/RtmpMediaSource.h"
|
||||||
|
#include "RtspMuxer/RtspDemuxer.h"
|
||||||
#include "MediaFile/MediaRecorder.h"
|
#include "MediaFile/MediaRecorder.h"
|
||||||
using namespace toolkit;
|
using namespace toolkit;
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
virtual void onGetSDP(const string& strSdp) override{
|
virtual void onGetSDP(const string& strSdp) override{
|
||||||
try {
|
try {
|
||||||
_pParser.reset(new RtpParser(strSdp));
|
_pParser.reset(new RtspDemuxer(strSdp));
|
||||||
_pRecorder.reset(new MediaRecorder(getVhost(),getApp(),getId(),_pParser,_bEnableHls,_bEnableMp4));
|
_pRecorder.reset(new MediaRecorder(getVhost(),getApp(),getId(),_pParser,_bEnableHls,_bEnableMp4));
|
||||||
//todo(xzl) 修复此处
|
//todo(xzl) 修复此处
|
||||||
// _pParser->setOnAudioCB( std::bind(&RtspToRtmpMediaSource::onGetAAC, this, placeholders::_1));
|
// _pParser->setOnAudioCB( std::bind(&RtspToRtmpMediaSource::onGetAAC, this, placeholders::_1));
|
||||||
@ -98,7 +98,7 @@ private:
|
|||||||
void makeAudioConfigPkt();
|
void makeAudioConfigPkt();
|
||||||
void makeMetaData();
|
void makeMetaData();
|
||||||
private:
|
private:
|
||||||
RtpParser::Ptr _pParser;
|
RtspDemuxer::Ptr _pParser;
|
||||||
RtmpMediaSource::Ptr _pRtmpSrc;
|
RtmpMediaSource::Ptr _pRtmpSrc;
|
||||||
uint8_t _ui8AudioFlags = 0;
|
uint8_t _ui8AudioFlags = 0;
|
||||||
MediaRecorder::Ptr _pRecorder;
|
MediaRecorder::Ptr _pRecorder;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "RtpParser.h"
|
#include "RtspDemuxer.h"
|
||||||
#include "Util/base64.h"
|
#include "Util/base64.h"
|
||||||
#include "H264/SPSParser.h"
|
#include "H264/SPSParser.h"
|
||||||
#include "Common/Factory.h"
|
#include "Common/Factory.h"
|
||||||
@ -50,7 +50,7 @@ static int getTimeInSDP(const string &sdp) {
|
|||||||
}
|
}
|
||||||
return atof(strEnd.data()) - atof(strStart.data());
|
return atof(strEnd.data()) - atof(strStart.data());
|
||||||
}
|
}
|
||||||
RtpParser::RtpParser(const string& sdp) {
|
RtspDemuxer::RtspDemuxer(const string& sdp) {
|
||||||
RtspTrack tmp[2];
|
RtspTrack tmp[2];
|
||||||
int cnt = parserSDP(sdp, tmp);
|
int cnt = parserSDP(sdp, tmp);
|
||||||
for (int i = 0; i < cnt; i++) {
|
for (int i = 0; i < cnt; i++) {
|
||||||
@ -70,7 +70,7 @@ RtpParser::RtpParser(const string& sdp) {
|
|||||||
_fDuration = getTimeInSDP(sdp);
|
_fDuration = getTimeInSDP(sdp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RtpParser::inputRtp(const RtpPacket::Ptr & rtp) {
|
bool RtspDemuxer::inputRtp(const RtpPacket::Ptr & rtp) {
|
||||||
switch (rtp->getTrackType()) {
|
switch (rtp->getTrackType()) {
|
||||||
case TrackVideo:{
|
case TrackVideo:{
|
||||||
if(_videoRtpDecoder){
|
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对象
|
//生成Track对象
|
||||||
_audioTrack = dynamic_pointer_cast<AudioTrack>(Factory::getTrackBySdp(audio.trackSdp));
|
_audioTrack = dynamic_pointer_cast<AudioTrack>(Factory::getTrackBySdp(audio.trackSdp));
|
||||||
if(_audioTrack){
|
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对象
|
//生成Track对象
|
||||||
_videoTrack = dynamic_pointer_cast<VideoTrack>(Factory::getTrackBySdp(video.trackSdp));
|
_videoTrack = dynamic_pointer_cast<VideoTrack>(Factory::getTrackBySdp(video.trackSdp));
|
||||||
if(_videoTrack){
|
if(_videoTrack){
|
||||||
@ -114,7 +114,7 @@ inline void RtpParser::onGetVideoTrack(const RtspTrack& video) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<Track::Ptr> RtpParser::getTracks() const {
|
vector<Track::Ptr> RtspDemuxer::getTracks() const {
|
||||||
vector<Track::Ptr> ret;
|
vector<Track::Ptr> ret;
|
||||||
if(_videoTrack){
|
if(_videoTrack){
|
||||||
ret.emplace_back(_videoTrack);
|
ret.emplace_back(_videoTrack);
|
@ -32,18 +32,18 @@
|
|||||||
#include "Player/Player.h"
|
#include "Player/Player.h"
|
||||||
#include "Player/PlayerBase.h"
|
#include "Player/PlayerBase.h"
|
||||||
#include "Util/TimeTicker.h"
|
#include "Util/TimeTicker.h"
|
||||||
#include "RtpCodec/RtpCodec.h"
|
#include "RtspMuxer/RtpCodec.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace toolkit;
|
using namespace toolkit;
|
||||||
|
|
||||||
namespace mediakit {
|
namespace mediakit {
|
||||||
|
|
||||||
class RtpParser : public PlayerBase{
|
class RtspDemuxer : public PlayerBase{
|
||||||
public:
|
public:
|
||||||
typedef std::shared_ptr<RtpParser> Ptr;
|
typedef std::shared_ptr<RtspDemuxer> Ptr;
|
||||||
RtpParser(const string &sdp);
|
RtspDemuxer(const string &sdp);
|
||||||
virtual ~RtpParser(){};
|
virtual ~RtspDemuxer(){};
|
||||||
|
|
||||||
//返回值:true 代表是i帧第一个rtp包
|
//返回值:true 代表是i帧第一个rtp包
|
||||||
bool inputRtp(const RtpPacket::Ptr &rtp);
|
bool inputRtp(const RtpPacket::Ptr &rtp);
|
@ -2,12 +2,12 @@
|
|||||||
// Created by xzl on 2018/10/24.
|
// Created by xzl on 2018/10/24.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "RtspMaker.h"
|
#include "RtspMuxer.h"
|
||||||
#include "Common/Factory.h"
|
#include "Common/Factory.h"
|
||||||
|
|
||||||
namespace mediakit {
|
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) {
|
if (track->getCodecId() == CodecInvalid) {
|
||||||
addTrack(std::make_shared<TitleSdp>(), ssrc, mtu);
|
addTrack(std::make_shared<TitleSdp>(), ssrc, mtu);
|
||||||
} else {
|
} else {
|
@ -11,16 +11,16 @@ namespace mediakit{
|
|||||||
/**
|
/**
|
||||||
* rtsp生成器
|
* rtsp生成器
|
||||||
*/
|
*/
|
||||||
class RtspMaker : public FrameRingInterface , public RtpRingInterface{
|
class RtspMuxer : public FrameRingInterface , public RtpRingInterface{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* 构成函数
|
* 构成函数
|
||||||
*/
|
*/
|
||||||
RtspMaker(){
|
RtspMuxer(){
|
||||||
_rtpRing = std::make_shared<RtpRingInterface::RingType>();
|
_rtpRing = std::make_shared<RtpRingInterface::RingType>();
|
||||||
_frameRing = std::make_shared<FrameRingInterface::RingType>();
|
_frameRing = std::make_shared<FrameRingInterface::RingType>();
|
||||||
}
|
}
|
||||||
virtual ~RtspMaker(){}
|
virtual ~RtspMuxer(){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加音视频或title 媒体
|
* 添加音视频或title 媒体
|
@ -5,8 +5,8 @@
|
|||||||
#ifndef ZLMEDIAKIT_RTSPSDP_H
|
#ifndef ZLMEDIAKIT_RTSPSDP_H
|
||||||
#define ZLMEDIAKIT_RTSPSDP_H
|
#define ZLMEDIAKIT_RTSPSDP_H
|
||||||
|
|
||||||
#include "RtpCodec/H264RtpCodec.h"
|
#include "RtspMuxer/H264RtpCodec.h"
|
||||||
#include "RtpCodec/AACRtpCodec.h"
|
#include "RtspMuxer/AACRtpCodec.h"
|
||||||
#include "Util/base64.h"
|
#include "Util/base64.h"
|
||||||
#include "Player/Track.h"
|
#include "Player/Track.h"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user