Fix build with newer FFmpeg.
[dcpomatic.git] / src / lib / active_text.cc
index 5f4440728f338e4ca068c8c23846ca93493c18d2..1180ce7b0bc42f3c6b1deb7ef1fb0fdbb789eecd 100644 (file)
 
 */
 
+
 #include "active_text.h"
 #include "text_content.h"
-#include <boost/shared_ptr.hpp>
-#include <boost/weak_ptr.hpp>
+
 
 using std::list;
 using std::pair;
 using std::make_pair;
-using boost::weak_ptr;
-using boost::shared_ptr;
+using std::weak_ptr;
+using std::shared_ptr;
 using boost::optional;
-
-void
-ActiveText::add (DCPTimePeriod period, list<PlayerText>& pc, list<Period> p) const
-{
-       BOOST_FOREACH (Period i, p) {
-               DCPTimePeriod test (i.from, i.to.get_value_or(DCPTime::max()));
-               optional<DCPTimePeriod> overlap = period.overlap (test);
-               if (overlap && overlap->duration() > DCPTime(period.duration().get() / 2)) {
-                       pc.push_back (i.subs);
-               }
-       }
-}
-
-list<PlayerText>
-ActiveText::get (DCPTimePeriod period) const
-{
-       boost::mutex::scoped_lock lm (_mutex);
-
-       list<PlayerText> ps;
-
-       for (Map::const_iterator i = _data.begin(); i != _data.end(); ++i) {
-
-               shared_ptr<const TextContent> 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);
+               for (auto j: i->second) {
+                       DCPTimePeriod test (j.from, j.to.get_value_or(DCPTime::max()));
+                       optional<DCPTimePeriod> overlap = period.overlap (test);
+                       if (overlap && overlap->duration() > DCPTime(period.duration().get() / 2)) {
+                               ps.push_back (j.subs);
+                       }
+               }
        }
 
        return ps;
@@ -102,7 +77,7 @@ ActiveText::clear_before (DCPTime time)
        Map updated;
        for (Map::const_iterator i = _data.begin(); i != _data.end(); ++i) {
                list<Period> as;
-               BOOST_FOREACH (Period j, i->second) {
+               for (auto j: i->second) {
                        if (!j.to || j.to.get() >= time) {
                                as.push_back (j);
                        }
@@ -144,7 +119,7 @@ ActiveText::add_to (weak_ptr<const TextContent> content, DCPTime to)
 
        _data[content].back().to = to;
 
-       BOOST_FOREACH (StringText& i, _data[content].back().subs.string) {
+       for (auto& i: _data[content].back().subs.string) {
                i.set_out (dcp::Time(to.seconds(), 1000));
        }