BOOST_FOREACH.
[dcpomatic.git] / src / lib / subtitle_encoder.cc
index 1ef7fcd9469b0d6b70b4b6750dcbd96f0b1fe120..cc42f1204e78c860b21e0ba623b494def2ed3124 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2019-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -18,7 +18,7 @@
 
 */
 
-#include "font.h"
+#include "font_data.h"
 #include "subtitle_encoder.h"
 #include "player.h"
 #include "compose.hpp"
@@ -26,9 +26,8 @@
 #include <dcp/interop_subtitle_asset.h>
 #include <dcp/raw_convert.h>
 #include <dcp/smpte_subtitle_asset.h>
-#include <boost/shared_ptr.hpp>
 #include <boost/filesystem.hpp>
-#include <boost/bind.hpp>
+#include <boost/bind/bind.hpp>
 
 #include "i18n.h"
 
@@ -36,8 +35,11 @@ using std::string;
 using std::make_pair;
 using std::pair;
 using std::vector;
-using boost::shared_ptr;
+using std::shared_ptr;
 using boost::optional;
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
 using dcp::raw_convert;
 
 /** @param output Directory, if there will be multiple output files, or a filename.
@@ -75,9 +77,11 @@ SubtitleEncoder::SubtitleEncoder (shared_ptr<const Film> film, shared_ptr<Job> j
                _assets.push_back (make_pair(shared_ptr<dcp::SubtitleAsset>(), boost::filesystem::change_extension(filename, extension)));
        }
 
-       BOOST_FOREACH (dcpomatic::DCPTimePeriod i, film->reels()) {
+       for (auto i: film->reels()) {
                _reels.push_back (i);
        }
+
+       _default_font = dcp::ArrayData (default_font_file());
 }
 
 void
@@ -111,8 +115,8 @@ SubtitleEncoder::go ()
                }
 
                if (!_film->interop() || _include_font) {
-                       BOOST_FOREACH (shared_ptr<dcpomatic::Font> j, _player->get_subtitle_fonts()) {
-                               i->first->add_font (j->id(), default_font_file());
+                       for (auto j: _player->get_subtitle_fonts()) {
+                               i->first->add_font (j.id, _default_font);
                        }
                }
 
@@ -158,7 +162,7 @@ SubtitleEncoder::text (PlayerText subs, TextType type, optional<DCPTextTrack> tr
                }
        }
 
-       BOOST_FOREACH (StringText i, subs.string) {
+       for (auto i: subs.string) {
                /* XXX: couldn't / shouldn't we use period here rather than getting time from the subtitle? */
                i.set_in  (i.in());
                i.set_out (i.out());