Files
ZLMediaKit/src/Shell/CMD.cpp

89 lines
1.6 KiB
C++
Raw Normal View History

2017-04-01 16:35:56 +08:00
/*
* CMD.cpp
*
* Created on: 2016926
* Author: xzl
*/
#include "CMD.h"
#include "ShellSession.h"
#include "Rtsp/RtspMediaSource.h"
#include "Rtmp/RtmpMediaSource.h"
using namespace ZL::Rtsp;
using namespace ZL::Rtmp;
namespace ZL {
namespace Shell {
mutex OptionParser::mtx_opt;
CMD::CMD() {
}
CMD::~CMD() {
}
CMD_help::CMD_help() {
parser.reset( new OptionParser(nullptr));
2017-08-10 16:16:42 +08:00
(*parser) << Option('c', "cmd", Option::ArgNone, "list all command", [](OutStream *stream,const char *arg) {
2017-04-01 16:35:56 +08:00
_StrPrinter printer;
for (auto &pr : ShellSession::g_mapCmd) {
printer << "\t" << pr.first << ":" << pr.second.description() << "\r\n";
}
stream->response(printer << endl);
return false;
}) << endl;
}
CMD_rtsp::CMD_rtsp() {
parser.reset(new OptionParser(nullptr));
2017-08-10 16:16:42 +08:00
(*parser) << Option('l', "list", Option::ArgNone, "list all media source of rtsp", [](OutStream *stream,const char *arg) {
2017-04-01 16:35:56 +08:00
_StrPrinter printer;
auto mediaSet = RtspMediaSource::getMediaSet();
for (auto &src : mediaSet) {
printer << "\t" << src << "\r\n";
}
stream->response(printer << endl);
return false;
}) << endl;
}
CMD_rtmp::CMD_rtmp() {
parser.reset(new OptionParser(nullptr));
2017-08-10 16:16:42 +08:00
(*parser) << Option('l', "list", Option::ArgNone, "list all media source of rtmp", [](OutStream *stream,const char *arg) {
2017-04-01 16:35:56 +08:00
_StrPrinter printer;
auto mediaSet = RtmpMediaSource::getMediaSet();
for (auto &src : mediaSet) {
printer << "\t" << src << "\r\n";
}
stream->response(printer << endl);
return false;
}) << endl;
}
} /* namespace Shell */
} /* namespace ZL */