+
+/* ----------------------------------------------------------------------- */
+void OPJ_CALLCONV opj_initialize_default_event_handler(opj_event_mgr_t * p_event, opj_bool verbose)
+{
+ 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_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_event->info_handler = opj_default_callback ;
+ p_event->warning_handler = opj_default_callback ;
+ }
+}
+
+/* ---------------------------------------------------------------------- */
+/* Default callback functions */
+
+/**
+ * Default callback function.
+ * Do nothing.
+ */
+void opj_default_callback (const char *msg, void *client_data)
+{
+}
+
+/**
+ * Default info callback function.
+ * Output = stdout.
+ */
+void opj_info_default_callback (const char *msg, void *client_data)
+{
+ (void)client_data;
+ fprintf(stdout, "[INFO] %s", msg);
+}
+
+/**
+ * Default warning callback function.
+ * Output = stderr.
+ */
+void opj_warning_default_callback (const char *msg, void *client_data)
+{
+ (void)client_data;
+ fprintf(stderr, "[WARNING] %s", msg);
+}
+
+/**
+ * Default error callback function.
+ * Output = stderr.
+ */
+void opj_error_default_callback (const char *msg, void *client_data)
+{
+ (void)client_data;
+ fprintf(stderr, "[ERROR] %s", msg);
+}