Sunshine/sunshine/main.cpp

49 lines
834 B
C++
Raw Normal View History

//
// Created by loki on 5/30/19.
//
#include <thread>
#include <filesystem>
#include <iostream>
#include "nvhttp.h"
#include "stream.h"
#include "config.h"
#include "process.h"
2019-12-22 22:34:12 +00:00
#include "thread_pool.h"
extern "C" {
#include <rs.h>
}
using namespace std::literals;
2019-12-22 22:34:12 +00:00
util::ThreadPool task_pool;
int main(int argc, char *argv[]) {
2019-12-03 22:19:00 +00:00
if(argc > 1) {
if(!std::filesystem::exists(argv[1])) {
std::cout << "Error: Couldn't find configuration file ["sv << argv[1] << ']' << std::endl;
return 7;
}
2019-12-03 22:19:00 +00:00
config::parse_file(argv[1]);
}
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);
reed_solomon_init();
2019-12-22 22:34:12 +00:00
task_pool.start(1);
std::thread httpThread { nvhttp::start };
2019-12-22 22:34:12 +00:00
stream::rtpThread();
httpThread.join();
return 0;
}