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 << " -h, --help show this help\n"
19 << "The <DCP>s are the DCP directories to compare.\n"
20 << "Default is to compare metadata and content ignoring timestamps\n"
21 << "and differing UUIDs. Pass -b to perform a bitwise comparison.\n";
25 main (int argc, char* argv[])
31 static struct option long_options[] = {
32 { "bitwise", no_argument, 0, 'b'},
33 { "version", no_argument, 0, 'v'},
34 { "help", no_argument, 0, 'h'},
38 int c = getopt_long (argc, argv, "bvh", long_options, &option_index);
49 cout << "dcpdiff version " << LIBDCP_VERSION << "\n";
57 if (argc <= optind || argc > (optind + 2)) {
62 if (!filesystem::exists (argv[optind])) {
63 cerr << argv[0] << ": DCP " << argv[optind] << " not found.\n";
67 if (!filesystem::exists (argv[optind + 1])) {
68 cerr << argv[0] << ": DCP " << argv[optind + 1] << " not found.\n";
74 a = new DCP (argv[optind]);
75 } catch (FileError& e) {
76 cerr << "Could not read DCP " << argv[optind] << "; " << e.what() << " " << e.filename() << "\n";
82 b = new DCP (argv[optind + 1]);
83 } catch (FileError& e) {
84 cerr << "Could not read DCP " << argv[optind + 1] << "; " << e.what() << " " << e.filename() << "\n";
88 EqualityFlags flags = EqualityFlags (LIBDCP_METADATA | MXF_INSPECT);
90 flags = EqualityFlags (flags | MXF_BITWISE);
93 list<string> notes = a->equals (*b, flags);
95 cout << "DCPs identical\n";
99 for (list<string>::iterator i = notes.begin(); i != notes.end(); ++i) {
100 cout << " " << *i << "\n";