From 3cab293bf022c87ad3775aec2eb5a7d6e997295d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 27 May 2015 10:24:22 +0100 Subject: [PATCH] Improved error messages; better equals() with corrupted MXFs. --- src/stereo_picture_frame.cc | 3 ++- src/stereo_picture_mxf.cc | 14 ++++++++++++-- 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 #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 other, EqualityOptions opt, No DCP_ASSERT (other_picture); for (int i = 0; i < _intrinsic_duration; ++i) { - shared_ptr frame_A = get_frame (i); - shared_ptr frame_B = other_picture->get_frame (i); + shared_ptr frame_A; + shared_ptr 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, -- 2.30.2