info: Add a 'flags' parametter to gst_debug_get_stack_trace
[platform/upstream/gstreamer.git] / plugins / tracers / gstlog.c
index ac9ae17..631e58d 100644 (file)
@@ -22,7 +22,7 @@
  * SECTION:gstlog
  * @short_description: log hook event
  *
- * A tracing module that logs all data from all hooks. 
+ * A tracing module that logs all data from all hooks.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -63,12 +63,13 @@ G_DEFINE_TYPE_WITH_CODE (GstLogTracer, gst_log_tracer, GST_TYPE_TRACER,
     _do_init);
 
 static void
-do_log (GstDebugCategory * cat, const char *fmt, ...)
+do_log (GstDebugCategory * cat, const char *func, GObject * obj,
+    const char *fmt, ...)
 {
   va_list var_args;
 
   va_start (var_args, fmt);
-  gst_debug_log_valist (cat, GST_LEVEL_TRACE, "", "", 0, NULL, fmt, var_args);
+  gst_debug_log_valist (cat, GST_LEVEL_TRACE, "", func, 0, obj, fmt, var_args);
   va_end (var_args);
 }
 
@@ -76,7 +77,7 @@ static void
 do_push_buffer_pre (GstTracer * self, guint64 ts, GstPad * pad,
     GstBuffer * buffer)
 {
-  do_log (GST_CAT_BUFFER,
+  do_log (GST_CAT_BUFFER, GST_FUNCTION, (GObject *) pad,
       "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", buffer=%" GST_PTR_FORMAT,
       GST_TIME_ARGS (ts), pad, buffer);
 }
@@ -85,7 +86,7 @@ static void
 do_push_buffer_post (GstTracer * self, guint64 ts, GstPad * pad,
     GstFlowReturn res)
 {
-  do_log (GST_CAT_BUFFER,
+  do_log (GST_CAT_BUFFER, GST_FUNCTION, (GObject *) pad,
       "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", res=%d",
       GST_TIME_ARGS (ts), pad, res);
 }
@@ -94,7 +95,7 @@ static void
 do_push_buffer_list_pre (GstTracer * self, guint64 ts, GstPad * pad,
     GstBufferList * list)
 {
-  do_log (GST_CAT_BUFFER_LIST,
+  do_log (GST_CAT_BUFFER_LIST, GST_FUNCTION, (GObject *) pad,
       "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", list=%p",
       GST_TIME_ARGS (ts), pad, list);
 }
@@ -103,7 +104,7 @@ static void
 do_push_buffer_list_post (GstTracer * self, guint64 ts, GstPad * pad,
     GstFlowReturn res)
 {
-  do_log (GST_CAT_BUFFER_LIST,
+  do_log (GST_CAT_BUFFER_LIST, GST_FUNCTION, (GObject *) pad,
       "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", res=%d",
       GST_TIME_ARGS (ts), pad, res);
 }
@@ -112,7 +113,7 @@ static void
 do_pull_range_pre (GstTracer * self, guint64 ts, GstPad * pad, guint64 offset,
     guint size)
 {
-  do_log (GST_CAT_BUFFER,
+  do_log (GST_CAT_BUFFER, GST_FUNCTION, (GObject *) pad,
       "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", offset=%" G_GUINT64_FORMAT
       ", size=%u", GST_TIME_ARGS (ts), pad, offset, size);
 }
@@ -121,7 +122,7 @@ static void
 do_pull_range_post (GstTracer * self, guint64 ts, GstPad * pad,
     GstBuffer * buffer, GstFlowReturn res)
 {
-  do_log (GST_CAT_BUFFER,
+  do_log (GST_CAT_BUFFER, GST_FUNCTION, (GObject *) pad,
       "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", buffer=%" GST_PTR_FORMAT
       ", res=%d", GST_TIME_ARGS (ts), pad, buffer, res);
 }
@@ -129,7 +130,7 @@ do_pull_range_post (GstTracer * self, guint64 ts, GstPad * pad,
 static void
 do_push_event_pre (GstTracer * self, guint64 ts, GstPad * pad, GstEvent * event)
 {
-  do_log (GST_CAT_EVENT,
+  do_log (GST_CAT_EVENT, GST_FUNCTION, (GObject *) pad,
       "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", event=%" GST_PTR_FORMAT,
       GST_TIME_ARGS (ts), pad, event);
 }
@@ -137,7 +138,23 @@ do_push_event_pre (GstTracer * self, guint64 ts, GstPad * pad, GstEvent * event)
 static void
 do_push_event_post (GstTracer * self, guint64 ts, GstPad * pad, gboolean res)
 {
-  do_log (GST_CAT_EVENT,
+  do_log (GST_CAT_EVENT, GST_FUNCTION, (GObject *) pad,
+      "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", res=%d",
+      GST_TIME_ARGS (ts), pad, res);
+}
+
+static void
+do_pad_query_pre (GstTracer * self, guint64 ts, GstPad * pad, GstQuery * query)
+{
+  do_log (GST_CAT_QUERY, GST_FUNCTION, (GObject *) pad,
+      "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", query=%"
+      GST_PTR_FORMAT, GST_TIME_ARGS (ts), pad, query);
+}
+
+static void
+do_pad_query_post (GstTracer * self, guint64 ts, GstPad * pad, gboolean res)
+{
+  do_log (GST_CAT_QUERY, GST_FUNCTION, (GObject *) pad,
       "%" GST_TIME_FORMAT ", pad=%" GST_PTR_FORMAT ", res=%d",
       GST_TIME_ARGS (ts), pad, res);
 }
@@ -146,7 +163,7 @@ static void
 do_post_message_pre (GstTracer * self, guint64 ts, GstElement * elem,
     GstMessage * msg)
 {
-  do_log (GST_CAT_EVENT,
+  do_log (GST_CAT_MESSAGE, GST_FUNCTION, (GObject *) elem,
       "%" GST_TIME_FORMAT ", element=%" GST_PTR_FORMAT ", message=%"
       GST_PTR_FORMAT, GST_TIME_ARGS (ts), elem, msg);
 }
@@ -155,23 +172,25 @@ static void
 do_post_message_post (GstTracer * self, guint64 ts, GstElement * elem,
     gboolean res)
 {
-  do_log (GST_CAT_EVENT,
+  do_log (GST_CAT_MESSAGE, GST_FUNCTION, (GObject *) elem,
       "%" GST_TIME_FORMAT ", element=%" GST_PTR_FORMAT ", res=%d",
       GST_TIME_ARGS (ts), elem, res);
 }
 
 static void
-do_query_pre (GstTracer * self, guint64 ts, GstElement * elem, GstQuery * query)
+do_element_query_pre (GstTracer * self, guint64 ts, GstElement * elem,
+    GstQuery * query)
 {
-  do_log (GST_CAT_QUERY,
+  do_log (GST_CAT_QUERY, GST_FUNCTION, (GObject *) elem,
       "%" GST_TIME_FORMAT ", element=%" GST_PTR_FORMAT ", query=%"
       GST_PTR_FORMAT, GST_TIME_ARGS (ts), elem, query);
 }
 
 static void
-do_query_post (GstTracer * self, guint64 ts, GstElement * elem, gboolean res)
+do_element_query_post (GstTracer * self, guint64 ts, GstElement * elem,
+    gboolean res)
 {
-  do_log (GST_CAT_QUERY,
+  do_log (GST_CAT_QUERY, GST_FUNCTION, (GObject *) elem,
       "%" GST_TIME_FORMAT ", element=%" GST_PTR_FORMAT ", res=%d",
       GST_TIME_ARGS (ts), elem, res);
 }
@@ -179,7 +198,7 @@ do_query_post (GstTracer * self, guint64 ts, GstElement * elem, gboolean res)
 static void
 do_element_new (GstTracer * self, guint64 ts, GstElement * elem)
 {
-  do_log (GST_CAT_ELEMENT_FACTORY,
+  do_log (GST_CAT_ELEMENT_FACTORY, GST_FUNCTION, (GObject *) elem,
       "%" GST_TIME_FORMAT ", element=%" GST_PTR_FORMAT,
       GST_TIME_ARGS (ts), elem);
 }
@@ -188,7 +207,7 @@ static void
 do_element_add_pad (GstTracer * self, guint64 ts, GstElement * elem,
     GstPad * pad)
 {
-  do_log (GST_CAT_ELEMENT_PADS,
+  do_log (GST_CAT_ELEMENT_PADS, GST_FUNCTION, (GObject *) elem,
       "%" GST_TIME_FORMAT ", element=%" GST_PTR_FORMAT ", pad=%" GST_PTR_FORMAT,
       GST_TIME_ARGS (ts), elem, pad);
 }
@@ -197,7 +216,7 @@ static void
 do_element_remove_pad (GstTracer * self, guint64 ts, GstElement * elem,
     GstPad * pad)
 {
-  do_log (GST_CAT_ELEMENT_PADS,
+  do_log (GST_CAT_ELEMENT_PADS, GST_FUNCTION, (GObject *) elem,
       "%" GST_TIME_FORMAT ", element=%" GST_PTR_FORMAT ", pad=%" GST_PTR_FORMAT,
       GST_TIME_ARGS (ts), elem, pad);
 }
@@ -206,7 +225,7 @@ static void
 do_element_change_state_pre (GstTracer * self, guint64 ts, GstElement * elem,
     GstStateChange change)
 {
-  do_log (GST_CAT_STATES,
+  do_log (GST_CAT_STATES, GST_FUNCTION, (GObject *) elem,
       "%" GST_TIME_FORMAT ", element=%" GST_PTR_FORMAT ", change=%d",
       GST_TIME_ARGS (ts), elem, (gint) change);
 }
@@ -215,7 +234,7 @@ static void
 do_element_change_state_post (GstTracer * self, guint64 ts, GstElement * elem,
     GstStateChange change, GstStateChangeReturn res)
 {
-  do_log (GST_CAT_STATES,
+  do_log (GST_CAT_STATES, GST_FUNCTION, (GObject *) elem,
       "%" GST_TIME_FORMAT ", element=%" GST_PTR_FORMAT ", change=%d, res=%d",
       GST_TIME_ARGS (ts), elem, (gint) change, (gint) res);
 }
@@ -223,7 +242,7 @@ do_element_change_state_post (GstTracer * self, guint64 ts, GstElement * elem,
 static void
 do_bin_add_pre (GstTracer * self, guint64 ts, GstBin * bin, GstElement * elem)
 {
-  do_log (GST_CAT_BIN,
+  do_log (GST_CAT_BIN, GST_FUNCTION, (GObject *) bin,
       "%" GST_TIME_FORMAT ", bin=%" GST_PTR_FORMAT ", element=%" GST_PTR_FORMAT,
       GST_TIME_ARGS (ts), bin, elem);
 }
@@ -232,7 +251,7 @@ static void
 do_bin_add_post (GstTracer * self, guint64 ts, GstBin * bin, GstElement * elem,
     gboolean res)
 {
-  do_log (GST_CAT_BIN,
+  do_log (GST_CAT_BIN, GST_FUNCTION, (GObject *) bin,
       "%" GST_TIME_FORMAT ", bin=%" GST_PTR_FORMAT ", element=%" GST_PTR_FORMAT
       ", res=%d", GST_TIME_ARGS (ts), bin, elem, res);
 }
@@ -241,7 +260,7 @@ static void
 do_bin_remove_pre (GstTracer * self, guint64 ts, GstBin * bin,
     GstElement * elem)
 {
-  do_log (GST_CAT_BIN,
+  do_log (GST_CAT_BIN, GST_FUNCTION, (GObject *) bin,
       "%" GST_TIME_FORMAT ", bin=%" GST_PTR_FORMAT ", element=%" GST_PTR_FORMAT,
       GST_TIME_ARGS (ts), bin, elem);
 }
@@ -249,24 +268,24 @@ do_bin_remove_pre (GstTracer * self, guint64 ts, GstBin * bin,
 static void
 do_bin_remove_post (GstTracer * self, guint64 ts, GstBin * bin, gboolean res)
 {
-  do_log (GST_CAT_BIN,
+  do_log (GST_CAT_BIN, GST_FUNCTION, (GObject *) bin,
       "%" GST_TIME_FORMAT ", bin=%" GST_PTR_FORMAT ", res=%d",
       GST_TIME_ARGS (ts), bin, res);
 }
 
 static void
-do_pad_link_pre (GstTracer * self, guint64 ts, GstPad * src, GstElement * sink)
+do_pad_link_pre (GstTracer * self, guint64 ts, GstPad * src, GstPad * sink)
 {
-  do_log (GST_CAT_PADS,
+  do_log (GST_CAT_PADS, GST_FUNCTION, (GObject *) src,
       "%" GST_TIME_FORMAT ", src=%" GST_PTR_FORMAT ", sink=%" GST_PTR_FORMAT,
       GST_TIME_ARGS (ts), src, sink);
 }
 
 static void
-do_pad_link_post (GstTracer * self, guint64 ts, GstPad * src, GstElement * sink,
+do_pad_link_post (GstTracer * self, guint64 ts, GstPad * src, GstPad * sink,
     GstPadLinkReturn res)
 {
-  do_log (GST_CAT_PADS,
+  do_log (GST_CAT_PADS, GST_FUNCTION, (GObject *) src,
       "%" GST_TIME_FORMAT ", src=%" GST_PTR_FORMAT ", sink=%" GST_PTR_FORMAT
       ", res=%d", GST_TIME_ARGS (ts), src, sink, (gint) res);
 }
@@ -275,7 +294,7 @@ static void
 do_pad_unlink_pre (GstTracer * self, guint64 ts, GstPad * src,
     GstElement * sink)
 {
-  do_log (GST_CAT_PADS,
+  do_log (GST_CAT_PADS, GST_FUNCTION, (GObject *) src,
       "%" GST_TIME_FORMAT ", src=%" GST_PTR_FORMAT ", sink=%" GST_PTR_FORMAT,
       GST_TIME_ARGS (ts), src, sink);
 }
@@ -284,7 +303,7 @@ static void
 do_pad_unlink_post (GstTracer * self, guint64 ts, GstPad * src,
     GstElement * sink, gboolean res)
 {
-  do_log (GST_CAT_PADS,
+  do_log (GST_CAT_PADS, GST_FUNCTION, (GObject *) src,
       "%" GST_TIME_FORMAT ", src=%" GST_PTR_FORMAT ", sink=%" GST_PTR_FORMAT
       ", res=%d", GST_TIME_ARGS (ts), src, sink, (gint) res);
 }
@@ -318,17 +337,17 @@ gst_log_tracer_init (GstLogTracer * self)
   gst_tracing_register_hook (tracer, "pad-push-event-post",
       G_CALLBACK (do_push_event_post));
   gst_tracing_register_hook (tracer, "pad-query-pre",
-      G_CALLBACK (do_query_pre));
+      G_CALLBACK (do_pad_query_pre));
   gst_tracing_register_hook (tracer, "pad-query-post",
-      G_CALLBACK (do_query_post));
+      G_CALLBACK (do_pad_query_post));
   gst_tracing_register_hook (tracer, "element-post-message-pre",
       G_CALLBACK (do_post_message_pre));
   gst_tracing_register_hook (tracer, "element-post-message-post",
       G_CALLBACK (do_post_message_post));
   gst_tracing_register_hook (tracer, "element-query-pre",
-      G_CALLBACK (do_query_pre));
+      G_CALLBACK (do_element_query_pre));
   gst_tracing_register_hook (tracer, "element-query-post",
-      G_CALLBACK (do_query_post));
+      G_CALLBACK (do_element_query_post));
   gst_tracing_register_hook (tracer, "element-new",
       G_CALLBACK (do_element_new));
   gst_tracing_register_hook (tracer, "element-add-pad",