Merge remote-tracking branch 'origin/main' into v1.9.x
[libdcp.git] / tools / dcpinfo.cc
index aa1ce8c2425f8e1167991a83c4794f3f787ec5b4..e812afe40775161afc2c1370a951bb4b56ea2b92 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
     files in the program, then also delete it here.
 */
 
+
+#include "common.h"
+#include "compose.hpp"
+#include "cpl.h"
 #include "dcp.h"
+#include "decrypted_kdm.h"
+#include "encrypted_kdm.h"
 #include "exceptions.h"
-#include "reel.h"
-#include "sound_asset.h"
+#include "filesystem.h"
+#include "interop_subtitle_asset.h"
+#include "mono_picture_asset.h"
 #include "picture_asset.h"
-#include "subtitle_asset.h"
+#include "reel.h"
 #include "reel_picture_asset.h"
 #include "reel_sound_asset.h"
 #include "reel_subtitle_asset.h"
-#include "subtitle_string.h"
-#include "subtitle_image.h"
-#include "interop_subtitle_asset.h"
 #include "smpte_subtitle_asset.h"
-#include "mono_picture_asset.h"
-#include "encrypted_kdm.h"
-#include "decrypted_kdm.h"
-#include "cpl.h"
-#include "common.h"
-#include "compose.hpp"
+#include "sound_asset.h"
+#include "subtitle_asset.h"
+#include "subtitle_image.h"
+#include "subtitle_string.h"
 #include <getopt.h>
 #include <boost/filesystem.hpp>
-#include <boost/foreach.hpp>
 #include <boost/algorithm/string.hpp>
 #include <iostream>
 #include <cstdlib>
 #include <sstream>
 #include <inttypes.h>
 
-using std::string;
+
 using std::cerr;
 using std::cout;
+using std::dynamic_pointer_cast;
+using std::exception;
 using std::list;
-using std::pair;
-using std::min;
 using std::max;
-using std::exception;
-using std::vector;
-using std::stringstream;
+using std::min;
+using std::pair;
 using std::shared_ptr;
-using std::dynamic_pointer_cast;
+using std::string;
+using std::stringstream;
+using std::vector;
 using boost::optional;
 using namespace dcp;
 
+
 static void
 help (string n)
 {
@@ -143,7 +146,7 @@ main_picture (vector<string> const& only, shared_ptr<Reel> reel, bool analyse, b
                OUTPUT_PICTURE(
                        " duration %1 (%2) intrinsic %3",
                        *mp->duration(),
-                       dcp::Time(*mp->duration(), mp->frame_rate().as_float(), mp->frame_rate().as_float()).as_string(dcp::SMPTE),
+                       dcp::Time(*mp->duration(), mp->frame_rate().as_float(), mp->frame_rate().as_float()).as_string(dcp::Standard::SMPTE),
                        mp->intrinsic_duration()
                        );
        } else {
@@ -316,7 +319,7 @@ main (int argc, char* argv[])
 
                switch (c) {
                case 'v':
-                       cout << "libdcp version " << LIBDCP_VERSION << "\n";
+                       cout << "libdcp version " << dcp::version << "\n";
                        exit (EXIT_SUCCESS);
                case 'h':
                        help (argv[0]);
@@ -350,7 +353,7 @@ main (int argc, char* argv[])
                exit (EXIT_FAILURE);
        }
 
-       if (!boost::filesystem::exists (argv[optind])) {
+       if (!filesystem::exists(argv[optind])) {
                cerr << argv[0] << ": DCP or CPL " << argv[optind] << " not found.\n";
                exit (EXIT_FAILURE);
        }
@@ -360,7 +363,7 @@ main (int argc, char* argv[])
                only = boost::split(only, *only_string, boost::is_any_of(","));
        }
 
-       vector<shared_ptr<CPL> > cpls;
+       vector<shared_ptr<CPL>> cpls;
        if (boost::filesystem::is_directory(argv[optind])) {
                DCP* dcp = 0;
                vector<dcp::VerificationNote> notes;
@@ -384,7 +387,7 @@ main (int argc, char* argv[])
                OUTPUT_DCP_PATH("DCP: %1\n", boost::filesystem::path(argv[optind]).string());
 
                dcp::filter_notes (notes, ignore_missing_assets);
-               BOOST_FOREACH (dcp::VerificationNote i, notes) {
+               for (auto i: notes) {
                        cerr << "Error: " << note_to_string(i) << "\n";
                }
 
@@ -396,11 +399,11 @@ main (int argc, char* argv[])
 
        dcp::Time total_time;
 
-       BOOST_FOREACH (shared_ptr<CPL> i, cpls) {
+       for (auto i: cpls) {
                OUTPUT_CPL_NAME_ID("  CPL: %1 %2\n", i->annotation_text().get_value_or(""), i->id());
 
                int R = 1;
-               BOOST_FOREACH (shared_ptr<Reel> j, i->reels()) {
+               for (auto j: i->reels()) {
                        if (should_output(only, "picture") || should_output(only, "sound") || should_output(only, "subtitle")) {
                                cout << "    Reel " << R << "\n";
                        }
@@ -433,7 +436,7 @@ main (int argc, char* argv[])
                }
        }
 
-       OUTPUT_TOTAL_TIME("Total: %1\n", total_time.as_string(dcp::SMPTE));
+       OUTPUT_TOTAL_TIME("Total: %1\n", total_time.as_string(dcp::Standard::SMPTE));
 
        return 0;
 }