summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMickael Savinaud <savmickael@users.noreply.github.com>2011-09-27 12:41:49 +0000
committerMickael Savinaud <savmickael@users.noreply.github.com>2011-09-27 12:41:49 +0000
commit67d04dd9ba5fdf9124b34e56cba0ea07a8abe196 (patch)
tree7726eeedf7c772d8b00db2b1e4ed868587112811
parentb8efd02c7feba78097eeb5bc4ef3781633382a47 (diff)
[trunk] WIP: enhance the event management into the new API
-rw-r--r--CHANGES3
-rw-r--r--applications/codec/j2k_dump.c2
-rw-r--r--libopenjpeg/event.c19
-rw-r--r--libopenjpeg/openjpeg.h13
4 files changed, 22 insertions, 15 deletions
diff --git a/CHANGES b/CHANGES
index 992968f1..0b18015d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,7 +6,8 @@ What's New for OpenJPEG
+ : added
September 27, 2011
-+ (mickael] WIP: fix some warnings about a static function and j2k_read_unk_v2
++ (mickael] WIP: enhance the event management into the new API
+* (mickael] WIP: fix some warnings about a static function and j2k_read_unk_v2
+ (mickael] WIP: add basis for a new output management of the codestream information and index
* [mickael] WIP: fix some warnings from j2k_dump and index.c
diff --git a/applications/codec/j2k_dump.c b/applications/codec/j2k_dump.c
index 37a74fd9..0aafa9b2 100644
--- a/applications/codec/j2k_dump.c
+++ b/applications/codec/j2k_dump.c
@@ -400,7 +400,7 @@ int main(int argc, char *argv[])
}
/* Set default event mgr */
- opj_set_default_event_handler(&event_mgr, parameters.m_verbose);
+ opj_initialize_default_event_handler(&event_mgr, parameters.m_verbose);
/* Initialize reading of directory */
if(img_fol.set_imgdir==1){
diff --git a/libopenjpeg/event.c b/libopenjpeg/event.c
index 7deb023b..2a700655 100644
--- a/libopenjpeg/event.c
+++ b/libopenjpeg/event.c
@@ -169,20 +169,25 @@ opj_bool opj_event_msg_v2(opj_event_mgr_t* event_mgr, int event_type, const char
}
/* ----------------------------------------------------------------------- */
-void OPJ_CALLCONV opj_set_default_event_handler(opj_event_mgr_t * p_manager, opj_bool verbose)
+void OPJ_CALLCONV opj_initialize_default_event_handler(opj_event_mgr_t * p_event, opj_bool verbose)
{
- p_manager->client_data = NULL;
- p_manager->error_handler = opj_error_default_callback;
+ if (! p_event){
+ fprintf(stderr, "[ERROR] Event structure provided to the opj_set_default_event_handler is equal to null pointer.\n");
+ return;
+ }
+
+ p_event->client_data = NULL;
+ p_event->error_handler = opj_error_default_callback;
if (verbose) {
- p_manager->info_handler = opj_info_default_callback;
- p_manager->warning_handler = opj_warning_default_callback;
+ p_event->info_handler = opj_info_default_callback;
+ p_event->warning_handler = opj_warning_default_callback;
}
else {
/* FIXME (MSD) This message should be remove when the documentation will be updated */
fprintf(stdout, "[INFO] Verbose mode = OFF => no other info/warning output.\n");
- p_manager->info_handler = opj_default_callback ;
- p_manager->warning_handler = opj_default_callback ;
+ p_event->info_handler = opj_default_callback ;
+ p_event->warning_handler = opj_default_callback ;
}
}
diff --git a/libopenjpeg/openjpeg.h b/libopenjpeg/openjpeg.h
index 26b96c4d..994576be 100644
--- a/libopenjpeg/openjpeg.h
+++ b/libopenjpeg/openjpeg.h
@@ -1164,19 +1164,20 @@ OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream (FILE * p_file,
/**
* FIXME DOC
- * FIXME Need to adapt this function to the V2 framework
+ * FIXME DEPRECATED
*/
OPJ_API opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context);
/**
- * Set the default event handler. This function set the output of message event to be stderr for warning and error output
- * and stdout for info output. It is optional, you can set your own event handler or provide a null structure to the
- * opj_setup_decoder function. In this last case no output will be displayed.
+ * Initialize a default event handler. This function set the output of message event to be stderr for warning and error output
+ * and stdout for info output in the verbose mode. In the case of the non-verbose mode only the error message are displayed.
+ * You can initialize your own event handler struct when you fill the field of the event structure. If you provide a null
+ * structure to the opj_setup_decoder function, no output will be displayed.
*
* @param p_manager a opj_event_mgr structure which will be pass to the codec.
*
*/
-OPJ_API void OPJ_CALLCONV opj_set_default_event_handler(opj_event_mgr_t * p_manager, opj_bool verbose);
+OPJ_API void OPJ_CALLCONV opj_initialize_default_event_handler(opj_event_mgr_t * p_manager, opj_bool verbose);
/*
@@ -1225,7 +1226,7 @@ OPJ_API void OPJ_CALLCONV opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_
*
* @param dinfo decompressor handlers
* @param parameters decompression parameters
- * @param vent_mgr message handler
+ * @param event_mgr message handler
*
* @return true if the decoder is correctly set
*/