| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #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;
- }
|