Add new write() method.
[libdcp.git] / tools / dcprecover.cc
index caf0e0fe753fca1e49067a1236c44bd2efac7cb0..f9e08087ad6873844d4d3c1fd307ab0c9d4d7d6e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
 #include <getopt.h>
 #include <libxml++/libxml++.h>
 #include <boost/filesystem.hpp>
-#include <boost/foreach.hpp>
 #include <iostream>
 
 using std::cerr;
 using std::cout;
 using std::string;
-using std::list;
-using boost::shared_ptr;
+using std::shared_ptr;
+using std::vector;
 using boost::optional;
 
 static void
@@ -65,6 +64,8 @@ void progress (float f)
 int
 main (int argc, char* argv[])
 {
+       dcp::init ();
+
        int option_index = 0;
        optional<boost::filesystem::path> output;
        while (true) {
@@ -100,14 +101,14 @@ main (int argc, char* argv[])
        /* Try to read it and report errors */
 
        dcp::DCP dcp (dcp_dir);
-       list<dcp::VerificationNote> notes;
+       vector<dcp::VerificationNote> notes;
        try {
                dcp.read (&notes, true);
        } catch (dcp::ReadError& e) {
                cout << "Error:" <<  e.what() << "\n";
        }
 
-       BOOST_FOREACH (dcp::VerificationNote i, notes) {
+       for (auto i: notes) {
                cout << "Error: " << dcp::note_to_string(i) << "\n";
        }
 
@@ -135,7 +136,7 @@ main (int argc, char* argv[])
                }
 
                /* Read all MXF assets */
-               list<shared_ptr<dcp::Asset> > assets;
+               vector<shared_ptr<dcp::Asset>> assets;
                for (boost::filesystem::directory_iterator i(dcp_dir); i != boost::filesystem::directory_iterator(); ++i) {
                        if (i->path().extension() == ".mxf") {
                                try {
@@ -154,7 +155,7 @@ main (int argc, char* argv[])
                dcp::DCP fixed (*output);
                fixed.add (cpl);
                fixed.resolve_refs (assets);
-               fixed.write_xml (dcp::INTEROP);
+               fixed.write_xml (dcp::Standard::INTEROP);
                cout << "Fixed XML files written to " << output->string() << "\n";
        }