diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 78d4ce7182..36fe1ac988 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -90,6 +90,9 @@ #include "gst_private.h" #include "gstinfo.h" +#undef gst_debug_remove_log_function +#undef gst_debug_add_log_function + #ifndef GST_DISABLE_GST_DEBUG #ifdef HAVE_DLFCN_H @@ -1064,7 +1067,8 @@ gst_debug_add_log_function (GstLogFunction func, gpointer data) LogFuncEntry *entry; GSList *list; - g_return_if_fail (func != NULL); + if (func == NULL) + func = gst_debug_log_default; entry = g_slice_new (LogFuncEntry); entry->func = func; @@ -1140,7 +1144,8 @@ gst_debug_remove_log_function (GstLogFunction func) { guint removals; - g_return_val_if_fail (func != NULL, 0); + if (func == NULL) + func = gst_debug_log_default; removals = gst_debug_remove_with_compare_func diff --git a/gst/gstinfo.h b/gst/gstinfo.h index 7c2d86f789..65f84355d7 100644 --- a/gst/gstinfo.h +++ b/gst/gstinfo.h @@ -337,9 +337,24 @@ G_CONST_RETURN gchar * void gst_debug_add_log_function (GstLogFunction func, gpointer data); + guint gst_debug_remove_log_function (GstLogFunction func); 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); gboolean gst_debug_is_active (void);