mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-10-31 22:58:51 +00:00
sccparse: Work around invalid drop-frame timecodes
Various SCC files have invalid drop frame timecodes. Every full minute the first two timecodes are skipped, except for every tenth minute, which means that e.g. "00:01:00;00" is not a valid timecode and the next valid timecode would be "00:01:00;02".
This commit is contained in:
parent
3b739530bf
commit
078bf81b85
1 changed files with 11 additions and 0 deletions
|
@ -109,6 +109,17 @@ fn parse_timecode(
|
|||
) -> Result<gst_video::ValidVideoTimeCode, gst::FlowError> {
|
||||
use std::convert::TryFrom;
|
||||
|
||||
let mut tc = tc.clone();
|
||||
// Workaround for various SCC files having invalid drop frame timecodes:
|
||||
// Every full minute the first two timecodes are skipped, except for every tenth minute.
|
||||
if tc.drop_frame
|
||||
&& tc.seconds == 0
|
||||
&& tc.minutes % 10 != 0
|
||||
&& (tc.frames == 0 || tc.frames == 1)
|
||||
{
|
||||
tc.frames = 2;
|
||||
}
|
||||
|
||||
let timecode = gst_video::VideoTimeCode::new(
|
||||
framerate,
|
||||
None,
|
||||
|
|
Loading…
Reference in a new issue