mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-20 14:46:24 +00:00
tttocea708: don't incorrectly recode timestamp to frame conversion on gap events
Simply use the already existing generate() which will convert from a timestamp and duration into frames for processing. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1942>
This commit is contained in:
parent
fe49837107
commit
b23a514657
1 changed files with 6 additions and 28 deletions
|
@ -60,7 +60,6 @@ impl Default for Settings {
|
|||
struct State {
|
||||
translator: TextToCea708,
|
||||
framerate: gst::Fraction,
|
||||
last_frame_no: u64,
|
||||
max_frame_no: u64,
|
||||
force_clear: bool,
|
||||
}
|
||||
|
@ -70,7 +69,6 @@ impl Default for State {
|
|||
Self {
|
||||
translator: TextToCea708::default(),
|
||||
framerate: gst::Fraction::new(DEFAULT_FPS_N, DEFAULT_FPS_D),
|
||||
last_frame_no: 0,
|
||||
max_frame_no: 0,
|
||||
force_clear: false,
|
||||
}
|
||||
|
@ -288,34 +286,14 @@ impl TtToCea708 {
|
|||
EventView::Gap(e) => {
|
||||
let mut state = self.state.lock().unwrap();
|
||||
|
||||
let (fps_n, fps_d) = (
|
||||
state.framerate.numer() as u64,
|
||||
state.framerate.denom() as u64,
|
||||
);
|
||||
|
||||
let (timestamp, duration) = e.get();
|
||||
|
||||
if state.last_frame_no == 0 {
|
||||
state.last_frame_no = timestamp.mul_div_floor(fps_n, fps_d).unwrap().seconds();
|
||||
|
||||
gst::debug!(
|
||||
CAT,
|
||||
imp = self,
|
||||
"Initial skip to frame no {}",
|
||||
state.last_frame_no
|
||||
);
|
||||
}
|
||||
|
||||
let frame_no = (timestamp + duration.unwrap_or(gst::ClockTime::ZERO))
|
||||
.mul_div_round(fps_n, fps_d)
|
||||
.unwrap()
|
||||
.seconds();
|
||||
state.max_frame_no = frame_no;
|
||||
|
||||
let last_frame_no = state.last_frame_no;
|
||||
state
|
||||
.translator
|
||||
.generate(last_frame_no, frame_no, Lines::new_empty());
|
||||
self.generate(
|
||||
&mut state,
|
||||
timestamp,
|
||||
duration.unwrap_or(gst::ClockTime::ZERO),
|
||||
Lines::new_empty(),
|
||||
);
|
||||
let bufferlist = self.pop_bufferlist(&mut state);
|
||||
|
||||
drop(state);
|
||||
|
|
Loading…
Reference in a new issue