Bump libdcp for macOS warning fix.
[libsub.git] / src / dcp_reader.cc
index 5784ad0fb52c4f23409865ecf863ff4c44ef0669..0c7a29a90aaa9d564f3f18932c00e305599fbd55 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #include <dcp/subtitle_string.h>
 #include <dcp/interop_subtitle_asset.h>
 #include <dcp/smpte_subtitle_asset.h>
-#include <boost/foreach.hpp>
 #include <boost/filesystem.hpp>
 
-using std::list;
-using std::cout;
-using std::string;
+using std::dynamic_pointer_cast;
 using std::exception;
+using std::make_shared;
 using std::shared_ptr;
+using std::string;
 using boost::optional;
-using std::dynamic_pointer_cast;
 using namespace sub;
 
 static Time
@@ -54,28 +52,28 @@ DCPReader::DCPReader (boost::filesystem::path file)
        string smpte_error;
 
        try {
-               sc.reset (new dcp::InteropSubtitleAsset (file));
+               sc = make_shared<dcp::InteropSubtitleAsset>(file);
        } catch (exception& e) {
                interop_error = e.what ();
        }
 
        if (!sc) {
                try {
-                       sc.reset (new dcp::SMPTESubtitleAsset (file));
+                       sc = make_shared<dcp::SMPTESubtitleAsset>(file);
                } catch (exception& e) {
                        smpte_error = e.what();
                }
        }
 
        if (!sc) {
-               throw DCPError (String::compose ("Could not read subtitles (%1 / %2)", interop_error, smpte_error));
+               throw DCPError(String::compose("Could not read subtitles (%1 / %2)", interop_error, smpte_error));
        }
 
 
-       BOOST_FOREACH (shared_ptr<dcp::Subtitle> i, sc->subtitles ()) {
+       for (auto i: sc->subtitles()) {
 
                /* We don't deal with image subs */
-               shared_ptr<dcp::SubtitleString> is = dynamic_pointer_cast<dcp::SubtitleString>(i);
+               auto is = dynamic_pointer_cast<const dcp::SubtitleString>(i);
                if (!is) {
                        continue;
                }
@@ -86,10 +84,10 @@ DCPReader::DCPReader (boost::filesystem::path file)
                rs.font_size = FontSize::from_proportional (is->size() / (72.0 * 11.0));
 
                switch (is->effect ()) {
-               case dcp::BORDER:
+               case dcp::Effect::BORDER:
                        rs.effect = BORDER;
                        break;
-               case dcp::SHADOW:
+               case dcp::Effect::SHADOW:
                        rs.effect = SHADOW;
                        break;
                default:
@@ -104,26 +102,26 @@ DCPReader::DCPReader (boost::filesystem::path file)
                rs.underline = is->underline ();
 
                switch (is->h_align()) {
-               case dcp::HALIGN_LEFT:
+               case dcp::HAlign::LEFT:
                        rs.horizontal_position.reference = LEFT_OF_SCREEN;
                        break;
-               case dcp::HALIGN_CENTER:
+               case dcp::HAlign::CENTER:
                        rs.horizontal_position.reference = HORIZONTAL_CENTRE_OF_SCREEN;
                        break;
-               case dcp::HALIGN_RIGHT:
+               case dcp::HAlign::RIGHT:
                        rs.horizontal_position.reference = RIGHT_OF_SCREEN;
                        break;
                }
 
                rs.vertical_position.proportional = is->v_position();
                switch (is->v_align()) {
-               case dcp::VALIGN_TOP:
+               case dcp::VAlign::TOP:
                        rs.vertical_position.reference = TOP_OF_SCREEN;
                        break;
-               case dcp::VALIGN_CENTER:
+               case dcp::VAlign::CENTER:
                        rs.vertical_position.reference = VERTICAL_CENTRE_OF_SCREEN;
                        break;
-               case dcp::VALIGN_BOTTOM:
+               case dcp::VAlign::BOTTOM:
                        rs.vertical_position.reference = BOTTOM_OF_SCREEN;
                        break;
                }