element: Enforce that elements created by gst_element_factory_create/make() are floating
[platform/upstream/gstreamer.git] / gst / gsttracerutils.h
index 49592a2..a2a5ed6 100644 (file)
@@ -27,6 +27,7 @@
 #include <glib-object.h>
 #include <gst/gstconfig.h>
 #include <gst/gstbin.h>
+#include <gst/gstutils.h>
 
 G_BEGIN_DECLS
 
@@ -70,6 +71,14 @@ typedef enum /*< skip >*/
   GST_TRACER_QUARK_HOOK_PAD_UNLINK_POST,
   GST_TRACER_QUARK_HOOK_ELEMENT_CHANGE_STATE_PRE,
   GST_TRACER_QUARK_HOOK_ELEMENT_CHANGE_STATE_POST,
+  GST_TRACER_QUARK_HOOK_MINI_OBJECT_CREATED,
+  GST_TRACER_QUARK_HOOK_MINI_OBJECT_DESTROYED,
+  GST_TRACER_QUARK_HOOK_OBJECT_CREATED,
+  GST_TRACER_QUARK_HOOK_OBJECT_DESTROYED,
+  GST_TRACER_QUARK_HOOK_MINI_OBJECT_REFFED,
+  GST_TRACER_QUARK_HOOK_MINI_OBJECT_UNREFFED,
+  GST_TRACER_QUARK_HOOK_OBJECT_REFFED,
+  GST_TRACER_QUARK_HOOK_OBJECT_UNREFFED,
   GST_TRACER_QUARK_MAX
 } GstTracerQuarkId;
 
@@ -266,16 +275,16 @@ typedef void (*GstTracerHookPadQueryPre) (GObject *self, GstClockTime ts,
  * @self: the tracer instance
  * @ts: the current timestamp
  * @pad: the pad
- * @res: the result of gst_pad_query()
  * @query: the query
+ * @res: the result of gst_pad_query()
  *
  * Post-hook for gst_pad_query() named "pad-query-post".
  */
 typedef void (*GstTracerHookPadQueryPost) (GObject *self, GstClockTime ts,
-    GstPad *pad, gboolean res, GstQuery *query);
-#define GST_TRACER_PAD_QUERY_POST(pad, res, query) G_STMT_START{ \
+    GstPad *pad, GstQuery *query, gboolean res);
+#define GST_TRACER_PAD_QUERY_POST(pad, query, res) G_STMT_START{ \
   GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_QUERY_POST), \
-    GstTracerHookPadQueryPost, (GST_TRACER_ARGS, pad, res, query)); \
+    GstTracerHookPadQueryPost, (GST_TRACER_ARGS, pad, query, res)); \
 }G_STMT_END
 
 /**
@@ -331,15 +340,16 @@ typedef void (*GstTracerHookElementQueryPre) (GObject *self, GstClockTime ts,
  * @self: the tracer instance
  * @ts: the current timestamp
  * @element: the element
+ * @query: the query
  * @res: the result of gst_element_query()
  *
  * Post-hook for gst_element_query() named "element-query-post".
  */
 typedef void (*GstTracerHookElementQueryPost) (GObject *self, GstClockTime ts,
-    GstElement *element, gboolean res);
-#define GST_TRACER_ELEMENT_QUERY_POST(element, res) G_STMT_START{ \
+    GstElement *element, GstQuery *query, gboolean res);
+#define GST_TRACER_ELEMENT_QUERY_POST(element, query, res) G_STMT_START{ \
   GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_QUERY_POST), \
-    GstTracerHookElementQueryPost, (GST_TRACER_ARGS, element, res)); \
+    GstTracerHookElementQueryPost, (GST_TRACER_ARGS, element, query, res)); \
 }G_STMT_END
 
 /**
@@ -348,7 +358,7 @@ typedef void (*GstTracerHookElementQueryPost) (GObject *self, GstClockTime ts,
  * @ts: the current timestamp
  * @element: the element
  *
- * Hook for gst_element_new() named "element-new".
+ * Hook for whenever a new element is created, named "element-new".
  */
 typedef void (*GstTracerHookElementNew) (GObject *self, GstClockTime ts,
     GstElement *element);
@@ -554,8 +564,150 @@ typedef void (*GstTracerHookPadUnlinkPost) (GObject *self, GstClockTime ts,
     GstTracerHookPadUnlinkPost, (GST_TRACER_ARGS, srcpad, sinkpad, result)); \
 }G_STMT_END
 
