From e3636c080d3d24471e85f519d69af4c11d5ecbd0 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 31 Jul 2012 12:41:33 +0100 Subject: Check sound; various fixups. --- tools/dcpdiff.cc | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'tools/dcpdiff.cc') diff --git a/tools/dcpdiff.cc b/tools/dcpdiff.cc index 9dd488ed..df5eb3d0 100644 --- a/tools/dcpdiff.cc +++ b/tools/dcpdiff.cc @@ -1,7 +1,10 @@ +#include #include #include "dcp.h" +#include "exceptions.h" using namespace std; +using namespace boost; using namespace libdcp; static void @@ -55,15 +58,38 @@ main (int argc, char* argv[]) exit (EXIT_FAILURE); } - DCP a (argv[optind]); - DCP b (argv[optind + 1]); + if (!filesystem::exists (argv[optind])) { + cerr << argv[0] << ": DCP " << argv[optind] << " not found.\n"; + exit (EXIT_FAILURE); + } + + if (!filesystem::exists (argv[optind + 1])) { + cerr << argv[0] << ": DCP " << argv[optind + 1] << " not found.\n"; + exit (EXIT_FAILURE); + } + + DCP* a = 0; + try { + a = new DCP (argv[optind]); + } catch (FileError& e) { + cerr << "Could not read DCP " << argv[optind] << "; " << e.what() << " " << e.filename() << "\n"; + exit (EXIT_FAILURE); + } + + DCP* b = 0; + try { + b = new DCP (argv[optind + 1]); + } 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); } - list notes = a.equals (b, flags); + list notes = a->equals (*b, flags); if (notes.empty ()) { cout << "DCPs identical\n"; exit (EXIT_SUCCESS); -- cgit v1.2.3