Initial Commit

This commit is contained in:
2023-03-18 13:11:34 +01:00
commit 1407b93895
15 changed files with 386 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
#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;
}