diff --git a/src/decode/mod.rs b/src/decode/mod.rs index e69de29..094ac03 100644 --- a/src/decode/mod.rs +++ b/src/decode/mod.rs @@ -0,0 +1,18 @@ +use std::sync::mpsc; +use std::error::Error; +use crate::util; + +pub fn spawn( + v: mpsc::Receiver, + a: mpsc::Receiver, + metadata: &util::Metadata + ) -> Result< + ( + mpsc::Receiver, + mpsc::Receiver, + mpsc::Receiver> + ), + Box + > { + todo!(); +} diff --git a/src/demux/mod.rs b/src/demux/mod.rs index e69de29..5fbb4aa 100644 --- a/src/demux/mod.rs +++ b/src/demux/mod.rs @@ -0,0 +1,16 @@ +use std::sync::mpsc; +use std::error::Error; + +use crate::util; + +pub fn spawn() -> Result< + ( + mpsc::Receiver, + mpsc::Receiver, + util::Metadata, + mpsc::Receiver> + ), + Box + > { + todo!(); +} diff --git a/src/encode/mod.rs b/src/encode/mod.rs index e69de29..9572052 100644 --- a/src/encode/mod.rs +++ b/src/encode/mod.rs @@ -0,0 +1,19 @@ +use std::sync::mpsc; +use std::error::Error; + +use crate::util; + +pub fn spawn( + v: mpsc::Receiver, + a: mpsc::Receiver, + metadata: &util::Metadata + ) -> Result< + ( + mpsc::Receiver, + mpsc::Receiver, + mpsc::Receiver> + ), + Box + > { + todo!(); +} diff --git a/src/main.rs b/src/main.rs index 10e51d8..18b9060 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,13 +4,29 @@ mod decode; mod encode; mod muxer; -fn init() { +use std::process::exit; +use std::sync::mpsc; + +fn init() -> Result<[mpsc::Receiver>; 4], Box>{ + 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() { +fn process(error_handles: [mpsc::Receiver>; 4]) -> Result<(), Box> { + todo!(); } fn main() { - init(); - process(); + 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); } diff --git a/src/muxer/mod.rs b/src/muxer/mod.rs index e69de29..b5540f8 100644 --- a/src/muxer/mod.rs +++ b/src/muxer/mod.rs @@ -0,0 +1,15 @@ +use std::sync::mpsc; +use std::error::Error; + +use crate::util; + +pub fn spawn( + v: mpsc::Receiver, + a: mpsc::Receiver, + metadata: &util::Metadata + ) -> Result< + mpsc::Receiver>, + Box + > { + todo!(); +}