*/
-#include <iostream>
-#include <boost/filesystem.hpp>
-#include <getopt.h>
#include "dcp.h"
#include "exceptions.h"
#include "common.h"
+#include "mxf.h"
+#include <getopt.h>
+#include <boost/filesystem.hpp>
+#include <iostream>
using namespace std;
using namespace boost;
<< " --cpl-annotation-texts allow differing CPL annotation texts\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"
+ << " --key hexadecimal key to use to decrypt MXFs\n"
<< " -k, --keep-going carry on in the event of errors, if possible\n"
<< " --ignore-missing-assets ignore missing asset files\n"
<< "\n"
}
DCP *
-load_dcp (boost::filesystem::path path, bool keep_going, bool ignore_missing_assets)
+load_dcp (boost::filesystem::path path, bool keep_going, bool ignore_missing_assets, optional<string> key)
{
DCP* dcp = 0;
try {
for (DCP::ReadErrors::const_iterator i = errors.begin(); i != errors.end(); ++i) {
cerr << (*i)->what() << "\n";
}
+
+ if (key) {
+ list<shared_ptr<Asset> > assets = dcp->assets ();
+ for (list<shared_ptr<Asset> >::const_iterator i = assets.begin(); i != assets.end(); ++i) {
+ shared_ptr<MXF> mxf = dynamic_pointer_cast<MXF> (*i);
+ if (mxf) {
+ mxf->set_key (Key (key.get ()));
+ }
+ }
+ }
+
} catch (FileError& e) {
cerr << "Could not read DCP " << path.string() << "; " << e.what() << " " << e.filename() << "\n";
exit (EXIT_FAILURE);
options.reel_hashes_can_differ = true;
bool keep_going = false;
bool ignore_missing_assets = false;
+ optional<string> key;
int option_index = 0;
while (1) {
/* From here we're using random capital letters for the short option */
{ "ignore-missing-assets", no_argument, 0, 'A'},
{ "cpl-annotation-texts", no_argument, 0, 'C'},
+ { "key", no_argument, 0, 'D'},
{ 0, 0, 0, 0 }
};
- int c = getopt_long (argc, argv, "Vhvnm:s:kA", long_options, &option_index);
+ int c = getopt_long (argc, argv, "Vhvnm:s:kACD", long_options, &option_index);
if (c == -1) {
break;
case 'C':
options.cpl_annotation_texts_can_differ = true;
break;
+ case 'D':
+ key = optarg;
+ break;
}
}
exit (EXIT_FAILURE);
}
- DCP* a = load_dcp (argv[optind], keep_going, ignore_missing_assets);
- DCP* b = load_dcp (argv[optind + 1], keep_going, ignore_missing_assets);
+ DCP* a = load_dcp (argv[optind], keep_going, ignore_missing_assets, key);
+ DCP* b = load_dcp (argv[optind + 1], keep_going, ignore_missing_assets, key);
/* 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;