From f6b85a24da3ae87940089a13b7c9b086f0bb719c Mon Sep 17 00:00:00 2001 From: _ <> Date: Sat, 13 Nov 2021 17:43:25 +0000 Subject: [PATCH] :shirt: refactor: move SharedState to main.rs --- src/decoder.rs | 6 ------ src/main.rs | 8 +++++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/decoder.rs b/src/decoder.rs index 4f7276c..c5c9a01 100644 --- a/src/decoder.rs +++ b/src/decoder.rs @@ -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, diff --git a/src/main.rs b/src/main.rs index 270a621..34873e5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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);