diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-07-31 00:32:58 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-07-31 00:32:58 +0100 |
| commit | 4678bf06d71c8a18c489912dabf8aca312ab8b6b (patch) | |
| tree | 00ad12122fa34cb38182091f0e853761d104a902 /tools/dcpdiff.cc | |
| parent | fe3476307bead95b72efc7d47a2ce3da31c35d88 (diff) | |
Barely-functional dcpdiff.
Diffstat (limited to 'tools/dcpdiff.cc')
| -rw-r--r-- | tools/dcpdiff.cc | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/tools/dcpdiff.cc b/tools/dcpdiff.cc index b503ee1a..840a1b3e 100644 --- a/tools/dcpdiff.cc +++ b/tools/dcpdiff.cc @@ -1,10 +1,63 @@ +#include <getopt.h> #include "dcp.h" +using namespace std; using namespace libdcp; +static void +help (string n) +{ + cerr << "Syntax: " << n << " [OPTION] <DCP> <DCP>\n" + << " -v, --version show DVD-o-matic version\n" + << " -h, --help show this help\n" + << "\n" + << "The <DCP>s are the DCP directories to compare.\n"; +} + int main (int argc, char* argv[]) { - DCP dcp ("/home/carl/src/dvdomatic-test/reference/dolby_aurora.vob/dolby_aurora.vob"); - return 0; + int option_index = 0; + while (1) { + static struct option long_options[] = { + { "version", no_argument, 0, 'v'}, + { "help", no_argument, 0, 'h'}, + { 0, 0, 0, 0 } + }; + + int c = getopt_long (argc, argv, "vh", long_options, &option_index); + + if (c == -1) { + break; + } + + switch (c) { + case 'v': + cout << "dcpdiff version " << LIBDCP_VERSION << "\n"; + exit (EXIT_SUCCESS); + case 'h': + help (argv[0]); + exit (EXIT_SUCCESS); + } + } + + if (argc <= optind || argc > (optind + 2)) { + help (argv[0]); + exit (EXIT_FAILURE); + } + + DCP a (argv[optind]); + DCP b (argv[optind + 1]); + + list<string> notes = a.equals (b, LIBDCP_METADATA); + if (notes.empty ()) { + cout << "DCPs identical by LIBDCP_METADATA\n"; + exit (EXIT_SUCCESS); + } + + for (list<string>::iterator i = notes.begin(); i != notes.end(); ++i) { + cout << " " << *i << "\n"; + } + + exit (EXIT_FAILURE); } |
