👕 refactor: move SharedState to main.rs

main
_ 2021-11-13 17:43:25 +00:00
parent be3c76d9d8
commit f6b85a24da
2 changed files with 7 additions and 7 deletions

View File

@ -105,12 +105,6 @@ impl PcmBuffers {
}
}
#[derive (Default)]
pub struct SharedState {
pub pcm_buffers: PcmBuffers,
pub quit: bool,
}
pub struct Decoder {
pub input_ctx: DemuxContext,
pub decoder: DecodeContext,

View File

@ -77,6 +77,12 @@ fn cmd_debug_pipe (args: &[String]) -> Result <()> {
Ok (())
}
#[derive (Default)]
pub struct SharedState {
pub pcm_buffers: decoder::PcmBuffers,
pub quit: bool,
}
fn cmd_play (args: &[String]) -> Result <()> {
tracing_subscriber::fmt::init ();
@ -86,7 +92,7 @@ fn cmd_play (args: &[String]) -> Result <()> {
.map (|s| s.to_string ())
.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 pair3 = Arc::clone (&pair);