47 lines
1.0 KiB
C++
47 lines
1.0 KiB
C++
#include "API/WebAPI.h"
|
|
#include <ctpl_stl.h>
|
|
#include <Logging.h>
|
|
#include <HttpServer.h>
|
|
#include <iostream>
|
|
#include <sstream>
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
try
|
|
{
|
|
Logging::OpenLog();
|
|
Logging::SetLogMask(Logging::Severity::Debug);
|
|
|
|
int port(8000);
|
|
ctpl::thread_pool threadPool(6);
|
|
std::string ffmpeg = "ffmpeg";
|
|
|
|
Http::HttpServer::CallbackMethod callback = std::bind(&StreamRecoder::API::WebAPI::ProcessQuery, &threadPool, ffmpeg, std::placeholders::_1, std::placeholders::_2);
|
|
|
|
Http::HttpServer server(port, callback);
|
|
Logging::Log(Logging::Severity::Info, "Startup Complete");
|
|
server.Wait();
|
|
|
|
Logging::Log(Logging::Severity::Info, "Stopping StreamRecoder...");
|
|
|
|
Logging::CloseLog();
|
|
}
|
|
catch (const std::exception& e)
|
|
{
|
|
std::cerr << "Exception caught" << std::endl;
|
|
|
|
std::stringstream ss;
|
|
ss << "Type : " << typeid(e).name() << std::endl;
|
|
ss << "ERROR: " << e.what() << std::endl;
|
|
|
|
Logging::Log(Logging::Severity::Error, ss.str());
|
|
|
|
Logging::CloseLog();
|
|
|
|
return -1;
|
|
}
|
|
|
|
return 0;
|
|
}
|