added plugin_desc structures to libs, which makes their locations cached in the regis...
[platform/upstream/gstreamer.git] / gst / gstinfo.c
index 7656f8b..c50e41b 100644 (file)
 #include "gst_private.h"
 #include "gstelement.h"
 #include "gstpad.h"
+#include "gstscheduler.h"
+
+#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];
+} Dl_info;
+#define _RLD_DLADDR             14
+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;
+}
+#endif
 
 extern gchar *_gst_progname;
 
@@ -93,29 +116,29 @@ const gchar *_gst_category_colors[32] = {
   [GST_CAT_COTHREAD_SWITCH]    = "00;37;42",
   [GST_CAT_AUTOPLUG]           = "00;34",
   [GST_CAT_AUTOPLUG_ATTEMPT]   = "00;36;44",
-  [GST_CAT_PARENTAGE]          = "01;37;41",           // !!
+  [GST_CAT_PARENTAGE]          = "01;37;41",           /* !! */
   [GST_CAT_STATES]             = "00;31",
   [GST_CAT_PLANNING]           = "07;35",
   [GST_CAT_SCHEDULING]         = "00;35",
   [GST_CAT_DATAFLOW]           = "00;32",
   [GST_CAT_BUFFER]             = "00;32",
   [GST_CAT_CAPS]               = "04;34",
-  [GST_CAT_CLOCK]              = "00;33",              // !!
-  [GST_CAT_ELEMENT_PADS]       = "01;37;41",           // !!
-  [GST_CAT_ELEMENTFACTORY]     = "01;37;41",           // !!
-  [GST_CAT_PADS]               = "01;37;41",           // !!
-  [GST_CAT_PIPELINE]           = "01;37;41",           // !!
+  [GST_CAT_CLOCK]              = "00;33",              /* !! */
+  [GST_CAT_ELEMENT_PADS]       = "01;37;41",           /* !! */
+  [GST_CAT_ELEMENTFACTORY]     = "01;37;41",           /* !! */
+  [GST_CAT_PADS]               = "01;37;41",           /* !! */
+  [GST_CAT_PIPELINE]           = "01;37;41",           /* !! */
   [GST_CAT_PLUGIN_LOADING]     = "00;36",
   [GST_CAT_PLUGIN_ERRORS]      = "05;31",
   [GST_CAT_PLUGIN_INFO]                = "00;36",
-  [GST_CAT_PROPERTIES]         = "00;37;44",           // !!
+  [GST_CAT_PROPERTIES]         = "00;37;44",           /* !! */
   [GST_CAT_THREAD]             = "00;31",
-  [GST_CAT_TYPES]              = "01;37;41",           // !!
-  [GST_CAT_XML]                        = "01;37;41",           // !!
+  [GST_CAT_TYPES]              = "01;37;41",           /* !! */
+  [GST_CAT_XML]                        = "01;37;41",           /* !! */
   [GST_CAT_NEGOTIATION]                = "07;34",
   [GST_CAT_REFCOUNTING]                = "00;34:42",
-  [GST_CAT_EVENT]              = "01;37;41",           // !!
-  [GST_CAT_PARAMS]             = "00;30;43",           // !!
+  [GST_CAT_EVENT]              = "01;37;41",           /* !! */
+  [GST_CAT_PARAMS]             = "00;30;43",           /* !! */
 
   [GST_CAT_CALL_TRACE]         = "",
   [31]                         = "05;31",
@@ -166,14 +189,14 @@ gst_default_debug_handler (gint category, gboolean incore,
   gchar *empty = "";
   gchar *elementname = empty,*location = empty;
   int pthread_id = getpid();
-  int cothread_id = cothread_getcurrent();
+  int cothread_id = 0; /*FIXME*/
 #ifdef GST_DEBUG_COLOR
   int pthread_color = pthread_id%6 + 31;
   int cothread_color = (cothread_id < 0) ? 37 : (cothread_id%6 + 31);
 #endif
 
   if (debug_string == NULL) debug_string = "";
-//  if (category != GST_CAT_GST_INIT)
+/*  if (category != GST_CAT_GST_INIT) */
     location = g_strdup_printf("%s:%d%s:",function,line,debug_string);
   if (element && GST_IS_ELEMENT (element))
 #ifdef GST_DEBUG_COLOR
@@ -184,11 +207,11 @@ gst_default_debug_handler (gint category, gboolean incore,
 
 #ifdef GST_DEBUG_COLOR
   fprintf(stderr,"DEBUG(\033[00;%dm%5d\033[00m:\033[00;%dm%2d\033[00m)\033["
-          "%s;%sm%s%s\033[00m %s",
+          "%s;%sm%s%s\033[00m %s\n",
           pthread_color,pthread_id,cothread_color,cothread_id,incore?"00":"01",
           _gst_category_colors[category],location,elementname,string);
 #else
-  fprintf(stderr,"DEBUG(%5d:%2d)%s%s %s",
+  fprintf(stderr,"DEBUG(%5d:%2d)%s%s %s\n",
           pthread_id,cothread_id,location,elementname,string);
 #endif /* GST_DEBUG_COLOR */
 
@@ -209,8 +232,6 @@ gst_default_debug_handler (gint category, gboolean incore,
 void
 gst_debug_set_categories (guint32 categories) {
   _gst_debug_categories = categories;
-  if (categories)
-    GST_INFO (0, "setting DEBUG categories to 0x%08X",categories);
 }
 
 /**
@@ -235,8 +256,6 @@ gst_debug_get_categories () {
 void
 gst_debug_enable_category (gint category) {
   _gst_debug_categories |= (1 << category);
-  if (_gst_debug_categories)
-    GST_INFO (0, "setting DEBUG categories to 0x%08X",_gst_debug_categories);
 }
 
 /**
@@ -248,8 +267,6 @@ gst_debug_enable_category (gint category) {
 void
 gst_debug_disable_category (gint category) {
   _gst_debug_categories &= ~ (1 << category);
-  if (_gst_debug_categories)
-    GST_INFO (0, "setting DEBUG categories to 0x%08X",_gst_debug_categories);
 }
 
 
@@ -284,7 +301,7 @@ gst_default_info_handler (gint category, gboolean incore,
   gchar *empty = "";
   gchar *elementname = empty,*location = empty;
   int pthread_id = getpid();
-  int cothread_id = cothread_getcurrent();
+  int cothread_id = 0; /*FIXME*/
 #ifdef GST_DEBUG_COLOR
   int pthread_color = pthread_id%6 + 31;
   int cothread_color = (cothread_id < 0) ? 37 : (cothread_id%6 + 31);
@@ -307,7 +324,7 @@ gst_default_info_handler (gint category, gboolean incore,
   #else
     fprintf(stderr,"INFO (%5d:%2d)%s%s %s\n",
             pthread_id,cothread_id,location,elementname,string);
-  #endif // GST_DEBUG_COLOR
+#endif /* GST_DEBUG_COLOR */
 /*
 #else
   #ifdef GST_DEBUG_COLOR
@@ -316,7 +333,8 @@ gst_default_info_handler (gint category, gboolean incore,
   #else
     fprintf(stderr,"INFO:%s%s %s\n",
             location,elementname,string);
-  #endif // GST_DEBUG_COLOR
+  #endif * GST_DEBUG_COLOR *
+
 #endif
 */
 
@@ -336,8 +354,6 @@ gst_default_info_handler (gint category, gboolean incore,
 void
 gst_info_set_categories (guint32 categories) {
   _gst_info_categories = categories;
-  if (categories)
-    GST_INFO (0, "setting INFO categories to 0x%08X",categories);
 }
 
 /**
@@ -363,8 +379,6 @@ gst_info_get_categories () {
 void
 gst_info_enable_category (gint category) {
   _gst_info_categories |= (1 << category);
-  if (_gst_info_categories)
-    GST_INFO (0, "setting INFO categories to 0x%08X",_gst_info_categories);
 }
 
 /**
@@ -376,8 +390,6 @@ gst_info_enable_category (gint category) {
 void
 gst_info_disable_category (gint category) {
   _gst_info_categories &= ~ (1 << category);
-  if (_gst_info_categories)
-    GST_INFO (0, "setting INFO categories to 0x%08X",_gst_info_categories);
 }
 
 
@@ -413,15 +425,15 @@ gst_default_error_handler (gchar *file, gchar *function,
   gchar *path;
   int i;
 
-  // if there are NULL pointers, point them to null strings to clean up output
+  /* if there are NULL pointers, point them to null strings to clean up output */
   if (!debug_string) debug_string = "";
   if (!string) string = "";
 
-  // print out a preamble
+  /* print out a preamble */
   fprintf(stderr,"***** GStreamer ERROR ***** in file %s at %s:%d%s\n",
           file,function,line,debug_string);
 
-  // if there's an element, print out the pertinent information
+  /* if there's an element, print out the pertinent information */
   if (element) {
     if (GST_IS_OBJECT(element)) {
       path = gst_object_get_path_string(element);
@@ -434,9 +446,9 @@ gst_default_error_handler (gchar *file, gchar *function,
     }
   }
 
-  // if there's an object, print it out as well
+  /* if there's an object, print it out as well */
   if (object) {
-    // attempt to pad the line, or create a new one
+    /* attempt to pad the line, or create a new one */
     if (chars < 40)
       for (i=0;i<(40-chars)/8+1;i++) fprintf(stderr,"\t");
     else
@@ -467,8 +479,8 @@ gst_default_error_handler (gchar *file, gchar *function,
 
 /***** DEBUG system *****/
 GHashTable *__gst_function_pointers = NULL;
-// FIXME make this thread specific
-static GSList *stack_trace = NULL;
+/* FIXME make this thread specific */
+/* static GSList *stack_trace = NULL; */
 
 gchar *_gst_debug_nameof_funcptr (void *ptr) __attribute__ ((no_instrument_function));
 
@@ -535,7 +547,7 @@ gst_debug_print_stack_trace (void)
 void 
 gst_debug_print_stack_trace (void)
 {
-  //nothing because it's compiled out
+  /* nothing because it's compiled out */
 }
 
 #endif /* GST_ENABLE_FUNC_INTSTRUMENTATION */