Using existing openjp2 handlers for now. #112

Seems a little greasy, but it works.  Probably should think about a
separate error handler, though.
This commit is contained in:
jevans 2013-09-12 21:07:58 -04:00
commit cc10537c14
3 changed files with 53 additions and 43 deletions

View file

@ -685,7 +685,7 @@ def check_error(status):
raise IOError("OpenJPEG function failure.")
# These library functions all return an error status. Circumvent that and
# force # them to raise an exception.
# force them to raise an exception.
FCNS = ['opj_decode', 'opj_decode_tile_data', 'opj_end_compress',
'opj_encode', 'opj_end_decompress', 'opj_get_decoded_tile',
'opj_read_header', 'opj_read_tile_header', 'opj_set_decode_area',

View file

@ -527,8 +527,7 @@ def encode(cinfo, cio, image):
OPENJPEG.opj_encode.argtypes = argtypes
OPENJPEG.opj_encode.restype = ctypes.c_int
status = OPENJPEG.opj_encode(cinfo, cio, image)
if not status:
raise RuntimeError("opj_encode failed")
return status
def destroy_decompress(dinfo):