summaryrefslogtreecommitdiff
path: root/src/mono_picture_frame.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-06-04 14:37:43 +0200
committerCarl Hetherington <cth@carlh.net>2021-06-04 14:37:43 +0200
commita5bd2e9eeecccb1a64aa7f3ae936698fce78bea5 (patch)
tree34136bd6b8dc487d578ded06da9d223424da910a /src/mono_picture_frame.cc
parente8c71ec28755e77bd6851b9ffd698794d214208a (diff)
Add option to ignore mismatched HMACs when reading MXFs.
Diffstat (limited to 'src/mono_picture_frame.cc')
-rw-r--r--src/mono_picture_frame.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mono_picture_frame.cc b/src/mono_picture_frame.cc
index fb451e08..df75126c 100644
--- a/src/mono_picture_frame.cc
+++ b/src/mono_picture_frame.cc
@@ -80,13 +80,14 @@ MonoPictureFrame::MonoPictureFrame (boost::filesystem::path path)
* @param reader Reader for the asset's MXF file.
* @param n Frame within the asset, not taking EntryPoint into account.
* @param c Context for decryption, or 0.
+ * @param check_hmac true to check the HMAC and give an error if it is not as expected.
*/
-MonoPictureFrame::MonoPictureFrame (ASDCP::JP2K::MXFReader* reader, int n, shared_ptr<DecryptionContext> c)
+MonoPictureFrame::MonoPictureFrame (ASDCP::JP2K::MXFReader* reader, int n, shared_ptr<DecryptionContext> c, bool check_hmac)
{
/* XXX: unfortunate guesswork on this buffer size */
_buffer = make_shared<ASDCP::JP2K::FrameBuffer>(4 * Kumu::Megabyte);
- auto const r = reader->ReadFrame (n, *_buffer, c->context(), c->hmac());
+ auto const r = reader->ReadFrame (n, *_buffer, c->context(), check_hmac ? c->hmac() : nullptr);
if (ASDCP_FAILURE(r)) {
boost::throw_exception (ReadError(String::compose ("could not read video frame %1 (%2)", n, static_cast<int>(r))));