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:
Sebastian Dröge 2020-12-30 13:28:52 +02:00
parent 3b739530bf
commit 078bf81b85

View file

@ -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,