2 #include <boost/filesystem.hpp>
5 #include "exceptions.h"
9 using namespace libdcp;
14 cerr << "Syntax: " << n << " [OPTION] <DCP> <DCP>\n"
15 << " -b, --bitwise bitwise check\n"
16 << " -v, --version show libdcp version\n"
17 << " -d, --verbose be verbose\n"
18 << " -h, --help show this help\n"
20 << "The <DCP>s are the DCP directories to compare.\n"
21 << "Default is to compare metadata and content ignoring timestamps\n"
22 << "and differing UUIDs. Pass -b to perform a bitwise comparison.\n";
26 main (int argc, char* argv[])
28 EqualityOptions options;
29 options.flags = EqualityFlags (LIBDCP_METADATA | MXF_INSPECT);
30 options.verbose = false;
34 static struct option long_options[] = {
35 { "bitwise", no_argument, 0, 'b'},
36 { "version", no_argument, 0, 'v'},
37 { "help", no_argument, 0, 'h'},
38 { "verbose", no_argument, 0, 'd'},
42 int c = getopt_long (argc, argv, "bvhd", long_options, &option_index);
50 options.flags = EqualityFlags (options.flags | MXF_BITWISE);
53 cout << "dcpdiff version " << LIBDCP_VERSION << "\n";
59 options.verbose = true;
64 if (argc <= optind || argc > (optind + 2)) {
69 if (!filesystem::exists (argv[optind])) {
70 cerr << argv[0] << ": DCP " << argv[optind] << " not found.\n";
74 if (!filesystem::exists (argv[optind + 1])) {
75 cerr << argv[0] << ": DCP " << argv[optind + 1] << " not found.\n";
81 a = new DCP (argv[optind]);
82 } catch (FileError& e) {
83 cerr << "Could not read DCP " << argv[optind] << "; " << e.what() << " " << e.filename() << "\n";
89 b = new DCP (argv[optind + 1]);
90 } catch (FileError& e) {
91 cerr << "Could not read DCP " << argv[optind + 1] << "; " << e.what() << " " << e.filename() << "\n";
95 options.max_mean_pixel_error = 5;
96 options.max_std_dev_pixel_error = 5;
98 list<string> notes = a->equals (*b, options);
100 cout << "DCPs equal\n";
104 for (list<string>::iterator i = notes.begin(); i != notes.end(); ++i) {
105 cout << " " << *i << "\n";