+/**
+ * GstTracerHookMiniObjectCreated:
+ * @self: the tracer instance
+ * @ts: the current timestamp
+ * @object: the mini object being created
+ *
+ * Hook called when a #GstMiniObject is created named "mini-object-created".
+ */
+typedef void (*GstTracerHookMiniObjectCreated) (GObject *self, GstClockTime ts,
+    GstMiniObject *object);
+#define GST_TRACER_MINI_OBJECT_CREATED(object) G_STMT_START{ \
+  GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MINI_OBJECT_CREATED), \
+    GstTracerHookMiniObjectCreated, (GST_TRACER_ARGS, object)); \
+}G_STMT_END
+
+/**
+ * GstTracerHookMiniObjectDestroyed:
+ * @self: the tracer instance
+ * @ts: the current timestamp
+ * @object: the mini object being destroyed
+ *
+ * Hook called when a #GstMiniObject is being destroyed named
+ * "mini-object-destroyed".
+ */
+typedef void (*GstTracerHookMiniObjectDestroyed) (GObject *self, GstClockTime ts,
+    GstMiniObject *object);
+#define GST_TRACER_MINI_OBJECT_DESTROYED(object) G_STMT_START{ \
+  GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MINI_OBJECT_DESTROYED), \
+    GstTracerHookMiniObjectDestroyed, (GST_TRACER_ARGS, object)); \
+}G_STMT_END
+
+/**
+ * GstTracerHookObjectUnreffed:
+ * @self: the tracer instance
+ * @ts: the current timestamp
+ * @object: the object being unreffed
+ * @new_refcount: the new refcount after unrefing @object
+ *
+ * Hook called when a #GstObject is being unreffed named
+ * "object-unreffed"
+ */
+typedef void (*GstTracerHookObjectUnreffed) (GObject *self, GstClockTime ts,
+    GstObject *object, gint new_refcount);
+#define GST_TRACER_OBJECT_UNREFFED(object, new_refcount) G_STMT_START{ \
+  GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_OBJECT_UNREFFED), \
+    GstTracerHookObjectUnreffed, (GST_TRACER_ARGS, object, new_refcount)); \
+}G_STMT_END
+
+/**
+ * GstTracerHookObjectReffed:
+ * @self: the tracer instance
+ * @ts: the current timestamp
+ * @object: the object being reffed
+ * @new_refcount: the new refcount after refing @object
+ *
+ * Hook called when a #GstObject is being reffed named
+ * "object-reffed".
+ */
+typedef void (*GstTracerHookObjectReffed) (GObject *self, GstClockTime ts,
+    GstObject *object, gint new_refcount);
+#define GST_TRACER_OBJECT_REFFED(object, new_refcount) G_STMT_START{ \
+  GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_OBJECT_REFFED), \
+    GstTracerHookObjectReffed, (GST_TRACER_ARGS, object, new_refcount)); \
+}G_STMT_END
+
+/**
+ * GstTracerHookMiniObjectUnreffed:
+ * @self: the tracer instance
+ * @ts: the current timestamp
+ * @object: the mini object being unreffed
+ * @new_refcount: the new refcount after unrefing @object
+ *
+ * Hook called when a #GstMiniObject is being unreffed named
+ * "mini-object-unreffed".
+ */
+typedef void (*GstTracerHookMiniObjectUnreffed) (GObject *self, GstClockTime ts,
+    GstMiniObject *object, gint new_refcount);
+#define GST_TRACER_MINI_OBJECT_UNREFFED(object, new_refcount) G_STMT_START{ \
+  GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MINI_OBJECT_UNREFFED), \
+    GstTracerHookMiniObjectUnreffed, (GST_TRACER_ARGS, object, new_refcount)); \
+}G_STMT_END
+
+/**
+ * GstTracerHookMiniObjectReffed:
+ * @self: the tracer instance
+ * @ts: the current timestamp
+ * @object: the mini object being reffed
+ * @new_refcount: the new refcount after refing @object
+ *
+ * Hook called when a #GstMiniObject is being reffed named
+ * "mini-object-reffed".
+ */
+typedef void (*GstTracerHookMiniObjectReffed) (GObject *self, GstClockTime ts,
+    GstMiniObject *object, gint new_refcount);
+#define GST_TRACER_MINI_OBJECT_REFFED(object, new_refcount) G_STMT_START{ \
+  GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MINI_OBJECT_REFFED), \
+    GstTracerHookMiniObjectReffed, (GST_TRACER_ARGS, object, new_refcount)); \
+}G_STMT_END
+
+/**
+ * GstTracerHookObjectCreated:
+ * @self: the tracer instance
+ * @ts: the current timestamp
+ * @object: the object being created
+ *
+ * Hook called when a #GstObject is created named "object-created".
+ */
+typedef void (*GstTracerHookObjectCreated) (GObject *self, GstClockTime ts,
+    GstObject *object);
+#define GST_TRACER_OBJECT_CREATED(object) G_STMT_START{ \
+  GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_OBJECT_CREATED), \
+    GstTracerHookObjectCreated, (GST_TRACER_ARGS, object)); \
+}G_STMT_END
+
+/**
+ * GstTracerHookObjectDestroyed:
+ * @self: the tracer instance
+ * @ts: the current timestamp
+ * @object: the object being destroyed
+ *
+ * Hook called when a #GstObject is being destroyed named
+ * "object-destroyed".
+ */
+typedef void (*GstTracerHookObjectDestroyed) (GObject *self, GstClockTime ts,
+    GstObject *object);
+#define GST_TRACER_OBJECT_DESTROYED(object) G_STMT_START{ \
+  GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_OBJECT_DESTROYED), \
+    GstTracerHookObjectDestroyed, (GST_TRACER_ARGS, object)); \
+}G_STMT_END
+
+
 #else /* !GST_DISABLE_GST_TRACER_HOOKS */
 
