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); gchar *message = g_strdup_vprintf (fmt, args);
if (level & G_LOG_LEVEL_ERROR) 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) else if (level & G_LOG_LEVEL_WARNING)
GST_CAT_WARNING_OBJECT (gst_dvbsub_overlay_lib_debug, render, "%s", GST_CAT_WARNING (gst_dvbsub_overlay_lib_debug, "%s", message);
message);
else if (level & G_LOG_LEVEL_INFO) 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) 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 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); "log level %d: %s", level, message);
g_free (message); g_free (message);
@ -225,8 +224,6 @@ gst_dvbsub_overlay_init (GstDVBSubOverlay * render,
render->dvbsub_mutex = g_mutex_new (); render->dvbsub_mutex = g_mutex_new ();
dvb_sub_set_global_log_cb (_dvbsub_log_cb, render);
render->dvb_sub = dvb_sub_new (); render->dvb_sub = dvb_sub_new ();
if (!render->dvb_sub) { if (!render->dvb_sub) {
GST_WARNING_OBJECT (render, "cannot create dvbsub instance"); 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", GST_DEBUG_CATEGORY_INIT (gst_dvbsub_overlay_lib_debug, "dvbsub_library",
0, "libdvbsub library"); 0, "libdvbsub library");
dvb_sub_set_global_log_cb (_dvbsub_log_cb, NULL);
return gst_element_register (plugin, "dvbsuboverlay", return gst_element_register (plugin, "dvbsuboverlay",
GST_RANK_PRIMARY, GST_TYPE_DVBSUB_OVERLAY); GST_RANK_PRIMARY, GST_TYPE_DVBSUB_OVERLAY);
} }