diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-06-04 14:37:43 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-06-04 14:37:43 +0200 |
| commit | a5bd2e9eeecccb1a64aa7f3ae936698fce78bea5 (patch) | |
| tree | 34136bd6b8dc487d578ded06da9d223424da910a /tools | |
| parent | e8c71ec28755e77bd6851b9ffd698794d214208a (diff) | |
Add option to ignore mismatched HMACs when reading MXFs.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/dcpdecryptmxf.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/dcpdecryptmxf.cc b/tools/dcpdecryptmxf.cc index cf8df735..4c615f99 100644 --- a/tools/dcpdecryptmxf.cc +++ b/tools/dcpdecryptmxf.cc @@ -68,13 +68,15 @@ help (string n) << " -o, --output output filename\n" << " -k, --kdm KDM file\n" << " -p, --private-key private key file\n" - << " -t, --type MXF type: picture or atmos\n"; + << " -t, --type MXF type: picture or atmos\n" + << " -i, --ignore-hmac don't raise an error if HMACs don't agree\n"; } template <class T, class U> -void copy (T const& in, shared_ptr<U> writer) +void copy (T const& in, shared_ptr<U> writer, bool ignore_hmac) { auto reader = in.start_read(); + reader->set_check_hmac (!ignore_hmac); for (int64_t i = 0; i < in.intrinsic_duration(); ++i) { auto frame = reader->get_frame (i); writer->write (frame->data(), frame->size()); @@ -92,6 +94,7 @@ main (int argc, char* argv[]) optional<boost::filesystem::path> output_file; optional<boost::filesystem::path> kdm_file; optional<boost::filesystem::path> private_key_file; + bool ignore_hmac = false; enum class Type { PICTURE, @@ -110,10 +113,11 @@ main (int argc, char* argv[]) { "kdm", required_argument, 0, 'k'}, { "private-key", required_argument, 0, 'p'}, { "type", required_argument, 0, 't' }, + { "ignore-hmac", no_argument, 0, 'i' }, { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "Avho:k:p:t:", long_options, &option_index); + int c = getopt_long (argc, argv, "Avho:k:p:t:i", long_options, &option_index); if (c == -1) { break; @@ -148,6 +152,9 @@ main (int argc, char* argv[]) exit (EXIT_FAILURE); } break; + case 'i': + ignore_hmac = true; + break; } } @@ -214,7 +221,7 @@ main (int argc, char* argv[]) in.atmos_version() ); auto writer = out.start_write (output_file.get()); - copy (in, writer); + copy (in, writer, ignore_hmac); break; } case Type::PICTURE: @@ -223,7 +230,7 @@ main (int argc, char* argv[]) add_key (in, decrypted_kdm); dcp::MonoPictureAsset out (in.edit_rate(), dcp::Standard::SMPTE); auto writer = out.start_write (output_file.get(), false); - copy (in, writer); + copy (in, writer, ignore_hmac); break; } } |
