mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-03 17:27:33 +08:00
简化命名空间
This commit is contained in:
@@ -32,10 +32,9 @@
|
||||
#include "RtspSession.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ZL::Network;
|
||||
using namespace toolkit;
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit{
|
||||
|
||||
MultiCastAddressMaker &MultiCastAddressMaker::Instance() {
|
||||
static MultiCastAddressMaker instance;
|
||||
@@ -51,8 +50,8 @@ static uint32_t addressToInt(const string &ip){
|
||||
|
||||
std::shared_ptr<uint32_t> MultiCastAddressMaker::obtain(uint32_t iTry) {
|
||||
lock_guard<recursive_mutex> lck(_mtx);
|
||||
GET_CONFIG_AND_REGISTER(string,addrMinStr,Config::MultiCast::kAddrMin);
|
||||
GET_CONFIG_AND_REGISTER(string,addrMaxStr,Config::MultiCast::kAddrMax);
|
||||
GET_CONFIG_AND_REGISTER(string,addrMinStr,MultiCast::kAddrMin);
|
||||
GET_CONFIG_AND_REGISTER(string,addrMaxStr,MultiCast::kAddrMax);
|
||||
uint32_t addrMin = addressToInt(addrMinStr);
|
||||
uint32_t addrMax = addressToInt(addrMaxStr);
|
||||
|
||||
@@ -112,7 +111,7 @@ RtpBroadCaster::RtpBroadCaster(const string &strLocalIp,const string &strVhost,c
|
||||
throw std::runtime_error(strErr);
|
||||
}
|
||||
auto fd = _apUdpSock[i]->rawFD();
|
||||
GET_CONFIG_AND_REGISTER(uint32_t,udpTTL,Config::MultiCast::kUdpTTL);
|
||||
GET_CONFIG_AND_REGISTER(uint32_t,udpTTL,MultiCast::kUdpTTL);
|
||||
|
||||
SockUtil::setMultiTTL(fd, udpTTL);
|
||||
SockUtil::setMultiLOOP(fd, false);
|
||||
@@ -184,8 +183,4 @@ RtpBroadCaster::Ptr RtpBroadCaster::get(const string &strLocalIp,const string &s
|
||||
}
|
||||
|
||||
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
|
||||
|
||||
}//namespace mediakit
|
||||
|
||||
@@ -39,11 +39,9 @@
|
||||
#include "Network/Socket.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ZL::Util;
|
||||
using namespace ZL::Network;
|
||||
using namespace toolkit;
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit{
|
||||
|
||||
class MultiCastAddressMaker
|
||||
{
|
||||
@@ -51,8 +49,8 @@ public:
|
||||
static MultiCastAddressMaker &Instance();
|
||||
|
||||
static bool isMultiCastAddress(uint32_t iAddr){
|
||||
static uint32_t addrMin = mINI::Instance()[Config::MultiCast::kAddrMin].as<uint32_t>();
|
||||
static uint32_t addrMax = mINI::Instance()[Config::MultiCast::kAddrMax].as<uint32_t>();
|
||||
static uint32_t addrMin = mINI::Instance()[MultiCast::kAddrMin].as<uint32_t>();
|
||||
static uint32_t addrMax = mINI::Instance()[MultiCast::kAddrMax].as<uint32_t>();
|
||||
return iAddr >= addrMin && iAddr <= addrMax;
|
||||
}
|
||||
static string toString(uint32_t iAddr){
|
||||
@@ -93,7 +91,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
}//namespace mediakit
|
||||
|
||||
#endif /* SRC_RTSP_RTPBROADCASTER_H_ */
|
||||
|
||||
@@ -33,8 +33,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit {
|
||||
|
||||
static int getTimeInSDP(const string &sdp) {
|
||||
auto strRange = FindField(sdp.data(), "a=range:npt=", "\r\n");
|
||||
@@ -127,5 +126,4 @@ vector<Track::Ptr> RtpParser::getTracks() const {
|
||||
}
|
||||
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
} /* namespace mediakit */
|
||||
|
||||
@@ -35,11 +35,9 @@
|
||||
#include "RtpCodec/RtpCodec.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ZL::Util;
|
||||
using namespace ZL::Player;
|
||||
using namespace toolkit;
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit {
|
||||
|
||||
class RtpParser : public PlayerBase{
|
||||
public:
|
||||
@@ -83,7 +81,6 @@ private:
|
||||
RtpCodec::Ptr _videoRtpDecoder;
|
||||
};
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
} /* namespace mediakit */
|
||||
|
||||
#endif /* SRC_RTP_RTPPARSER_H_ */
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
#include "Player/Frame.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ZL::Util;
|
||||
using namespace toolkit;
|
||||
using namespace mediakit;
|
||||
|
||||
|
||||
class RtspTrack{
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#include "RtspMaker.h"
|
||||
#include "Common/Factory.h"
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit {
|
||||
|
||||
void RtspMaker::addTrack(const Track::Ptr &track, uint32_t ssrc, int mtu) {
|
||||
if (track->getCodecId() == CodecInvalid) {
|
||||
@@ -19,5 +18,4 @@ void RtspMaker::addTrack(const Track::Ptr &track, uint32_t ssrc, int mtu) {
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
} /* namespace mediakit */
|
||||
@@ -7,8 +7,7 @@
|
||||
|
||||
#include "RtspSdp.h"
|
||||
|
||||
namespace ZL{
|
||||
namespace Rtsp{
|
||||
namespace mediakit{
|
||||
/**
|
||||
* rtsp生成器
|
||||
*/
|
||||
@@ -131,7 +130,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
} /* namespace mediakit */
|
||||
|
||||
#endif //ZLMEDIAKIT_RTSPMAKER_H
|
||||
|
||||
@@ -45,12 +45,9 @@
|
||||
#include "Thread/ThreadPool.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ZL::Util;
|
||||
using namespace ZL::Thread;
|
||||
using namespace ZL::Media;
|
||||
using namespace toolkit;
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit {
|
||||
|
||||
class RtspMediaSource: public MediaSource {
|
||||
public:
|
||||
@@ -102,7 +99,6 @@ protected:
|
||||
RingType::Ptr _pRing; //rtp环形缓冲
|
||||
};
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
} /* namespace mediakit */
|
||||
|
||||
#endif /* SRC_RTSP_RTSPMEDIASOURCE_H_ */
|
||||
|
||||
@@ -37,11 +37,9 @@
|
||||
#include "Util/util.h"
|
||||
#include "Util/base64.h"
|
||||
#include "Network/sockutil.h"
|
||||
using namespace toolkit;
|
||||
|
||||
using namespace ZL::Util;
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit {
|
||||
|
||||
#define POP_HEAD(trackidx) \
|
||||
auto it = _amapRtpSort[trackidx].begin(); \
|
||||
@@ -656,8 +654,8 @@ bool RtspPlayer::handleOneRtp(int iTrackidx, unsigned char *pucData, unsigned in
|
||||
//开始排序缓存
|
||||
if (_abSortStarted[iTrackidx]) {
|
||||
_amapRtpSort[iTrackidx].emplace(rtppt.sequence, pt_ptr);
|
||||
GET_CONFIG_AND_REGISTER(uint32_t,clearCount,Config::Rtp::kClearCount);
|
||||
GET_CONFIG_AND_REGISTER(uint32_t,maxRtpCount,Config::Rtp::kMaxRtpCount);
|
||||
GET_CONFIG_AND_REGISTER(uint32_t,clearCount,Rtp::kClearCount);
|
||||
GET_CONFIG_AND_REGISTER(uint32_t,maxRtpCount,Rtp::kMaxRtpCount);
|
||||
if (_aui64SeqOkCnt[iTrackidx] >= clearCount) {
|
||||
//网络环境改善,需要清空排序缓存
|
||||
_aui64SeqOkCnt[iTrackidx] = 0;
|
||||
@@ -841,7 +839,6 @@ int RtspPlayer::getTrackIndexByTrackType(TrackType trackType) const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
} /* namespace mediakit */
|
||||
|
||||
|
||||
|
||||
@@ -41,14 +41,9 @@
|
||||
#include "Network/TcpClient.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ZL::Rtsp;
|
||||
using namespace ZL::Player;
|
||||
using namespace ZL::Util;
|
||||
using namespace ZL::Poller;
|
||||
using namespace ZL::Network;
|
||||
using namespace toolkit;
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit {
|
||||
|
||||
//实现了rtsp播放器协议部分的功能
|
||||
class RtspPlayer: public PlayerBase,public TcpClient {
|
||||
@@ -142,7 +137,6 @@ private:
|
||||
Ticker _aNowStampTicker[2];
|
||||
};
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
} /* namespace mediakit */
|
||||
|
||||
#endif /* SRC_RTSPPLAYER_RTSPPLAYER_H_TXT_ */
|
||||
|
||||
@@ -37,11 +37,9 @@
|
||||
#include "Util/TimeTicker.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ZL::Util;
|
||||
using namespace ZL::Player;
|
||||
using namespace toolkit;
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit {
|
||||
|
||||
class RtspPlayerImp: public PlayerImp<RtspPlayer,RtpParser> {
|
||||
public:
|
||||
@@ -95,7 +93,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
} /* namespace mediakit */
|
||||
|
||||
#endif /* SRC_RTP_RTPPARSERTESTER_H_ */
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "RtspSdp.h"
|
||||
#include "Common/Factory.h"
|
||||
|
||||
namespace mediakit{
|
||||
|
||||
void Sdp::createRtpEncoder(uint32_t ssrc, int mtu) {
|
||||
_encoder = Factory::getRtpEncoderById(getCodecId(),
|
||||
ssrc,
|
||||
@@ -10,5 +12,6 @@ void Sdp::createRtpEncoder(uint32_t ssrc, int mtu) {
|
||||
getTrackType() * 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
#include "Util/base64.h"
|
||||
#include "Player/Track.h"
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit {
|
||||
|
||||
/**
|
||||
* sdp基类
|
||||
@@ -259,8 +258,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
} /* namespace mediakit */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -36,12 +36,10 @@
|
||||
#include "Util/NoticeCenter.h"
|
||||
#include "Network/sockutil.h"
|
||||
|
||||
using namespace Config;
|
||||
using namespace ZL::Util;
|
||||
using namespace ZL::Network;
|
||||
using namespace std;
|
||||
using namespace toolkit;
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit {
|
||||
|
||||
static int kSockFlags = SOCKET_DEFAULE_FLAGS | FLAG_MORE;
|
||||
|
||||
@@ -301,7 +299,7 @@ void RtspSession::onAuthFailed(const weak_ptr<RtspSession> &weakSelf,const strin
|
||||
|
||||
int n;
|
||||
char response[2 * 1024];
|
||||
GET_CONFIG_AND_REGISTER(bool,authBasic,Config::Rtsp::kAuthBasic);
|
||||
GET_CONFIG_AND_REGISTER(bool,authBasic,Rtsp::kAuthBasic);
|
||||
if (!authBasic) {
|
||||
//我们需要客户端优先以md5方式认证
|
||||
strongSelf->_strNonce = makeRandStr(32);
|
||||
@@ -1089,6 +1087,5 @@ inline void RtspSession::sendRTCP() {
|
||||
#endif
|
||||
|
||||
}
|
||||
/* namespace Session */
|
||||
} /* namespace ZL */
|
||||
/* namespace mediakit */
|
||||
|
||||
|
||||
@@ -41,15 +41,9 @@
|
||||
#include "Http/HttpRequestSplitter.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ZL::Util;
|
||||
using namespace ZL::Rtsp;
|
||||
using namespace ZL::Player;
|
||||
using namespace ZL::Network;
|
||||
using namespace ZL::Http;
|
||||
using namespace toolkit;
|
||||
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit {
|
||||
|
||||
class RtspSession;
|
||||
|
||||
@@ -205,7 +199,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
} /* namespace Session */
|
||||
} /* namespace ZL */
|
||||
} /* namespace mediakit */
|
||||
|
||||
#endif /* SESSION_RTSPSESSION_H_ */
|
||||
|
||||
@@ -30,13 +30,9 @@
|
||||
#include "RtspToRtmpMediaSource.h"
|
||||
#include "Util/util.h"
|
||||
#include "Network/sockutil.h"
|
||||
using namespace toolkit;
|
||||
|
||||
using namespace ZL::Util;
|
||||
using namespace ZL::Network;
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
RtspToRtmpMediaSource::RtspToRtmpMediaSource(const string &vhost,
|
||||
const string &app,
|
||||
@@ -220,5 +216,5 @@ void RtspToRtmpMediaSource::makeMetaData() {
|
||||
#endif
|
||||
_pRtmpSrc->onGetMetaData(metaData);
|
||||
}
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
|
||||
} /* namespace mediakit */
|
||||
|
||||
@@ -32,12 +32,10 @@
|
||||
#include "Rtmp/amf.h"
|
||||
#include "Rtmp/RtmpMediaSource.h"
|
||||
#include "MediaFile/MediaRecorder.h"
|
||||
using namespace toolkit;
|
||||
|
||||
using namespace ZL::Rtmp;
|
||||
using namespace ZL::MediaFile;
|
||||
namespace mediakit {
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
class RtspToRtmpMediaSource: public RtspMediaSource {
|
||||
public:
|
||||
typedef std::shared_ptr<RtspToRtmpMediaSource> Ptr;
|
||||
@@ -109,7 +107,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
} /* namespace mediakit */
|
||||
|
||||
#endif /* SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_ */
|
||||
|
||||
@@ -26,11 +26,9 @@
|
||||
|
||||
#include "UDPServer.h"
|
||||
#include "Util/TimeTicker.h"
|
||||
using namespace toolkit;
|
||||
|
||||
using namespace ZL::Util;
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit {
|
||||
|
||||
UDPServer &UDPServer::Instance() {
|
||||
static UDPServer *instance(new UDPServer());
|
||||
@@ -116,7 +114,6 @@ void UDPServer::onRcvData(int iTrackIndex, const Buffer::Ptr &pBuf, struct socka
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
} /* namespace mediakit */
|
||||
|
||||
|
||||
|
||||
@@ -36,11 +36,9 @@
|
||||
#include "Network/Socket.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ZL::Util;
|
||||
using namespace ZL::Network;
|
||||
using namespace toolkit;
|
||||
|
||||
namespace ZL {
|
||||
namespace Rtsp {
|
||||
namespace mediakit {
|
||||
|
||||
class UDPServer {
|
||||
public:
|
||||
@@ -63,7 +61,6 @@ private:
|
||||
mutex _mtxDataHandler;
|
||||
};
|
||||
|
||||
} /* namespace Rtsp */
|
||||
} /* namespace ZL */
|
||||
} /* namespace mediakit */
|
||||
|
||||
#endif /* RTSP_UDPSERVER_H_ */
|
||||
|
||||
Reference in New Issue
Block a user