summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-05-27 10:24:22 +0100
committerCarl Hetherington <cth@carlh.net>2015-05-27 10:24:22 +0100
commit3cab293bf022c87ad3775aec2eb5a7d6e997295d (patch)
treef8966722fb776344e195ca4c498ac4c09fec7d4c
parent484a9009ff684bedca3f2cf4868e7dd03215d8e8 (diff)
Improved error messages; better equals() with corrupted MXFs.
-rw-r--r--src/stereo_picture_frame.cc3
-rw-r--r--src/stereo_picture_mxf.cc14
2 files changed, 14 insertions, 3 deletions
diff --git a/src/stereo_picture_frame.cc b/src/stereo_picture_frame.cc
index ac7d7bf1..3ee08303 100644
--- a/src/stereo_picture_frame.cc
+++ b/src/stereo_picture_frame.cc
@@ -24,6 +24,7 @@
#include "colour_conversion.h"
#include "AS_DCP.h"
#include "KM_fileio.h"
+#include "compose.hpp"
#include <openjpeg.h>
#define DCI_GAMMA 2.6
@@ -48,7 +49,7 @@ StereoPictureFrame::StereoPictureFrame (boost::filesystem::path mxf_path, int n)
_buffer = new ASDCP::JP2K::SFrameBuffer (4 * Kumu::Megabyte);
if (ASDCP_FAILURE (reader.ReadFrame (n, *_buffer))) {
- boost::throw_exception (DCPReadError ("could not read video frame"));
+ boost::throw_exception (DCPReadError (String::compose ("could not read video frame %1 of %2", n, mxf_path.string())));
}
}
diff --git a/src/stereo_picture_mxf.cc b/src/stereo_picture_mxf.cc
index e68921e3..2ca00762 100644
--- a/src/stereo_picture_mxf.cc
+++ b/src/stereo_picture_mxf.cc
@@ -110,8 +110,18 @@ StereoPictureMXF::equals (shared_ptr<const Asset> other, EqualityOptions opt, No
DCP_ASSERT (other_picture);
for (int i = 0; i < _intrinsic_duration; ++i) {
- shared_ptr<const StereoPictureFrame> frame_A = get_frame (i);
- shared_ptr<const StereoPictureFrame> frame_B = other_picture->get_frame (i);
+ shared_ptr<const StereoPictureFrame> frame_A;
+ shared_ptr<const StereoPictureFrame> frame_B;
+ try {
+ frame_A = get_frame (i);
+ frame_B = other_picture->get_frame (i);
+ } catch (DCPReadError& e) {
+ /* If there was a problem reading the frame data we'll just assume
+ the two frames are not equal.
+ */
+ note (DCP_ERROR, e.what ());
+ return false;
+ }
if (!frame_buffer_equals (
i, opt, note,