2 #include <boost/filesystem.hpp>
5 #include "exceptions.h"
11 static bool verbose = false;
16 cerr << "Syntax: " << n << " [OPTION] <DCP> <DCP>\n"
17 << " -V, --version show libdcp version\n"
18 << " -h, --help show this help\n"
19 << " -v, --verbose be verbose\n"
20 << " -n, --names allow differing MXF names\n"
21 << " -m, --mean-pixel maximum allowed mean pixel error (default 5)\n"
22 << " -s, --std-dev-pixel maximum allowed standard deviation of pixel error (default 5)\n"
24 << "The <DCP>s are the DCP directories to compare.\n"
25 << "Comparison is of metadata and content, ignoring timestamps\n"
26 << "and differing UUIDs.\n";
30 note (NoteType t, string n)
32 if (t == ERROR || verbose) {
33 cout << " " << n << "\n";
38 main (int argc, char* argv[])
40 EqualityOptions options;
41 options.max_mean_pixel_error = 5;
42 options.max_std_dev_pixel_error = 5;
46 static struct option long_options[] = {
47 { "version", no_argument, 0, 'V'},
48 { "help", no_argument, 0, 'h'},
49 { "verbose", no_argument, 0, 'v'},
50 { "names", no_argument, 0, 'n'},
51 { "mean-pixel", required_argument, 0, 'm'},
52 { "std-dev-pixel", required_argument, 0, 's'},
56 int c = getopt_long (argc, argv, "Vhvnm:s:", long_options, &option_index);
64 cout << "dcpdiff version " << LIBDCP_VERSION << "\n";
73 options.mxf_names_can_differ = true;
76 options.max_mean_pixel_error = atof (optarg);
79 options.max_std_dev_pixel_error = atof (optarg);
84 if (argc <= optind || argc > (optind + 2)) {
89 if (!filesystem::exists (argv[optind])) {
90 cerr << argv[0] << ": DCP " << argv[optind] << " not found.\n";
94 if (!filesystem::exists (argv[optind + 1])) {
95 cerr << argv[0] << ": DCP " << argv[optind + 1] << " not found.\n";
101 a = new DCP (argv[optind]);
103 } catch (FileError& e) {
104 cerr << "Could not read DCP " << argv[optind] << "; " << e.what() << " " << e.filename() << "\n";
110 b = new DCP (argv[optind + 1]);
112 } catch (FileError& e) {
113 cerr << "Could not read DCP " << argv[optind + 1] << "; " << e.what() << " " << e.filename() << "\n";
117 /* I think this is just below the LSB at 16-bits (ie the 8th most significant bit at 24-bit) */
118 options.max_audio_sample_error = 255;
120 bool const equals = a->equals (*b, options, boost::bind (note, _1, _2));