From 00cb3fefe933e128f08c4f38aa73f4cd2ebc2e9a Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 3 Dec 2024 12:37:53 +1100 Subject: [PATCH] cea708mux: output padding by default Part-of: --- video/closedcaption/src/cea708mux/imp.rs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/video/closedcaption/src/cea708mux/imp.rs b/video/closedcaption/src/cea708mux/imp.rs index f5a36232..eb4668b7 100644 --- a/video/closedcaption/src/cea708mux/imp.rs +++ b/video/closedcaption/src/cea708mux/imp.rs @@ -83,7 +83,6 @@ fn fps_from_caps(caps: &gst::CapsRef) -> Result { )) } -#[derive(Default)] struct State { out_format: CeaFormat, fps: Option, @@ -92,6 +91,21 @@ struct State { n_frames: u64, } +impl Default for State { + fn default() -> Self { + let mut writer = CCDataWriter::default(); + writer.set_output_padding(true); + writer.set_output_cea608_padding(true); + Self { + out_format: CeaFormat::default(), + fps: None, + dtvcc_seq_no: 0, + writer, + n_frames: 0, + } + } +} + #[derive(Default)] pub struct Cea708Mux { state: Mutex, @@ -424,8 +438,6 @@ impl AggregatorImpl for Cea708Mux { let format = state.out_format; let fps = state.fps; *state = State::default(); - state.writer.set_output_padding(true); - state.writer.set_output_cea608_padding(true); state.out_format = format; state.fps = fps; state.n_frames = 0; @@ -586,8 +598,6 @@ impl ElementImpl for Cea708Mux { gst::StateChange::ReadyToPaused => { let mut state = self.state.lock().unwrap(); *state = State::default(); - state.writer.set_output_padding(true); - state.writer.set_output_cea608_padding(true); } _ => (), } @@ -598,8 +608,6 @@ impl ElementImpl for Cea708Mux { gst::StateChange::PausedToReady => { let mut state = self.state.lock().unwrap(); *state = State::default(); - state.writer.set_output_padding(true); - state.writer.set_output_cea608_padding(true); } _ => (), }