diff --git a/test.cpp b/test.cpp new file mode 100644 index 00000000..1ab4c402 --- /dev/null +++ b/test.cpp @@ -0,0 +1,59 @@ +//============================================================================ +// Name : main.cpp +// Author : 熊子良 +// Version : +//============================================================================ + + +#include +#include +#include +#include "Util/SqlPool.h" +#include "Util/logger.h" +#include "Util/onceToken.h" +#include "Rtsp/UDPServer.h" +#include "Rtsp/RtspSession.h" +#include "Rtmp/RtmpSession.h" +#include "Network/TcpServer.h" +#include "Poller/EventPoller.hpp" +#include "Thread/WorkThreadPool.h" +#include "Http/HttpSession.h" + +using namespace std; +using namespace ZL::Util; +using namespace ZL::Http; +using namespace ZL::Rtsp; +using namespace ZL::Rtmp; +using namespace ZL::Thread; +using namespace ZL::Network; + +void programExit(int arg) { + EventPoller::Instance().shutdown(); +} +int main(int argc,char *argv[]){ + signal(SIGINT, programExit); + + Logger::Instance().add(std::make_shared("stdout", LTrace)); + Logger::Instance().setWriter(std::make_shared()); + + TcpServer::Ptr rtspSrv(new TcpServer()); + TcpServer::Ptr rtmpSrv(new TcpServer()); + TcpServer::Ptr httpSrv(new TcpServer()); + rtspSrv->start(mINI::Instance()[Config::Rtsp::kPort]); + rtmpSrv->start(mINI::Instance()[Config::Rtmp::kPort]); + httpSrv->start(mINI::Instance()[Config::Http::kPort]); + + EventPoller::Instance().runLoop(); + + rtspSrv.reset(); + rtmpSrv.reset(); + httpSrv.reset(); + static onceToken token(nullptr, []() { + UDPServer::Destory(); + WorkThreadPool::Destory(); + EventPoller::Destory(); + Logger::Destory(); + }); + return 0; +} +