From 3a7b6acdb993864f319a6ceb3bc4c3fb7d4aaefd Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 5 Aug 2018 01:15:45 +0100 Subject: Get closed caption view data from the butler, rather than the player. You can't introduce the butler (so that the player is ahead of time) and then ask the player what should be in the frame that is being displayed "now"; the player will already have moved on. --- src/lib/active_text.cc | 40 +++++++--------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) (limited to 'src/lib/active_text.cc') diff --git a/src/lib/active_text.cc b/src/lib/active_text.cc index 5f4440728..2988c04a3 100644 --- a/src/lib/active_text.cc +++ b/src/lib/active_text.cc @@ -30,38 +30,6 @@ using boost::weak_ptr; using boost::shared_ptr; using boost::optional; -void -ActiveText::add (DCPTimePeriod period, list& pc, list p) const -{ - BOOST_FOREACH (Period i, p) { - DCPTimePeriod test (i.from, i.to.get_value_or(DCPTime::max())); - optional overlap = period.overlap (test); - if (overlap && overlap->duration() > DCPTime(period.duration().get() / 2)) { - pc.push_back (i.subs); - } - } -} - -list -ActiveText::get (DCPTimePeriod period) const -{ - boost::mutex::scoped_lock lm (_mutex); - - list ps; - - for (Map::const_iterator i = _data.begin(); i != _data.end(); ++i) { - - shared_ptr caption = i->first.lock (); - if (!caption || !caption->use()) { - continue; - } - - add (period, ps, i->second); - } - - return ps; -} - /** Get the open captions that should be burnt into a given period. * @param period Period of interest. * @param always_burn_captions Always burn captions even if their content is not set to burn. @@ -85,7 +53,13 @@ ActiveText::get_burnt (DCPTimePeriod period, bool always_burn_captions) const continue; } - add (period, ps, i->second); + BOOST_FOREACH (Period j, i->second) { + DCPTimePeriod test (j.from, j.to.get_value_or(DCPTime::max())); + optional overlap = period.overlap (test); + if (overlap && overlap->duration() > DCPTime(period.duration().get() / 2)) { + ps.push_back (j.subs); + } + } } return ps; -- cgit v1.2.3