X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Factive_text.cc;h=3a7e1a27ebeff7a43e63877e65416fc82b102bb0;hb=4b7185e4eda53534c4d71a1f31ba33ca3dd8dc8d;hp=5f4440728f338e4ca068c8c23846ca93493c18d2;hpb=0a5e92450ae992e9ed24026dd60ae351d0a3e60b;p=dcpomatic.git diff --git a/src/lib/active_text.cc b/src/lib/active_text.cc index 5f4440728..3a7e1a27e 100644 --- a/src/lib/active_text.cc +++ b/src/lib/active_text.cc @@ -29,38 +29,7 @@ using std::make_pair; 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; -} +using namespace dcpomatic; /** Get the open captions that should be burnt into a given period. * @param period Period of interest. @@ -85,7 +54,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;