Header guards.
[libdcp.git] / tools / dcpdiff.cc
index 7913c533e22ee4b7a44384616290934fc6124c9a..b361b93a35a1771b8f8c3b0a8065a5e528f1635c 100644 (file)
@@ -14,9 +14,12 @@ static void
 help (string n)
 {
        cerr << "Syntax: " << n << " [OPTION] <DCP> <DCP>\n"
-            << "  -V, --version      show libdcp version\n"
-            << "  -h, --help         show this help\n"
-            << "  -v, --verbose      be verbose\n"
+            << "  -V, --version        show libdcp version\n"
+            << "  -h, --help           show this help\n"
+            << "  -v, --verbose        be verbose\n"
+            << "  -n, --names          allow differing MXF names\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"
             << "\n"
             << "The <DCP>s are the DCP directories to compare.\n"
             << "Comparison is of metadata and content, ignoring timestamps\n"
@@ -26,7 +29,7 @@ help (string n)
 void
 note (NoteType t, string n)
 {
-       if (t == ERROR || (t == PROGRESS && verbose)) {
+       if (t == ERROR || verbose) {
                cout << " " << n << "\n";
        }
 }
@@ -35,6 +38,8 @@ int
 main (int argc, char* argv[])
 {
        EqualityOptions options;
+       options.max_mean_pixel_error = 5;
+       options.max_std_dev_pixel_error = 5;
        
        int option_index = 0;
        while (1) {
@@ -42,10 +47,13 @@ main (int argc, char* argv[])
                        { "version", no_argument, 0, 'V'},
                        { "help", no_argument, 0, 'h'},
                        { "verbose", no_argument, 0, 'v'},
+                       { "names", no_argument, 0, 'n'},
+                       { "mean-pixel", required_argument, 0, 'm'},
+                       { "std-dev-pixel", required_argument, 0, 's'},
                        { 0, 0, 0, 0 }
                };
 
-               int c = getopt_long (argc, argv, "Vhv", long_options, &option_index);
+               int c = getopt_long (argc, argv, "Vhvnm:s:", long_options, &option_index);
 
                if (c == -1) {
                        break;
@@ -61,6 +69,15 @@ main (int argc, char* argv[])
                case 'v':
                        verbose = true;
                        break;
+               case 'n':
+                       options.mxf_names_can_differ = true;
+                       break;
+               case 'm':
+                       options.max_mean_pixel_error = atof (optarg);
+                       break;
+               case 's':
+                       options.max_std_dev_pixel_error = atof (optarg);
+                       break;
                }
        }
 
@@ -97,8 +114,6 @@ main (int argc, char* argv[])
                exit (EXIT_FAILURE);
        }
 
-       options.max_mean_pixel_error = 5;
-       options.max_std_dev_pixel_error = 5;
        /* 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;