整理命名空间 (#1409)

* feat: remove using namespace mediakit in header files.

(cherry picked from commit d44aeb339a8a0e1f0455be82b21fe4b1b536299f)

* feat: remove using namespace mediakit in FFmpegSource.h

* feat: remove using namespace mediakit in RtpExt.h

* feat: remove using namespace mediakit in header files.

* feat: remove using namespace std in header files.

* feat: remove using namespace std in header files when zltoolkit remove std in header

* 补充命名空间

* 整理命名空间

* 整理命名空间2

* 修复macos ci

* 修复编译问题

* 修复编译问题2

* 修复编译问题3

Co-authored-by: Johnny <hellojinqiang@gmail.com>
Co-authored-by: Xiaofeng Wang <wasphin@gmail.com>
This commit is contained in:
夏楚
2022-02-02 20:34:50 +08:00
committed by GitHub
parent 80a0e27d8c
commit c72cf4cbcc
239 changed files with 1887 additions and 1766 deletions

View File

@@ -22,12 +22,9 @@
#include "TS/TSMediaSource.h"
#include "FMP4/FMP4MediaSource.h"
using namespace std;
using namespace toolkit;
namespace mediakit {
class HttpSession: public TcpSession,
class HttpSession: public toolkit::TcpSession,
public FlvMuxer,
public HttpRequestSplitter,
public WebSocketSplitter {
@@ -40,19 +37,19 @@ public:
* @param accessPath 运行或禁止访问的根目录
* @param cookieLifeSecond 鉴权cookie有效期
**/
typedef std::function<void(const string &errMsg,const string &accessPath, int cookieLifeSecond)> HttpAccessPathInvoker;
typedef std::function<void(const std::string &errMsg,const std::string &accessPath, int cookieLifeSecond)> HttpAccessPathInvoker;
HttpSession(const Socket::Ptr &pSock);
HttpSession(const toolkit::Socket::Ptr &pSock);
~HttpSession() override;
void onRecv(const Buffer::Ptr &) override;
void onError(const SockException &err) override;
void onRecv(const toolkit::Buffer::Ptr &) override;
void onError(const toolkit::SockException &err) override;
void onManager() override;
static string urlDecode(const string &str);
static std::string urlDecode(const std::string &str);
protected:
//FlvMuxer override
void onWrite(const Buffer::Ptr &data, bool flush) override ;
void onWrite(const toolkit::Buffer::Ptr &data, bool flush) override ;
void onDetach() override;
std::shared_ptr<FlvMuxer> getSharedPtr() override;
@@ -74,7 +71,7 @@ protected:
size_t len,
size_t totalSize,
size_t recvedSize){
shutdown(SockException(Err_shutdown,"http post content is too huge,default closed"));
shutdown(toolkit::SockException(toolkit::Err_shutdown,"http post content is too huge,default closed"));
}
/**
@@ -92,7 +89,7 @@ protected:
* 发送数据进行websocket协议打包后回调
* @param buffer websocket协议数据
*/
void onWebSocketEncodeData(Buffer::Ptr buffer) override;
void onWebSocketEncodeData(toolkit::Buffer::Ptr buffer) override;
/**
* 接收到完整的一个webSocket数据包后回调
@@ -107,11 +104,11 @@ private:
void Handle_Req_HEAD(ssize_t &content_len);
void Handle_Req_OPTIONS(ssize_t &content_len);
bool checkLiveStream(const string &schema, const string &url_suffix, const function<void(const MediaSource::Ptr &src)> &cb);
bool checkLiveStream(const std::string &schema, const std::string &url_suffix, const std::function<void(const MediaSource::Ptr &src)> &cb);
bool checkLiveStreamFlv(const function<void()> &cb = nullptr);
bool checkLiveStreamTS(const function<void()> &cb = nullptr);
bool checkLiveStreamFMP4(const function<void()> &fmp4_list = nullptr);
bool checkLiveStreamFlv(const std::function<void()> &cb = nullptr);
bool checkLiveStreamTS(const std::function<void()> &cb = nullptr);
bool checkLiveStreamFMP4(const std::function<void()> &fmp4_list = nullptr);
bool checkWebSocket();
bool emitHttpEvent(bool doInvoke);
@@ -129,18 +126,17 @@ private:
bool _live_over_websocket = false;
//消耗的总流量
uint64_t _total_bytes_usage = 0;
string _origin;
std::string _origin;
Parser _parser;
Ticker _ticker;
toolkit::Ticker _ticker;
MediaInfo _mediaInfo;
TSMediaSource::RingType::RingReader::Ptr _ts_reader;
FMP4MediaSource::RingType::RingReader::Ptr _fmp4_reader;
//处理content数据的callback
function<bool (const char *data,size_t len) > _contentCallBack;
std::function<bool (const char *data,size_t len) > _contentCallBack;
};
typedef TcpSessionWithSSL<HttpSession> HttpsSession;
using HttpsSession = toolkit::TcpSessionWithSSL<HttpSession>;
} /* namespace mediakit */