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-03 19:23:33 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include <rs.h>
|
|
|
|
}
|
|
|
|
|
|
|
|
using namespace std::literals;
|
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;
|
|
|
|
}
|
|
|
|
proc::proc = std::move(*proc_opt);
|
|
|
|
|
2019-12-03 19:23:33 +00:00
|
|
|
reed_solomon_init();
|
|
|
|
|
|
|
|
std::thread httpThread { nvhttp::start };
|
|
|
|
std::thread rtpThread { stream::rtpThread };
|
|
|
|
|
|
|
|
httpThread.join();
|
|
|
|
rtpThread.join();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|