From 6965e3e03cd58c5a485dab576298fbfdb9aad7c9 Mon Sep 17 00:00:00 2001 From: Mickael Savinaud Date: Mon, 14 May 2012 11:04:59 +0000 Subject: [PATCH] adding jp2_encode_v2 from v2 branches; using the right return value for opj_stream_flush --- libopenjpeg/j2k.c | 2 +- libopenjpeg/jp2.c | 8 ++++++++ libopenjpeg/jp2.h | 11 +++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c index 9301b294..98a1a106 100644 --- a/libopenjpeg/j2k.c +++ b/libopenjpeg/j2k.c @@ -6040,7 +6040,7 @@ opj_bool j2k_write_eoc_v2( opj_j2k_v2_t *p_j2k, return OPJ_FALSE; } - if ( opj_stream_flush(p_stream,p_manager) == EXIT_FAILURE) { + if ( ! opj_stream_flush(p_stream,p_manager) ) { return OPJ_FALSE; } diff --git a/libopenjpeg/jp2.c b/libopenjpeg/jp2.c index f359f297..84c4f049 100644 --- a/libopenjpeg/jp2.c +++ b/libopenjpeg/jp2.c @@ -2388,6 +2388,14 @@ void jp2_setup_encoder( opj_jp2_v2_t *jp2, // jp2->jpip_on = parameters->jpip_on; } + +opj_bool opj_jp2_encode_v2( opj_jp2_v2_t *jp2, + opj_stream_private_t *stream, + opj_event_mgr_t * p_manager) +{ + return j2k_encode_v2(jp2->j2k, stream, p_manager); +} + opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info) { int pos_iptr, pos_cidx, pos_jp2c, len_jp2c, len_cidx, end_pos, pos_fidx, len_fidx; diff --git a/libopenjpeg/jp2.h b/libopenjpeg/jp2.h index b44f9b6d..ad28ba88 100644 --- a/libopenjpeg/jp2.h +++ b/libopenjpeg/jp2.h @@ -358,6 +358,17 @@ Encode an image into a JPEG-2000 file stream */ opj_bool opj_jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, opj_codestream_info_t *cstr_info); +/** +Encode an image into a JPEG-2000 file stream +@param jp2 JP2 compressor handle +@param stream Output buffer stream +@param p_manager event manager +@return Returns true if successful, returns false otherwise +*/ +opj_bool opj_jp2_encode_v2( opj_jp2_v2_t *jp2, + opj_stream_private_t *stream, + opj_event_mgr_t * p_manager); + /** * Starts a compression scheme, i.e. validates the codec parameters, writes the header.