简化命名空间

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

View File

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

View File

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

View File

@@ -28,16 +28,13 @@
#include "Common/config.h"
#include "Util/mini.h"
#include "Http/HttpSession.h"
using namespace toolkit;
using namespace ZL::Util;
namespace ZL {
namespace MediaFile {
namespace mediakit {
#ifdef ENABLE_MP4V2
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;
@@ -169,7 +166,7 @@ MediaReader::~MediaReader() {
void MediaReader::startReadMP4() {
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](){
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){
#ifdef ENABLE_MP4V2
GET_CONFIG_AND_REGISTER(string,appName,Config::Record::kAppName);
GET_CONFIG_AND_REGISTER(string,appName,Record::kAppName);
if (strApp != appName) {
return nullptr;
@@ -343,5 +340,4 @@ MediaSource::Ptr MediaReader::onMakeMediaSource(const string &strSchema,const st
} /* namespace MediaFile */
} /* namespace ZL */
} /* namespace mediakit */

View File

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

View File

@@ -30,12 +30,9 @@
#include "Util/util.h"
#include "Util/mini.h"
#include "Network/sockutil.h"
using namespace toolkit;
using namespace ZL::Util;
using namespace ZL::Network;
namespace ZL {
namespace MediaFile {
namespace mediakit {
MediaRecorder::MediaRecorder(const string &strVhost_tmp,
const string &strApp,
@@ -44,10 +41,10 @@ MediaRecorder::MediaRecorder(const string &strVhost_tmp,
bool enableHls,
bool enableMp4) {
GET_CONFIG_AND_REGISTER(string,hlsPath,Config::Hls::kFilePath);
GET_CONFIG_AND_REGISTER(uint32_t,hlsBufSize,Config::Hls::kFileBufSize);
GET_CONFIG_AND_REGISTER(uint32_t,hlsDuration,Config::Hls::kSegmentDuration);
GET_CONFIG_AND_REGISTER(uint32_t,hlsNum,Config::Hls::kSegmentNum);
GET_CONFIG_AND_REGISTER(string,hlsPath,Hls::kFilePath);
GET_CONFIG_AND_REGISTER(uint32_t,hlsBufSize,Hls::kFileBufSize);
GET_CONFIG_AND_REGISTER(uint32_t,hlsDuration,Hls::kSegmentDuration);
GET_CONFIG_AND_REGISTER(uint32_t,hlsNum,Hls::kSegmentNum);
string strVhost = strVhost_tmp;
if(trim(strVhost).empty()){
@@ -61,8 +58,8 @@ MediaRecorder::MediaRecorder(const string &strVhost_tmp,
}
#ifdef ENABLE_MP4V2
GET_CONFIG_AND_REGISTER(string,recordPath,Config::Record::kFilePath);
GET_CONFIG_AND_REGISTER(string,recordAppName,Config::Record::kAppName);
GET_CONFIG_AND_REGISTER(string,recordPath,Record::kFilePath);
GET_CONFIG_AND_REGISTER(string,recordAppName,Record::kAppName);
if(enableMp4){
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
}
} /* namespace MediaFile */
} /* namespace ZL */
} /* namespace mediakit */

View File

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

View File

@@ -34,11 +34,9 @@
#include "Util/mini.h"
#include "Util/util.h"
#include "Util/NoticeCenter.h"
using namespace toolkit;
using namespace ZL::Util;
namespace ZL {
namespace MediaFile {
namespace mediakit {
string timeStr(const char *fmt) {
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) {
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)){
//在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) {
GET_CONFIG_AND_REGISTER(uint32_t,recordSec,Config::Record::kFileSecond);
GET_CONFIG_AND_REGISTER(uint32_t,recordSec,Record::kFileSecond);
//todo(xzl) 修复此处
@@ -161,7 +159,7 @@ void Mp4Maker::createFile() {
_info.strFileName = strTime + ".mp4";
_info.strFilePath = strFile;
GET_CONFIG_AND_REGISTER(string,appName,Config::Record::kAppName);
GET_CONFIG_AND_REGISTER(string,appName,Record::kAppName);
_info.strUrl = _info.strVhost + "/"
+ appName + "/"
@@ -230,12 +228,11 @@ void Mp4Maker::closeFile() {
stat(_strFile.data(), &fileData);
_info.ui64FileSize = fileData.st_size;
//----record 业务逻辑----//
NoticeCenter::Instance().emitEvent(Config::Broadcast::kBroadcastRecordMP4,_info,*this);
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastRecordMP4,_info,*this);
}
}
} /* namespace MediaFile */
} /* namespace ZL */
} /* namespace mediakit */
#endif //ENABLE_MP4V2

View File

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

View File

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

View File

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