mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
info: make adding/removing of gst_debug_log_default() work properly
Make adding/removing gst_debug_log_default() work reliably in all circumstances. The problem was that depending on platform and linker flags the function argument might resolve to different addresses, which made it impossible to remove the default log function added in gst_init() from application code (because the pointer values didn't match). The new approach should keep things simple by passing NULL for the default function, which the code in libgstreamer can then handle. https://bugzilla.gnome.org/show_bug.cgi?id=625396 https://bugzilla.gnome.org/show_bug.cgi?id=640771
This commit is contained in:
parent
74ff936752
commit
609a75eae2
2 changed files with 22 additions and 2 deletions
|
@ -90,6 +90,9 @@
|
||||||
#include "gst_private.h"
|
#include "gst_private.h"
|
||||||
#include "gstinfo.h"
|
#include "gstinfo.h"
|
||||||
|
|
||||||
|
#undef gst_debug_remove_log_function
|
||||||
|
#undef gst_debug_add_log_function
|
||||||
|
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
|
|
||||||
#ifdef HAVE_DLFCN_H
|
#ifdef HAVE_DLFCN_H
|
||||||
|
@ -1064,7 +1067,8 @@ gst_debug_add_log_function (GstLogFunction func, gpointer data)
|
||||||
LogFuncEntry *entry;
|
LogFuncEntry *entry;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
|
|
||||||
g_return_if_fail (func != NULL);
|
if (func == NULL)
|
||||||
|
func = gst_debug_log_default;
|
||||||
|
|
||||||
entry = g_slice_new (LogFuncEntry);
|
entry = g_slice_new (LogFuncEntry);
|
||||||
entry->func = func;
|
entry->func = func;
|
||||||
|
@ -1140,7 +1144,8 @@ gst_debug_remove_log_function (GstLogFunction func)
|
||||||
{
|
{
|
||||||
guint removals;
|
guint removals;
|
||||||
|
|
||||||
g_return_val_if_fail (func != NULL, 0);
|
if (func == NULL)
|
||||||
|
func = gst_debug_log_default;
|
||||||
|
|
||||||
removals =
|
removals =
|
||||||
gst_debug_remove_with_compare_func
|
gst_debug_remove_with_compare_func
|
||||||
|
|
|
@ -337,9 +337,24 @@ G_CONST_RETURN gchar *
|
||||||
|
|
||||||
void gst_debug_add_log_function (GstLogFunction func,
|
void gst_debug_add_log_function (GstLogFunction func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
guint gst_debug_remove_log_function (GstLogFunction func);
|
guint gst_debug_remove_log_function (GstLogFunction func);
|
||||||
guint gst_debug_remove_log_function_by_data (gpointer data);
|
guint gst_debug_remove_log_function_by_data (gpointer data);
|
||||||
|
|
||||||
|
#define gst_debug_add_log_function(func,data) \
|
||||||
|
G_STMT_START{ \
|
||||||
|
if (func == gst_debug_log_default) { \
|
||||||
|
gst_debug_add_log_function(NULL,data); \
|
||||||
|
} else { \
|
||||||
|
gst_debug_add_log_function(func,data); \
|
||||||
|
} \
|
||||||
|
}G_STMT_END
|
||||||
|
|
||||||
|
#define gst_debug_remove_log_function(func) \
|
||||||
|
(func == gst_debug_log_default) ? \
|
||||||
|
gst_debug_remove_log_function(NULL) : \
|
||||||
|
gst_debug_remove_log_function(func)
|
||||||
|
|
||||||
void gst_debug_set_active (gboolean active);
|
void gst_debug_set_active (gboolean active);
|
||||||
gboolean gst_debug_is_active (void);
|
gboolean gst_debug_is_active (void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue