2023-10-05 14:18:14 +05:00
|
|
|
mod util;
|
|
|
|
mod demux;
|
|
|
|
mod decode;
|
|
|
|
mod encode;
|
|
|
|
mod muxer;
|
|
|
|
|
2023-10-05 14:59:51 +05:00
|
|
|
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]);
|
2023-10-05 14:18:14 +05:00
|
|
|
}
|
|
|
|
|
2023-10-05 14:59:51 +05:00
|
|
|
fn process(error_handles: [mpsc::Receiver<Box<dyn std::error::Error>>; 4]) -> Result<(), Box<dyn std::error::Error>> {
|
|
|
|
todo!();
|
2023-10-05 14:18:14 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2023-10-05 14:59:51 +05:00
|
|
|
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);
|
2023-10-05 14:18:14 +05:00
|
|
|
}
|