]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/blobdiff - gst/gstinfo.h
Changes to make it possible to LD_PRELOAD libttif
[glsdk/gstreamer0-10.git] / gst / gstinfo.h
index 7c2d86f789cef23d7af896b2f40d27ffd9c23a29..3abdb2dd42512de0733a3ca29224fa11169f9762 100644 (file)
@@ -177,6 +177,8 @@ struct _GstDebugCategory {
 
   const gchar *                name;
   const gchar *                description;
+
+  void *ext;                /**< for use by LD_PRELOADED trace extension */
 };
 
 /********** some convenience macros for debugging **********/
@@ -260,6 +262,14 @@ typedef void (*GstLogFunction)  (GstDebugCategory * category,
 /* FIXME 0.11: move this into private headers */
 void            _gst_debug_init (void);
 
+typedef struct {
+       const gchar *file;
+       const gchar *function;
+       const gint   line;
+} GstDebugTraceLocation;
+
+#define GST_DEBUG_TRACE_LOCATION() \
+       { __FILE__, GST_FUNCTION, __LINE__ }
 
 #ifdef GST_USING_PRINTF_EXTENSION
 
@@ -273,6 +283,13 @@ void                   gst_debug_log            (GstDebugCategory * category,
                                           const gchar      * format,
                                           ...) G_GNUC_NO_INSTRUMENT;
 
+void               gst_debug_log2           (GstDebugCategory * category,
+                                          GstDebugLevel      level,
+                                          const GstDebugTraceLocation *location,
+                                          GObject          * object,
+                                          const gchar      * format,
+                                          ...) G_GNUC_NO_INSTRUMENT;
+
 #else /* GST_USING_PRINTF_EXTENSION */
 
 void               gst_debug_log            (GstDebugCategory * category,
@@ -284,6 +301,13 @@ void                   gst_debug_log            (GstDebugCategory * category,
                                           const gchar      * format,
                                           ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT;
 
+void               gst_debug_log2           (GstDebugCategory * category,
+                                          GstDebugLevel      level,
+                                          const GstDebugTraceLocation *location,
+                                          GObject          * object,
+                                          const gchar      * format,
+                                          ...) G_GNUC_PRINTF (5, 6) G_GNUC_NO_INSTRUMENT;
+
 #endif /* GST_USING_PRINTF_EXTENSION */
 
 void            gst_debug_log_valist     (GstDebugCategory * category,
@@ -317,12 +341,25 @@ typedef   void (* GstDebugFuncPtr)        (void);
 /* do no use these functions, use the GST_DEBUG*_FUNCPTR macros */
 void   _gst_debug_register_funcptr     (GstDebugFuncPtr        func,
                                         const gchar *          ptrname);
-G_CONST_RETURN gchar *
+const gchar *
        _gst_debug_nameof_funcptr       (GstDebugFuncPtr        func) G_GNUC_NO_INSTRUMENT;
 
 
+void            gst_debug_log_valist2    (GstDebugCategory * category,
+                                          GstDebugLevel      level,
+                                          const GstDebugTraceLocation *location,
+                                          GObject          * object,
+                                          const gchar      * format,
+                                          va_list            args) G_GNUC_NO_INSTRUMENT;
+
 const gchar   * gst_debug_message_get    (GstDebugMessage  * message);
 
+gchar *         gst_debug_print_object (gpointer ptr);
+
+#ifdef HAVE_PRINTF_EXTENSION
+gchar *         gst_debug_print_segment (gpointer ptr);
+#endif
+
 void            gst_debug_log_default    (GstDebugCategory * category,
                                           GstDebugLevel      level,
                                           const gchar      * file,
@@ -332,11 +369,11 @@ void            gst_debug_log_default    (GstDebugCategory * category,
                                           GstDebugMessage  * message,
                                           gpointer           unused) G_GNUC_NO_INSTRUMENT;
 
-G_CONST_RETURN gchar *
-                gst_debug_level_get_name (GstDebugLevel level);
+const gchar *   gst_debug_level_get_name (GstDebugLevel level);
 
 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);
 
@@ -358,11 +395,9 @@ void                   gst_debug_category_set_threshold     (GstDebugCategory *    catego
                                                       GstDebugLevel            level);
 void            gst_debug_category_reset_threshold   (GstDebugCategory *       category);
 GstDebugLevel   gst_debug_category_get_threshold     (GstDebugCategory *       category);
-G_CONST_RETURN gchar *
-                   gst_debug_category_get_name          (GstDebugCategory *    category);
+const gchar *   gst_debug_category_get_name          (GstDebugCategory *       category);
 guint           gst_debug_category_get_color         (GstDebugCategory *       category);
-G_CONST_RETURN gchar *
-                gst_debug_category_get_description   (GstDebugCategory *       category);
+const gchar *   gst_debug_category_get_description   (GstDebugCategory *       category);
 GSList *        gst_debug_get_all_categories   (void);
 
 
@@ -372,6 +407,20 @@ gint    gst_debug_construct_win_color  (guint colorinfo);
 
 #ifndef GST_DISABLE_GST_DEBUG
 
+#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)
+
 /**
  * GST_DEBUG_CATEGORY:
  * @cat: the category
@@ -482,7 +531,7 @@ extern gboolean                     __gst_debug_enabled;
 
 /* since 0.10.7, the min debug level, used for quickly discarding debug
  * messages that fall under the threshold. */
-GST_EXPORT GstDebugLevel            __gst_debug_min; 
+GST_EXPORT GstDebugLevel            __gst_debug_min;
 
 /**
  * GST_CAT_LEVEL_LOG:
@@ -495,19 +544,41 @@ GST_EXPORT GstDebugLevel            __gst_debug_min;
  * debugging messages. You will probably want to use one of the ones described
  * below.
  */
+#if defined(GST_USING_PRINTF_EXTENSION) && defined(G_HAVE_GNUC_VARARGS)
+#define GST_CAT_LEVEL_LOG_obj(cat,level,object,str,args...) G_STMT_START{  \
+  if (G_UNLIKELY (level <= __gst_debug_min)) {                             \
+    const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION();          \
+    gst_debug_log2 ((cat), (level), &loc, NULL, "%"GST_PTR_FORMAT" "str,   \
+        (object), ##args );                                                \
+  }                                                                        \
+}G_STMT_END
+#define GST_CAT_LEVEL_LOG_noobj(cat,level,object,str,args...) G_STMT_START{\
+  if (G_UNLIKELY (level <= __gst_debug_min)) {                             \
+    const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION();          \
+    gst_debug_log2 ((cat), (level), &loc, NULL, (str), ##args );           \
+  }                                                                        \
+}G_STMT_END
+#else
+#  define GST_CAT_LEVEL_LOG_obj   GST_CAT_LEVEL_LOG
+#  define GST_CAT_LEVEL_LOG_noobj GST_CAT_LEVEL_LOG
+#endif
+
+
 #ifdef G_HAVE_ISO_VARARGS
 #define GST_CAT_LEVEL_LOG(cat,level,object,...) G_STMT_START{          \
-  if (G_UNLIKELY (level <= __gst_debug_min)) {                                         \
-    gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__,   \
-        (GObject *) (object), __VA_ARGS__);                            \
+  if (G_UNLIKELY (level <= __gst_debug_min)) { \
+       const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION();   \
+    gst_debug_log2 ((cat), (level), &loc, (GObject *) (object),                \
+            __VA_ARGS__);                                                                                      \
   }                                                                    \
 }G_STMT_END
 #else /* G_HAVE_GNUC_VARARGS */
 #ifdef G_HAVE_GNUC_VARARGS
 #define GST_CAT_LEVEL_LOG(cat,level,object,args...) G_STMT_START{      \
   if (G_UNLIKELY (level <= __gst_debug_min)) {                                         \
-    gst_debug_log ((cat), (level), __FILE__, GST_FUNCTION, __LINE__,   \
-        (GObject *) (object), ##args );                                        \
+    const GstDebugTraceLocation loc = GST_DEBUG_TRACE_LOCATION();      \
+    gst_debug_log2 ((cat), (level), &loc, (GObject *) (object),                \
+            ##args );                                                                                      \
   }                                                                    \
 }G_STMT_END
 #else /* no variadic macros, use inline */
@@ -1244,6 +1315,7 @@ GST_TRACE (const char *format, ...)
 
 #if defined(__GNUC__) && __GNUC__ >= 3
 #  pragma GCC poison gst_debug_log
+#  pragma GCC poison gst_debug_log2
 #  pragma GCC poison gst_debug_log_valist
 #  pragma GCC poison _gst_debug_category_new
 #endif