Missing read() calls in dcpdiff.
[libdcp.git] / tools / dcpdiff.cc
index 9d4243331a215a638f5ed3ef4e0e6507ea584423..6141b8ff2e45bd168005bf4c3d8433d3f762939c 100644 (file)
@@ -14,17 +14,20 @@ help (string n)
        cerr << "Syntax: " << n << " [OPTION] <DCP> <DCP>\n"
             << "  -b, --bitwise      bitwise check\n"
             << "  -v, --version      show libdcp version\n"
+            << "  -d, --verbose      be verbose\n"
             << "  -h, --help         show this help\n"
             << "\n"
             << "The <DCP>s are the DCP directories to compare.\n"
-            << "Default is to compare metadata and content ignoring timestamps\n"
+            << "Default is to compare metadata and content, ignoring timestamps\n"
             << "and differing UUIDs.  Pass -b to perform a bitwise comparison.\n";
 }
 
 int
 main (int argc, char* argv[])
 {
-       bool bitwise = false;
+       EqualityOptions options;
+       options.flags = EqualityFlags (LIBDCP_METADATA | MXF_INSPECT);
+       options.verbose = false;
        
        int option_index = 0;
        while (1) {
@@ -32,10 +35,11 @@ main (int argc, char* argv[])
                        { "bitwise", no_argument, 0, 'b'},
                        { "version", no_argument, 0, 'v'},
                        { "help", no_argument, 0, 'h'},
+                       { "verbose", no_argument, 0, 'd'},
                        { 0, 0, 0, 0 }
                };
 
-               int c = getopt_long (argc, argv, "bvh", long_options, &option_index);
+               int c = getopt_long (argc, argv, "bvhd", long_options, &option_index);
 
                if (c == -1) {
                        break;
@@ -43,7 +47,7 @@ main (int argc, char* argv[])
 
                switch (c) {
                case 'b':
-                       bitwise = true;
+                       options.flags = EqualityFlags (options.flags | MXF_BITWISE);
                        break;
                case 'v':
                        cout << "dcpdiff version " << LIBDCP_VERSION << "\n";
@@ -51,6 +55,9 @@ main (int argc, char* argv[])
                case 'h':
                        help (argv[0]);
                        exit (EXIT_SUCCESS);
+               case 'd':
+                       options.verbose = true;
+                       break;
                }
        }
 
@@ -72,6 +79,7 @@ main (int argc, char* argv[])
        DCP* a = 0;
        try {
                a = new DCP (argv[optind]);
+               a->read ();
        } catch (FileError& e) {
                cerr << "Could not read DCP " << argv[optind] << "; " << e.what() << " " << e.filename() << "\n";
                exit (EXIT_FAILURE);
@@ -80,19 +88,18 @@ main (int argc, char* argv[])
        DCP* b = 0;
        try {
                b = new DCP (argv[optind + 1]);
+               b->read ();
        } catch (FileError& e) {
                cerr << "Could not read DCP " << argv[optind + 1] << "; " << e.what() << " " << e.filename() << "\n";
                exit (EXIT_FAILURE);
        }
 
-       EqualityFlags flags = EqualityFlags (LIBDCP_METADATA | MXF_INSPECT);
-       if (bitwise) {
-               flags = EqualityFlags (flags | MXF_BITWISE);
-       }
+       options.max_mean_pixel_error = 5;
+       options.max_std_dev_pixel_error = 5;
 
-       list<string> notes = a->equals (*b, flags);
+       list<string> notes = a->equals (*b, options);
        if (notes.empty ()) {
-               cout << "DCPs identical\n";
+               cout << "DCPs equal\n";
                exit (EXIT_SUCCESS);
        }