summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-02-13 12:34:10 +0100
committerCarl Hetherington <cth@carlh.net>2023-02-13 19:06:57 +0100
commit2a347807b597ed912406ccebf727bd1af07c556c (patch)
treee864abc4f795c4f8018178dc40060bb5f5b9eee6
parent8b86c990e526e55e273cc408377f13e64a27fb26 (diff)
Add a nice note for general MXF errors.bad-mxf
-rw-r--r--src/verify.cc38
-rw-r--r--src/verify.h4
-rw-r--r--src/verify_j2k.cc1
3 files changed, 30 insertions, 13 deletions
diff --git a/src/verify.cc b/src/verify.cc
index 822037ca..0de5a744 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -443,25 +443,35 @@ verify_picture_asset (shared_ptr<const ReelFileAsset> reel_file_asset, boost::fi
if (auto mono_asset = dynamic_pointer_cast<MonoPictureAsset>(reel_file_asset->asset_ref().asset())) {
auto reader = mono_asset->start_read ();
for (int64_t i = 0; i < duration; ++i) {
- auto frame = reader->get_frame (i);
- biggest_frame = max(biggest_frame, frame->size());
- if (!mono_asset->encrypted() || mono_asset->key()) {
- vector<VerificationNote> j2k_notes;
- verify_j2k (frame, j2k_notes);
- check_and_add (j2k_notes);
+ try {
+ auto frame = reader->get_frame (i);
+ biggest_frame = max(biggest_frame, frame->size());
+ if (!mono_asset->encrypted() || mono_asset->key()) {
+ vector<VerificationNote> j2k_notes;
+ verify_j2k (frame, j2k_notes);
+ check_and_add (j2k_notes);
+ }
+ }
+ catch (ReadError const& e) {
+ notes.push_back({VerificationNote::Type::ERROR, VerificationNote::Code::INVALID_MXF_CODESTREAM, string(e.what()) });
}
progress (float(i) / duration);
}
} else if (auto stereo_asset = dynamic_pointer_cast<StereoPictureAsset>(asset)) {
auto reader = stereo_asset->start_read ();
for (int64_t i = 0; i < duration; ++i) {
- auto frame = reader->get_frame (i);
- biggest_frame = max(biggest_frame, max(frame->left()->size(), frame->right()->size()));
- if (!stereo_asset->encrypted() || stereo_asset->key()) {
- vector<VerificationNote> j2k_notes;
- verify_j2k (frame->left(), j2k_notes);
- verify_j2k (frame->right(), j2k_notes);
- check_and_add (j2k_notes);
+ try {
+ auto frame = reader->get_frame (i);
+ biggest_frame = max(biggest_frame, max(frame->left()->size(), frame->right()->size()));
+ if (!stereo_asset->encrypted() || stereo_asset->key()) {
+ vector<VerificationNote> j2k_notes;
+ verify_j2k (frame->left(), j2k_notes);
+ verify_j2k (frame->right(), j2k_notes);
+ check_and_add (j2k_notes);
+ }
+ }
+ catch (ReadError const& e) {
+ notes.push_back({VerificationNote::Type::ERROR, VerificationNote::Code::INVALID_MXF_CODESTREAM, string(e.what()) });
}
progress (float(i) / duration);
}
@@ -1925,6 +1935,8 @@ dcp::note_to_string (VerificationNote note)
return "Some assets are encrypted but some are not.";
case VerificationNote::Code::INVALID_JPEG2000_CODESTREAM:
return String::compose("The JPEG2000 codestream for at least one frame is invalid (%1).", note.note().get());
+ case VerificationNote::Code::INVALID_MXF_CODESTREAM:
+ return String::compose("The MXF codestream for at least one frame is invalid (%1).", note.note().get());
case VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_2K:
return String::compose("The JPEG2000 codestream uses %1 guard bits in a 2K image instead of 1.", note.note().get());
case VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_4K:
diff --git a/src/verify.h b/src/verify.h
index 77fc28b3..c4ff8001 100644
--- a/src/verify.h
+++ b/src/verify.h
@@ -331,6 +331,10 @@ public:
* note contains details
*/
INVALID_JPEG2000_CODESTREAM,
+ /** General error during MXF parsing
+ * note contains details
+ */
+ INVALID_MXF_CODESTREAM,
/** Invalid number of guard bits in a 2K JPEG2000 stream (should be 1) [Bv2.1_10.2.1]
* note contains the number of guard bits
*/
diff --git a/src/verify_j2k.cc b/src/verify_j2k.cc
index 86ffb5b4..a1927234 100644
--- a/src/verify_j2k.cc
+++ b/src/verify_j2k.cc
@@ -39,6 +39,7 @@
#include "compose.hpp"
#include "data.h"
+#include "exceptions.h"
#include "raw_convert.h"
#include "verify.h"
#include "verify_j2k.h"