summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/gstreamer/files/gst-0.10.32-0002-Changes-to-make-it-possible-to-LD_PRELOAD-libttif.patch')
-rw-r--r--media-libs/gstreamer/files/gst-0.10.32-0002-Changes-to-make-it-possible-to-LD_PRELOAD-libttif.patch262
1 files changed, 262 insertions, 0 deletions
diff --git a/media-libs/gstreamer/files/gst-0.10.32-0002-Changes-to-make-it-possible-to-LD_PRELOAD-libttif.patch b/media-libs/gstreamer/files/gst-0.10.32-0002-Changes-to-make-it-possible-to-LD_PRELOAD-libttif.patch
new file mode 100644
index 0000000..724bd58
--- /dev/null
+++ b/media-libs/gstreamer/files/gst-0.10.32-0002-Changes-to-make-it-possible-to-LD_PRELOAD-libttif.patch
@@ -0,0 +1,262 @@
+From ac55210758bdd06fe0dec6ef67a60a96a86b39f4 Mon Sep 17 00:00:00 2001
+From: Rob Clark <rob@ti.com>
+Date: Sun, 4 Apr 2010 09:14:34 -0500
+Subject: [PATCH 2/5] Changes to make it possible to LD_PRELOAD libttif
+
+1) if GST_USING_PRINTF_EXTENSION, then prepend the fmt string with "<%P> " and
+pass object as a normal arg. When using TTIF, you want the whole fmt string,
+including the object name prefix, to be constant. This way, only the fmt
+string pointer needs to be logged.
+2) GstDebugTraceLocation: small optimization to stash __FILE__, __LINE__, and
+GST_FUNCTION together and pass as a single ptr.. the optimization is probably
+lost in the noise with the default printf() based traces, but makes more of a
+difference with faster trace systems
+---
+ gst/gstinfo.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++-----
+ gst/gstinfo.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
+ 2 files changed, 123 insertions(+), 11 deletions(-)
+
+diff --git a/gst/gstinfo.c b/gst/gstinfo.c
+index 3688120..dfa8650 100644
+--- a/gst/gstinfo.c
++++ b/gst/gstinfo.c
+@@ -494,6 +494,31 @@ gst_path_basename (const gchar * file_name)
+ #endif
+
+ /**
++ * gst_debug_log2:
++ * @category: category to log
++ * @level: level of the message is in
++ * @location: the file, function name, and line number of the location that
++ * emitted the message
++ * @object: the object this message relates to or NULL if none
++ * @format: a printf style format string
++ * @...: optional arguments for the format
++ *
++ * Logs the given message using the currently registered debugging handlers.
++ */
++void
++gst_debug_log2 (GstDebugCategory * category, GstDebugLevel level,
++ const GstDebugTraceLocation * location,
++ GObject * object, const gchar * format, ...)
++{
++ va_list var_args;
++
++ va_start (var_args, format);
++ gst_debug_log_valist2 (category, level, location, object, format, var_args);
++ va_end (var_args);
++}
++
++
++/**
+ * gst_debug_log_valist:
+ * @category: category to log
+ * @level: level of the message is in
+@@ -512,13 +537,39 @@ gst_debug_log_valist (GstDebugCategory * category, GstDebugLevel level,
+ const gchar * file, const gchar * function, gint line,
+ GObject * object, const gchar * format, va_list args)
+ {
++ GstDebugTraceLocation location = {
++ .file = file,
++ .function = function,
++ .line = line
++ };
++ gst_debug_log_valist2 (category, level, &location, object, format, args);
++}
++
++/**
++ * gst_debug_log_valist2:
++ * @category: category to log
++ * @level: level of the message is in
++ * @location: the file, function name, and line number of the location that
++ * emitted the message
++ * @object: the object this message relates to or NULL if none
++ * @format: a printf style format string
++ * @args: optional arguments for the format
++ *
++ * Logs the given message using the currently registered debugging handlers.
++ */
++void
++gst_debug_log_valist2 (GstDebugCategory * category, GstDebugLevel level,
++ const GstDebugTraceLocation * location,
++ GObject * object, const gchar * format, va_list args)
++{
+ GstDebugMessage message;
+ LogFuncEntry *entry;
+ GSList *handler;
+
+ g_return_if_fail (category != NULL);
+- g_return_if_fail (file != NULL);
+- g_return_if_fail (function != NULL);
++ g_return_if_fail (location != NULL);
++ g_return_if_fail (location->file != NULL);
++ g_return_if_fail (location->function != NULL);
+ g_return_if_fail (format != NULL);
+
+ /* The predefined macro __FILE__ is always the exact path given to the
+@@ -536,8 +587,9 @@ gst_debug_log_valist (GstDebugCategory * category, GstDebugLevel level,
+ while (handler) {
+ entry = handler->data;
+ handler = g_slist_next (handler);
+- entry->func (category, level, file, function, line, object, &message,
+- entry->user_data);
++ // TODO: change GstLogFunction and pass GstDebugTraceLocation ptr instead..
++ entry->func (category, level, location->file, location->function,
++ location->line, object, &message, entry->user_data);
+ }
+ g_free (message.message);
+ va_end (message.arguments);
+@@ -610,7 +662,7 @@ gst_info_structure_to_string (GstStructure * s)
+ return gst_structure_to_string (s);
+ }
+
+-static gchar *
++gchar *
+ gst_debug_print_object (gpointer ptr)
+ {
+ GObject *object = (GObject *) ptr;
+@@ -708,7 +760,7 @@ gst_debug_print_object (gpointer ptr)
+
+ #ifdef HAVE_PRINTF_EXTENSION
+
+-static gchar *
++gchar *
+ gst_debug_print_segment (gpointer ptr)
+ {
+ GstSegment *segment = (GstSegment *) ptr;
+diff --git a/gst/gstinfo.h b/gst/gstinfo.h
+index 7c2d86f..24ca706 100644
+--- a/gst/gstinfo.h
++++ b/gst/gstinfo.h
+@@ -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,
+@@ -321,8 +345,21 @@ G_CONST_RETURN 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,
+@@ -495,19 +532,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 +1303,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
+--
+1.7.1
+