From c8ff422a42eac30517a7acde57ab84e55449f4e4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 26 Jun 2015 22:02:00 +0100 Subject: Fix missing subtitles in some cases. We were passing subtitles back from decoders to SubtitleDecoder using dcp::SubtitleStrings and relying on their storage of time to know when the subtitles were. These times are quantised (by the use of dcp::SubtitleString) and then compared with unquantised times (kept as ContentTime) in the main checking loop in SubtitleDecoder::get(). Fix this by storing periods as ContentTimePeriod as well as in the dcp::SubtitleStrings. --- src/lib/dcp_subtitle_decoder.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/lib/dcp_subtitle_decoder.cc') diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc index 3c7bffdda..bb2537fc4 100644 --- a/src/lib/dcp_subtitle_decoder.cc +++ b/src/lib/dcp_subtitle_decoder.cc @@ -54,7 +54,7 @@ DCPSubtitleDecoder::pass () list s; s.push_back (*_next); - text_subtitle (s); + text_subtitle (content_time_period (*_next), s); ++_next; return false; @@ -74,11 +74,7 @@ DCPSubtitleDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) c list d; for (list::const_iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) { - ContentTimePeriod period ( - ContentTime::from_seconds (i->in().as_seconds ()), - ContentTime::from_seconds (i->out().as_seconds ()) - ); - + ContentTimePeriod period = content_time_period (*i); if ((starting && p.contains (period.from)) || (!starting && p.overlaps (period))) { d.push_back (period); } @@ -87,3 +83,11 @@ DCPSubtitleDecoder::text_subtitles_during (ContentTimePeriod p, bool starting) c return d; } +ContentTimePeriod +DCPSubtitleDecoder::content_time_period (dcp::SubtitleString s) const +{ + return ContentTimePeriod ( + ContentTime::from_seconds (s.in().as_seconds ()), + ContentTime::from_seconds (s.out().as_seconds ()) + ); +} -- cgit v1.2.3