hls-transcoder-2/src/main.rs

32 lines
984 B
Rust

mod util;
mod demux;
mod decode;
mod encode;
mod muxer;
use std::process::exit;
use std::sync::mpsc;
fn init() -> Result<[mpsc::Receiver<Box<dyn std::error::Error>>; 4], Box<dyn std::error::Error>>{
let (v_out, a_out, metadata, demux_err_recv) = demux::spawn()?;
let (raw_v_out, raw_a_out, decode_err_recv) = decode::spawn(v_out, a_out, &metadata)?;
let (enc_v_out, enc_a_out, encode_err_recv) = encode::spawn(raw_v_out, raw_a_out, &metadata)?;
let muxer_err_recv = muxer::spawn(enc_v_out, enc_a_out, &metadata)?;
return Ok([demux_err_recv, decode_err_recv, encode_err_recv, muxer_err_recv]);
}
fn process(error_handles: [mpsc::Receiver<Box<dyn std::error::Error>>; 4]) -> Result<(), Box<dyn std::error::Error>> {
todo!();
}
fn main() {
let error_handles = match init() {
Ok(x) => x,
Err(x) => {dbg!(x); exit(1);}
};
match process(error_handles) {
Ok(_) => (),
Err(x) => {dbg!(x); exit(1)}
};
exit(0);
}