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 "Player/Track.h"
|
||||
#include "Rtsp/RtspSdp.h"
|
||||
#include "RtspMuxer/RtspSdp.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace toolkit;
|
||||
|
@ -32,10 +32,10 @@
|
||||
#include <functional>
|
||||
#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;
|
||||
|
@ -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"
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <unordered_map>
|
||||
#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<recursive_mutex> lock(_mtxMap);
|
||||
_metadata = metadata;
|
||||
RtmpParser parser(metadata);
|
||||
RtmpDemuxer parser(metadata);
|
||||
_iCfgFrameSize = parser.getTracks().size();
|
||||
if(ready()){
|
||||
MediaSource::regist();
|
||||
|
@ -31,15 +31,15 @@
|
||||
#include <functional>
|
||||
#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<RtmpPlayer,RtmpParser> {
|
||||
class RtmpPlayerImp: public PlayerImp<RtmpPlayer,RtmpDemuxer> {
|
||||
public:
|
||||
typedef std::shared_ptr<RtmpPlayerImp> 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);
|
||||
|
@ -34,11 +34,10 @@
|
||||
#include <unordered_map>
|
||||
#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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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();
|
@ -29,8 +29,8 @@
|
||||
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
#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<RtmpParser> Ptr;
|
||||
RtmpParser(const AMFValue &val);
|
||||
virtual ~RtmpParser();
|
||||
typedef std::shared_ptr<RtmpDemuxer> Ptr;
|
||||
RtmpDemuxer(const AMFValue &val);
|
||||
virtual ~RtmpDemuxer();
|
||||
|
||||
bool inputRtmp(const RtmpPacket::Ptr &pkt);
|
||||
|
@ -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"
|
||||
|
@ -31,8 +31,8 @@
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#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<RtspPlayer,RtpParser> {
|
||||
class RtspPlayerImp: public PlayerImp<RtspPlayer,RtspDemuxer> {
|
||||
public:
|
||||
typedef std::shared_ptr<RtspPlayerImp> 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);
|
||||
|
@ -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;
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
#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<AudioTrack>(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<VideoTrack>(Factory::getTrackBySdp(video.trackSdp));
|
||||
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;
|
||||
if(_videoTrack){
|
||||
ret.emplace_back(_videoTrack);
|
@ -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<RtpParser> Ptr;
|
||||
RtpParser(const string &sdp);
|
||||
virtual ~RtpParser(){};
|
||||
typedef std::shared_ptr<RtspDemuxer> Ptr;
|
||||
RtspDemuxer(const string &sdp);
|
||||
virtual ~RtspDemuxer(){};
|
||||
|
||||
//返回值:true 代表是i帧第一个rtp包
|
||||
bool inputRtp(const RtpPacket::Ptr &rtp);
|
@ -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<TitleSdp>(), ssrc, mtu);
|
||||
} else {
|
@ -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<RtpRingInterface::RingType>();
|
||||
_frameRing = std::make_shared<FrameRingInterface::RingType>();
|
||||
}
|
||||
virtual ~RtspMaker(){}
|
||||
virtual ~RtspMuxer(){}
|
||||
|
||||
/**
|
||||
* 添加音视频或title 媒体
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user