gst-indent run on core
[platform/upstream/gstreamer.git] / gst / gstinfo.c
index 3579f27..6958992 100644 (file)
@@ -33,9 +33,9 @@
 #ifdef HAVE_PRINTF_EXTENSION
 #include <printf.h>
 #endif
-#include <stdio.h> /* fprintf */
+#include <stdio.h>             /* fprintf */
 #include <unistd.h>
-#include <string.h> /* G_VA_COPY */
+#include <string.h>            /* G_VA_COPY */
 #include "gstinfo.h"
 #include "gstlog.h"
 #include "gst_private.h"
 #include "gstscheduler.h"
 #include "gst_private.h"
 
-GST_DEBUG_CATEGORY_STATIC(GST_CAT_DEBUG);
+GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEBUG);
 
 #if 0
 #if defined __sgi__
 #include <rld_interface.h>
-typedef struct DL_INFO {
-  const char * dli_fname;
-  void       * dli_fbase;
-  const char * dli_sname;
-  void       * dli_saddr;
-  int          dli_version;
-  int          dli_reserved1;
-  long         dli_reserved[4];
+typedef struct DL_INFO
+{
+  const char *dli_fname;
+  void *dli_fbase;
+  const char *dli_sname;
+  void *dli_saddr;
+  int dli_version;
+  int dli_reserved1;
+  long dli_reserved[4];
 } Dl_info;
+
 #define _RLD_DLADDR             14
-int dladdr(void *address, Dl_info *dl);
+int dladdr (void *address, Dl_info * dl);
 
-int dladdr(void *address, Dl_info *dl)
+int
+dladdr (void *address, Dl_info * dl)
 {
   void *v;
-  v = _rld_new_interface(_RLD_DLADDR,address,dl);
-  return (int)v;
+
+  v = _rld_new_interface (_RLD_DLADDR, address, dl);
+  return (int) v;
 }
 #endif /* __sgi__ */
 #endif
 
 extern gchar *_gst_progname;
 
-static void    gst_debug_reset_threshold       (gpointer category,
-                                                gpointer unused);
-static void    gst_debug_reset_all_thresholds  (void);
+static void gst_debug_reset_threshold (gpointer category, gpointer unused);
+static void gst_debug_reset_all_thresholds (void);
 
 #ifdef HAVE_PRINTF_EXTENSION
-static int _gst_info_printf_extension (FILE *stream, const struct printf_info *info,
-    const void *const *args);
-static int _gst_info_printf_extension_arginfo (const struct printf_info *info, size_t n,
-    int *argtypes);
+static int _gst_info_printf_extension (FILE * stream,
+    const struct printf_info *info, const void *const *args);
+static int _gst_info_printf_extension_arginfo (const struct printf_info *info,
+    size_t n, int *argtypes);
 #endif
 
-struct _GstDebugMessage {
-  gchar *              message;
-  const gchar *                format;
-  va_list              arguments;
+struct _GstDebugMessage
+{
+  gchar *message;
+  const gchar *format;
+  va_list arguments;
 };
 
 /* list of all name/level pairs from --gst-debug and GST_DEBUG */
 static GStaticMutex __level_name_mutex = G_STATIC_MUTEX_INIT;
 static GSList *__level_name = NULL;
-typedef struct {
-  GPatternSpec *       pat;
-  GstDebugLevel                level;
+typedef struct
+{
+  GPatternSpec *pat;
+  GstDebugLevel level;
 } LevelNameEntry;
 
 /* list of all categories */
@@ -102,9 +107,10 @@ static GStaticMutex __cat_mutex = G_STATIC_MUTEX_INIT;
 static GSList *__categories = NULL;
 
 /* all registered debug handlers */
-typedef struct {
-  GstLogFunction       func;
-  gpointer             user_data;
+typedef struct
+{
+  GstLogFunction func;
+  gpointer user_data;
 } LogFuncEntry;
 static GStaticMutex __log_func_mutex = G_STATIC_MUTEX_INIT;
 static GSList *__log_functions = NULL;
@@ -152,7 +158,8 @@ GstDebugCategory *GST_CAT_SEEK = NULL;
  * Initializes the debugging system.
  * Normally you don't want to call this, because gst_init does it for you.
  */
-void _gst_debug_init (void)
+void
+_gst_debug_init (void)
 {
   gst_atomic_int_init (&__default_level, GST_LEVEL_DEFAULT);
   gst_atomic_int_init (&__use_color, 1);
@@ -163,104 +170,73 @@ void _gst_debug_init (void)
 #endif
 
   /* do NOT use a single debug function before this line has been run */
-  GST_CAT_DEFAULT      = _gst_debug_category_new ("default", 
-                               GST_DEBUG_UNDERLINE,
-                               NULL);
-  GST_CAT_DEBUG                = _gst_debug_category_new ("GST_DEBUG",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_YELLOW,
-                               "debugging subsystem");
+  GST_CAT_DEFAULT = _gst_debug_category_new ("default",
+      GST_DEBUG_UNDERLINE, NULL);
+  GST_CAT_DEBUG = _gst_debug_category_new ("GST_DEBUG",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_YELLOW, "debugging subsystem");
 
   gst_debug_add_log_function (gst_debug_log_default, NULL);
 
   /* FIXME: add descriptions here */
-  GST_CAT_GST_INIT     = _gst_debug_category_new ("GST_INIT",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_RED,
-                               NULL);
-  GST_CAT_COTHREADS    = _gst_debug_category_new ("GST_COTHREADS",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN,
-                               NULL);
+  GST_CAT_GST_INIT = _gst_debug_category_new ("GST_INIT",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_RED, NULL);
+  GST_CAT_COTHREADS = _gst_debug_category_new ("GST_COTHREADS",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, NULL);
   GST_CAT_COTHREAD_SWITCH = _gst_debug_category_new ("GST_COTHREAD_SWITCH",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_GREEN,
-                               NULL);
-  GST_CAT_AUTOPLUG     = _gst_debug_category_new ("GST_AUTOPLUG",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE,
-                               NULL);
+      GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_GREEN, NULL);
+  GST_CAT_AUTOPLUG = _gst_debug_category_new ("GST_AUTOPLUG",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE, NULL);
   GST_CAT_AUTOPLUG_ATTEMPT = _gst_debug_category_new ("GST_AUTOPLUG_ATTEMPT",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_CYAN | GST_DEBUG_BG_BLUE,
-                               NULL);
-  GST_CAT_PARENTAGE    = _gst_debug_category_new ("GST_PARENTAGE",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED,
-                               NULL);
-  GST_CAT_STATES       = _gst_debug_category_new ("GST_STATES",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_RED,
-                               NULL);
-  GST_CAT_PLANNING     = _gst_debug_category_new ("GST_PLANNING",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_MAGENTA,
-                               NULL);
-  GST_CAT_SCHEDULING   = _gst_debug_category_new ("GST_SCHEDULING",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_MAGENTA,
-                               NULL);
-  GST_CAT_DATAFLOW     = _gst_debug_category_new ("GST_DATAFLOW",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN,
-                               NULL);
-  GST_CAT_BUFFER       = _gst_debug_category_new ("GST_BUFFER",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN,
-                               NULL);
-  GST_CAT_CAPS         = _gst_debug_category_new ("GST_CAPS",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE,
-                               NULL);
-  GST_CAT_CLOCK                = _gst_debug_category_new ("GST_CLOCK",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_YELLOW,
-                               NULL);
-  GST_CAT_ELEMENT_PADS = _gst_debug_category_new ("GST_ELEMENT_PADS",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED,
-                               NULL);
-  GST_CAT_PADS         = _gst_debug_category_new ("GST_PADS",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED,
-                               NULL);
-  GST_CAT_PIPELINE     = _gst_debug_category_new ("GST_PIPELINE",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED,
-                               NULL);
+      GST_DEBUG_BOLD | GST_DEBUG_FG_CYAN | GST_DEBUG_BG_BLUE, NULL);
+  GST_CAT_PARENTAGE = _gst_debug_category_new ("GST_PARENTAGE",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
+  GST_CAT_STATES = _gst_debug_category_new ("GST_STATES",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_RED, NULL);
+  GST_CAT_PLANNING = _gst_debug_category_new ("GST_PLANNING",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_MAGENTA, NULL);
+  GST_CAT_SCHEDULING = _gst_debug_category_new ("GST_SCHEDULING",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_MAGENTA, NULL);
+  GST_CAT_DATAFLOW = _gst_debug_category_new ("GST_DATAFLOW",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, NULL);
+  GST_CAT_BUFFER = _gst_debug_category_new ("GST_BUFFER",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, NULL);
+  GST_CAT_CAPS = _gst_debug_category_new ("GST_CAPS",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE, NULL);
+  GST_CAT_CLOCK = _gst_debug_category_new ("GST_CLOCK",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_YELLOW, NULL);
+  GST_CAT_ELEMENT_PADS = _gst_debug_category_new ("GST_ELEMENT_PADS",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
+  GST_CAT_PADS = _gst_debug_category_new ("GST_PADS",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
+  GST_CAT_PIPELINE = _gst_debug_category_new ("GST_PIPELINE",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
   GST_CAT_PLUGIN_LOADING = _gst_debug_category_new ("GST_PLUGIN_LOADING",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_CYAN,
-                               NULL);
-  GST_CAT_PLUGIN_INFO  = _gst_debug_category_new ("GST_PLUGIN_INFO",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_CYAN,
-                               NULL);
-  GST_CAT_PROPERTIES   = _gst_debug_category_new ("GST_PROPERTIES",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_BLUE,
-                               NULL);
-  GST_CAT_THREAD       = _gst_debug_category_new ("GST_THREAD",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_RED,
-                               NULL);
-  GST_CAT_TYPES                = _gst_debug_category_new ("GST_TYPES",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED,
-                               NULL);
-  GST_CAT_XML          = _gst_debug_category_new ("GST_XML",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED,
-                               NULL);
-  GST_CAT_NEGOTIATION  = _gst_debug_category_new ("GST_NEGOTIATION",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE,
-                               NULL);
-  GST_CAT_REFCOUNTING  = _gst_debug_category_new ("GST_REFCOUNTING",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE | GST_DEBUG_BG_GREEN,
-                               NULL);
-  GST_CAT_ERROR_SYSTEM  = _gst_debug_category_new ("GST_ERROR_SYSTEM",
-                                GST_DEBUG_BOLD | GST_DEBUG_FG_RED | GST_DEBUG_BG_WHITE,
-                                NULL);
-
-  GST_CAT_EVENT                = _gst_debug_category_new ("GST_EVENT",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED,
-                               NULL);
-  GST_CAT_PARAMS       = _gst_debug_category_new ("GST_PARAMS",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_BLACK | GST_DEBUG_BG_YELLOW,
-                               NULL);
-  GST_CAT_CALL_TRACE   = _gst_debug_category_new ("GST_CALL_TRACE",
-                               GST_DEBUG_BOLD,
-                               NULL);
-  GST_CAT_SEEK          = _gst_debug_category_new ("GST_SEEK",
-                               0,
-                               "plugins reacting to seek events");
+      GST_DEBUG_BOLD | GST_DEBUG_FG_CYAN, NULL);
+  GST_CAT_PLUGIN_INFO = _gst_debug_category_new ("GST_PLUGIN_INFO",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_CYAN, NULL);
+  GST_CAT_PROPERTIES = _gst_debug_category_new ("GST_PROPERTIES",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_BLUE, NULL);
+  GST_CAT_THREAD = _gst_debug_category_new ("GST_THREAD",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_RED, NULL);
+  GST_CAT_TYPES = _gst_debug_category_new ("GST_TYPES",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
+  GST_CAT_XML = _gst_debug_category_new ("GST_XML",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
+  GST_CAT_NEGOTIATION = _gst_debug_category_new ("GST_NEGOTIATION",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE, NULL);
+  GST_CAT_REFCOUNTING = _gst_debug_category_new ("GST_REFCOUNTING",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE | GST_DEBUG_BG_GREEN, NULL);
+  GST_CAT_ERROR_SYSTEM = _gst_debug_category_new ("GST_ERROR_SYSTEM",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_RED | GST_DEBUG_BG_WHITE, NULL);
+
+  GST_CAT_EVENT = _gst_debug_category_new ("GST_EVENT",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
+  GST_CAT_PARAMS = _gst_debug_category_new ("GST_PARAMS",
+      GST_DEBUG_BOLD | GST_DEBUG_FG_BLACK | GST_DEBUG_BG_YELLOW, NULL);
+  GST_CAT_CALL_TRACE = _gst_debug_category_new ("GST_CALL_TRACE",
+      GST_DEBUG_BOLD, NULL);
+  GST_CAT_SEEK = _gst_debug_category_new ("GST_SEEK",
+      0, "plugins reacting to seek events");
 }
 
 /* we can't do this further above, because we initialize the GST_CAT_DEFAULT struct */
@@ -279,16 +255,19 @@ void _gst_debug_init (void)
  * 
  * Logs the given message using the currently registered debugging handlers.
  */
-void gst_debug_log (GstDebugCategory *category, GstDebugLevel level,
-                   const gchar *file, const gchar *function, gint line,
-                   GObject *object, const gchar *format, ...)
+void
+gst_debug_log (GstDebugCategory * category, GstDebugLevel level,
+    const gchar * file, const gchar * function, gint line,
+    GObject * object, const gchar * format, ...)
 {
   va_list var_args;
-  
+
   va_start (var_args, format);
-  gst_debug_log_valist (category, level, file, function, line, object, format, var_args);
+  gst_debug_log_valist (category, level, file, function, line, object, format,
+      var_args);
   va_end (var_args);
 }
+
 /**
  * gst_debug_log_valist:
  * @category: category to log
@@ -302,9 +281,10 @@ void gst_debug_log (GstDebugCategory *category, GstDebugLevel level,
  * 
  * Logs the given message using the currently registered debugging handlers.
  */
-void gst_debug_log_valist (GstDebugCategory *category, GstDebugLevel level,
-                          const gchar *file, const gchar *function, gint line,
-                          GObject *object, const gchar *format, va_list args)
+void
+gst_debug_log_valist (GstDebugCategory * category, GstDebugLevel level,
+    const gchar * file, const gchar * function, gint line,
+    GObject * object, const gchar * format, va_list args)
 {
   GstDebugMessage message;
   LogFuncEntry *entry;
@@ -318,16 +298,18 @@ void gst_debug_log_valist (GstDebugCategory *category, GstDebugLevel level,
   message.message = NULL;
   message.format = format;
   G_VA_COPY (message.arguments, args);
-  
+
   handler = __log_functions;
   while (handler) {
     entry = handler->data;
     handler = g_slist_next (handler);
-    entry->func (category, level, file, function, line, object, &message, entry->user_data);
+    entry->func (category, level, file, function, line, object, &message,
+       entry->user_data);
   }
   g_free (message.message);
   va_end (message.arguments);
 }
+
 /**
  * gst_debug_message_get:
  * @message: a debug message
@@ -336,7 +318,7 @@ void gst_debug_log_valist (GstDebugCategory *category, GstDebugLevel level,
  * in debug handlers to extract the message.
  */
 const gchar *
-gst_debug_message_get (GstDebugMessage *message)
+gst_debug_message_get (GstDebugMessage * message)
 {
   if (message->message == NULL) {
     message->message = g_strdup_vprintf (message->format, message->arguments);
@@ -348,7 +330,7 @@ gst_debug_message_get (GstDebugMessage *message)
 static gchar *
 gst_debug_print_object (gpointer ptr)
 {
-  GObject *object = (GObject *)ptr;
+  GObject *object = (GObject *) ptr;
 
 #ifdef unused
   /* This is a cute trick to detect unmapped memory, but is unportable,
@@ -356,7 +338,7 @@ gst_debug_print_object (gpointer ptr)
   {
     int ret;
 
-    ret = madvise ((void *)((unsigned long)ptr & (~0xfff)), 4096, 0);
+    ret = madvise ((void *) ((unsigned long) ptr & (~0xfff)), 4096, 0);
     if (ret == -1 && errno == ENOMEM) {
       buffer = g_strdup_printf ("%p (unmapped memory)", ptr);
     }
@@ -367,14 +349,14 @@ gst_debug_print_object (gpointer ptr)
   if (object == NULL) {
     return g_strdup ("(NULL)");
   }
-  if (*(GType *)ptr == GST_TYPE_CAPS) {
-    return gst_caps_to_string ((GstCaps *)ptr);
+  if (*(GType *) ptr == GST_TYPE_CAPS) {
+    return gst_caps_to_string ((GstCaps *) ptr);
   }
-  if (*(GType *)ptr == GST_TYPE_STRUCTURE) {
-    return gst_structure_to_string ((GstStructure *)ptr);
+  if (*(GType *) ptr == GST_TYPE_STRUCTURE) {
+    return gst_structure_to_string ((GstStructure *) ptr);
   }
 #ifdef USE_POISONING
-  if (*(guint32 *)ptr == 0xffffffff) {
+  if (*(guint32 *) ptr == 0xffffffff) {
     return g_strdup_printf ("<poisoned@%p>", ptr);
   }
 #endif
@@ -385,7 +367,7 @@ gst_debug_print_object (gpointer ptr)
     return g_strdup_printf ("<%s>", GST_OBJECT_NAME (object));
   }
   if (G_IS_OBJECT (object)) {
-    return g_strdup_printf ("<%s@%p>", G_OBJECT_TYPE_NAME(object), object);  
+    return g_strdup_printf ("<%s@%p>", G_OBJECT_TYPE_NAME (object), object);
   }
 
   return g_strdup_printf ("%p", ptr);
@@ -419,7 +401,8 @@ gst_debug_construct_term_color (guint colorinfo)
     g_string_append_printf (color, ";3%1d", colorinfo & GST_DEBUG_FG_MASK);
   }
   if (colorinfo & GST_DEBUG_BG_MASK) {
-    g_string_append_printf (color, ";4%1d", (colorinfo & GST_DEBUG_BG_MASK) >> 4);
+    g_string_append_printf (color, ";4%1d",
+       (colorinfo & GST_DEBUG_BG_MASK) >> 4);
   }
   g_string_append (color, "m");
 
@@ -427,6 +410,7 @@ gst_debug_construct_term_color (guint colorinfo)
   g_string_free (color, FALSE);
   return ret;
 }
+
 /**
  * gst_debug_log_default:
  * @category: category to log
@@ -446,24 +430,26 @@ gst_debug_construct_term_color (guint colorinfo)
  * gst_debug_remove_log_function (gst_debug_log_default);
  */
 void
-gst_debug_log_default (GstDebugCategory *category, GstDebugLevel level,
-                      const gchar *file, const gchar *function, gint line,
-                      GObject *object, GstDebugMessage *message, gpointer unused)
+gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
+    const gchar * file, const gchar * function, gint line,
+    GObject * object, GstDebugMessage * message, gpointer unused)
 {
   gchar *color;
   gchar *clear;
   gchar *obj;
   gchar *pidcolor;
   gint pid;
-  
+
   if (level > gst_debug_category_get_threshold (category))
     return;
-  
-  pid = getpid();
+
+  pid = getpid ();
 
   /* color info */
   if (gst_debug_is_colored ()) {
-    color = gst_debug_construct_term_color (gst_debug_category_get_color (category));
+    color =
+       gst_debug_construct_term_color (gst_debug_category_get_color
+       (category));
     clear = "\033[00m";
     pidcolor = g_strdup_printf ("\033[3%1dm", pid % 6 + 31);
   } else {
@@ -474,17 +460,17 @@ gst_debug_log_default (GstDebugCategory *category, GstDebugLevel level,
 
   obj = object ? gst_debug_print_object (object) : g_strdup ("");
 
-  g_printerr ("%s %s%15s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n", 
-             gst_debug_level_get_name (level),
-              color, gst_debug_category_get_name (category), clear,
-              pidcolor, pid, clear,
-             color, file, line, function, obj, clear,
-             gst_debug_message_get (message));
+  g_printerr ("%s %s%15s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n",
+      gst_debug_level_get_name (level),
+      color, gst_debug_category_get_name (category), clear,
+      pidcolor, pid, clear,
+      color, file, line, function, obj, clear, gst_debug_message_get (message));
 
   g_free (color);
   g_free (pidcolor);
   g_free (obj);
 }
+
 /**
  * gst_debug_level_get_name:
  * @level: the level to get the name for
@@ -497,17 +483,24 @@ const gchar *
 gst_debug_level_get_name (GstDebugLevel level)
 {
   switch (level) {
-    case GST_LEVEL_NONE:       return "";
-    case GST_LEVEL_ERROR:      return "ERROR";
-    case GST_LEVEL_WARNING:    return "WARN ";
-    case GST_LEVEL_INFO:       return "INFO ";
-    case GST_LEVEL_DEBUG:      return "DEBUG";
-    case GST_LEVEL_LOG:                return "LOG  ";
+    case GST_LEVEL_NONE:
+      return "";
+    case GST_LEVEL_ERROR:
+      return "ERROR";
+    case GST_LEVEL_WARNING:
+      return "WARN ";
+    case GST_LEVEL_INFO:
+      return "INFO ";
+    case GST_LEVEL_DEBUG:
+      return "DEBUG";
+    case GST_LEVEL_LOG:
+      return "LOG  ";
     default:
       g_warning ("invalid level specified for gst_debug_level_get_name");
       return "";
   }
 }
+
 /**
  * gst_debug_add_log_function:
  * @func: the function to use
@@ -539,28 +532,32 @@ gst_debug_add_log_function (GstLogFunction func, gpointer data)
   g_static_mutex_unlock (&__log_func_mutex);
 
   GST_DEBUG ("prepended log function %p (user data %p) to log functions",
-             func, data);
+      func, data);
 }
+
 static gint
 gst_debug_compare_log_function_by_func (gconstpointer entry, gconstpointer func)
 {
   gpointer entryfunc = ((LogFuncEntry *) entry)->func;
-  
+
   return (entryfunc < func) ? -1 : (entryfunc > func) ? 1 : 0;
 }
+
 static gint
 gst_debug_compare_log_function_by_data (gconstpointer entry, gconstpointer data)
 {
   gpointer entrydata = ((LogFuncEntry *) entry)->user_data;
-  
+
   return (entrydata < data) ? -1 : (entrydata > data) ? 1 : 0;
 }
+
 static guint
 gst_debug_remove_with_compare_func (GCompareFunc func, gpointer data)
 {
   GSList *found;
   GSList *new;
   guint removals = 0;
+
   g_static_mutex_lock (&__log_func_mutex);
   new = __log_functions;
   while ((found = g_slist_find_custom (new, data, func))) {
@@ -578,6 +575,7 @@ gst_debug_remove_with_compare_func (GCompareFunc func, gpointer data)
 
   return removals;
 }
+
 /**
  * gst_debug_remove_log_function:
  * @func: the log function to remove
@@ -590,15 +588,18 @@ guint
 gst_debug_remove_log_function (GstLogFunction func)
 {
   guint removals;
-  
+
   g_return_val_if_fail (func != NULL, 0);
 
-  removals = gst_debug_remove_with_compare_func (gst_debug_compare_log_function_by_func, func);
-  GST_DEBUG ("removed log function %p %d times from log function list",
-             func, removals);
+  removals =
+      gst_debug_remove_with_compare_func
+      (gst_debug_compare_log_function_by_func, func);
+  GST_DEBUG ("removed log function %p %d times from log function list", func,
+      removals);
 
   return removals;
 }
+
 /**
  * gst_debug_remove_log_function_by_data:
  * @data: user data of the log function to remove
@@ -612,12 +613,16 @@ gst_debug_remove_log_function_by_data (gpointer data)
 {
   guint removals;
 
-  removals = gst_debug_remove_with_compare_func (gst_debug_compare_log_function_by_data, data);
-  GST_DEBUG ("removed %d log functions with user data %p from log function list",
-             removals, data);
+  removals =
+      gst_debug_remove_with_compare_func
+      (gst_debug_compare_log_function_by_data, data);
+  GST_DEBUG
+      ("removed %d log functions with user data %p from log function list",
+      removals, data);
 
   return removals;
 }
+
 /**
  * gst_debug_set_colored:
  * @colored: Whether to use colored output or not
@@ -629,6 +634,7 @@ gst_debug_set_colored (gboolean colored)
 {
   gst_atomic_int_set (&__use_color, colored ? 1 : 0);
 }
+
 /**
  * gst_debug_is_colored:
  * 
@@ -641,6 +647,7 @@ gst_debug_is_colored (void)
 {
   return gst_atomic_int_read (&__use_color) == 0 ? FALSE : TRUE;
 }
+
 /**
  * gst_debug_set_active:
  * @active: Whether to use debugging output or not
@@ -656,6 +663,7 @@ gst_debug_set_active (gboolean active)
 {
   __gst_debug_enabled = active;
 }
+
 /**
  * gst_debug_is_active:
  * 
@@ -668,6 +676,7 @@ gst_debug_is_active (void)
 {
   return __gst_debug_enabled;
 }
+
 /**
  * gst_debug_set_default_threshold:
  * @level: level to set
@@ -681,6 +690,7 @@ gst_debug_set_default_threshold (GstDebugLevel level)
   gst_atomic_int_set (&__default_level, level);
   gst_debug_reset_all_thresholds ();
 }
+
 /**
  * gst_debug_get_default_threshold:
  * 
@@ -690,7 +700,7 @@ gst_debug_set_default_threshold (GstDebugLevel level)
  */
 GstDebugLevel
 gst_debug_get_default_threshold (void)
-{      
+{
   return (GstDebugLevel) gst_atomic_int_read (&__default_level);
 }
 static void
@@ -698,15 +708,16 @@ gst_debug_reset_threshold (gpointer category, gpointer unused)
 {
   GstDebugCategory *cat = (GstDebugCategory *) category;
   GSList *walk;
-  
+
   g_static_mutex_lock (&__level_name_mutex);
   walk = __level_name;
   while (walk) {
     LevelNameEntry *entry = walk->data;
+
     walk = g_slist_next (walk);
     if (g_pattern_match_string (entry->pat, cat->name)) {
       GST_LOG ("category %s matches pattern %p - gets set to level %d",
-               cat->name, entry->pat, entry->level);
+         cat->name, entry->pat, entry->level);
       gst_debug_category_set_threshold (cat, entry->level);
       goto exit;
     }
@@ -731,10 +742,11 @@ for_each_threshold_by_entry (gpointer data, gpointer user_data)
 
   if (g_pattern_match_string (entry->pat, cat->name)) {
     GST_LOG ("category %s matches pattern %p - gets set to level %d",
-             cat->name, entry->pat, entry->level);
+       cat->name, entry->pat, entry->level);
     gst_debug_category_set_threshold (cat, entry->level);
   }
 }
+
 /**
  * gst_debug_set_threshold_for_name:
  * @name: name of the categories to set
@@ -744,11 +756,11 @@ for_each_threshold_by_entry (gpointer data, gpointer user_data)
  * level.
  */
 void
-gst_debug_set_threshold_for_name (const gchar *name, GstDebugLevel level)
+gst_debug_set_threshold_for_name (const gchar * name, GstDebugLevel level)
 {
   GPatternSpec *pat;
   LevelNameEntry *entry;
-       
+
   g_return_if_fail (name != NULL);
 
   pat = g_pattern_spec_new (name);
@@ -762,6 +774,7 @@ gst_debug_set_threshold_for_name (const gchar *name, GstDebugLevel level)
   g_slist_foreach (__categories, for_each_threshold_by_entry, entry);
   g_static_mutex_unlock (&__cat_mutex);
 }
+
 /**
  * gst_debug_unset_threshold_for_name:
  * @name: name of the categories to set
@@ -769,11 +782,11 @@ gst_debug_set_threshold_for_name (const gchar *name, GstDebugLevel level)
  * Resets all categories with the given name back to the default level.
  */
 void
-gst_debug_unset_threshold_for_name (const gchar *name)
+gst_debug_unset_threshold_for_name (const gchar * name)
 {
   GSList *walk;
   GPatternSpec *pat;
-       
+
   g_return_if_fail (name != NULL);
 
   pat = g_pattern_spec_new (name);
@@ -782,6 +795,7 @@ gst_debug_unset_threshold_for_name (const gchar *name)
   /* improve this if you want, it's mighty slow */
   while (walk) {
     LevelNameEntry *entry = walk->data;
+
     if (g_pattern_spec_equal (entry->pat, pat)) {
       __level_name = g_slist_remove_link (__level_name, walk);
       g_pattern_spec_free (entry->pat);
@@ -794,11 +808,12 @@ gst_debug_unset_threshold_for_name (const gchar *name)
   g_pattern_spec_free (pat);
   gst_debug_reset_all_thresholds ();
 }
+
 GstDebugCategory *
-_gst_debug_category_new        (gchar *name, guint color, gchar *description)
+_gst_debug_category_new (gchar * name, guint color, gchar * description)
 {
   GstDebugCategory *cat;
-  
+
   g_return_val_if_fail (name != NULL, NULL);
 
   cat = g_new (GstDebugCategory, 1);
@@ -820,6 +835,7 @@ _gst_debug_category_new     (gchar *name, guint color, gchar *description)
 
   return cat;
 }
+
 /**
  * gst_debug_category_free:
  * @category: #GstDebugCategory to free.
@@ -827,9 +843,10 @@ _gst_debug_category_new    (gchar *name, guint color, gchar *description)
  * Removes and frees the category and all associated resources.
  */
 void
-gst_debug_category_free (GstDebugCategory *category)
+gst_debug_category_free (GstDebugCategory * category)
 {
-  if (category == NULL) return;
+  if (category == NULL)
+    return;
 
   /* remove from category list */
   g_static_mutex_lock (&__cat_mutex);
@@ -858,7 +875,8 @@ gst_debug_category_free (GstDebugCategory *category)
  * </para></note>
  */
 void
-gst_debug_category_set_threshold (GstDebugCategory *category, GstDebugLevel level)
+gst_debug_category_set_threshold (GstDebugCategory * category,
+    GstDebugLevel level)
 {
   g_return_if_fail (category != NULL);
 
@@ -876,7 +894,7 @@ gst_debug_category_set_threshold (GstDebugCategory *category, GstDebugLevel leve
  * gst_debug_category_set_threshold().
  */
 void
-gst_debug_category_reset_threshold (GstDebugCategory *category)
+gst_debug_category_reset_threshold (GstDebugCategory * category)
 {
   gst_debug_reset_threshold (category, NULL);
 }
@@ -890,7 +908,7 @@ gst_debug_category_reset_threshold (GstDebugCategory *category)
  * Returns: the #GstDebugLevel that is used as threshold.
  */
 GstDebugLevel
-gst_debug_category_get_threshold (GstDebugCategory *category)
+gst_debug_category_get_threshold (GstDebugCategory * category)
 {
   return gst_atomic_int_read (category->threshold);
 }
@@ -904,7 +922,7 @@ gst_debug_category_get_threshold (GstDebugCategory *category)
  * Returns: the name of the category.
  */
 const gchar *
-gst_debug_category_get_name (GstDebugCategory *category)
+gst_debug_category_get_name (GstDebugCategory * category)
 {
   return category->name;
 }
@@ -919,7 +937,7 @@ gst_debug_category_get_name (GstDebugCategory *category)
  * Returns: the color of the category.
  */
 guint
-gst_debug_category_get_color (GstDebugCategory *category)
+gst_debug_category_get_color (GstDebugCategory * category)
 {
   return category->color;
 }
@@ -933,10 +951,11 @@ gst_debug_category_get_color (GstDebugCategory *category)
  * Returns: the description of the category.
  */
 const gchar *
-gst_debug_category_get_description (GstDebugCategory *category)
+gst_debug_category_get_description (GstDebugCategory * category)
 {
   return category->description;
 }
+
 /**
  * gst_debug_get_all_categories:
  *
@@ -957,44 +976,49 @@ gst_debug_get_all_categories (void)
   ret = g_slist_copy (__categories);
   g_static_mutex_unlock (&__cat_mutex);
 
-  return ret; 
+  return ret;
 }
 
 /*** FUNCTION POINTERS ********************************************************/
 
 GHashTable *__gst_function_pointers = NULL;
-const gchar *_gst_debug_nameof_funcptr (void *ptr) G_GNUC_NO_INSTRUMENT;
-
-/* This function MUST NOT return NULL */
 const gchar *
 _gst_debug_nameof_funcptr (void *ptr)
+    G_GNUC_NO_INSTRUMENT;
+
+/* This function MUST NOT return NULL */
+     const gchar *_gst_debug_nameof_funcptr (void *ptr)
 {
   gchar *ptrname;
+
 #ifdef HAVE_DLADDR
   Dl_info dlinfo;
 #endif
 
-  if (__gst_function_pointers && (ptrname = g_hash_table_lookup(__gst_function_pointers,ptr))) {
+  if (__gst_function_pointers
+      && (ptrname = g_hash_table_lookup (__gst_function_pointers, ptr))) {
     return ptrname;
   }
   /* we need to create an entry in the hash table for this one so we don't leak
    * the name */
 #ifdef HAVE_DLADDR
-  if (dladdr(ptr,&dlinfo) && dlinfo.dli_sname) {
+  if (dladdr (ptr, &dlinfo) && dlinfo.dli_sname) {
     gchar *name = g_strdup (dlinfo.dli_sname);
+
     _gst_debug_register_funcptr (ptr, name);
     return name;
   } else
 #endif
   {
     gchar *name = g_strdup_printf ("%p", ptr);
+
     _gst_debug_register_funcptr (ptr, name);
     return name;
   }
 }
 
 void *
-_gst_debug_register_funcptr (void *ptr, gchar *ptrname)
+_gst_debug_register_funcptr (void *ptr, gchar * ptrname)
 {
   if (!__gst_function_pointers)
     __gst_function_pointers = g_hash_table_new (g_direct_hash, g_direct_equal);
@@ -1006,7 +1030,7 @@ _gst_debug_register_funcptr (void *ptr, gchar *ptrname)
 
 #ifdef HAVE_PRINTF_EXTENSION
 static int
-_gst_info_printf_extension (FILE *stream, const struct printf_info *info,
+_gst_info_printf_extension (FILE * stream, const struct printf_info *info,
     const void *const *args)
 {
   char *buffer;
@@ -1014,7 +1038,7 @@ _gst_info_printf_extension (FILE *stream, const struct printf_info *info,
   void *ptr;
 
   buffer = NULL;
-  ptr = *(void **)args[0];
+  ptr = *(void **) args[0];
 
   buffer = gst_debug_print_object (ptr);
   len = fprintf (stream, "%*s", (info->left ? -info->width : info->width),
@@ -1040,32 +1064,39 @@ _gst_info_printf_extension_arginfo (const struct printf_info *info, size_t n,
 /* FIXME make this thread specific */
 static GSList *stack_trace = NULL;
 
-void __cyg_profile_func_enter(void *this_fn,void *call_site) G_GNUC_NO_INSTRUMENT;
-void __cyg_profile_func_enter(void *this_fn,void *call_site) 
+void
+__cyg_profile_func_enter (void *this_fn, void *call_site)
+    G_GNUC_NO_INSTRUMENT;
+     void __cyg_profile_func_enter (void *this_fn, void *call_site)
 {
   gchar *name = _gst_debug_nameof_funcptr (this_fn);
   gchar *site = _gst_debug_nameof_funcptr (call_site);
-       
-  GST_CAT_DEBUG(GST_CAT_CALL_TRACE, "entering function %s from %s", name, site);
-  stack_trace = g_slist_prepend (stack_trace, g_strdup_printf ("%8p in %s from %p (%s)", this_fn, name, call_site, site));
+
+  GST_CAT_DEBUG (GST_CAT_CALL_TRACE, "entering function %s from %s", name,
+      site);
+  stack_trace =
+      g_slist_prepend (stack_trace, g_strdup_printf ("%8p in %s from %p (%s)",
+         this_fn, name, call_site, site));
 
   g_free (name);
   g_free (site);
 }
 
-void __cyg_profile_func_exit(void *this_fn,void *call_site) G_GNUC_NO_INSTRUMENT;
-void __cyg_profile_func_exit(void *this_fn,void *call_site) 
+void
+__cyg_profile_func_exit (void *this_fn, void *call_site)
+    G_GNUC_NO_INSTRUMENT;
+     void __cyg_profile_func_exit (void *this_fn, void *call_site)
 {
   gchar *name = _gst_debug_nameof_funcptr (this_fn);
 
-  GST_CAT_DEBUG(GST_CAT_CALL_TRACE, "leaving function %s", name);
+  GST_CAT_DEBUG (GST_CAT_CALL_TRACE, "leaving function %s", name);
   g_free (stack_trace->data);
   stack_trace = g_slist_delete_link (stack_trace, stack_trace);
 
   g_free (name);
 }
 
-void 
+void
 gst_debug_print_stack_trace (void)
 {
   GSList *walk = stack_trace;
@@ -1083,7 +1114,7 @@ gst_debug_print_stack_trace (void)
   }
 }
 #else
-void 
+void
 gst_debug_print_stack_trace (void)
 {
   /* nothing because it's compiled out */