Handler function typing
This commit is contained in:
parent
244c92c5b9
commit
9c0df440c5
5 changed files with 88 additions and 4 deletions
|
@ -0,0 +1,18 @@
|
|||
use std::sync::mpsc;
|
||||
use std::error::Error;
|
||||
use crate::util;
|
||||
|
||||
pub fn spawn(
|
||||
v: mpsc::Receiver<util::NALUPacket>,
|
||||
a: mpsc::Receiver<util::NALUPacket>,
|
||||
metadata: &util::Metadata
|
||||
) -> Result<
|
||||
(
|
||||
mpsc::Receiver<util::RawMedia>,
|
||||
mpsc::Receiver<util::RawMedia>,
|
||||
mpsc::Receiver<Box<dyn Error>>
|
||||
),
|
||||
Box<dyn Error>
|
||||
> {
|
||||
todo!();
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
use std::sync::mpsc;
|
||||
use std::error::Error;
|
||||
|
||||
use crate::util;
|
||||
|
||||
pub fn spawn() -> Result<
|
||||
(
|
||||
mpsc::Receiver<util::NALUPacket>,
|
||||
mpsc::Receiver<util::NALUPacket>,
|
||||
util::Metadata,
|
||||
mpsc::Receiver<Box<dyn Error>>
|
||||
),
|
||||
Box<dyn Error>
|
||||
> {
|
||||
todo!();
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
use std::sync::mpsc;
|
||||
use std::error::Error;
|
||||
|
||||
use crate::util;
|
||||
|
||||
pub fn spawn(
|
||||
v: mpsc::Receiver<util::RawMedia>,
|
||||
a: mpsc::Receiver<util::RawMedia>,
|
||||
metadata: &util::Metadata
|
||||
) -> Result<
|
||||
(
|
||||
mpsc::Receiver<util::NALUPacket>,
|
||||
mpsc::Receiver<util::NALUPacket>,
|
||||
mpsc::Receiver<Box<dyn Error>>
|
||||
),
|
||||
Box<dyn Error>
|
||||
> {
|
||||
todo!();
|
||||
}
|
24
src/main.rs
24
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<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() {
|
||||
fn process(error_handles: [mpsc::Receiver<Box<dyn std::error::Error>>; 4]) -> Result<(), Box<dyn std::error::Error>> {
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
use std::sync::mpsc;
|
||||
use std::error::Error;
|
||||
|
||||
use crate::util;
|
||||
|
||||
pub fn spawn(
|
||||
v: mpsc::Receiver<util::NALUPacket>,
|
||||
a: mpsc::Receiver<util::NALUPacket>,
|
||||
metadata: &util::Metadata
|
||||
) -> Result<
|
||||
mpsc::Receiver<Box<dyn Error>>,
|
||||
Box<dyn Error>
|
||||
> {
|
||||
todo!();
|
||||
}
|
Loading…
Reference in a new issue