简化命名空间

This commit is contained in:
xiongziliang 2018-10-24 17:17:55 +08:00
parent ed1402e9d6
commit 9f16cc1201
133 changed files with 446 additions and 788 deletions

@ -1 +1 @@
Subproject commit d7487e37dd915e8391c1d6a45f1773af13b366a7 Subproject commit 6e69a082a2f6e6161785b00c7421bf1a811ed34a

View File

@ -39,10 +39,7 @@
#include "cleaner.h" #include "cleaner.h"
using namespace std; using namespace std;
using namespace ZL::Util; using namespace toolkit;
using namespace ZL::Rtmp;
using namespace ZL::Rtsp;
using namespace ZL::Http;
static TcpServer::Ptr s_pRtspSrv; static TcpServer::Ptr s_pRtspSrv;
static TcpServer::Ptr s_pRtmpSrv; static TcpServer::Ptr s_pRtmpSrv;

View File

@ -5,7 +5,7 @@
#include "flvrecorder.h" #include "flvrecorder.h"
#include "Rtmp/FlvMuxer.h" #include "Rtmp/FlvMuxer.h"
using namespace ZL::Rtmp; using namespace toolkit;
API_EXPORT FlvRecorderContex API_CALL createFlvRecorder(){ API_EXPORT FlvRecorderContex API_CALL createFlvRecorder(){
DebugL; DebugL;

View File

@ -33,9 +33,7 @@
#include "cleaner.h" #include "cleaner.h"
using namespace std; using namespace std;
using namespace ZL::Util; using namespace toolkit;
using namespace ZL::Http;
static recursive_mutex s_mtxMapDownloader; static recursive_mutex s_mtxMapDownloader;
static unordered_map<void *, HttpDownloader::Ptr> s_mapDownloader; static unordered_map<void *, HttpDownloader::Ptr> s_mapDownloader;

View File

@ -32,8 +32,7 @@
#include "cleaner.h" #include "cleaner.h"
using namespace std; using namespace std;
using namespace ZL::DEV; using namespace toolkit;
using namespace ZL::Util;
static recursive_mutex s_mtxMapMedia; static recursive_mutex s_mtxMapMedia;
static unordered_map<void *, DevChannel::Ptr> s_mapMedia; static unordered_map<void *, DevChannel::Ptr> s_mapMedia;

View File

@ -35,11 +35,7 @@
#include "cleaner.h" #include "cleaner.h"
using namespace std; using namespace std;
using namespace ZL::Util; using namespace toolkit;
using namespace ZL::Thread;
using namespace ZL::Player;
using namespace ZL::Rtmp;
using namespace ZL::Rtsp;
static recursive_mutex s_mtxMapPlayer; static recursive_mutex s_mtxMapPlayer;
static unordered_map<void *, MediaPlayer::Ptr> s_mapPlayer; static unordered_map<void *, MediaPlayer::Ptr> s_mapPlayer;

View File

@ -28,8 +28,7 @@
#include "Device/PlayerProxy.h" #include "Device/PlayerProxy.h"
#include "Util/onceToken.h" #include "Util/onceToken.h"
using namespace ZL::DEV; using namespace toolkit;
using namespace ZL::Util;
static recursive_mutex s_mtxMapProxyPlayer; static recursive_mutex s_mtxMapProxyPlayer;
static unordered_map<void *, PlayerProxy::Ptr> s_mapProxyPlayer; static unordered_map<void *, PlayerProxy::Ptr> s_mapProxyPlayer;

View File

@ -38,10 +38,9 @@ extern "C" {
} }
#endif #endif
using namespace ZL::Util; using namespace toolkit;
namespace ZL { namespace mediakit {
namespace Codec {
AACEncoder::AACEncoder() { AACEncoder::AACEncoder() {
@ -117,8 +116,7 @@ int AACEncoder::inputData(char *pcPcmBufr, int iLen, unsigned char **ppucOutBuff
return nRet; return nRet;
} }
} /* namespace Codec */ } /* namespace mediakit */
} /* namespace ZL */
#endif //ENABLE_FAAC #endif //ENABLE_FAAC

View File

@ -28,8 +28,7 @@
#ifndef CODEC_AACENCODER_H_ #ifndef CODEC_AACENCODER_H_
#define CODEC_AACENCODER_H_ #define CODEC_AACENCODER_H_
namespace ZL { namespace mediakit {
namespace Codec {
class AACEncoder { class AACEncoder {
public: public:
@ -51,7 +50,6 @@ private:
}; };
} /* namespace Codec */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* CODEC_AACENCODER_H_ */ #endif /* CODEC_AACENCODER_H_ */

View File

@ -28,10 +28,10 @@
#include "H264Encoder.h" #include "H264Encoder.h"
#include "Util/TimeTicker.h" #include "Util/TimeTicker.h"
using namespace ZL::Util;
namespace ZL { using namespace toolkit;
namespace Codec {
namespace mediakit {
H264Encoder::H264Encoder() { H264Encoder::H264Encoder() {
@ -347,8 +347,7 @@ int H264Encoder::inputData(char* apcYuv[3], int aiYuvLen[3], int64_t i64Pts, H26
return iNal; return iNal;
} }
} /* namespace Codec */ } /* namespace mediakit */
} /* namespace ZL */
#endif //ENABLE_X264 #endif //ENABLE_X264

View File

@ -38,8 +38,7 @@ extern "C" {
} }
#endif //__cplusplus #endif //__cplusplus
namespace ZL { namespace mediakit {
namespace Codec {
class H264Encoder { class H264Encoder {
public: public:
@ -60,7 +59,6 @@ private:
H264Frame _aFrames[10]; H264Frame _aFrames[10];
}; };
} /* namespace Codec */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* CODEC_H264ENCODER_H_ */ #endif /* CODEC_H264ENCODER_H_ */

View File

@ -4,6 +4,8 @@
#include "Factory.h" #include "Factory.h"
namespace mediakit{
Sdp::Ptr Factory::getSdpByTrack(const Track::Ptr &track) { Sdp::Ptr Factory::getSdpByTrack(const Track::Ptr &track) {
switch (track->getCodecId()){ switch (track->getCodecId()){
case CodecH264:{ case CodecH264:{
@ -101,3 +103,5 @@ RtpCodec::Ptr Factory::getRtpDecoderById(CodecId codecId, uint32_t ui32SampleRat
} }
} }
}//namespace mediakit

View File

@ -10,7 +10,9 @@
#include "Rtsp/RtspSdp.h" #include "Rtsp/RtspSdp.h"
using namespace std; using namespace std;
using namespace ZL::Rtsp; using namespace toolkit;
namespace mediakit{
class Factory { class Factory {
public: public:
@ -53,5 +55,6 @@ public:
static RtpCodec::Ptr getRtpDecoderById(CodecId codecId, uint32_t ui32SampleRate); static RtpCodec::Ptr getRtpDecoderById(CodecId codecId, uint32_t ui32SampleRate);
}; };
}//namespace mediakit
#endif //ZLMEDIAKIT_FACTORY_H #endif //ZLMEDIAKIT_FACTORY_H

View File

@ -31,12 +31,9 @@
#include "Rtsp/Rtsp.h" #include "Rtsp/Rtsp.h"
#include "Network/sockutil.h" #include "Network/sockutil.h"
using namespace ZL::Util; using namespace toolkit;
using namespace ZL::Network;
using namespace ZL::MediaFile;
namespace ZL { namespace mediakit {
namespace Media {
recursive_mutex MediaSource::g_mtxMediaSrc; recursive_mutex MediaSource::g_mtxMediaSrc;
MediaSource::SchemaVhostAppStreamMap MediaSource::g_mapMediaSrc; MediaSource::SchemaVhostAppStreamMap MediaSource::g_mapMediaSrc;
@ -174,5 +171,4 @@ void MediaInfo::parse(const string &url){
} }
} /* namespace Media */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -40,11 +40,9 @@
#include "Rtsp/Rtsp.h" #include "Rtsp/Rtsp.h"
using namespace std; using namespace std;
using namespace Config; using namespace toolkit;
using namespace ZL::Util;
namespace ZL { namespace mediakit {
namespace Media {
class MediaSourceEvent class MediaSourceEvent
{ {
@ -234,8 +232,7 @@ private:
static recursive_mutex g_mtxMediaSrc; //访问静态的媒体源表的互斥锁 static recursive_mutex g_mtxMediaSrc; //访问静态的媒体源表的互斥锁
}; };
} /* namespace Media */ } /* namespace mediakit */
} /* namespace ZL */
#endif //ZLMEDIAKIT_MEDIASOURCE_H #endif //ZLMEDIAKIT_MEDIASOURCE_H

View File

@ -30,9 +30,9 @@
#include "Util/onceToken.h" #include "Util/onceToken.h"
#include "Network/sockutil.h" #include "Network/sockutil.h"
using namespace ZL::Network; using namespace toolkit;
namespace Config { namespace mediakit {
bool loadIniConfig(const char *ini_path){ bool loadIniConfig(const char *ini_path){
string ini; string ini;
@ -293,6 +293,6 @@ onceToken token([](){
} //namespace Hls } //namespace Hls
} // namespace Config } // namespace mediakit

View File

@ -34,9 +34,9 @@
#include "Util/NoticeCenter.h" #include "Util/NoticeCenter.h"
using namespace std; using namespace std;
using namespace ZL::Util; using namespace toolkit;
namespace Config { namespace mediakit {
//加载配置文件,如果配置文件不存在,那么会导出默认配置并生成配置文件 //加载配置文件,如果配置文件不存在,那么会导出默认配置并生成配置文件
//加载配置文件成功后会触发kBroadcastUpdateConfig广播 //加载配置文件成功后会触发kBroadcastUpdateConfig广播
@ -131,7 +131,7 @@ extern const char kBroadcastReloadConfig[];
#define RELOAD_KEY_REGISTER(arg,key) \ #define RELOAD_KEY_REGISTER(arg,key) \
do{ \ do{ \
static onceToken s_token([](){ \ static onceToken s_token([](){ \
NoticeCenter::Instance().addListener(ReloadConfigTag,Config::Broadcast::kBroadcastReloadConfig,[](BroadcastReloadConfigArgs){ \ NoticeCenter::Instance().addListener(ReloadConfigTag,Broadcast::kBroadcastReloadConfig,[](BroadcastReloadConfigArgs){ \
RELOAD_KEY(arg,key); \ RELOAD_KEY(arg,key); \
}); \ }); \
}); \ }); \
@ -234,6 +234,6 @@ extern const char kFileBufSize[];
extern const char kFilePath[]; extern const char kFilePath[];
} //namespace Hls } //namespace Hls
} // namespace Config } // namespace mediakit
#endif /* COMMON_CONFIG_H */ #endif /* COMMON_CONFIG_H */

View File

@ -31,10 +31,9 @@
#include "Util/base64.h" #include "Util/base64.h"
#include "Util/TimeTicker.h" #include "Util/TimeTicker.h"
using namespace ZL::Util; using namespace toolkit;
namespace ZL { namespace mediakit {
namespace DEV {
DevChannel::DevChannel(const char *strVhost, DevChannel::DevChannel(const char *strVhost,
const char *strApp, const char *strApp,
@ -107,7 +106,7 @@ void DevChannel::inputH264(const char* pcData, int iDataLen, uint32_t uiStamp) {
auto lam = [this](const RtpPacket::Ptr &pkt, bool bKeyPos) { auto lam = [this](const RtpPacket::Ptr &pkt, bool bKeyPos) {
onGetRTP(pkt,bKeyPos); onGetRTP(pkt,bKeyPos);
}; };
GET_CONFIG_AND_REGISTER(uint32_t,videoMtu,Config::Rtp::kVideoMtuSize); GET_CONFIG_AND_REGISTER(uint32_t,videoMtu,Rtp::kVideoMtuSize);
_pRtpMaker_h264.reset(new RtpMaker_H264(lam, ui32Ssrc,videoMtu)); _pRtpMaker_h264.reset(new RtpMaker_H264(lam, ui32Ssrc,videoMtu));
} }
if (!_bSdp_gotH264 && _video) { if (!_bSdp_gotH264 && _video) {
@ -139,7 +138,7 @@ void DevChannel::inputAAC(const char *pcDataWithoutAdts,int iDataLen, uint32_t u
auto lam = [this](const RtpPacket::Ptr &pkt, bool keyPos) { auto lam = [this](const RtpPacket::Ptr &pkt, bool keyPos) {
onGetRTP(pkt,keyPos); onGetRTP(pkt,keyPos);
}; };
GET_CONFIG_AND_REGISTER(uint32_t,audioMtu,Config::Rtp::kAudioMtuSize); GET_CONFIG_AND_REGISTER(uint32_t,audioMtu,Rtp::kAudioMtuSize);
_pRtpMaker_aac.reset(new RtpMaker_AAC(lam, ssrc, audioMtu,_audio->iSampleRate)); _pRtpMaker_aac.reset(new RtpMaker_AAC(lam, ssrc, audioMtu,_audio->iSampleRate));
} }
if (!_bSdp_gotAAC && _audio && pcAdtsHeader) { if (!_bSdp_gotAAC && _audio && pcAdtsHeader) {
@ -304,6 +303,5 @@ void DevChannel::initAudio(const AudioInfo& info) {
_pAdtsHeader->no_raw_data_blocks_in_frame = 0; _pAdtsHeader->no_raw_data_blocks_in_frame = 0;
} }
} /* namespace DEV */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -39,22 +39,18 @@
#include "Util/TimeTicker.h" #include "Util/TimeTicker.h"
using namespace std; using namespace std;
using namespace ZL::Rtsp; using namespace toolkit;
using namespace ZL::Util;
#ifdef ENABLE_FAAC #ifdef ENABLE_FAAC
#include "Codec/AACEncoder.h" #include "Codec/AACEncoder.h"
using namespace ZL::Codec;
#endif //ENABLE_FAAC #endif //ENABLE_FAAC
#ifdef ENABLE_X264 #ifdef ENABLE_X264
#include "Codec/H264Encoder.h" #include "Codec/H264Encoder.h"
using namespace ZL::Codec;
#endif //ENABLE_X264 #endif //ENABLE_X264
namespace ZL { namespace mediakit {
namespace DEV {
class VideoInfo { class VideoInfo {
public: public:
@ -124,7 +120,6 @@ private:
}; };
} /* namespace DEV */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* DEVICE_DEVICE_H_ */ #endif /* DEVICE_DEVICE_H_ */

View File

@ -0,0 +1,8 @@
//
// Created by xzl on 2018/10/24.
//
#include "MediaSourceMaker.h"
namespace mediakit{
}

View File

@ -0,0 +1,24 @@
//
// Created by xzl on 2018/10/24.
//
#ifndef ZLMEDIAKIT_MEDIASOURCEMAKER_H
#define ZLMEDIAKIT_MEDIASOURCEMAKER_H
#include "Player/Track.h"
#include "Rtsp/RtspMediaSource.h"
#include "Rtmp/RtmpMediaSource.h"
namespace mediakit {
class MediaSourceMaker {
public:
MediaSourceMaker() {}
virtual ~MediaSourceMaker() {}
private:
RtspMediaSource::Ptr _rtspSrc;
RtmpMediaSource::Ptr _rtmpSrc;
};
} //namespace mediakit
#endif //ZLMEDIAKIT_MEDIASOURCEMAKER_H

View File

@ -32,11 +32,9 @@
#include "Util/logger.h" #include "Util/logger.h"
#include "Thread/AsyncTaskThread.h" #include "Thread/AsyncTaskThread.h"
using namespace ZL::Util; using namespace toolkit;
using namespace ZL::Thread;
namespace ZL { namespace mediakit {
namespace DEV {
static uint8_t s_mute_adts[] = {0xff, 0xf1, 0x6c, 0x40, 0x2d, 0x3f, 0xfc, 0x00, 0xe0, 0x34, 0x20, 0xad, 0xf2, 0x3f, 0xb5, 0xdd, static uint8_t s_mute_adts[] = {0xff, 0xf1, 0x6c, 0x40, 0x2d, 0x3f, 0xfc, 0x00, 0xe0, 0x34, 0x20, 0xad, 0xf2, 0x3f, 0xb5, 0xdd,
0x73, 0xac, 0xbd, 0xca, 0xd7, 0x7d, 0x4a, 0x13, 0x2d, 0x2e, 0xa2, 0x62, 0x02, 0x70, 0x3c, 0x1c, 0x73, 0xac, 0xbd, 0xca, 0xd7, 0x7d, 0x4a, 0x13, 0x2d, 0x2e, 0xa2, 0x62, 0x02, 0x70, 0x3c, 0x1c,
@ -220,5 +218,4 @@ void PlayerProxy::makeMuteAudio(uint32_t stamp) {
} }
} /* namespace Player */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -33,10 +33,10 @@
#include "Util/TimeTicker.h" #include "Util/TimeTicker.h"
using namespace std; using namespace std;
using namespace ZL::Player; using namespace toolkit;
namespace ZL {
namespace DEV { namespace mediakit {
class PlayerProxy :public MediaPlayer, public std::enable_shared_from_this<PlayerProxy> , public MediaSourceEvent { class PlayerProxy :public MediaPlayer, public std::enable_shared_from_this<PlayerProxy> , public MediaSourceEvent {
public: public:
@ -71,7 +71,6 @@ private:
int _iAudioIndex = 0; int _iAudioIndex = 0;
}; };
} /* namespace Player */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_DEVICE_PLAYERPROXY_H_ */ #endif /* SRC_DEVICE_PLAYERPROXY_H_ */

View File

@ -26,8 +26,8 @@
#include "H264Parser.h" #include "H264Parser.h"
#include "Util/logger.h" #include "Util/logger.h"
using namespace toolkit;
using namespace ZL::Util;
H264Parser::H264Parser(){ H264Parser::H264Parser(){

View File

@ -7,8 +7,7 @@
#include <memory> #include <memory>
#include "macros.h" #include "macros.h"
#include "Util/logger.h" #include "Util/logger.h"
using namespace ZL::Util; using namespace toolkit;
template <class ForwardIterator> template <class ForwardIterator>
void STLDeleteContainerPairSecondPointers(ForwardIterator begin, void STLDeleteContainerPairSecondPointers(ForwardIterator begin,

View File

@ -8,8 +8,7 @@
#include "macros.h" #include "macros.h"
#include "h264_parser.h" #include "h264_parser.h"
#include "h264_poc.h" #include "h264_poc.h"
using namespace toolkit;
using namespace ZL::Util;
namespace media { namespace media {

View File

@ -88,7 +88,7 @@ static type& name = *new type arguments
#include <assert.h> #include <assert.h>
#include "Util/logger.h" #include "Util/logger.h"
using namespace ZL::Util; using namespace toolkit;
#define DCHECK(x) if(!(x)) { ErrorL << "DCHECK " << #x <<endl; } #define DCHECK(x) if(!(x)) { ErrorL << "DCHECK " << #x <<endl; }
#define DCHECK_GT(x,y) if(!((x) > (y))) { ErrorL << "DCHECK_GT:" << #x << #y << endl; } #define DCHECK_GT(x,y) if(!((x) > (y))) { ErrorL << "DCHECK_GT:" << #x << #y << endl; }

View File

@ -27,8 +27,7 @@
#include "HttpClient.h" #include "HttpClient.h"
#include "Rtsp/Rtsp.h" #include "Rtsp/Rtsp.h"
namespace ZL { namespace mediakit {
namespace Http {
HttpClient::HttpClient() { HttpClient::HttpClient() {
@ -272,6 +271,5 @@ void HttpClient::checkCookie(HttpClient::HttpHeader &headers) {
} }
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -38,11 +38,9 @@
#include "HttpCookie.h" #include "HttpCookie.h"
using namespace std; using namespace std;
using namespace ZL::Util; using namespace toolkit;
using namespace ZL::Network;
namespace ZL { namespace mediakit {
namespace Http {
class HttpArgs : public StrCaseMap { class HttpArgs : public StrCaseMap {
public: public:
@ -311,21 +309,6 @@ private:
float _fTimeOutSec = 0; float _fTimeOutSec = 0;
}; };
} /* namespace mediakit */
} /* namespace Http */
} /* namespace ZL */
#endif /* Http_HttpClient_h */ #endif /* Http_HttpClient_h */

View File

@ -24,10 +24,9 @@
* SOFTWARE. * SOFTWARE.
*/ */
#include <Http/HttpClientImp.h> #include "Http/HttpClientImp.h"
namespace ZL { namespace mediakit {
namespace Http {
HttpClientImp::HttpClientImp() { HttpClientImp::HttpClientImp() {
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
@ -87,5 +86,4 @@ int HttpClientImp::send(const Buffer::Ptr &buf) {
} }
#endif //ENABLE_OPENSSL #endif //ENABLE_OPENSSL
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -30,11 +30,11 @@
#include "HttpClient.h" #include "HttpClient.h"
#ifdef ENABLE_OPENSSL #ifdef ENABLE_OPENSSL
#include "Util/SSLBox.h" #include "Util/SSLBox.h"
using namespace ZL::Util;
#endif //ENABLE_OPENSSL #endif //ENABLE_OPENSSL
namespace ZL { using namespace toolkit;
namespace Http {
namespace mediakit {
class HttpClientImp: public HttpClient { class HttpClientImp: public HttpClient {
public: public:
@ -59,7 +59,6 @@ private:
#endif //ENABLE_OPENSSL #endif //ENABLE_OPENSSL
}; };
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_HTTP_HTTPCLIENTIMP_H_ */ #endif /* SRC_HTTP_HTTPCLIENTIMP_H_ */

View File

@ -26,10 +26,9 @@
#include "HttpCookie.h" #include "HttpCookie.h"
#include "Util/util.h" #include "Util/util.h"
using namespace ZL::Util; using namespace toolkit;
namespace ZL { namespace mediakit {
namespace Http {
void HttpCookie::setPath(const string &path){ void HttpCookie::setPath(const string &path){
_path = path; _path = path;
@ -104,5 +103,4 @@ vector<HttpCookie::Ptr> HttpCookieStorage::get(const string &host, const string
} }
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -34,8 +34,7 @@
#include <mutex> #include <mutex>
using namespace std; using namespace std;
namespace ZL { namespace mediakit {
namespace Http {
class HttpCookie { class HttpCookie {
public: public:
@ -75,7 +74,6 @@ private:
}; };
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */
#endif //ZLMEDIAKIT_HTTPCOOKIE_H #endif //ZLMEDIAKIT_HTTPCOOKIE_H

View File

@ -27,11 +27,9 @@
#include "HttpDownloader.h" #include "HttpDownloader.h"
#include "Util/MD5.h" #include "Util/MD5.h"
#include "Util/File.h" #include "Util/File.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit {
namespace ZL {
namespace Http {
HttpDownloader::HttpDownloader() { HttpDownloader::HttpDownloader() {
@ -115,5 +113,4 @@ void HttpDownloader::closeFile() {
} }
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -29,8 +29,7 @@
#include "HttpClientImp.h" #include "HttpClientImp.h"
namespace ZL { namespace mediakit {
namespace Http {
class HttpDownloader: public HttpClientImp { class HttpDownloader: public HttpClientImp {
public: public:
@ -60,7 +59,6 @@ private:
bool _bDownloadSuccess = false; bool _bDownloadSuccess = false;
}; };
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_HTTP_HTTPDOWNLOADER_H_ */ #endif /* SRC_HTTP_HTTPDOWNLOADER_H_ */

View File

@ -28,10 +28,9 @@
#include "HttpRequestSplitter.h" #include "HttpRequestSplitter.h"
#include "Util/logger.h" #include "Util/logger.h"
#include "Util/util.h" #include "Util/util.h"
using namespace ZL::Util; using namespace toolkit;
namespace ZL { namespace mediakit {
namespace Http {
void HttpRequestSplitter::input(const char *data,uint64_t len) { void HttpRequestSplitter::input(const char *data,uint64_t len) {
const char *ptr = data; const char *ptr = data;
@ -126,6 +125,5 @@ void HttpRequestSplitter::reset() {
} }
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -30,8 +30,7 @@
#include <string> #include <string>
using namespace std; using namespace std;
namespace ZL { namespace mediakit {
namespace Http {
class HttpRequestSplitter { class HttpRequestSplitter {
public: public:
@ -79,7 +78,6 @@ private:
int64_t _content_len = 0; int64_t _content_len = 0;
}; };
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */
#endif //ZLMEDIAKIT_HTTPREQUESTSPLITTER_H #endif //ZLMEDIAKIT_HTTPREQUESTSPLITTER_H

View File

@ -25,8 +25,7 @@
*/ */
#include "HttpRequester.h" #include "HttpRequester.h"
namespace ZL{ namespace mediakit{
namespace Http{
HttpRequester::HttpRequester(){ HttpRequester::HttpRequester(){
@ -63,6 +62,4 @@ void HttpRequester::startRequester(const string &url,const HttpRequesterResult &
} }
}//namespace mediakit
}//namespace Http
}//namespace ZL

View File

@ -29,9 +29,8 @@
#include "HttpClientImp.h" #include "HttpClientImp.h"
namespace ZL{ namespace mediakit{
namespace Http{
class HttpRequester : public HttpClientImp class HttpRequester : public HttpClientImp
{ {
public: public:
@ -50,7 +49,6 @@ private:
HttpRequesterResult _onResult; HttpRequesterResult _onResult;
}; };
}//namespace Http }//namespace mediakit
}//namespace ZL
#endif /* Htt_HttpRequester_h */ #endif /* Htt_HttpRequester_h */

View File

@ -43,11 +43,9 @@
#include "Util/base64.h" #include "Util/base64.h"
#include "Util/SHA1.h" #include "Util/SHA1.h"
#include "Rtmp/utils.h" #include "Rtmp/utils.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit {
namespace ZL {
namespace Http {
static int kSockFlags = SOCKET_DEFAULE_FLAGS | FLAG_MORE; static int kSockFlags = SOCKET_DEFAULE_FLAGS | FLAG_MORE;
@ -109,7 +107,7 @@ HttpSession::HttpSession(const std::shared_ptr<ThreadPool> &pTh, const Socket::P
//设置15秒发送超时时间 //设置15秒发送超时时间
pSock->setSendTimeOutSecond(15); pSock->setSendTimeOutSecond(15);
GET_CONFIG_AND_REGISTER(string,rootPath,Config::Http::kRootPath); GET_CONFIG_AND_REGISTER(string,rootPath,Http::kRootPath);
_strPath = rootPath; _strPath = rootPath;
} }
@ -178,7 +176,7 @@ void HttpSession::onError(const SockException& err) {
} }
void HttpSession::onManager() { void HttpSession::onManager() {
GET_CONFIG_AND_REGISTER(uint32_t,keepAliveSec,Config::Http::kKeepAliveSecond); GET_CONFIG_AND_REGISTER(uint32_t,keepAliveSec,Http::kKeepAliveSecond);
if(_ticker.elapsedTime() > keepAliveSec * 1000){ if(_ticker.elapsedTime() > keepAliveSec * 1000){
//1分钟超时 //1分钟超时
@ -298,7 +296,7 @@ inline bool HttpSession::Handle_Req_GET(int64_t &content_len) {
string strFile = _strPath + "/" + _mediaInfo._vhost + _parser.Url(); string strFile = _strPath + "/" + _mediaInfo._vhost + _parser.Url();
/////////////HTTP连接是否需要被关闭//////////////// /////////////HTTP连接是否需要被关闭////////////////
GET_CONFIG_AND_REGISTER(uint32_t,reqCnt,Config::Http::kMaxReqCount); GET_CONFIG_AND_REGISTER(uint32_t,reqCnt,Http::kMaxReqCount);
bool bClose = (strcasecmp(_parser["Connection"].data(),"close") == 0) || ( ++_iReqCnt > reqCnt); bool bClose = (strcasecmp(_parser["Connection"].data(),"close") == 0) || ( ++_iReqCnt > reqCnt);
//访问的是文件夹 //访问的是文件夹
@ -369,7 +367,7 @@ inline bool HttpSession::Handle_Req_GET(int64_t &content_len) {
//回复Content部分 //回复Content部分
std::shared_ptr<int64_t> piLeft(new int64_t(iRangeEnd - iRangeStart + 1)); std::shared_ptr<int64_t> piLeft(new int64_t(iRangeEnd - iRangeStart + 1));
GET_CONFIG_AND_REGISTER(uint32_t,sendBufSize,Config::Http::kSendBufSize); GET_CONFIG_AND_REGISTER(uint32_t,sendBufSize,Http::kSendBufSize);
weak_ptr<HttpSession> weakSelf = dynamic_pointer_cast<HttpSession>(shared_from_this()); weak_ptr<HttpSession> weakSelf = dynamic_pointer_cast<HttpSession>(shared_from_this());
auto onFlush = [pFilePtr,bClose,weakSelf,piLeft]() { auto onFlush = [pFilePtr,bClose,weakSelf,piLeft]() {
@ -529,9 +527,9 @@ inline void HttpSession::sendResponse(const char* pcStatus, const KeyValue& head
} }
inline HttpSession::KeyValue HttpSession::makeHttpHeader(bool bClose, int64_t iContentSize,const char* pcContentType) { inline HttpSession::KeyValue HttpSession::makeHttpHeader(bool bClose, int64_t iContentSize,const char* pcContentType) {
KeyValue headerOut; KeyValue headerOut;
GET_CONFIG_AND_REGISTER(string,charSet,Config::Http::kCharSet); GET_CONFIG_AND_REGISTER(string,charSet,Http::kCharSet);
GET_CONFIG_AND_REGISTER(uint32_t,keepAliveSec,Config::Http::kKeepAliveSecond); GET_CONFIG_AND_REGISTER(uint32_t,keepAliveSec,Http::kKeepAliveSecond);
GET_CONFIG_AND_REGISTER(uint32_t,reqCnt,Config::Http::kMaxReqCount); GET_CONFIG_AND_REGISTER(uint32_t,reqCnt,Http::kMaxReqCount);
headerOut.emplace("Date", dateStr()); headerOut.emplace("Date", dateStr());
headerOut.emplace("Server", SERVER_NAME); headerOut.emplace("Server", SERVER_NAME);
@ -552,7 +550,7 @@ inline HttpSession::KeyValue HttpSession::makeHttpHeader(bool bClose, int64_t iC
string HttpSession::urlDecode(const string &str){ string HttpSession::urlDecode(const string &str){
auto ret = strCoding::UrlUTF8Decode(str); auto ret = strCoding::UrlUTF8Decode(str);
#ifdef _WIN32 #ifdef _WIN32
GET_CONFIG_AND_REGISTER(string,charSet,Config::Http::kCharSet); GET_CONFIG_AND_REGISTER(string,charSet,Http::kCharSet);
bool isGb2312 = !strcasecmp(charSet.data(), "gb2312"); bool isGb2312 = !strcasecmp(charSet.data(), "gb2312");
if (isGb2312) { if (isGb2312) {
ret = strCoding::UTF8ToGB2312(ret); ret = strCoding::UTF8ToGB2312(ret);
@ -570,7 +568,7 @@ inline void HttpSession::urlDecode(Parser &parser){
inline bool HttpSession::emitHttpEvent(bool doInvoke){ inline bool HttpSession::emitHttpEvent(bool doInvoke){
///////////////////是否断开本链接/////////////////////// ///////////////////是否断开本链接///////////////////////
GET_CONFIG_AND_REGISTER(uint32_t,reqCnt,Config::Http::kMaxReqCount); GET_CONFIG_AND_REGISTER(uint32_t,reqCnt,Http::kMaxReqCount);
bool bClose = (strcasecmp(_parser["Connection"].data(),"close") == 0) || ( ++_iReqCnt > reqCnt); bool bClose = (strcasecmp(_parser["Connection"].data(),"close") == 0) || ( ++_iReqCnt > reqCnt);
auto Origin = _parser["Origin"]; auto Origin = _parser["Origin"];
@ -594,7 +592,7 @@ inline bool HttpSession::emitHttpEvent(bool doInvoke){
}; };
///////////////////广播HTTP事件/////////////////////////// ///////////////////广播HTTP事件///////////////////////////
bool consumed = false;//该事件是否被消费 bool consumed = false;//该事件是否被消费
NoticeCenter::Instance().emitEvent(Config::Broadcast::kBroadcastHttpRequest,_parser,invoker,consumed,*this); NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastHttpRequest,_parser,invoker,consumed,*this);
if(!consumed && doInvoke){ if(!consumed && doInvoke){
//该事件无人消费所以返回404 //该事件无人消费所以返回404
invoker("404 Not Found",KeyValue(),""); invoker("404 Not Found",KeyValue(),"");
@ -606,8 +604,8 @@ inline bool HttpSession::emitHttpEvent(bool doInvoke){
return consumed; return consumed;
} }
inline bool HttpSession::Handle_Req_POST(int64_t &content_len) { inline bool HttpSession::Handle_Req_POST(int64_t &content_len) {
GET_CONFIG_AND_REGISTER(uint64_t,maxReqSize,Config::Http::kMaxReqSize); GET_CONFIG_AND_REGISTER(uint64_t,maxReqSize,Http::kMaxReqSize);
GET_CONFIG_AND_REGISTER(int,maxReqCnt,Config::Http::kMaxReqCount); GET_CONFIG_AND_REGISTER(int,maxReqCnt,Http::kMaxReqCount);
int64_t totalContentLen = _parser["Content-Length"].empty() ? -1 : atoll(_parser["Content-Length"].data()); int64_t totalContentLen = _parser["Content-Length"].empty() ? -1 : atoll(_parser["Content-Length"].data());
@ -686,7 +684,7 @@ void HttpSession::responseDelay(const string &Origin,bool bClose,
sendResponse(codeOut.data(), headerOut, contentOut); sendResponse(codeOut.data(), headerOut, contentOut);
} }
inline void HttpSession::sendNotFound(bool bClose) { inline void HttpSession::sendNotFound(bool bClose) {
GET_CONFIG_AND_REGISTER(string,notFound,Config::Http::kNotFound); GET_CONFIG_AND_REGISTER(string,notFound,Http::kNotFound);
sendResponse("404 Not Found", makeHttpHeader(bClose, notFound.size()), notFound); sendResponse("404 Not Found", makeHttpHeader(bClose, notFound.size()), notFound);
} }
@ -728,5 +726,4 @@ std::shared_ptr<FlvMuxer> HttpSession::getSharedPtr(){
return dynamic_pointer_cast<FlvMuxer>(shared_from_this()); return dynamic_pointer_cast<FlvMuxer>(shared_from_this());
} }
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -37,11 +37,9 @@
#include "WebSocketSplitter.h" #include "WebSocketSplitter.h"
using namespace std; using namespace std;
using namespace ZL::Rtmp; using namespace toolkit;
using namespace ZL::Network;
namespace ZL { namespace mediakit {
namespace Http {
class HttpSession: public TcpSession, class HttpSession: public TcpSession,
public FlvMuxer, public FlvMuxer,
@ -128,7 +126,6 @@ private:
}; };
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_HTTP_HTTPSESSION_H_ */ #endif /* SRC_HTTP_HTTPSESSION_H_ */

View File

@ -31,10 +31,9 @@
#include "Util/SSLBox.h" #include "Util/SSLBox.h"
#include "Util/TimeTicker.h" #include "Util/TimeTicker.h"
using namespace ZL::Util; using namespace toolkit;
namespace ZL { namespace mediakit {
namespace Http {
class HttpsSession: public HttpSession { class HttpsSession: public HttpSession {
public: public:
@ -284,7 +283,6 @@ typedef WebSocketSession<EchoSession,HttpSession> EchoWebSocketSession;
typedef WebSocketSession<EchoSession,HttpsSession> SSLEchoWebSocketSession; typedef WebSocketSession<EchoSession,HttpsSession> SSLEchoWebSocketSession;
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_HTTP_HTTPSSESSION_H_ */ #endif /* SRC_HTTP_HTTPSSESSION_H_ */

View File

@ -30,11 +30,9 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include "Util/logger.h" #include "Util/logger.h"
#include "Util/util.h" #include "Util/util.h"
using namespace ZL::Util; using namespace toolkit;
namespace mediakit {
namespace ZL {
namespace Http {
/** /**
* *
@ -210,27 +208,7 @@ void WebSocketSplitter::encode(const WebSocketHeader &header,uint8_t *data, cons
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -34,8 +34,7 @@
using namespace std; using namespace std;
namespace ZL { namespace mediakit {
namespace Http {
class WebSocketHeader { class WebSocketHeader {
public: public:
@ -130,8 +129,7 @@ private:
uint64_t _playload_offset = 0; uint64_t _playload_offset = 0;
}; };
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */
#endif //ZLMEDIAKIT_WEBSOCKETSPLITTER_H #endif //ZLMEDIAKIT_WEBSOCKETSPLITTER_H

View File

@ -31,8 +31,7 @@
#include <windows.h> #include <windows.h>
#endif//defined(_WIN32) #endif//defined(_WIN32)
namespace ZL { namespace mediakit {
namespace Http {
//////////////////////////通用/////////////////////// //////////////////////////通用///////////////////////
void UTF8ToUnicode(wchar_t* pOut, const char *pText) void UTF8ToUnicode(wchar_t* pOut, const char *pText)
@ -239,5 +238,4 @@ string strCoding::GB2312ToUTF8(const string &str) {
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -32,8 +32,7 @@
using namespace std; using namespace std;
namespace ZL { namespace mediakit {
namespace Http {
class strCoding { class strCoding {
public: public:
@ -51,7 +50,6 @@ private:
virtual ~strCoding(void); virtual ~strCoding(void);
}; };
} /* namespace Http */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_HTTP_STRCODING_H_ */ #endif /* SRC_HTTP_STRCODING_H_ */

View File

@ -27,11 +27,9 @@
#include "HLSMaker.h" #include "HLSMaker.h"
#include "Util/File.h" #include "Util/File.h"
#include "Util/uv_errno.h" #include "Util/uv_errno.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit {
namespace ZL {
namespace MediaFile {
HLSMaker::HLSMaker(const string& strM3u8File, HLSMaker::HLSMaker(const string& strM3u8File,
uint32_t ui32BufSize, uint32_t ui32BufSize,
@ -184,6 +182,5 @@ bool HLSMaker::removets() {
return true; return true;
} }
} /* namespace MediaFile */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -34,11 +34,9 @@
#include "Util/util.h" #include "Util/util.h"
#include "Util/logger.h" #include "Util/logger.h"
#include <deque> #include <deque>
using namespace toolkit;
using namespace ZL::Util; namespace mediakit {
namespace ZL {
namespace MediaFile {
class HLSMaker { class HLSMaker {
public: public:
@ -75,7 +73,6 @@ private:
bool removets(); bool removets();
}; };
} /* namespace MediaFile */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* HLSMAKER_H_ */ #endif /* HLSMAKER_H_ */

View File

@ -28,16 +28,13 @@
#include "Common/config.h" #include "Common/config.h"
#include "Util/mini.h" #include "Util/mini.h"
#include "Http/HttpSession.h" #include "Http/HttpSession.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit {
namespace ZL {
namespace MediaFile {
#ifdef ENABLE_MP4V2 #ifdef ENABLE_MP4V2
MediaReader::MediaReader(const string &strVhost,const string &strApp, const string &strId) { MediaReader::MediaReader(const string &strVhost,const string &strApp, const string &strId) {
GET_CONFIG_AND_REGISTER(string,recordPath,Config::Record::kFilePath); GET_CONFIG_AND_REGISTER(string,recordPath,Record::kFilePath);
auto strFileName = recordPath + "/" + strVhost + "/" + strApp + "/" + strId; auto strFileName = recordPath + "/" + strVhost + "/" + strApp + "/" + strId;
@ -169,7 +166,7 @@ MediaReader::~MediaReader() {
void MediaReader::startReadMP4() { void MediaReader::startReadMP4() {
auto strongSelf = shared_from_this(); auto strongSelf = shared_from_this();
GET_CONFIG_AND_REGISTER(uint32_t,sampleMS,Config::Record::kSampleMS); GET_CONFIG_AND_REGISTER(uint32_t,sampleMS,Record::kSampleMS);
AsyncTaskThread::Instance().DoTaskDelay(reinterpret_cast<uint64_t>(this), sampleMS, [strongSelf](){ AsyncTaskThread::Instance().DoTaskDelay(reinterpret_cast<uint64_t>(this), sampleMS, [strongSelf](){
return strongSelf->readSample(); return strongSelf->readSample();
@ -323,7 +320,7 @@ void MediaReader::seek(int iSeekTime,bool bReStart){
MediaSource::Ptr MediaReader::onMakeMediaSource(const string &strSchema,const string &strVhost,const string &strApp, const string &strId){ MediaSource::Ptr MediaReader::onMakeMediaSource(const string &strSchema,const string &strVhost,const string &strApp, const string &strId){
#ifdef ENABLE_MP4V2 #ifdef ENABLE_MP4V2
GET_CONFIG_AND_REGISTER(string,appName,Config::Record::kAppName); GET_CONFIG_AND_REGISTER(string,appName,Record::kAppName);
if (strApp != appName) { if (strApp != appName) {
return nullptr; return nullptr;
@ -343,5 +340,4 @@ MediaSource::Ptr MediaReader::onMakeMediaSource(const string &strSchema,const st
} /* namespace MediaFile */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -34,13 +34,9 @@
#ifdef ENABLE_MP4V2 #ifdef ENABLE_MP4V2
#include <mp4v2/mp4v2.h> #include <mp4v2/mp4v2.h>
#endif //ENABLE_MP4V2 #endif //ENABLE_MP4V2
using namespace toolkit;
using namespace ZL::DEV; namespace mediakit {
using namespace ZL::Rtsp;
using namespace ZL::Rtmp;
namespace ZL {
namespace MediaFile {
class MediaReader : public std::enable_shared_from_this<MediaReader> ,public MediaSourceEvent{ class MediaReader : public std::enable_shared_from_this<MediaReader> ,public MediaSourceEvent{
public: public:
@ -103,7 +99,6 @@ private:
#endif //ENABLE_MP4V2 #endif //ENABLE_MP4V2
}; };
} /* namespace MediaFile */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_MEDIAFILE_MEDIAREADER_H_ */ #endif /* SRC_MEDIAFILE_MEDIAREADER_H_ */

View File

@ -30,12 +30,9 @@
#include "Util/util.h" #include "Util/util.h"
#include "Util/mini.h" #include "Util/mini.h"
#include "Network/sockutil.h" #include "Network/sockutil.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit {
using namespace ZL::Network;
namespace ZL {
namespace MediaFile {
MediaRecorder::MediaRecorder(const string &strVhost_tmp, MediaRecorder::MediaRecorder(const string &strVhost_tmp,
const string &strApp, const string &strApp,
@ -44,10 +41,10 @@ MediaRecorder::MediaRecorder(const string &strVhost_tmp,
bool enableHls, bool enableHls,
bool enableMp4) { bool enableMp4) {
GET_CONFIG_AND_REGISTER(string,hlsPath,Config::Hls::kFilePath); GET_CONFIG_AND_REGISTER(string,hlsPath,Hls::kFilePath);
GET_CONFIG_AND_REGISTER(uint32_t,hlsBufSize,Config::Hls::kFileBufSize); GET_CONFIG_AND_REGISTER(uint32_t,hlsBufSize,Hls::kFileBufSize);
GET_CONFIG_AND_REGISTER(uint32_t,hlsDuration,Config::Hls::kSegmentDuration); GET_CONFIG_AND_REGISTER(uint32_t,hlsDuration,Hls::kSegmentDuration);
GET_CONFIG_AND_REGISTER(uint32_t,hlsNum,Config::Hls::kSegmentNum); GET_CONFIG_AND_REGISTER(uint32_t,hlsNum,Hls::kSegmentNum);
string strVhost = strVhost_tmp; string strVhost = strVhost_tmp;
if(trim(strVhost).empty()){ if(trim(strVhost).empty()){
@ -61,8 +58,8 @@ MediaRecorder::MediaRecorder(const string &strVhost_tmp,
} }
#ifdef ENABLE_MP4V2 #ifdef ENABLE_MP4V2
GET_CONFIG_AND_REGISTER(string,recordPath,Config::Record::kFilePath); GET_CONFIG_AND_REGISTER(string,recordPath,Record::kFilePath);
GET_CONFIG_AND_REGISTER(string,recordAppName,Config::Record::kAppName); GET_CONFIG_AND_REGISTER(string,recordAppName,Record::kAppName);
if(enableMp4){ if(enableMp4){
auto mp4FilePath = recordPath + "/" + strVhost + "/" + recordAppName + "/" + strApp + "/" + strId + "/"; auto mp4FilePath = recordPath + "/" + strVhost + "/" + recordAppName + "/" + strApp + "/" + strId + "/";
@ -96,5 +93,4 @@ void MediaRecorder::inputAAC(void* pData, uint32_t ui32Length, uint32_t ui32Time
#endif //ENABLE_MP4V2 #endif //ENABLE_MP4V2
} }
} /* namespace MediaFile */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -35,13 +35,9 @@
#endif //ENABLE_MP4V2 #endif //ENABLE_MP4V2
#include "HLSMaker.h" #include "HLSMaker.h"
using namespace toolkit;
using namespace std; namespace mediakit {
using namespace ZL::Player;
namespace ZL {
namespace MediaFile {
class MediaRecorder { class MediaRecorder {
public: public:
@ -70,7 +66,6 @@ private:
}; };
} /* namespace MediaFile */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_MEDIAFILE_MEDIARECORDER_H_ */ #endif /* SRC_MEDIAFILE_MEDIARECORDER_H_ */

View File

@ -34,11 +34,9 @@
#include "Util/mini.h" #include "Util/mini.h"
#include "Util/util.h" #include "Util/util.h"
#include "Util/NoticeCenter.h" #include "Util/NoticeCenter.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit {
namespace ZL {
namespace MediaFile {
string timeStr(const char *fmt) { string timeStr(const char *fmt) {
std::tm tm_snapshot; std::tm tm_snapshot;
@ -116,7 +114,7 @@ void Mp4Maker::inputAAC(void *pData, uint32_t ui32Length, uint32_t ui32TimeStamp
} }
void Mp4Maker::_inputH264(void* pData, uint32_t ui32Length, uint32_t ui32Duration, int iType) { void Mp4Maker::_inputH264(void* pData, uint32_t ui32Length, uint32_t ui32Duration, int iType) {
GET_CONFIG_AND_REGISTER(uint32_t,recordSec,Config::Record::kFileSecond); GET_CONFIG_AND_REGISTER(uint32_t,recordSec,Record::kFileSecond);
if(iType == 5 && (_hMp4 == MP4_INVALID_FILE_HANDLE || _ticker.elapsedTime() > recordSec * 1000)){ if(iType == 5 && (_hMp4 == MP4_INVALID_FILE_HANDLE || _ticker.elapsedTime() > recordSec * 1000)){
//在I帧率处新建MP4文件 //在I帧率处新建MP4文件
@ -129,7 +127,7 @@ void Mp4Maker::_inputH264(void* pData, uint32_t ui32Length, uint32_t ui32Duratio
} }
void Mp4Maker::_inputAAC(void* pData, uint32_t ui32Length, uint32_t ui32Duration) { void Mp4Maker::_inputAAC(void* pData, uint32_t ui32Length, uint32_t ui32Duration) {
GET_CONFIG_AND_REGISTER(uint32_t,recordSec,Config::Record::kFileSecond); GET_CONFIG_AND_REGISTER(uint32_t,recordSec,Record::kFileSecond);
//todo(xzl) 修复此处 //todo(xzl) 修复此处
@ -161,7 +159,7 @@ void Mp4Maker::createFile() {
_info.strFileName = strTime + ".mp4"; _info.strFileName = strTime + ".mp4";
_info.strFilePath = strFile; _info.strFilePath = strFile;
GET_CONFIG_AND_REGISTER(string,appName,Config::Record::kAppName); GET_CONFIG_AND_REGISTER(string,appName,Record::kAppName);
_info.strUrl = _info.strVhost + "/" _info.strUrl = _info.strVhost + "/"
+ appName + "/" + appName + "/"
@ -230,12 +228,11 @@ void Mp4Maker::closeFile() {
stat(_strFile.data(), &fileData); stat(_strFile.data(), &fileData);
_info.ui64FileSize = fileData.st_size; _info.ui64FileSize = fileData.st_size;
//----record 业务逻辑----// //----record 业务逻辑----//
NoticeCenter::Instance().emitEvent(Config::Broadcast::kBroadcastRecordMP4,_info,*this); NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastRecordMP4,_info,*this);
} }
} }
} /* namespace MediaFile */ } /* namespace mediakit */
} /* namespace ZL */
#endif //ENABLE_MP4V2 #endif //ENABLE_MP4V2

View File

@ -37,13 +37,9 @@
#include "Util/logger.h" #include "Util/logger.h"
#include "Util/TimeTicker.h" #include "Util/TimeTicker.h"
#include "Util/TimeTicker.h" #include "Util/TimeTicker.h"
using namespace toolkit;
using namespace std; namespace mediakit {
using namespace ZL::Util;
using namespace ZL::Player;
namespace ZL {
namespace MediaFile {
class Mp4Info class Mp4Info
{ {
@ -98,8 +94,7 @@ private:
Mp4Info _info; Mp4Info _info;
}; };
} /* namespace MediaFile */ } /* namespace mediakit */
} /* namespace ZL */
#endif ///ENABLE_MP4V2 #endif ///ENABLE_MP4V2

View File

@ -26,8 +26,7 @@
#include "TSMaker.h" #include "TSMaker.h"
#include "Util/logger.h" #include "Util/logger.h"
using namespace toolkit;
using namespace ZL::Util;
TSMaker::TSMaker() { TSMaker::TSMaker() {
m_pOutVideoTs = NULL; m_pOutVideoTs = NULL;

View File

@ -34,9 +34,8 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
#include "Util/File.h" #include "Util/File.h"
using namespace std; using namespace std;
using namespace ZL::Util; using namespace toolkit;
#define TS_PACKET_SIZE 188 #define TS_PACKET_SIZE 188
#define TS_PACKET_HEADER 4 #define TS_PACKET_HEADER 4

View File

@ -3,3 +3,7 @@
// //
#include "Frame.h" #include "Frame.h"
namespace mediakit{
}

View File

@ -7,9 +7,9 @@
#include "Util/RingBuffer.h" #include "Util/RingBuffer.h"
#include "Network/Socket.h" #include "Network/Socket.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit{
using namespace ZL::Network;
typedef enum { typedef enum {
CodecInvalid = -1, CodecInvalid = -1,
@ -290,6 +290,6 @@ public:
} ; } ;
}//namespace mediakit
#endif //ZLMEDIAKIT_FRAME_H #endif //ZLMEDIAKIT_FRAME_H

View File

@ -28,12 +28,9 @@
#include "MediaPlayer.h" #include "MediaPlayer.h"
#include "Rtmp/RtmpPlayerImp.h" #include "Rtmp/RtmpPlayerImp.h"
#include "Rtsp/RtspPlayerImp.h" #include "Rtsp/RtspPlayerImp.h"
using namespace toolkit;
using namespace ZL::Rtmp; namespace mediakit {
using namespace ZL::Rtsp;
namespace ZL {
namespace Player {
MediaPlayer::MediaPlayer() { MediaPlayer::MediaPlayer() {
} }
@ -78,5 +75,4 @@ void MediaPlayer::teardown() {
} }
} /* namespace Player */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -34,14 +34,9 @@
#include "Rtsp/RtspPlayer.h" #include "Rtsp/RtspPlayer.h"
#include "Rtmp/RtmpPlayer.h" #include "Rtmp/RtmpPlayer.h"
#include "Thread/TaskExecutor.h" #include "Thread/TaskExecutor.h"
using namespace toolkit;
using namespace std; namespace mediakit {
using namespace ZL::Rtsp;
using namespace ZL::Rtmp;
using namespace ZL::Thread;
namespace ZL {
namespace Player {
class MediaPlayer : public PlayerImp<PlayerBase,PlayerBase> { class MediaPlayer : public PlayerImp<PlayerBase,PlayerBase> {
public: public:
@ -58,7 +53,6 @@ private:
}; };
} /* namespace Player */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_PLAYER_MEDIAPLAYER_H_ */ #endif /* SRC_PLAYER_MEDIAPLAYER_H_ */

View File

@ -28,9 +28,7 @@
#include "Player.h" #include "Player.h"
#include "H264/SPSParser.h" #include "H264/SPSParser.h"
#include "Util/logger.h" #include "Util/logger.h"
using namespace toolkit;
using namespace ZL::Util;
void writeAdtsHeader(const AACFrame &hed, uint8_t *pcAdts) { void writeAdtsHeader(const AACFrame &hed, uint8_t *pcAdts) {
pcAdts[0] = (hed.syncword >> 4 & 0xFF); //8bit pcAdts[0] = (hed.syncword >> 4 & 0xFF); //8bit

View File

@ -31,6 +31,7 @@
#include "Frame.h" #include "Frame.h"
using namespace std; using namespace std;
using namespace mediakit;
unsigned const samplingFrequencyTable[16] = { 96000, 88200, unsigned const samplingFrequencyTable[16] = { 96000, 88200,
64000, 48000, 64000, 48000,

View File

@ -29,13 +29,9 @@
#include "Rtsp/Rtsp.h" #include "Rtsp/Rtsp.h"
#include "Rtsp/RtspPlayerImp.h" #include "Rtsp/RtspPlayerImp.h"
#include "Rtmp/RtmpPlayerImp.h" #include "Rtmp/RtmpPlayerImp.h"
using namespace toolkit;
using namespace std; namespace mediakit {
using namespace ZL::Rtmp;
using namespace ZL::Rtsp;
namespace ZL {
namespace Player {
const char PlayerBase::kNetAdapter[] = "net_adapter"; const char PlayerBase::kNetAdapter[] = "net_adapter";
const char PlayerBase::kRtpType[] = "rtp_type"; const char PlayerBase::kRtpType[] = "rtp_type";
@ -55,5 +51,4 @@ PlayerBase::Ptr PlayerBase::createPlayer(const char* strUrl) {
return PlayerBase::Ptr(new RtspPlayerImp()); return PlayerBase::Ptr(new RtspPlayerImp());
} }
} /* namespace Player */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -38,14 +38,9 @@
#include "Common/MediaSource.h" #include "Common/MediaSource.h"
#include "Frame.h" #include "Frame.h"
#include "Track.h" #include "Track.h"
using namespace toolkit;
using namespace std; namespace mediakit {
using namespace ZL::Util;
using namespace ZL::Media;
using namespace ZL::Network;
namespace ZL {
namespace Player {
class PlayerBase : public mINI{ class PlayerBase : public mINI{
public: public:
@ -170,7 +165,6 @@ protected:
MediaSource::Ptr _pMediaSrc; MediaSource::Ptr _pMediaSrc;
}; };
} /* namespace Player */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_PLAYER_PLAYERBASE_H_ */ #endif /* SRC_PLAYER_PLAYERBASE_H_ */

View File

@ -11,9 +11,9 @@
#include "Util/RingBuffer.h" #include "Util/RingBuffer.h"
#include "Rtsp/Rtsp.h" #include "Rtsp/Rtsp.h"
#include "Player.h" #include "Player.h"
using namespace toolkit;
using namespace std; namespace mediakit{
using namespace ZL::Util;
class Track : public FrameRing , public CodecInfo{ class Track : public FrameRing , public CodecInfo{
public: public:
@ -324,5 +324,6 @@ private:
int _channel = 0; int _channel = 0;
}; };
}//namespace mediakit
#endif //ZLMEDIAKIT_TRACK_H #endif //ZLMEDIAKIT_TRACK_H

View File

@ -8,8 +8,7 @@
#define FILE_BUF_SIZE (64 * 1024) #define FILE_BUF_SIZE (64 * 1024)
namespace ZL { namespace mediakit {
namespace Rtmp {
FlvMuxer::FlvMuxer() { FlvMuxer::FlvMuxer() {
@ -227,5 +226,4 @@ FlvRecorder::~FlvRecorder() {
} }
}//namespace Rtmp }//namespace mediakit
}//namespace ZL

View File

@ -8,11 +8,9 @@
#include "Rtmp.h" #include "Rtmp.h"
#include "RtmpMediaSource.h" #include "RtmpMediaSource.h"
#include "Network/Socket.h" #include "Network/Socket.h"
using namespace toolkit;
using namespace ZL::Network; namespace mediakit {
namespace ZL {
namespace Rtmp {
class FlvMuxer{ class FlvMuxer{
public: public:
@ -55,7 +53,6 @@ private:
}; };
}//namespace Rtmp }//namespace mediakit
}//namespace ZL
#endif //ZLMEDIAKIT_FLVRECORDER_H #endif //ZLMEDIAKIT_FLVRECORDER_H

View File

@ -31,10 +31,7 @@
#include "Util/util.h" #include "Util/util.h"
#include "Util/logger.h" #include "Util/logger.h"
#include "Network/sockutil.h" #include "Network/sockutil.h"
using namespace toolkit;
using namespace std;
using namespace ZL::Util;
using namespace ZL::Network;
#define PORT 1935 #define PORT 1935
#define DEFAULT_CHUNK_LEN 128 #define DEFAULT_CHUNK_LEN 128

View File

@ -44,14 +44,9 @@
#include "Util/ResourcePool.h" #include "Util/ResourcePool.h"
#include "Util/NoticeCenter.h" #include "Util/NoticeCenter.h"
#include "Thread/ThreadPool.h" #include "Thread/ThreadPool.h"
using namespace toolkit;
using namespace std; namespace mediakit {
using namespace ZL::Util;
using namespace ZL::Thread;
using namespace ZL::Media;
namespace ZL {
namespace Rtmp {
class RtmpMediaSource: public MediaSource { class RtmpMediaSource: public MediaSource {
public: public:
@ -122,7 +117,6 @@ protected:
bool _bRegisted = false; bool _bRegisted = false;
}; };
} /* namespace Rtmp */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_RTMP_RTMPMEDIASOURCE_H_ */ #endif /* SRC_RTMP_RTMPMEDIASOURCE_H_ */

View File

@ -26,8 +26,7 @@
#include "RtmpParser.h" #include "RtmpParser.h"
namespace ZL { namespace mediakit {
namespace Rtmp {
RtmpParser::RtmpParser(const AMFValue &val) { RtmpParser::RtmpParser(const AMFValue &val) {
auto videoCodec = val["videocodecid"]; auto videoCodec = val["videocodecid"];
@ -232,29 +231,4 @@ inline void RtmpParser::onCheckMedia(const AMFValue& obj) {
} }
} /* namespace mediakit */
} /* namespace Rtmp */
} /* namespace ZL */

View File

@ -34,16 +34,12 @@
#include "Player/Player.h" #include "Player/Player.h"
#include "Util/TimeTicker.h" #include "Util/TimeTicker.h"
#include "Player/PlayerBase.h" #include "Player/PlayerBase.h"
using namespace toolkit;
using namespace std;
using namespace ZL::Util;
using namespace ZL::Player;
#define H264_CODEC_ID 7 #define H264_CODEC_ID 7
#define AAC_CODEC_ID 10 #define AAC_CODEC_ID 10
namespace ZL { namespace mediakit {
namespace Rtmp {
class RtmpParser : public PlayerBase{ class RtmpParser : public PlayerBase{
public: public:
@ -112,7 +108,6 @@ private:
}; };
} /* namespace Rtmp */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_RTMP_RTMPPARSER_H_ */ #endif /* SRC_RTMP_RTMPPARSER_H_ */

View File

@ -30,11 +30,9 @@
#include "Util/util.h" #include "Util/util.h"
#include "Util/onceToken.h" #include "Util/onceToken.h"
#include "Thread/ThreadPool.h" #include "Thread/ThreadPool.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit {
namespace ZL {
namespace Rtmp {
unordered_map<string, RtmpPlayer::rtmpCMDHandle> RtmpPlayer::g_mapCmd; unordered_map<string, RtmpPlayer::rtmpCMDHandle> RtmpPlayer::g_mapCmd;
RtmpPlayer::RtmpPlayer() { RtmpPlayer::RtmpPlayer() {
@ -351,6 +349,5 @@ void RtmpPlayer::seekToTime(float fTime){
} }
} /* namespace Rtmp */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -39,14 +39,9 @@
#include "Util/TimeTicker.h" #include "Util/TimeTicker.h"
#include "Network/Socket.h" #include "Network/Socket.h"
#include "Network/TcpClient.h" #include "Network/TcpClient.h"
using namespace toolkit;
using namespace std; namespace mediakit {
using namespace ZL::Util;
using namespace ZL::Player;
using namespace ZL::Network;
namespace ZL {
namespace Rtmp {
class RtmpPlayer:public PlayerBase, public TcpClient, public RtmpProtocol{ class RtmpPlayer:public PlayerBase, public TcpClient, public RtmpProtocol{
public: public:
@ -156,7 +151,6 @@ private:
Ticker _aNowStampTicker[2]; Ticker _aNowStampTicker[2];
}; };
} /* namespace Rtmp */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_RTMP_RtmpPlayer2_H_ */ #endif /* SRC_RTMP_RtmpPlayer2_H_ */

View File

@ -35,13 +35,10 @@
#include "RtmpMediaSource.h" #include "RtmpMediaSource.h"
#include "Poller/Timer.h" #include "Poller/Timer.h"
#include "Util/TimeTicker.h" #include "Util/TimeTicker.h"
using namespace toolkit;
using namespace std; namespace mediakit {
using namespace ZL::Util;
using namespace ZL::Player;
namespace ZL {
namespace Rtmp {
class RtmpPlayerImp: public PlayerImp<RtmpPlayer,RtmpParser> { class RtmpPlayerImp: public PlayerImp<RtmpPlayer,RtmpParser> {
public: public:
typedef std::shared_ptr<RtmpPlayerImp> Ptr; typedef std::shared_ptr<RtmpPlayerImp> Ptr;
@ -92,7 +89,6 @@ private:
}; };
} /* namespace Rtmp */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_RTMP_RTMPPLAYERIMP_H_ */ #endif /* SRC_RTMP_RTMPPLAYERIMP_H_ */

View File

@ -29,7 +29,7 @@
#include "Util/util.h" #include "Util/util.h"
#include "Util/onceToken.h" #include "Util/onceToken.h"
#include "Thread/ThreadPool.h" #include "Thread/ThreadPool.h"
using namespace ZL::Util; using namespace toolkit;
#ifdef ENABLE_OPENSSL #ifdef ENABLE_OPENSSL
#include "Util/SSLBox.h" #include "Util/SSLBox.h"
@ -72,8 +72,7 @@ static string openssl_HMACsha256(const void *key,unsigned int key_len,
#define S2_FMS_KEY_SIZE 68 #define S2_FMS_KEY_SIZE 68
#define C1_OFFSET_SIZE 4 #define C1_OFFSET_SIZE 4
namespace ZL { namespace mediakit {
namespace Rtmp {
RtmpProtocol::RtmpProtocol() { RtmpProtocol::RtmpProtocol() {
_nextHandle = [this](){ _nextHandle = [this](){
@ -697,5 +696,4 @@ BufferRaw::Ptr RtmpProtocol::obtainBuffer(const void *data, int len) {
return buffer; return buffer;
} }
} /* namespace Rtmp */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -39,11 +39,9 @@
#include "Util/ResourcePool.h" #include "Util/ResourcePool.h"
using namespace std; using namespace std;
using namespace ZL::Util; using namespace toolkit;
using namespace ZL::Network;
namespace ZL { namespace mediakit {
namespace Rtmp {
class RtmpProtocol { class RtmpProtocol {
public: public:
@ -119,7 +117,6 @@ private:
function<void()> _nextHandle; function<void()> _nextHandle;
}; };
} /* namespace Rtmp */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_RTMP_RTMPPROTOCOL_H_ */ #endif /* SRC_RTMP_RTMPPROTOCOL_H_ */

View File

@ -29,11 +29,9 @@
#include "Util/util.h" #include "Util/util.h"
#include "Util/onceToken.h" #include "Util/onceToken.h"
#include "Thread/ThreadPool.h" #include "Thread/ThreadPool.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit {
namespace ZL {
namespace Rtmp {
static int kSockFlags = SOCKET_DEFAULE_FLAGS | FLAG_MORE; static int kSockFlags = SOCKET_DEFAULE_FLAGS | FLAG_MORE;
@ -286,6 +284,5 @@ void RtmpPusher::onRtmpChunk(RtmpPacket &chunkData) {
} }
} /* namespace Rtmp */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -31,8 +31,7 @@
#include "RtmpMediaSource.h" #include "RtmpMediaSource.h"
#include "Network/TcpClient.h" #include "Network/TcpClient.h"
namespace ZL { namespace mediakit {
namespace Rtmp {
class RtmpPusher: public RtmpProtocol , public TcpClient{ class RtmpPusher: public RtmpProtocol , public TcpClient{
public: public:
@ -123,7 +122,6 @@ private:
Event _onPublished; Event _onPublished;
}; };
} /* namespace Rtmp */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_RTMP_RTMPPUSHER_H_ */ #endif /* SRC_RTMP_RTMPPUSHER_H_ */

View File

@ -29,8 +29,7 @@
#include "Common/config.h" #include "Common/config.h"
#include "Util/onceToken.h" #include "Util/onceToken.h"
namespace ZL { namespace mediakit {
namespace Rtmp {
static int kSockFlags = SOCKET_DEFAULE_FLAGS | FLAG_MORE; static int kSockFlags = SOCKET_DEFAULE_FLAGS | FLAG_MORE;
@ -191,7 +190,7 @@ void RtmpSession::onCmd_publish(AMFDecoder &dec) {
onRes(err); onRes(err);
}); });
}; };
auto flag = NoticeCenter::Instance().emitEvent(Config::Broadcast::kBroadcastRtmpPublish, auto flag = NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastRtmpPublish,
_mediaInfo, _mediaInfo,
invoker, invoker,
*this); *this);
@ -506,7 +505,7 @@ void RtmpSession::onRtmpChunk(RtmpPacket &chunkData) {
if (!_pPublisherSrc) { if (!_pPublisherSrc) {
throw std::runtime_error("Not a rtmp publisher!"); throw std::runtime_error("Not a rtmp publisher!");
} }
GET_CONFIG_AND_REGISTER(bool,rtmp_modify_stamp,Config::Rtmp::kModifyStamp); GET_CONFIG_AND_REGISTER(bool,rtmp_modify_stamp,Rtmp::kModifyStamp);
if(rtmp_modify_stamp){ if(rtmp_modify_stamp){
chunkData.timeStamp = _stampTicker[chunkData.typeId % 2].elapsedTime(); chunkData.timeStamp = _stampTicker[chunkData.typeId % 2].elapsedTime();
} }
@ -565,5 +564,4 @@ void RtmpSession::cancelDelyaTask(){
} }
} /* namespace Rtmp */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -37,12 +37,9 @@
#include "Util/util.h" #include "Util/util.h"
#include "Util/TimeTicker.h" #include "Util/TimeTicker.h"
#include "Network/TcpSession.h" #include "Network/TcpSession.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit {
using namespace ZL::Network;
namespace ZL {
namespace Rtmp {
class RtmpSession: public TcpSession ,public RtmpProtocol , public MediaSourceEvent{ class RtmpSession: public TcpSession ,public RtmpProtocol , public MediaSourceEvent{
public: public:
@ -107,7 +104,6 @@ private:
}; };
} /* namespace Rtmp */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_RTMP_RTMPSESSION_H_ */ #endif /* SRC_RTMP_RTMPSESSION_H_ */

View File

@ -29,12 +29,9 @@
#include "Util/util.h" #include "Util/util.h"
#include "Util/base64.h" #include "Util/base64.h"
#include "Network/sockutil.h" #include "Network/sockutil.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit {
using namespace ZL::Network;
namespace ZL {
namespace Rtmp {
RtmpToRtspMediaSource::RtmpToRtspMediaSource(const string &vhost, RtmpToRtspMediaSource::RtmpToRtspMediaSource(const string &vhost,
const string &app, const string &app,
@ -89,7 +86,7 @@ void RtmpToRtspMediaSource::makeSDP() {
// _pRtspSrc->onGetRTP(pkt,bKeyPos); // _pRtspSrc->onGetRTP(pkt,bKeyPos);
// }; // };
// //
// GET_CONFIG_AND_REGISTER(uint32_t,videoMtu,Config::Rtp::kVideoMtuSize); // GET_CONFIG_AND_REGISTER(uint32_t,videoMtu,Rtp::kVideoMtuSize);
// _pRtpMaker_h264.reset(new RtpMaker_H264(lam, ssrc0,videoMtu)); // _pRtpMaker_h264.reset(new RtpMaker_H264(lam, ssrc0,videoMtu));
// //
// char strTemp[100]; // char strTemp[100];
@ -131,7 +128,7 @@ void RtmpToRtspMediaSource::makeSDP() {
// auto lam = [this](const RtpPacket::Ptr &pkt, bool bKeyPos) { // auto lam = [this](const RtpPacket::Ptr &pkt, bool bKeyPos) {
// _pRtspSrc->onGetRTP(pkt,bKeyPos); // _pRtspSrc->onGetRTP(pkt,bKeyPos);
// }; // };
// GET_CONFIG_AND_REGISTER(uint32_t,audioMtu,Config::Rtp::kAudioMtuSize); // GET_CONFIG_AND_REGISTER(uint32_t,audioMtu,Rtp::kAudioMtuSize);
// _pRtpMaker_aac.reset(new RtpMaker_AAC(lam, ssrc1, audioMtu,_pParser->getAudioSampleRate())); // _pRtpMaker_aac.reset(new RtpMaker_AAC(lam, ssrc1, audioMtu,_pParser->getAudioSampleRate()));
// //
// char configStr[32]; // char configStr[32];
@ -159,5 +156,4 @@ void RtmpToRtspMediaSource::makeSDP() {
} }
} /* namespace Rtmp */ } /* namespace mediakit */
} /* namespace ZL */

View File

@ -43,14 +43,10 @@
#include "Util/util.h" #include "Util/util.h"
#include "Util/logger.h" #include "Util/logger.h"
#include "MediaFile/MediaRecorder.h" #include "MediaFile/MediaRecorder.h"
using namespace std; using namespace std;
using namespace ZL::Util; using namespace toolkit;
using namespace ZL::Rtsp;
using namespace ZL::MediaFile;
namespace ZL { namespace mediakit {
namespace Rtmp {
class RtmpToRtspMediaSource: public RtmpMediaSource { class RtmpToRtspMediaSource: public RtmpMediaSource {
public: public:
@ -100,7 +96,6 @@ private:
void makeSDP(); void makeSDP();
}; };
} /* namespace Rtmp */ } /* namespace mediakit */
} /* namespace ZL */
#endif /* SRC_RTMP_RTMPTORTSPMEDIASOURCE_H_ */ #endif /* SRC_RTMP_RTMPTORTSPMEDIASOURCE_H_ */

View File

@ -30,9 +30,7 @@
#include "Util/util.h" #include "Util/util.h"
#include "Util/logger.h" #include "Util/logger.h"
#include "Network/sockutil.h" #include "Network/sockutil.h"
using namespace toolkit;
using namespace ZL::Util;
using namespace ZL::Network;
/////////////////////AMFValue///////////////////////////// /////////////////////AMFValue/////////////////////////////
inline void AMFValue::destroy() { inline void AMFValue::destroy() {

View File

@ -30,9 +30,7 @@
#include <stdarg.h> #include <stdarg.h>
#include "Util/util.h" #include "Util/util.h"
#include "Network/sockutil.h" #include "Network/sockutil.h"
using namespace toolkit;
using namespace ZL::Util;
using namespace ZL::Network;
/* /*
* Used to do unaligned loads on archs that don't support them. GCC can mostly * Used to do unaligned loads on archs that don't support them. GCC can mostly

View File

@ -5,8 +5,7 @@
#include <Player/Player.h> #include <Player/Player.h>
#include "AACRtmpCodec.h" #include "AACRtmpCodec.h"
namespace ZL{ namespace mediakit{
namespace Rtmp {
AACRtmpDecoder::AACRtmpDecoder() { AACRtmpDecoder::AACRtmpDecoder() {
_adts = obtainFrame(); _adts = obtainFrame();
@ -127,13 +126,4 @@ void AACRtmpEncoder::makeAudioConfigPkt() {
}//namespace mediakit
}//namespace Rtmp
}//namespace ZL

View File

@ -7,8 +7,7 @@
#include "RtmpCodec.h" #include "RtmpCodec.h"
namespace ZL{ namespace mediakit{
namespace Rtmp {
/** /**
* aac Rtmp转adts类 * aac Rtmp转adts类
*/ */
@ -64,7 +63,6 @@ private:
uint8_t _ui8AudioFlags; uint8_t _ui8AudioFlags;
}; };
}//namespace Rtmp }//namespace mediakit
}//namespace ZL
#endif //ZLMEDIAKIT_AACRTMPCODEC_H #endif //ZLMEDIAKIT_AACRTMPCODEC_H

View File

@ -4,6 +4,7 @@
#include "H264RtmpCodec.h" #include "H264RtmpCodec.h"
namespace mediakit{
H264RtmpDecoder::H264RtmpDecoder() { H264RtmpDecoder::H264RtmpDecoder() {
_h264frame = obtainFrame(); _h264frame = obtainFrame();
@ -185,20 +186,7 @@ void H264RtmpEncoder::makeVideoConfigPkt() {
} }
}//namespace mediakit

View File

@ -7,9 +7,9 @@
#include "RtmpCodec.h" #include "RtmpCodec.h"
#include "Util/ResourcePool.h" #include "Util/ResourcePool.h"
using namespace toolkit;
using namespace ZL::Rtmp; namespace mediakit{
/** /**
* h264 Rtmp解码类 * h264 Rtmp解码类
*/ */
@ -64,4 +64,6 @@ private:
void makeVideoConfigPkt(); void makeVideoConfigPkt();
}; };
}//namespace mediakit
#endif //ZLMEDIAKIT_H264RTMPCODEC_H #endif //ZLMEDIAKIT_H264RTMPCODEC_H

View File

@ -3,3 +3,6 @@
// //
#include "RtmpCodec.h" #include "RtmpCodec.h"
namespace mediakit{
}

View File

@ -8,12 +8,9 @@
#include "Rtmp/Rtmp.h" #include "Rtmp/Rtmp.h"
#include "Player/Frame.h" #include "Player/Frame.h"
#include "Util/RingBuffer.h" #include "Util/RingBuffer.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit{
namespace ZL{
namespace Rtmp {
class RtmpRingInterface { class RtmpRingInterface {
public: public:
@ -78,9 +75,6 @@ public:
}; };
}//namespace mediakit
}//namespace Rtmp
}//namespace ZL
#endif //ZLMEDIAKIT_RTMPCODEC_H #endif //ZLMEDIAKIT_RTMPCODEC_H

View File

@ -4,6 +4,8 @@
#include "AACRtpCodec.h" #include "AACRtpCodec.h"
namespace mediakit{
AACRtpEncoder::AACRtpEncoder(uint32_t ui32Ssrc, AACRtpEncoder::AACRtpEncoder(uint32_t ui32Ssrc,
uint32_t ui32MtuSize, uint32_t ui32MtuSize,
uint32_t ui32SampleRate, uint32_t ui32SampleRate,
@ -20,7 +22,7 @@ AACRtpEncoder::AACRtpEncoder(uint32_t ui32Ssrc,
void AACRtpEncoder::inputFrame(const Frame::Ptr &frame) { void AACRtpEncoder::inputFrame(const Frame::Ptr &frame) {
RtpCodec::inputFrame(frame); RtpCodec::inputFrame(frame);
GET_CONFIG_AND_REGISTER(uint32_t, cycleMS, Config::Rtp::kCycleMS); GET_CONFIG_AND_REGISTER(uint32_t, cycleMS, Rtp::kCycleMS);
auto uiStamp = frame->stamp(); auto uiStamp = frame->stamp();
auto pcData = frame->data() + frame->prefixSize(); auto pcData = frame->data() + frame->prefixSize();
auto iLen = frame->size() - frame->prefixSize(); auto iLen = frame->size() - frame->prefixSize();
@ -125,6 +127,7 @@ void AACRtpDecoder::onGetAAC(const AACFrame::Ptr &frame) {
_adts = obtainFrame(); _adts = obtainFrame();
} }
}//namespace mediakit

View File

@ -7,6 +7,7 @@
#include "RtpCodec.h" #include "RtpCodec.h"
namespace mediakit{
/** /**
* aac rtp转adts类 * aac rtp转adts类
*/ */
@ -75,5 +76,6 @@ private:
unsigned char _aucSectionBuf[1600]; unsigned char _aucSectionBuf[1600];
}; };
}//namespace mediakit
#endif //ZLMEDIAKIT_AACRTPCODEC_H #endif //ZLMEDIAKIT_AACRTPCODEC_H

View File

@ -4,6 +4,7 @@
#include "H264RtpCodec.h" #include "H264RtpCodec.h"
namespace mediakit{
H264RtpDecoder::H264RtpDecoder() { H264RtpDecoder::H264RtpDecoder() {
_h264frame = obtainFrame(); _h264frame = obtainFrame();
@ -121,7 +122,7 @@ H264RtpEncoder::H264RtpEncoder(uint32_t ui32Ssrc,
void H264RtpEncoder::inputFrame(const Frame::Ptr &frame) { void H264RtpEncoder::inputFrame(const Frame::Ptr &frame) {
RtpCodec::inputFrame(frame); RtpCodec::inputFrame(frame);
GET_CONFIG_AND_REGISTER(uint32_t,cycleMS,Config::Rtp::kCycleMS); GET_CONFIG_AND_REGISTER(uint32_t,cycleMS,Rtp::kCycleMS);
auto pcData = frame->data() + frame->prefixSize(); auto pcData = frame->data() + frame->prefixSize();
auto uiStamp = frame->stamp(); auto uiStamp = frame->stamp();
auto iLen = frame->size() - frame->prefixSize(); auto iLen = frame->size() - frame->prefixSize();
@ -202,4 +203,6 @@ void H264RtpEncoder::makeH264Rtp(const void* data, unsigned int len, bool mark,
uint8_t type = ((uint8_t *) (data))[0] & 0x1F; uint8_t type = ((uint8_t *) (data))[0] & 0x1F;
RtpCodec::inputRtp(rtppkt,type == 5); RtpCodec::inputRtp(rtppkt,type == 5);
_ui16Sequence++; _ui16Sequence++;
} }
}//namespace mediakit

View File

@ -7,8 +7,9 @@
#include "RtpCodec.h" #include "RtpCodec.h"
#include "Util/ResourcePool.h" #include "Util/ResourcePool.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit{
/** /**
* h264 rtp解码类 * h264 rtp解码类
@ -74,5 +75,6 @@ private:
unsigned char _aucSectionBuf[1600]; unsigned char _aucSectionBuf[1600];
}; };
}//namespace mediakit{
#endif //ZLMEDIAKIT_H264RTPCODEC_H #endif //ZLMEDIAKIT_H264RTPCODEC_H

View File

@ -9,10 +9,9 @@
#include "Util/RingBuffer.h" #include "Util/RingBuffer.h"
#include "Rtsp/Rtsp.h" #include "Rtsp/Rtsp.h"
#include "Player/PlayerBase.h" #include "Player/PlayerBase.h"
using namespace toolkit;
using namespace std; namespace mediakit{
using namespace ZL::Util;
using namespace ZL::Player;
class RtpPacket : public CodecInfo { class RtpPacket : public CodecInfo {
public: public:
@ -156,7 +155,7 @@ public:
virtual ~RtpCodec(){} virtual ~RtpCodec(){}
}; };
}//namespace mediakit

View File

@ -34,12 +34,9 @@
#include "Util/TimeTicker.h" #include "Util/TimeTicker.h"
#include "Util/ResourcePool.h" #include "Util/ResourcePool.h"
#include "Thread/ThreadPool.h" #include "Thread/ThreadPool.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit{
using namespace ZL::Thread;
namespace ZL {
namespace Rtsp {
class RtpMaker { class RtpMaker {
public: public:
@ -102,7 +99,7 @@ private:
onGetRTP callBack; onGetRTP callBack;
}; };
} /* namespace RTP */ } //namespace mediakit
} /* namespace ZL */
#endif /* RTP_RTPMAKER_H_ */ #endif /* RTP_RTPMAKER_H_ */

View File

@ -28,15 +28,12 @@
#include "RtpMakerAAC.h" #include "RtpMakerAAC.h"
#include "Util/mini.h" #include "Util/mini.h"
#include "Network/sockutil.h" #include "Network/sockutil.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit{
using namespace ZL::Network;
namespace ZL {
namespace Rtsp {
void RtpMaker_AAC::makeRtp(const char *pcData, int iLen, uint32_t uiStamp) { void RtpMaker_AAC::makeRtp(const char *pcData, int iLen, uint32_t uiStamp) {
GET_CONFIG_AND_REGISTER(uint32_t,cycleMS,Config::Rtp::kCycleMS); GET_CONFIG_AND_REGISTER(uint32_t,cycleMS,Rtp::kCycleMS);
uiStamp %= cycleMS; uiStamp %= cycleMS;
char *ptr = (char *) pcData; char *ptr = (char *) pcData;
@ -99,5 +96,4 @@ inline void RtpMaker_AAC::makeAACRtp(const void *pData, unsigned int uiLen, bool
_ui16Sequence++; _ui16Sequence++;
} }
} /* namespace RTP */ }//namespace mediakit
} /* namespace ZL */

View File

@ -35,10 +35,9 @@
#include "Util/ResourcePool.h" #include "Util/ResourcePool.h"
using namespace std; using namespace std;
using namespace ZL::Util; using namespace toolkit;
namespace ZL { namespace mediakit{
namespace Rtsp {
class RtpMaker_AAC: public RtpMaker { class RtpMaker_AAC: public RtpMaker {
public: public:
@ -56,7 +55,6 @@ private:
unsigned char _aucSectionBuf[1600]; unsigned char _aucSectionBuf[1600];
}; };
} /* namespace RTP */ }//namespace mediakit
} /* namespace ZL */
#endif /* RTP_RTPMAKERAAC_H_ */ #endif /* RTP_RTPMAKERAAC_H_ */

View File

@ -28,15 +28,12 @@
#include "RtpMakerH264.h" #include "RtpMakerH264.h"
#include "Util/mini.h" #include "Util/mini.h"
#include "Network/sockutil.h" #include "Network/sockutil.h"
using namespace toolkit;
using namespace ZL::Util; namespace mediakit{
using namespace ZL::Network;
namespace ZL {
namespace Rtsp {
void RtpMaker_H264::makeRtp(const char* pcData, int iLen, uint32_t uiStamp) { void RtpMaker_H264::makeRtp(const char* pcData, int iLen, uint32_t uiStamp) {
GET_CONFIG_AND_REGISTER(uint32_t,cycleMS,Config::Rtp::kCycleMS); GET_CONFIG_AND_REGISTER(uint32_t,cycleMS,Rtp::kCycleMS);
uiStamp %= cycleMS; uiStamp %= cycleMS;
int iSize = _iMtuSize - 2; int iSize = _iMtuSize - 2;
@ -118,5 +115,4 @@ inline void RtpMaker_H264::makeH264Rtp(const void* data, unsigned int len, bool
//InfoL<<timeStamp<<" "<<time<<" "<<sampleRate; //InfoL<<timeStamp<<" "<<time<<" "<<sampleRate;
} }
} /* namespace RTP */ }//namespace mediakit
} /* namespace ZL */

View File

@ -34,11 +34,9 @@
#include "Util/RingBuffer.h" #include "Util/RingBuffer.h"
using namespace std; using namespace std;
using namespace ZL::Util; using namespace toolkit;
using namespace ZL::Rtsp;
namespace ZL { namespace mediakit{
namespace Rtsp {
class RtpMaker_H264: public RtpMaker { class RtpMaker_H264: public RtpMaker {
public: public:
@ -56,7 +54,7 @@ private:
unsigned char aucSectionBuf[1600]; unsigned char aucSectionBuf[1600];
}; };
} /* namespace RTP */ }//namespace mediakit
} /* namespace ZL */
#endif /* RTP_RTPMAKERH264_H_ */ #endif /* RTP_RTPMAKERH264_H_ */

Some files were not shown because too many files have changed in this diff Show More