👕 refactor: move SharedState to main.rs
parent
be3c76d9d8
commit
f6b85a24da
|
@ -105,12 +105,6 @@ impl PcmBuffers {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive (Default)]
|
|
||||||
pub struct SharedState {
|
|
||||||
pub pcm_buffers: PcmBuffers,
|
|
||||||
pub quit: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Decoder {
|
pub struct Decoder {
|
||||||
pub input_ctx: DemuxContext,
|
pub input_ctx: DemuxContext,
|
||||||
pub decoder: DecodeContext,
|
pub decoder: DecodeContext,
|
||||||
|
|
|
@ -78,6 +78,12 @@ fn cmd_debug_pipe (args: &[String]) -> Result <()> {
|
||||||
Ok (())
|
Ok (())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive (Default)]
|
||||||
|
pub struct SharedState {
|
||||||
|
pub pcm_buffers: decoder::PcmBuffers,
|
||||||
|
pub quit: bool,
|
||||||
|
}
|
||||||
|
|
||||||
fn cmd_play (args: &[String]) -> Result <()> {
|
fn cmd_play (args: &[String]) -> Result <()> {
|
||||||
tracing_subscriber::fmt::init ();
|
tracing_subscriber::fmt::init ();
|
||||||
|
|
||||||
|
@ -86,7 +92,7 @@ fn cmd_play (args: &[String]) -> Result <()> {
|
||||||
.map (|s| s.to_string ())
|
.map (|s| s.to_string ())
|
||||||
.collect ();
|
.collect ();
|
||||||
|
|
||||||
let pair = Arc::new ((Mutex::new (decoder::SharedState::default ()), Condvar::new ()));
|
let pair = Arc::new ((Mutex::new (SharedState::default ()), Condvar::new ()));
|
||||||
let pair2 = Arc::clone (&pair);
|
let pair2 = Arc::clone (&pair);
|
||||||
let pair3 = Arc::clone (&pair);
|
let pair3 = Arc::clone (&pair);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue