dvbsuboverlay: Set the global library log function exactly once

And don't use one of the possibly many renderer instances, this is only
calling for crashes.
This commit is contained in:
Sebastian Dröge 2010-12-03 15:52:21 +01:00 committed by Edward Hervey
parent 2a976ae133
commit 472cace08b

View file

@ -155,16 +155,15 @@ _dvbsub_log_cb (GLogLevelFlags level, const gchar * fmt, va_list args,
gchar *message = g_strdup_vprintf (fmt, args);
if (level & G_LOG_LEVEL_ERROR)
GST_CAT_ERROR_OBJECT (gst_dvbsub_overlay_lib_debug, render, "%s", message);
GST_CAT_ERROR (gst_dvbsub_overlay_lib_debug, "%s", message);
else if (level & G_LOG_LEVEL_WARNING)
GST_CAT_WARNING_OBJECT (gst_dvbsub_overlay_lib_debug, render, "%s",
message);
GST_CAT_WARNING (gst_dvbsub_overlay_lib_debug, "%s", message);
else if (level & G_LOG_LEVEL_INFO)
GST_CAT_INFO_OBJECT (gst_dvbsub_overlay_lib_debug, render, "%s", message);
GST_CAT_INFO (gst_dvbsub_overlay_lib_debug, "%s", message);
else if (level & G_LOG_LEVEL_DEBUG)
GST_CAT_DEBUG_OBJECT (gst_dvbsub_overlay_lib_debug, render, "%s", message);
GST_CAT_DEBUG (gst_dvbsub_overlay_lib_debug, "%s", message);
else
GST_CAT_LOG_OBJECT (gst_dvbsub_overlay_lib_debug, render,
GST_CAT_LOG (gst_dvbsub_overlay_lib_debug,
"log level %d: %s", level, message);
g_free (message);
@ -225,8 +224,6 @@ gst_dvbsub_overlay_init (GstDVBSubOverlay * render,
render->dvbsub_mutex = g_mutex_new ();
dvb_sub_set_global_log_cb (_dvbsub_log_cb, render);
render->dvb_sub = dvb_sub_new ();
if (!render->dvb_sub) {
GST_WARNING_OBJECT (render, "cannot create dvbsub instance");
@ -1054,6 +1051,8 @@ plugin_init (GstPlugin * plugin)
GST_DEBUG_CATEGORY_INIT (gst_dvbsub_overlay_lib_debug, "dvbsub_library",
0, "libdvbsub library");
dvb_sub_set_global_log_cb (_dvbsub_log_cb, NULL);
return gst_element_register (plugin, "dvbsuboverlay",
GST_RANK_PRIMARY, GST_TYPE_DVBSUB_OVERLAY);
}