2019-12-03 19:23:33 +00:00
|
|
|
//
|
|
|
|
// Created by loki on 5/30/19.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <thread>
|
2019-12-08 18:21:27 +00:00
|
|
|
#include <filesystem>
|
|
|
|
#include <iostream>
|
2019-12-03 19:23:33 +00:00
|
|
|
|
|
|
|
#include "nvhttp.h"
|
|
|
|
#include "stream.h"
|
2019-12-15 13:30:00 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "process.h"
|
2019-12-22 22:34:12 +00:00
|
|
|
#include "thread_pool.h"
|
2019-12-03 19:23:33 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include <rs.h>
|
|
|
|
}
|
|
|
|
|
2019-12-28 21:29:29 +00:00
|
|
|
#include "platform/common.h"
|
2019-12-03 19:23:33 +00:00
|
|
|
using namespace std::literals;
|
2019-12-22 22:34:12 +00:00
|
|
|
|
|
|
|
util::ThreadPool task_pool;
|
2019-12-25 19:57:23 +00:00
|
|
|
bool display_cursor;
|
|
|
|
|
2019-12-15 13:30:00 +00:00
|
|
|
int main(int argc, char *argv[]) {
|
2019-12-03 22:19:00 +00:00
|
|
|
if(argc > 1) {
|
2019-12-08 18:21:27 +00:00
|
|
|
if(!std::filesystem::exists(argv[1])) {
|
2019-12-14 22:57:04 +00:00
|
|
|
std::cout << "Error: Couldn't find configuration file ["sv << argv[1] << ']' << std::endl;
|
2019-12-08 18:21:27 +00:00
|
|
|
return 7;
|
|
|
|
}
|
|
|
|
|
2019-12-03 22:19:00 +00:00
|
|
|
config::parse_file(argv[1]);
|
|
|
|
}
|
|
|
|
|
2019-12-16 21:02:21 +00:00
|
|
|
auto proc_opt = proc::parse(config::stream.file_apps);
|
2019-12-15 18:36:22 +00:00
|
|
|
if(!proc_opt) {
|
|
|
|
return 7;
|
|
|
|
}
|
2019-12-30 18:37:12 +00:00
|
|
|
|
2019-12-15 18:36:22 +00:00
|
|
|
proc::proc = std::move(*proc_opt);
|
|
|
|
|
2019-12-03 19:23:33 +00:00
|
|
|
reed_solomon_init();
|
|
|
|
|
2019-12-22 22:34:12 +00:00
|
|
|
task_pool.start(1);
|
|
|
|
|
2019-12-03 19:23:33 +00:00
|
|
|
std::thread httpThread { nvhttp::start };
|
|
|
|
|
2019-12-22 22:34:12 +00:00
|
|
|
stream::rtpThread();
|
2019-12-03 19:23:33 +00:00
|
|
|
httpThread.join();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|