整理命名空间 (#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

@@ -13,17 +13,15 @@
#include "Util/CMD.h"
#include "Common/MediaSource.h"
using namespace toolkit;
namespace mediakit {
class CMD_media: public CMD {
class CMD_media : public toolkit::CMD {
public:
CMD_media(){
_parser.reset(new OptionParser([](const std::shared_ptr<ostream> &stream,mINI &ini){
MediaSource::for_each_media([&](const MediaSource::Ptr &media){
if(ini.find("list") != ini.end()){
CMD_media() {
_parser.reset(new toolkit::OptionParser([](const std::shared_ptr<std::ostream> &stream, toolkit::mINI &ini) {
MediaSource::for_each_media([&](const MediaSource::Ptr &media) {
if (ini.find("list") != ini.end()) {
//列出源
(*stream) << "\t"
<< media->getSchema() << "/"
@@ -34,14 +32,14 @@ public:
return;
}
EventPollerPool::Instance().getPoller()->async([ini,media,stream](){
if(ini.find("kick") != ini.end()){
toolkit::EventPollerPool::Instance().getPoller()->async([ini, media, stream]() {
if (ini.find("kick") != ini.end()) {
//踢出源
do{
if(!media) {
do {
if (!media) {
break;
}
if(!media->close(true)) {
if (!media->close(true)) {
break;
}
(*stream) << "\t踢出成功:"
@@ -51,7 +49,7 @@ public:
<< media->getId()
<< "\r\n";
return;
}while(0);
} while (0);
(*stream) << "\t踢出失败:"
<< media->getSchema() << "/"
<< media->getVhost() << "/"
@@ -59,19 +57,21 @@ public:
<< media->getId()
<< "\r\n";
}
},false);
}, false);
}, ini["schema"], ini["vhost"], ini["app"], ini["stream"]);
}));
(*_parser) << Option('k', "kick", Option::ArgNone,nullptr,false, "踢出媒体源", nullptr);
(*_parser) << Option('l', "list", Option::ArgNone,nullptr,false, "列出媒体源", nullptr);
(*_parser) << Option('S', "schema", Option::ArgRequired,nullptr,false, "协议筛选", nullptr);
(*_parser) << Option('v', "vhost", Option::ArgRequired,nullptr,false, "虚拟主机筛选", nullptr);
(*_parser) << Option('a', "app", Option::ArgRequired,nullptr,false, "应用名筛选", nullptr);
(*_parser) << Option('s', "stream", Option::ArgRequired,nullptr,false, "流id筛选", nullptr);
(*_parser) << toolkit::Option('k', "kick", toolkit::Option::ArgNone, nullptr, false, "踢出媒体源", nullptr);
(*_parser) << toolkit::Option('l', "list", toolkit::Option::ArgNone, nullptr, false, "列出媒体源", nullptr);
(*_parser) << toolkit::Option('S', "schema", toolkit::Option::ArgRequired, nullptr, false, "协议筛选", nullptr);
(*_parser) << toolkit::Option('v', "vhost", toolkit::Option::ArgRequired, nullptr, false, "虚拟主机筛选", nullptr);
(*_parser) << toolkit::Option('a', "app", toolkit::Option::ArgRequired, nullptr, false, "应用名筛选", nullptr);
(*_parser) << toolkit::Option('s', "stream", toolkit::Option::ArgRequired, nullptr, false, "流id筛选", nullptr);
}
virtual ~CMD_media() {}
const char *description() const override {
return "媒体源相关操作.";
}

View File

@@ -14,6 +14,8 @@
#include "Util/NoticeCenter.h"
#include "Common/config.h"
#include "ShellCMD.h"
using namespace std;
using namespace toolkit;
namespace mediakit {

View File

@@ -15,29 +15,28 @@
#include "Common/config.h"
#include "Util/TimeTicker.h"
#include "Network/TcpSession.h"
using namespace toolkit;
namespace mediakit {
class ShellSession: public TcpSession {
class ShellSession: public toolkit::TcpSession {
public:
ShellSession(const Socket::Ptr &_sock);
ShellSession(const toolkit::Socket::Ptr &_sock);
virtual ~ShellSession();
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;
private:
inline bool onCommandLine(const string &);
inline bool onCommandLine(const std::string &);
inline void pleaseInputUser();
inline void pleaseInputPasswd();
inline void printShellPrefix();
function<bool(const string &)> _loginInterceptor;
string _strRecvBuf;
Ticker _beatTicker;
string _strUserName;
std::function<bool(const std::string &)> _loginInterceptor;
std::string _strRecvBuf;
toolkit::Ticker _beatTicker;
std::string _strUserName;
};
} /* namespace mediakit */