From 02c77d2e44ee5389b1ea0dc1d4031c037c445b29 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Fri, 16 Jun 2023 00:48:39 +0900 Subject: [PATCH] mccparse: Map timecode to PTS directly without offset Assumes that caption stream's timeline starts from zero, and maps timecode time_since_daily_jam() to PTS directly without subtracting the first seen timecode. Part-of: --- video/closedcaption/src/mcc_parse/imp.rs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/video/closedcaption/src/mcc_parse/imp.rs b/video/closedcaption/src/mcc_parse/imp.rs index 6bbbf0d9..99fcbcaf 100644 --- a/video/closedcaption/src/mcc_parse/imp.rs +++ b/video/closedcaption/src/mcc_parse/imp.rs @@ -60,7 +60,6 @@ struct State { format: Option, need_segment: bool, pending_events: Vec, - start_position: Option, last_position: Option, last_timecode: Option, timecode_rate: Option<(u8, bool)>, @@ -86,7 +85,6 @@ impl Default for State { format: None, need_segment: true, pending_events: Vec::new(), - start_position: None, last_position: None, last_timecode: None, timecode_rate: None, @@ -204,21 +202,6 @@ impl State { /// not produce timestamps jumping backwards fn update_timestamp(&mut self, imp: &MccParse, timecode: &gst_video::ValidVideoTimeCode) { let nsecs = timecode.time_since_daily_jam(); - if self.start_position.is_none() { - self.start_position = Some(nsecs); - } - let start_position = self.start_position.expect("checked above"); - - let nsecs = nsecs.checked_sub(start_position).unwrap_or_else(|| { - gst::fixme!( - CAT, - imp: imp, - "New position {} < start position {}", - nsecs, - start_position, - ); - start_position - }); if self .last_position @@ -849,7 +832,6 @@ impl MccParse { state.segment = gst::FormattedSegment::new(); state.need_segment = true; state.pending_events.clear(); - state.start_position = Some(gst::ClockTime::ZERO); state.last_position = None; state.last_timecode = None; state.timecode_rate = None;