summaryrefslogtreecommitdiff
path: root/tools/dcpdiff.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-12-06 10:47:04 +0100
committerCarl Hetherington <cth@carlh.net>2019-12-22 01:21:00 +0100
commit30dfa051113792305f9704d5a76ffaf57c21063d (patch)
tree4a4055b40bfb64ebf5b7509ef81a104db4a52e46 /tools/dcpdiff.cc
parent9cb23adda9ebe6a76992b68db78ccb638348dac1 (diff)
Use VerificationNote for non-fatal errors in DCP::read.
Diffstat (limited to 'tools/dcpdiff.cc')
-rw-r--r--tools/dcpdiff.cc26
1 files changed, 11 insertions, 15 deletions
diff --git a/tools/dcpdiff.cc b/tools/dcpdiff.cc
index 5e0560a0..976a2919 100644
--- a/tools/dcpdiff.cc
+++ b/tools/dcpdiff.cc
@@ -39,6 +39,7 @@
#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/filesystem.hpp>
+#include <boost/foreach.hpp>
#include <iostream>
#include <list>
@@ -67,7 +68,6 @@ help (string n)
<< " -m, --mean-pixel maximum allowed mean pixel error (default 5)\n"
<< " -s, --std-dev-pixel maximum allowed standard deviation of pixel error (default 5)\n"
<< " --key hexadecimal key to use to decrypt MXFs\n"
- << " -k, --keep-going carry on in the event of errors, if possible\n"
<< " --ignore-missing-assets ignore missing asset files\n"
<< "\n"
<< "The <DCP>s are the DCP directories to compare.\n"
@@ -84,17 +84,18 @@ note (NoteType t, string n)
}
}
+static
DCP *
-load_dcp (boost::filesystem::path path, bool keep_going, bool ignore_missing_assets, optional<string> key)
+load_dcp (boost::filesystem::path path, bool ignore_missing_assets, optional<string> key)
{
DCP* dcp = 0;
try {
dcp = new DCP (path);
- DCP::ReadErrors errors;
- dcp->read (keep_going, &errors);
- filter_errors (errors, ignore_missing_assets);
- for (DCP::ReadErrors::const_iterator i = errors.begin(); i != errors.end(); ++i) {
- cerr << (*i)->what() << "\n";
+ list<dcp::VerificationNote> notes;
+ dcp->read (&notes);
+ filter_notes (notes, ignore_missing_assets);
+ BOOST_FOREACH (dcp::VerificationNote i, notes) {
+ cerr << dcp::note_to_string(i) << "\n";
}
if (key) {
@@ -123,7 +124,6 @@ main (int argc, char* argv[])
options.max_std_dev_pixel_error = 5;
options.reel_hashes_can_differ = true;
options.reel_annotation_texts_can_differ = false;
- options.keep_going = false;
bool ignore_missing_assets = false;
optional<string> key;
@@ -135,7 +135,6 @@ main (int argc, char* argv[])
{ "verbose", no_argument, 0, 'v'},
{ "mean-pixel", required_argument, 0, 'm'},
{ "std-dev-pixel", required_argument, 0, 's'},
- { "keep-going", no_argument, 0, 'k'},
{ "annotation-texts", no_argument, 0, 'a'},
{ "issue-dates", no_argument, 0, 'd'},
/* From here we're using random capital letters for the short option */
@@ -146,7 +145,7 @@ main (int argc, char* argv[])
{ 0, 0, 0, 0 }
};
- int c = getopt_long (argc, argv, "Vhvm:s:kadACD:E", long_options, &option_index);
+ int c = getopt_long (argc, argv, "Vhvm:s:adACD:E", long_options, &option_index);
if (c == -1) {
break;
@@ -168,9 +167,6 @@ main (int argc, char* argv[])
case 's':
options.max_std_dev_pixel_error = atof (optarg);
break;
- case 'k':
- options.keep_going = true;
- break;
case 'a':
options.cpl_annotation_texts_can_differ = options.reel_annotation_texts_can_differ = true;
break;
@@ -208,8 +204,8 @@ main (int argc, char* argv[])
exit (EXIT_FAILURE);
}
- DCP* a = load_dcp (argv[optind], options.keep_going, ignore_missing_assets, key);
- DCP* b = load_dcp (argv[optind + 1], options.keep_going, ignore_missing_assets, key);
+ DCP* a = load_dcp (argv[optind], ignore_missing_assets, key);
+ DCP* b = load_dcp (argv[optind + 1], ignore_missing_assets, key);
/* I think this is just below the LSB at 16-bits (ie the 8th most significant bit at 24-bit) */
options.max_audio_sample_error = 255;