+static inline void
+_priv_gst_tracing_init (void)
+{
+  GST_DEBUG ("Tracing hooks are disabled");
+}
+
+static inline void
+_priv_gst_tracing_deinit (void)
+{
+}
+
 #define GST_TRACER_PAD_PUSH_PRE(pad, buffer)
 #define GST_TRACER_PAD_PUSH_POST(pad, res)
 #define GST_TRACER_PAD_PUSH_LIST_PRE(pad, list)
@@ -565,11 +717,11 @@ typedef void (*GstTracerHookPadUnlinkPost) (GObject *self, GstClockTime ts,
 #define GST_TRACER_PAD_PUSH_EVENT_PRE(pad, event)
 #define GST_TRACER_PAD_PUSH_EVENT_POST(pad, res)
 #define GST_TRACER_PAD_QUERY_PRE(pad, query)
-#define GST_TRACER_PAD_QUERY_POST(pad, res, query)
+#define GST_TRACER_PAD_QUERY_POST(pad, query, res)
 #define GST_TRACER_ELEMENT_POST_MESSAGE_PRE(element, message)
 #define GST_TRACER_ELEMENT_POST_MESSAGE_POST(element, res)
 #define GST_TRACER_ELEMENT_QUERY_PRE(element, query)
-#define GST_TRACER_ELEMENT_QUERY_POST(element, res)
+#define GST_TRACER_ELEMENT_QUERY_POST(element, query, res)
 #define GST_TRACER_ELEMENT_NEW(element)
 #define GST_TRACER_ELEMENT_ADD_PAD(element, pad)
 #define GST_TRACER_ELEMENT_REMOVE_PAD(element, pad)
@@ -583,6 +735,14 @@ typedef void (*GstTracerHookPadUnlinkPost) (GObject *self, GstClockTime ts,
 #define GST_TRACER_PAD_LINK_POST(srcpad, sinkpad, res)
 #define GST_TRACER_PAD_UNLINK_PRE(srcpad, sinkpad)
 #define GST_TRACER_PAD_UNLINK_POST(srcpad, sinkpad, res)
+#define GST_TRACER_MINI_OBJECT_CREATED(object)
+#define GST_TRACER_MINI_OBJECT_DESTROYED(object)
+#define GST_TRACER_MINI_OBJECT_REFFED(object, new_refcount)
+#define GST_TRACER_MINI_OBJECT_UNREFFED(object, new_refcount)
+#define GST_TRACER_OBJECT_CREATED(object)
+#define GST_TRACER_OBJECT_DESTROYED(object)
+#define GST_TRACER_OBJECT_REFFED(object, new_refcount)
+#define GST_TRACER_OBJECT_UNREFFED(object, new_refcount)
 
 #endif /* GST_DISABLE_GST_TRACER_HOOKS */