Better error on JPEG2000 decode failure.
authorCarl Hetherington <cth@carlh.net>
Tue, 7 May 2013 22:03:51 +0000 (23:03 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 7 May 2013 22:03:51 +0000 (23:03 +0100)
src/util.cc

index c66e63f5104bfb14d272dde96e74bf90af34bf0d..6bee0dc76d34ff62ad460719bf4b81811ae20c35 100644 (file)
@@ -26,6 +26,7 @@
 #include <iostream>
 #include <iomanip>
 #include <boost/filesystem.hpp>
+#include <boost/lexical_cast.hpp>
 #include <openssl/sha.h>
 #include "KM_util.h"
 #include "KM_fileio.h"
@@ -41,6 +42,7 @@ using std::stringstream;
 using std::min;
 using std::max;
 using boost::shared_ptr;
+using boost::lexical_cast;
 using namespace libdcp;
 
 /** Create a UUID.
@@ -187,7 +189,7 @@ libdcp::decompress_j2k (uint8_t* data, int64_t size, int reduce)
        if (!image) {
                opj_destroy_decompress (decoder);
                opj_cio_close (cio);
-               boost::throw_exception (DCPReadError ("could not decode JPEG2000 codestream"));
+               boost::throw_exception (DCPReadError ("could not decode JPEG2000 codestream of " + lexical_cast<string> (size) + " bytes."));
        }
 
        opj_cio_close (cio);