diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-10-10 23:55:59 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-10-10 23:55:59 +0100 |
| commit | 338843002c42629dd42520db510823b9c6c0e64d (patch) | |
| tree | bbf4a439c3cbb354202ff3dd1ff1b652ad7cb0da /src/lib/dcp_decoder.cc | |
| parent | c7e9b9a5c9d39e703fcd98b0bfdba2197a34108d (diff) | |
Fix failure of DCPDecoder::text_subtitles_during to account for reels.
Diffstat (limited to 'src/lib/dcp_decoder.cc')
| -rw-r--r-- | src/lib/dcp_decoder.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc index 156fba101..5d73a9bbf 100644 --- a/src/lib/dcp_decoder.cc +++ b/src/lib/dcp_decoder.cc @@ -251,27 +251,32 @@ DCPDecoder::text_subtitles_during (ContentTimePeriod period, bool starting) cons list<ContentTimePeriod> ctp; double const vfr = _dcp_content->active_video_frame_rate (); + int offset = 0; + BOOST_FOREACH (shared_ptr<dcp::Reel> r, _reels) { if (!r->main_subtitle ()) { + offset += r->main_picture()->duration(); continue; } int64_t const entry_point = r->main_subtitle()->entry_point (); list<dcp::SubtitleString> subs = r->main_subtitle()->asset()->subtitles_during ( - dcp::Time (period.from.seconds(), 1000) - dcp::Time (entry_point, vfr, vfr), - dcp::Time (period.to.seconds(), 1000) - dcp::Time (entry_point, vfr, vfr), + dcp::Time (period.from.seconds(), 1000) - dcp::Time (offset - entry_point, vfr, vfr), + dcp::Time (period.to.seconds(), 1000) - dcp::Time (offset - entry_point, vfr, vfr), starting ); BOOST_FOREACH (dcp::SubtitleString const & s, subs) { ctp.push_back ( ContentTimePeriod ( - ContentTime::from_seconds (s.in().as_seconds ()), - ContentTime::from_seconds (s.out().as_seconds ()) + ContentTime::from_seconds (s.in().as_seconds ()) + ContentTime::from_frames (offset - entry_point, vfr), + ContentTime::from_seconds (s.out().as_seconds ()) + ContentTime::from_frames (offset - entry_point, vfr) ) ); } + + offset += r->main_subtitle()->duration(); } return ctp; |
