summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-02-13 19:45:03 +0000
committerCarl Hetherington <cth@carlh.net>2017-02-13 19:45:03 +0000
commit15f7f4ab0f89e7881d1249dab00b716045bcdf42 (patch)
tree81f70360f94f2b7993f3b01e3f8b11aa4dbdd837
parent5e7368087004da802d042b9ee2922c9a623cc7d4 (diff)
More informative errors when opj_start_compress fails.
-rw-r--r--cscript2
-rw-r--r--src/j2k.cc7
2 files changed, 7 insertions, 2 deletions
diff --git a/cscript b/cscript
index 2f5f6f76..9be355e6 100644
--- a/cscript
+++ b/cscript
@@ -37,7 +37,7 @@ def dependencies(target):
if target.platform == 'windows' and target.version == 'xp':
return (('libcxml', 'v0.15.4'), ('openjpeg-cdist', '5d8bffd'), ('asdcplib-cth', 'v0.1.3'))
else:
- return (('libcxml', 'v0.15.4'), ('openjpeg2-cdist', '94bdab1'), ('asdcplib-cth', 'v0.1.3'))
+ return (('libcxml', 'v0.15.4'), ('openjpeg2-cdist', '8ea62cc'), ('asdcplib-cth', 'v0.1.3'))
def build(target, options):
cmd = './waf configure --disable-examples --prefix=%s' % target.directory
diff --git a/src/j2k.cc b/src/j2k.cc
index 15f360c5..4a154574 100644
--- a/src/j2k.cc
+++ b/src/j2k.cc
@@ -301,7 +301,12 @@ dcp::compress_j2k (shared_ptr<const OpenJPEGImage> xyz, int bandwidth, int frame
opj_stream_set_user_data (stream, buffer, write_free_function);
if (!opj_start_compress (encoder, xyz->opj_image(), stream)) {
- throw MiscError ("could not start JPEG2000 encoding");
+ if ((errno & 0x61500) == 0x61500) {
+ /* We've had one of the magic error codes from our patched openjpeg */
+ throw MiscError (String::compose ("could not start JPEG2000 encoding (%1)", errno & 0xff));
+ } else {
+ throw MiscError ("could not start JPEG2000 encoding");
+ }
}
if (!opj_encode (encoder, stream)) {