mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-10-31 22:58:51 +00:00
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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1246>
This commit is contained in:
parent
26fd68a37c
commit
02c77d2e44
1 changed files with 0 additions and 18 deletions
|
@ -60,7 +60,6 @@ struct State {
|
||||||
format: Option<Format>,
|
format: Option<Format>,
|
||||||
need_segment: bool,
|
need_segment: bool,
|
||||||
pending_events: Vec<gst::Event>,
|
pending_events: Vec<gst::Event>,
|
||||||
start_position: Option<gst::ClockTime>,
|
|
||||||
last_position: Option<gst::ClockTime>,
|
last_position: Option<gst::ClockTime>,
|
||||||
last_timecode: Option<gst_video::ValidVideoTimeCode>,
|
last_timecode: Option<gst_video::ValidVideoTimeCode>,
|
||||||
timecode_rate: Option<(u8, bool)>,
|
timecode_rate: Option<(u8, bool)>,
|
||||||
|
@ -86,7 +85,6 @@ impl Default for State {
|
||||||
format: None,
|
format: None,
|
||||||
need_segment: true,
|
need_segment: true,
|
||||||
pending_events: Vec::new(),
|
pending_events: Vec::new(),
|
||||||
start_position: None,
|
|
||||||
last_position: None,
|
last_position: None,
|
||||||
last_timecode: None,
|
last_timecode: None,
|
||||||
timecode_rate: None,
|
timecode_rate: None,
|
||||||
|
@ -204,21 +202,6 @@ impl State {
|
||||||
/// not produce timestamps jumping backwards
|
/// not produce timestamps jumping backwards
|
||||||
fn update_timestamp(&mut self, imp: &MccParse, timecode: &gst_video::ValidVideoTimeCode) {
|
fn update_timestamp(&mut self, imp: &MccParse, timecode: &gst_video::ValidVideoTimeCode) {
|
||||||
let nsecs = timecode.time_since_daily_jam();
|
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
|
if self
|
||||||
.last_position
|
.last_position
|
||||||
|
@ -849,7 +832,6 @@ impl MccParse {
|
||||||
state.segment = gst::FormattedSegment::new();
|
state.segment = gst::FormattedSegment::new();
|
||||||
state.need_segment = true;
|
state.need_segment = true;
|
||||||
state.pending_events.clear();
|
state.pending_events.clear();
|
||||||
state.start_position = Some(gst::ClockTime::ZERO);
|
|
||||||
state.last_position = None;
|
state.last_position = None;
|
||||||
state.last_timecode = None;
|
state.last_timecode = None;
|
||||||
state.timecode_rate = None;
|
state.timecode_rate = None;
|
||||||
|
|
Loading…
Reference in a new issue