mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-04 23:30:05 +00:00
openjpegenc/-dec: print openjpeg logs for debug tracing
This commit is contained in:
parent
05dfea2689
commit
3d1ca76725
2 changed files with 74 additions and 2 deletions
|
@ -863,6 +863,33 @@ gst_openjpeg_dec_negotiate (GstOpenJPEGDec * self, opj_image_t * image)
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_openjpeg_dec_opj_error (const char *msg, void *userdata)
|
||||
{
|
||||
GstOpenJPEGDec *self = GST_OPENJPEG_DEC (userdata);
|
||||
gchar *trimmed = g_strchomp (g_strdup (msg));
|
||||
GST_TRACE_OBJECT (self, "openjpeg error: %s", trimmed);
|
||||
g_free (trimmed);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_openjpeg_dec_opj_warning (const char *msg, void *userdata)
|
||||
{
|
||||
GstOpenJPEGDec *self = GST_OPENJPEG_DEC (userdata);
|
||||
gchar *trimmed = g_strchomp (g_strdup (msg));
|
||||
GST_TRACE_OBJECT (self, "openjpeg warning: %s", trimmed);
|
||||
g_free (trimmed);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_openjpeg_dec_opj_info (const char *msg, void *userdata)
|
||||
{
|
||||
GstOpenJPEGDec *self = GST_OPENJPEG_DEC (userdata);
|
||||
gchar *trimmed = g_strchomp (g_strdup (msg));
|
||||
GST_TRACE_OBJECT (self, "openjpeg info: %s", trimmed);
|
||||
g_free (trimmed);
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_openjpeg_dec_handle_frame (GstVideoDecoder * decoder,
|
||||
GstVideoCodecFrame * frame)
|
||||
|
@ -872,6 +899,7 @@ gst_openjpeg_dec_handle_frame (GstVideoDecoder * decoder,
|
|||
gint64 deadline;
|
||||
GstMapInfo map;
|
||||
opj_dinfo_t *dec;
|
||||
opj_event_mgr_t callbacks;
|
||||
opj_cio_t *io;
|
||||
opj_image_t *image;
|
||||
GstVideoFrame vframe;
|
||||
|
@ -891,7 +919,15 @@ gst_openjpeg_dec_handle_frame (GstVideoDecoder * decoder,
|
|||
if (!dec)
|
||||
goto initialization_error;
|
||||
|
||||
opj_set_event_mgr ((opj_common_ptr) dec, NULL, NULL);
|
||||
if (G_UNLIKELY (gst_debug_category_get_threshold (GST_CAT_DEFAULT) >=
|
||||
GST_LEVEL_TRACE)) {
|
||||
callbacks.error_handler = gst_openjpeg_dec_opj_error;
|
||||
callbacks.warning_handler = gst_openjpeg_dec_opj_warning;
|
||||
callbacks.info_handler = gst_openjpeg_dec_opj_info;
|
||||
opj_set_event_mgr ((opj_common_ptr) dec, &callbacks, self);
|
||||
} else {
|
||||
opj_set_event_mgr ((opj_common_ptr) dec, NULL, NULL);
|
||||
}
|
||||
|
||||
params = self->params;
|
||||
if (self->ncomps)
|
||||
|
|
|
@ -714,6 +714,33 @@ gst_openjpeg_enc_fill_image (GstOpenJPEGEnc * self, GstVideoFrame * frame)
|
|||
return image;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_openjpeg_dec_opj_error (const char *msg, void *userdata)
|
||||
{
|
||||
GstOpenJPEGEnc *self = GST_OPENJPEG_ENC (userdata);
|
||||
gchar *trimmed = g_strchomp (g_strdup (msg));
|
||||
GST_TRACE_OBJECT (self, "openjpeg error: %s", trimmed);
|
||||
g_free (trimmed);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_openjpeg_dec_opj_warning (const char *msg, void *userdata)
|
||||
{
|
||||
GstOpenJPEGEnc *self = GST_OPENJPEG_ENC (userdata);
|
||||
gchar *trimmed = g_strchomp (g_strdup (msg));
|
||||
GST_TRACE_OBJECT (self, "openjpeg warning: %s", trimmed);
|
||||
g_free (trimmed);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_openjpeg_dec_opj_info (const char *msg, void *userdata)
|
||||
{
|
||||
GstOpenJPEGEnc *self = GST_OPENJPEG_ENC (userdata);
|
||||
gchar *trimmed = g_strchomp (g_strdup (msg));
|
||||
GST_TRACE_OBJECT (self, "openjpeg info: %s", trimmed);
|
||||
g_free (trimmed);
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_openjpeg_enc_handle_frame (GstVideoEncoder * encoder,
|
||||
GstVideoCodecFrame * frame)
|
||||
|
@ -722,6 +749,7 @@ gst_openjpeg_enc_handle_frame (GstVideoEncoder * encoder,
|
|||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
GstMapInfo map;
|
||||
opj_cinfo_t *enc;
|
||||
opj_event_mgr_t callbacks;
|
||||
opj_cio_t *io;
|
||||
opj_image_t *image;
|
||||
GstVideoFrame vframe;
|
||||
|
@ -733,7 +761,15 @@ gst_openjpeg_enc_handle_frame (GstVideoEncoder * encoder,
|
|||
if (!enc)
|
||||
goto initialization_error;
|
||||
|
||||
opj_set_event_mgr ((opj_common_ptr) enc, NULL, NULL);
|
||||
if (G_UNLIKELY (gst_debug_category_get_threshold (GST_CAT_DEFAULT) >=
|
||||
GST_LEVEL_TRACE)) {
|
||||
callbacks.error_handler = gst_openjpeg_dec_opj_error;
|
||||
callbacks.warning_handler = gst_openjpeg_dec_opj_warning;
|
||||
callbacks.info_handler = gst_openjpeg_dec_opj_info;
|
||||
opj_set_event_mgr ((opj_common_ptr) enc, &callbacks, self);
|
||||
} else {
|
||||
opj_set_event_mgr ((opj_common_ptr) enc, NULL, NULL);
|
||||
}
|
||||
|
||||
if (!gst_video_frame_map (&vframe, &self->input_state->info,
|
||||
frame->input_buffer, GST_MAP_READ))
|
||||
|
|
Loading…
Reference in a new issue