2 * Copyright (C) 2013 Stefan Sauer <ensonic@users.sf.net>
4 * gsttracerutils.h: tracing subsystem
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #ifndef __GST_TRACER_UTILS_H__
24 #define __GST_TRACER_UTILS_H__
27 #include <glib-object.h>
28 #include <gst/gstconfig.h>
29 #include <gst/gstbin.h>
30 #include <gst/gstutils.h>
34 #ifndef GST_DISABLE_GST_TRACER_HOOKS
38 void _priv_gst_tracing_init (void);
39 void _priv_gst_tracing_deinit (void);
43 /* These enums need to match the number and order
44 * of strings declared in _quark_table, in gsttracerutils.c */
45 typedef enum /*< skip >*/
47 GST_TRACER_QUARK_HOOK_PAD_PUSH_PRE = 0,
48 GST_TRACER_QUARK_HOOK_PAD_PUSH_POST,
49 GST_TRACER_QUARK_HOOK_PAD_PUSH_LIST_PRE,
50 GST_TRACER_QUARK_HOOK_PAD_PUSH_LIST_POST,
51 GST_TRACER_QUARK_HOOK_PAD_PULL_RANGE_PRE,
52 GST_TRACER_QUARK_HOOK_PAD_PULL_RANGE_POST,
53 GST_TRACER_QUARK_HOOK_PAD_PUSH_EVENT_PRE ,
54 GST_TRACER_QUARK_HOOK_PAD_PUSH_EVENT_POST,
55 GST_TRACER_QUARK_HOOK_PAD_QUERY_PRE ,
56 GST_TRACER_QUARK_HOOK_PAD_QUERY_POST,
57 GST_TRACER_QUARK_HOOK_ELEMENT_POST_MESSAGE_PRE,
58 GST_TRACER_QUARK_HOOK_ELEMENT_POST_MESSAGE_POST,
59 GST_TRACER_QUARK_HOOK_ELEMENT_QUERY_PRE,
60 GST_TRACER_QUARK_HOOK_ELEMENT_QUERY_POST,
61 GST_TRACER_QUARK_HOOK_ELEMENT_NEW,
62 GST_TRACER_QUARK_HOOK_ELEMENT_ADD_PAD,
63 GST_TRACER_QUARK_HOOK_ELEMENT_REMOVE_PAD,
64 GST_TRACER_QUARK_HOOK_BIN_ADD_PRE,
65 GST_TRACER_QUARK_HOOK_BIN_ADD_POST,
66 GST_TRACER_QUARK_HOOK_BIN_REMOVE_PRE,
67 GST_TRACER_QUARK_HOOK_BIN_REMOVE_POST,
68 GST_TRACER_QUARK_HOOK_PAD_LINK_PRE,
69 GST_TRACER_QUARK_HOOK_PAD_LINK_POST,
70 GST_TRACER_QUARK_HOOK_PAD_UNLINK_PRE,
71 GST_TRACER_QUARK_HOOK_PAD_UNLINK_POST,
72 GST_TRACER_QUARK_HOOK_ELEMENT_CHANGE_STATE_PRE,
73 GST_TRACER_QUARK_HOOK_ELEMENT_CHANGE_STATE_POST,
74 GST_TRACER_QUARK_HOOK_MINI_OBJECT_CREATED,
75 GST_TRACER_QUARK_HOOK_MINI_OBJECT_DESTROYED,
76 GST_TRACER_QUARK_HOOK_OBJECT_CREATED,
77 GST_TRACER_QUARK_HOOK_OBJECT_DESTROYED,
78 GST_TRACER_QUARK_HOOK_MINI_OBJECT_REFFED,
79 GST_TRACER_QUARK_HOOK_MINI_OBJECT_UNREFFED,
80 GST_TRACER_QUARK_HOOK_OBJECT_REFFED,
81 GST_TRACER_QUARK_HOOK_OBJECT_UNREFFED,
82 GST_TRACER_QUARK_HOOK_PLUGIN_FEATURE_LOADED,
83 GST_TRACER_QUARK_HOOK_PAD_CHAIN_PRE,
84 GST_TRACER_QUARK_HOOK_PAD_CHAIN_POST,
85 GST_TRACER_QUARK_HOOK_PAD_CHAIN_LIST_PRE,
86 GST_TRACER_QUARK_HOOK_PAD_CHAIN_LIST_POST,
90 extern GQuark _priv_gst_tracer_quark_table[GST_TRACER_QUARK_MAX];
92 #define GST_TRACER_QUARK(q) _priv_gst_tracer_quark_table[GST_TRACER_QUARK_##q]
94 /* tracing module helpers */
101 extern gboolean _priv_tracer_enabled;
102 /* key are hook-id quarks, values are GstTracerHook */
103 extern GHashTable *_priv_tracers;
105 #define GST_TRACER_IS_ENABLED (_priv_tracer_enabled)
107 #define GST_TRACER_TS \
108 GST_CLOCK_DIFF (_priv_gst_start_time, gst_util_get_timestamp ())
112 #define GST_TRACER_ARGS h->tracer, ts
113 #define GST_TRACER_DISPATCH(key,type,args) G_STMT_START{ \
114 if (GST_TRACER_IS_ENABLED) { \
115 GstClockTime ts = GST_TRACER_TS; \
118 __l = g_hash_table_lookup (_priv_tracers, GINT_TO_POINTER (key)); \
119 for (__n = __l; __n; __n = g_list_next (__n)) { \
120 h = (GstTracerHook *) __n->data; \
121 ((type)(h->func)) args; \
123 __l = g_hash_table_lookup (_priv_tracers, NULL); \
124 for (__n = __l; __n; __n = g_list_next (__n)) { \
125 h = (GstTracerHook *) __n->data; \
126 ((type)(h->func)) args; \
132 * GstTracerHookPadPushPre:
133 * @self: the tracer instance
134 * @ts: the current timestamp
136 * @buffer: the buffer
138 * Pre-hook for gst_pad_push() named "pad-push-pre".
140 typedef void (*GstTracerHookPadPushPre) (GObject *self, GstClockTime ts,
141 GstPad *pad, GstBuffer *buffer);
142 #define GST_TRACER_PAD_PUSH_PRE(pad, buffer) G_STMT_START{ \
143 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PUSH_PRE), \
144 GstTracerHookPadPushPre, (GST_TRACER_ARGS, pad, buffer)); \
148 * GstTracerHookPadPushPost:
149 * @self: the tracer instance
150 * @ts: the current timestamp
152 * @res: the result of gst_pad_push()
154 * Post-hook for gst_pad_push() named "pad-push-post".
156 typedef void (*GstTracerHookPadPushPost) (GObject * self, GstClockTime ts,
157 GstPad *pad, GstFlowReturn res);
158 #define GST_TRACER_PAD_PUSH_POST(pad, res) G_STMT_START{ \
159 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PUSH_POST), \
160 GstTracerHookPadPushPost, (GST_TRACER_ARGS, pad, res)); \
164 * GstTracerHookPadPushListPre:
165 * @self: the tracer instance
166 * @ts: the current timestamp
168 * @list: the buffer-list
170 * Pre-hook for gst_pad_push_list() named "pad-push-list-pre".
172 typedef void (*GstTracerHookPadPushListPre) (GObject *self, GstClockTime ts,
173 GstPad *pad, GstBufferList *list);
174 #define GST_TRACER_PAD_PUSH_LIST_PRE(pad, list) G_STMT_START{ \
175 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PUSH_LIST_PRE), \
176 GstTracerHookPadPushListPre, (GST_TRACER_ARGS, pad, list)); \
180 * GstTracerHookPadPushListPost:
181 * @self: the tracer instance
182 * @ts: the current timestamp
184 * @res: the result of gst_pad_push_list()
186 * Post-hook for gst_pad_push_list() named "pad-push-list-post".
188 typedef void (*GstTracerHookPadPushListPost) (GObject *self, GstClockTime ts,
191 #define GST_TRACER_PAD_PUSH_LIST_POST(pad, res) G_STMT_START{ \
192 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PUSH_LIST_POST), \
193 GstTracerHookPadPushListPost, (GST_TRACER_ARGS, pad, res)); \
197 * GstTracerHookPadPullRangePre:
198 * @self: the tracer instance
199 * @ts: the current timestamp
201 * @offset: the stream offset
202 * @size: the requested size
204 * Pre-hook for gst_pad_pull_range() named "pad-pull-range-pre".
206 typedef void (*GstTracerHookPadPullRangePre) (GObject *self, GstClockTime ts,
207 GstPad *pad, guint64 offset, guint size);
208 #define GST_TRACER_PAD_PULL_RANGE_PRE(pad, offset, size) G_STMT_START{ \
209 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PULL_RANGE_PRE), \
210 GstTracerHookPadPullRangePre, (GST_TRACER_ARGS, pad, offset, size)); \
214 * GstTracerHookPadPullRangePost:
215 * @self: the tracer instance
216 * @ts: the current timestamp
218 * @buffer: the buffer
219 * @res: the result of gst_pad_pull_range()
221 * Post-hook for gst_pad_pull_range() named "pad-pull-range-post".
223 typedef void (*GstTracerHookPadPullRangePost) (GObject *self, GstClockTime ts,
224 GstPad *pad, GstBuffer *buffer, GstFlowReturn res);
225 #define GST_TRACER_PAD_PULL_RANGE_POST(pad, buffer, res) G_STMT_START{ \
226 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PULL_RANGE_POST), \
227 GstTracerHookPadPullRangePost, (GST_TRACER_ARGS, pad, buffer, res)); \
231 * GstTracerHookPadPushEventPre:
232 * @self: the tracer instance
233 * @ts: the current timestamp
237 * Pre-hook for gst_pad_push_event() named "pad-push-event-pre".
239 typedef void (*GstTracerHookPadPushEventPre) (GObject *self, GstClockTime ts,
240 GstPad *pad, GstEvent *event);
241 #define GST_TRACER_PAD_PUSH_EVENT_PRE(pad, event) G_STMT_START{ \
242 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PUSH_EVENT_PRE), \
243 GstTracerHookPadPushEventPre, (GST_TRACER_ARGS, pad, event)); \
247 * GstTracerHookPadPushEventPost:
248 * @self: the tracer instance
249 * @ts: the current timestamp
251 * @res: the result of gst_pad_push_event()
253 * Post-hook for gst_pad_push_event() named "pad-push-event-post".
255 typedef void (*GstTracerHookPadPushEventPost) (GObject *self, GstClockTime ts,
256 GstPad *pad, gboolean res);
257 #define GST_TRACER_PAD_PUSH_EVENT_POST(pad, res) G_STMT_START{ \
258 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PUSH_EVENT_POST), \
259 GstTracerHookPadPushEventPost, (GST_TRACER_ARGS, pad, res)); \
263 * GstTracerHookPadQueryPre:
264 * @self: the tracer instance
265 * @ts: the current timestamp
269 * Pre-hook for gst_pad_query() named "pad-query-pre".
271 typedef void (*GstTracerHookPadQueryPre) (GObject *self, GstClockTime ts,
272 GstPad *pad, GstQuery *query);
273 #define GST_TRACER_PAD_QUERY_PRE(pad, query) G_STMT_START{ \
274 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_QUERY_PRE), \
275 GstTracerHookPadQueryPre, (GST_TRACER_ARGS, pad, query)); \
279 * GstTracerHookPadQueryPost:
280 * @self: the tracer instance
281 * @ts: the current timestamp
284 * @res: the result of gst_pad_query()
286 * Post-hook for gst_pad_query() named "pad-query-post".
288 typedef void (*GstTracerHookPadQueryPost) (GObject *self, GstClockTime ts,
289 GstPad *pad, GstQuery *query, gboolean res);
290 #define GST_TRACER_PAD_QUERY_POST(pad, query, res) G_STMT_START{ \
291 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_QUERY_POST), \
292 GstTracerHookPadQueryPost, (GST_TRACER_ARGS, pad, query, res)); \
296 * GstTracerHookElementPostMessagePre:
297 * @self: the tracer instance
298 * @ts: the current timestamp
299 * @element: the element
300 * @message: the message
302 * Pre-hook for gst_element_post_message() named "element-post-message-pre".
304 typedef void (*GstTracerHookElementPostMessagePre) (GObject *self,
305 GstClockTime ts, GstElement *element, GstMessage *message);
306 #define GST_TRACER_ELEMENT_POST_MESSAGE_PRE(element, message) G_STMT_START{ \
307 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_POST_MESSAGE_PRE), \
308 GstTracerHookElementPostMessagePre, (GST_TRACER_ARGS, element, message)); \
312 * GstTracerHookElementPostMessagePost:
313 * @self: the tracer instance
314 * @ts: the current timestamp
315 * @element: the element
316 * @res: the result of gst_element_post_message()
318 * Pre-hook for gst_element_post_message() named "element-post-message-post".
320 typedef void (*GstTracerHookElementPostMessagePost) (GObject *self,
321 GstClockTime ts, GstElement *element, gboolean res);
322 #define GST_TRACER_ELEMENT_POST_MESSAGE_POST(element, res) G_STMT_START{ \
323 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_POST_MESSAGE_POST), \
324 GstTracerHookElementPostMessagePost, (GST_TRACER_ARGS, element, res)); \
328 * GstTracerHookElementQueryPre:
329 * @self: the tracer instance
330 * @ts: the current timestamp
331 * @element: the element
334 * Pre-hook for gst_element_query() named "element-query-pre".
336 typedef void (*GstTracerHookElementQueryPre) (GObject *self, GstClockTime ts,
337 GstElement *element, GstQuery *query);
338 #define GST_TRACER_ELEMENT_QUERY_PRE(element, query) G_STMT_START{ \
339 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_QUERY_PRE), \
340 GstTracerHookElementQueryPre, (GST_TRACER_ARGS, element, query)); \
344 * GstTracerHookElementQueryPost:
345 * @self: the tracer instance
346 * @ts: the current timestamp
347 * @element: the element
349 * @res: the result of gst_element_query()
351 * Post-hook for gst_element_query() named "element-query-post".
353 typedef void (*GstTracerHookElementQueryPost) (GObject *self, GstClockTime ts,
354 GstElement *element, GstQuery *query, gboolean res);
355 #define GST_TRACER_ELEMENT_QUERY_POST(element, query, res) G_STMT_START{ \
356 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_QUERY_POST), \
357 GstTracerHookElementQueryPost, (GST_TRACER_ARGS, element, query, res)); \
361 * GstTracerHookElementNew:
362 * @self: the tracer instance
363 * @ts: the current timestamp
364 * @element: the element
366 * Hook for whenever a new element is created, named "element-new".
368 typedef void (*GstTracerHookElementNew) (GObject *self, GstClockTime ts,
369 GstElement *element);
370 #define GST_TRACER_ELEMENT_NEW(element) G_STMT_START{ \
371 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_NEW), \
372 GstTracerHookElementNew, (GST_TRACER_ARGS, element)); \
376 * GstTracerHookElementAddPad:
377 * @self: the tracer instance
378 * @ts: the current timestamp
379 * @element: the element
382 * Hook for gst_element_add_pad() named "element-add-pad".
384 typedef void (*GstTracerHookElementAddPad) (GObject *self, GstClockTime ts,
385 GstElement *element, GstPad *pad);
386 #define GST_TRACER_ELEMENT_ADD_PAD(element, pad) G_STMT_START{ \
387 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_ADD_PAD), \
388 GstTracerHookElementAddPad, (GST_TRACER_ARGS, element, pad)); \
392 * GstTracerHookElementRemovePad:
393 * @self: the tracer instance
394 * @ts: the current timestamp
395 * @element: the element
398 * Hook for gst_element_remove_pad() named "element-remove-pad".
400 typedef void (*GstTracerHookElementRemovePad) (GObject *self, GstClockTime ts,
401 GstElement *element, GstPad *pad);
402 #define GST_TRACER_ELEMENT_REMOVE_PAD(element, pad) G_STMT_START{ \
403 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_REMOVE_PAD), \
404 GstTracerHookElementRemovePad, (GST_TRACER_ARGS, element, pad)); \
408 * GstTracerHookElementChangeStatePre:
409 * @self: the tracer instance
410 * @ts: the current timestamp
411 * @element: the element
412 * @transition: the transition
414 * Pre-hook for gst_element_change_state() named "element-change-state-pre".
416 typedef void (*GstTracerHookElementChangeStatePre) (GObject *self,
417 GstClockTime ts, GstElement *element, GstStateChange transition);
418 #define GST_TRACER_ELEMENT_CHANGE_STATE_PRE(element, transition) G_STMT_START{ \
419 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_CHANGE_STATE_PRE), \
420 GstTracerHookElementChangeStatePre, (GST_TRACER_ARGS, element, transition)); \
424 * GstTracerHookElementChangeStatePost:
425 * @self: the tracer instance
426 * @ts: the current timestamp
427 * @element: the element
428 * @transition: the transition
429 * @result: the result of gst_pad_push()
431 * Post-hook for gst_element_change_state() named "element-change-state-post".
433 typedef void (*GstTracerHookElementChangeStatePost) (GObject *self,
434 GstClockTime ts, GstElement *element, GstStateChange transition,
435 GstStateChangeReturn result);
436 #define GST_TRACER_ELEMENT_CHANGE_STATE_POST(element, transition, result) G_STMT_START{ \
437 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_CHANGE_STATE_POST), \
438 GstTracerHookElementChangeStatePost, (GST_TRACER_ARGS, element, transition, result)); \
442 * GstTracerHookBinAddPre:
443 * @self: the tracer instance
444 * @ts: the current timestamp
446 * @element: the element
448 * Pre-hook for gst_bin_add() named "bin-add-pre".
450 typedef void (*GstTracerHookBinAddPre) (GObject *self, GstClockTime ts,
451 GstBin *bin, GstElement *element);
452 #define GST_TRACER_BIN_ADD_PRE(bin, element) G_STMT_START{ \
453 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_BIN_ADD_PRE), \
454 GstTracerHookBinAddPre, (GST_TRACER_ARGS, bin, element)); \
458 * GstTracerHookBinAddPost:
459 * @self: the tracer instance
460 * @ts: the current timestamp
462 * @element: the element
463 * @result: the result of gst_bin_add()
465 * Post-hook for gst_bin_add() named "bin-add-post".
467 typedef void (*GstTracerHookBinAddPost) (GObject *self, GstClockTime ts,
468 GstBin *bin, GstElement *element, gboolean result);
469 #define GST_TRACER_BIN_ADD_POST(bin, element, result) G_STMT_START{ \
470 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_BIN_ADD_POST), \
471 GstTracerHookBinAddPost, (GST_TRACER_ARGS, bin, element, result)); \
475 * GstTracerHookBinRemovePre:
476 * @self: the tracer instance
477 * @ts: the current timestamp
479 * @element: the element
481 * Pre-hook for gst_bin_remove() named "bin-remove-pre".
483 typedef void (*GstTracerHookBinRemovePre) (GObject *self, GstClockTime ts,
484 GstBin *bin, GstElement *element);
485 #define GST_TRACER_BIN_REMOVE_PRE(bin, element) G_STMT_START{ \
486 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_BIN_REMOVE_PRE), \
487 GstTracerHookBinRemovePre, (GST_TRACER_ARGS, bin, element)); \
491 * GstTracerHookBinRemovePost:
492 * @self: the tracer instance
493 * @ts: the current timestamp
495 * @result: the result of gst_bin_remove()
497 * Post-hook for gst_bin_remove() named "bin-remove-post".
499 typedef void (*GstTracerHookBinRemovePost) (GObject *self, GstClockTime ts,
500 GstBin *bin, gboolean result);
501 #define GST_TRACER_BIN_REMOVE_POST(bin, result) G_STMT_START{ \
502 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_BIN_REMOVE_POST), \
503 GstTracerHookBinRemovePost, (GST_TRACER_ARGS, bin, result)); \
507 * GstTracerHookPadLinkPre:
508 * @self: the tracer instance
509 * @ts: the current timestamp
510 * @srcpad: the srcpad
511 * @sinkpad: the sinkpad
513 * Pre-hook for gst_pad_link() named "pad-link-pre".
515 typedef void (*GstTracerHookPadLinkPre) (GObject *self, GstClockTime ts,
516 GstPad *srcpad, GstPad *sinkpad);
517 #define GST_TRACER_PAD_LINK_PRE(srcpad, sinkpad) G_STMT_START{ \
518 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_LINK_PRE), \
519 GstTracerHookPadLinkPre, (GST_TRACER_ARGS, srcpad, sinkpad)); \
523 * GstTracerHookPadLinkPost:
524 * @self: the tracer instance
525 * @ts: the current timestamp
526 * @srcpad: the srcpad
527 * @sinkpad: the sinkpad
528 * @result: the result of gst_pad_link()
530 * Post-hook for gst_pad_link() named "pad-link-post".
532 typedef void (*GstTracerHookPadLinkPost) (GObject *self, GstClockTime ts,
533 GstPad *srcpad, GstPad *sinkpad, GstPadLinkReturn result);
534 #define GST_TRACER_PAD_LINK_POST(srcpad, sinkpad, result) G_STMT_START{ \
535 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_LINK_POST), \
536 GstTracerHookPadLinkPost, (GST_TRACER_ARGS, srcpad, sinkpad, result)); \
540 * GstTracerHookPadUnlinkPre:
541 * @self: the tracer instance
542 * @ts: the current timestamp
543 * @srcpad: the srcpad
544 * @sinkpad: the sinkpad
546 * Pre-hook for gst_pad_unlink() named "pad-unlink-pre".
548 typedef void (*GstTracerHookPadUnlinkPre) (GObject *self, GstClockTime ts,
549 GstPad *srcpad, GstPad *sinkpad);
550 #define GST_TRACER_PAD_UNLINK_PRE(srcpad, sinkpad) G_STMT_START{ \
551 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_UNLINK_PRE), \
552 GstTracerHookPadUnlinkPre, (GST_TRACER_ARGS, srcpad, sinkpad)); \
556 * GstTracerHookPadUnlinkPost:
557 * @self: the tracer instance
558 * @ts: the current timestamp
559 * @srcpad: the srcpad
560 * @sinkpad: the sinkpad
561 * @result: the result of gst_pad_push()
563 * Post-hook for gst_pad_unlink() named "pad-unlink-post".
565 typedef void (*GstTracerHookPadUnlinkPost) (GObject *self, GstClockTime ts,
566 GstPad *srcpad, GstPad *sinkpad, gboolean result);
567 #define GST_TRACER_PAD_UNLINK_POST(srcpad, sinkpad, result) G_STMT_START{ \
568 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_UNLINK_POST), \
569 GstTracerHookPadUnlinkPost, (GST_TRACER_ARGS, srcpad, sinkpad, result)); \
573 * GstTracerHookMiniObjectCreated:
574 * @self: the tracer instance
575 * @ts: the current timestamp
576 * @object: the mini object being created
578 * Hook called when a #GstMiniObject is created named "mini-object-created".
580 typedef void (*GstTracerHookMiniObjectCreated) (GObject *self, GstClockTime ts,
581 GstMiniObject *object);
582 #define GST_TRACER_MINI_OBJECT_CREATED(object) G_STMT_START{ \
583 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MINI_OBJECT_CREATED), \
584 GstTracerHookMiniObjectCreated, (GST_TRACER_ARGS, object)); \
588 * GstTracerHookMiniObjectDestroyed:
589 * @self: the tracer instance
590 * @ts: the current timestamp
591 * @object: the mini object being destroyed
593 * Hook called when a #GstMiniObject is being destroyed named
594 * "mini-object-destroyed".
596 typedef void (*GstTracerHookMiniObjectDestroyed) (GObject *self, GstClockTime ts,
597 GstMiniObject *object);
598 #define GST_TRACER_MINI_OBJECT_DESTROYED(object) G_STMT_START{ \
599 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MINI_OBJECT_DESTROYED), \
600 GstTracerHookMiniObjectDestroyed, (GST_TRACER_ARGS, object)); \
604 * GstTracerHookObjectUnreffed:
605 * @self: the tracer instance
606 * @ts: the current timestamp
607 * @object: the object being unreffed
608 * @new_refcount: the new refcount after unrefing @object
610 * Hook called when a #GstObject is being unreffed named
613 typedef void (*GstTracerHookObjectUnreffed) (GObject *self, GstClockTime ts,
614 GstObject *object, gint new_refcount);
615 #define GST_TRACER_OBJECT_UNREFFED(object, new_refcount) G_STMT_START{ \
616 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_OBJECT_UNREFFED), \
617 GstTracerHookObjectUnreffed, (GST_TRACER_ARGS, object, new_refcount)); \
621 * GstTracerHookObjectReffed:
622 * @self: the tracer instance
623 * @ts: the current timestamp
624 * @object: the object being reffed
625 * @new_refcount: the new refcount after refing @object
627 * Hook called when a #GstObject is being reffed named
630 typedef void (*GstTracerHookObjectReffed) (GObject *self, GstClockTime ts,
631 GstObject *object, gint new_refcount);
632 #define GST_TRACER_OBJECT_REFFED(object, new_refcount) G_STMT_START{ \
633 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_OBJECT_REFFED), \
634 GstTracerHookObjectReffed, (GST_TRACER_ARGS, object, new_refcount)); \
638 * GstTracerHookMiniObjectUnreffed:
639 * @self: the tracer instance
640 * @ts: the current timestamp
641 * @object: the mini object being unreffed
642 * @new_refcount: the new refcount after unrefing @object
644 * Hook called when a #GstMiniObject is being unreffed named
645 * "mini-object-unreffed".
647 typedef void (*GstTracerHookMiniObjectUnreffed) (GObject *self, GstClockTime ts,
648 GstMiniObject *object, gint new_refcount);
649 #define GST_TRACER_MINI_OBJECT_UNREFFED(object, new_refcount) G_STMT_START{ \
650 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MINI_OBJECT_UNREFFED), \
651 GstTracerHookMiniObjectUnreffed, (GST_TRACER_ARGS, object, new_refcount)); \
655 * GstTracerHookMiniObjectReffed:
656 * @self: the tracer instance
657 * @ts: the current timestamp
658 * @object: the mini object being reffed
659 * @new_refcount: the new refcount after refing @object
661 * Hook called when a #GstMiniObject is being reffed named
662 * "mini-object-reffed".
664 typedef void (*GstTracerHookMiniObjectReffed) (GObject *self, GstClockTime ts,
665 GstMiniObject *object, gint new_refcount);
666 #define GST_TRACER_MINI_OBJECT_REFFED(object, new_refcount) G_STMT_START{ \
667 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MINI_OBJECT_REFFED), \
668 GstTracerHookMiniObjectReffed, (GST_TRACER_ARGS, object, new_refcount)); \
672 * GstTracerHookObjectCreated:
673 * @self: the tracer instance
674 * @ts: the current timestamp
675 * @object: the object being created
677 * Hook called when a #GstObject is created named "object-created".
679 typedef void (*GstTracerHookObjectCreated) (GObject *self, GstClockTime ts,
681 #define GST_TRACER_OBJECT_CREATED(object) G_STMT_START{ \
682 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_OBJECT_CREATED), \
683 GstTracerHookObjectCreated, (GST_TRACER_ARGS, object)); \
687 * GstTracerHookObjectDestroyed:
688 * @self: the tracer instance
689 * @ts: the current timestamp
690 * @object: the object being destroyed
692 * Hook called when a #GstObject is being destroyed named
693 * "object-destroyed".
695 typedef void (*GstTracerHookObjectDestroyed) (GObject *self, GstClockTime ts,
698 #define GST_TRACER_OBJECT_DESTROYED(object) G_STMT_START{ \
699 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_OBJECT_DESTROYED), \
700 GstTracerHookObjectDestroyed, (GST_TRACER_ARGS, object)); \
704 * GstTracerHookPluginFeatureLoaded:
705 * @self: the tracer instance
706 * @ts: the current timestamp
707 * @feature: the plugin feature that was loaded
709 * Hook called when a GstPluginFeature is loaded named
710 * "plugin-feature-loaded".
714 typedef void (*GstTracerHookPluginFeatureLoaded) (GObject *self, GstClockTime ts,
715 GstPluginFeature *feature);
717 * GST_TRACER_PLUGIN_FEATURE_LOADED:
718 * @feature: The feature that this tracer is called for
720 * Add a tracepoint when a plugin feature is loaded.
724 #define GST_TRACER_PLUGIN_FEATURE_LOADED(feature) G_STMT_START{ \
725 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PLUGIN_FEATURE_LOADED), \
726 GstTracerHookPluginFeatureLoaded, (GST_TRACER_ARGS, feature)); \
730 * GstTracerHookPadChainPre:
731 * @self: the tracer instance
732 * @ts: the current timestamp
734 * @buffer: the buffer
736 * Pre-hook for gst_pad_chain() named "pad-chain-pre".
740 typedef void (*GstTracerHookPadChainPre) (GObject *self, GstClockTime ts,
741 GstPad *pad, GstBuffer *buffer);
744 * GST_TRACER_PAD_CHAIN_PRE:
746 * @buffer: a %GstBuffer
748 * Dispatches the "pad-chain-pre" hook.
752 #define GST_TRACER_PAD_CHAIN_PRE(pad, buffer) G_STMT_START{ \
753 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_CHAIN_PRE), \
754 GstTracerHookPadChainPre, (GST_TRACER_ARGS, pad, buffer)); \
758 * GstTracerHookPadChainPost:
759 * @self: the tracer instance
760 * @ts: the current timestamp
762 * @res: the result of gst_pad_chain()
764 * Post-hook for gst_pad_chain() named "pad-chain-post".
768 typedef void (*GstTracerHookPadChainPost) (GObject * self, GstClockTime ts,
769 GstPad *pad, GstFlowReturn res);
772 * GST_TRACER_PAD_CHAIN_POST:
774 * @res: a %GstFlowReturn
776 * Dispatches the "pad-chain-post" hook.
780 #define GST_TRACER_PAD_CHAIN_POST(pad, res) G_STMT_START{ \
781 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_CHAIN_POST), \
782 GstTracerHookPadChainPost, (GST_TRACER_ARGS, pad, res)); \
786 * GstTracerHookPadChainListPre:
787 * @self: the tracer instance
788 * @ts: the current timestamp
790 * @list: the buffer-list
792 * Pre-hook for gst_pad_chain_list() named "pad-chain-list-pre".
796 typedef void (*GstTracerHookPadChainListPre) (GObject *self, GstClockTime ts,
797 GstPad *pad, GstBufferList *list);
800 * GST_TRACER_PAD_CHAIN_LIST_PRE:
802 * @list: a %GstBufferList
804 * Dispatches the "pad-chain-list-pre" hook.
808 #define GST_TRACER_PAD_CHAIN_LIST_PRE(pad, list) G_STMT_START{ \
809 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_CHAIN_LIST_PRE), \
810 GstTracerHookPadChainListPre, (GST_TRACER_ARGS, pad, list)); \
814 * GstTracerHookPadChainListPost:
815 * @self: the tracer instance
816 * @ts: the current timestamp
818 * @res: the result of gst_pad_chain_list()
820 * Post-hook for gst_pad_chain_list() named "pad-chain-list-post".
824 typedef void (*GstTracerHookPadChainListPost) (GObject *self, GstClockTime ts,
829 * GST_TRACER_PAD_CHAIN_LIST_POST:
831 * @res: a %GstFlowReturn
833 * Dispatches the "pad-chain-list-post" hook.
837 #define GST_TRACER_PAD_CHAIN_LIST_POST(pad, res) G_STMT_START{ \
838 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_CHAIN_LIST_POST), \
839 GstTracerHookPadChainListPost, (GST_TRACER_ARGS, pad, res)); \
842 #else /* !GST_DISABLE_GST_TRACER_HOOKS */
845 _priv_gst_tracing_init (void)
847 GST_DEBUG ("Tracing hooks are disabled");
851 _priv_gst_tracing_deinit (void)
855 #define GST_TRACER_PAD_PUSH_PRE(pad, buffer)
856 #define GST_TRACER_PAD_PUSH_POST(pad, res)
857 #define GST_TRACER_PAD_PUSH_LIST_PRE(pad, list)
858 #define GST_TRACER_PAD_PUSH_LIST_POST(pad, res)
859 #define GST_TRACER_PAD_PULL_RANGE_PRE(pad, offset, size)
860 #define GST_TRACER_PAD_PULL_RANGE_POST(pad, buffer, res)
861 #define GST_TRACER_PAD_PUSH_EVENT_PRE(pad, event)
862 #define GST_TRACER_PAD_PUSH_EVENT_POST(pad, res)
863 #define GST_TRACER_PAD_QUERY_PRE(pad, query)
864 #define GST_TRACER_PAD_QUERY_POST(pad, query, res)
865 #define GST_TRACER_ELEMENT_POST_MESSAGE_PRE(element, message)
866 #define GST_TRACER_ELEMENT_POST_MESSAGE_POST(element, res)
867 #define GST_TRACER_ELEMENT_QUERY_PRE(element, query)
868 #define GST_TRACER_ELEMENT_QUERY_POST(element, query, res)
869 #define GST_TRACER_ELEMENT_NEW(element)
870 #define GST_TRACER_ELEMENT_ADD_PAD(element, pad)
871 #define GST_TRACER_ELEMENT_REMOVE_PAD(element, pad)
872 #define GST_TRACER_ELEMENT_CHANGE_STATE_PRE(element, transition)
873 #define GST_TRACER_ELEMENT_CHANGE_STATE_POST(element, transition, res)
874 #define GST_TRACER_BIN_ADD_PRE(bin, element)
875 #define GST_TRACER_BIN_ADD_POST(bin, element, res)
876 #define GST_TRACER_BIN_REMOVE_PRE(bin, element)
877 #define GST_TRACER_BIN_REMOVE_POST(bin, res)
878 #define GST_TRACER_PAD_LINK_PRE(srcpad, sinkpad)
879 #define GST_TRACER_PAD_LINK_POST(srcpad, sinkpad, res)
880 #define GST_TRACER_PAD_UNLINK_PRE(srcpad, sinkpad)
881 #define GST_TRACER_PAD_UNLINK_POST(srcpad, sinkpad, res)
882 #define GST_TRACER_MINI_OBJECT_CREATED(object)
883 #define GST_TRACER_MINI_OBJECT_DESTROYED(object)
884 #define GST_TRACER_MINI_OBJECT_REFFED(object, new_refcount)
885 #define GST_TRACER_MINI_OBJECT_UNREFFED(object, new_refcount)
886 #define GST_TRACER_OBJECT_CREATED(object)
887 #define GST_TRACER_OBJECT_DESTROYED(object)
888 #define GST_TRACER_OBJECT_REFFED(object, new_refcount)
889 #define GST_TRACER_OBJECT_UNREFFED(object, new_refcount)
890 #define GST_TRACER_PLUGIN_FEATURE_LOADED(feature)
891 #define GST_TRACER_PAD_CHAIN_PRE(pad, buffer)
892 #define GST_TRACER_PAD_CHAIN_POST(pad, res)
893 #define GST_TRACER_PAD_CHAIN_LIST_PRE(pad, list)
894 #define GST_TRACER_PAD_CHAIN_LIST_POST(pad, res)
896 #endif /* GST_DISABLE_GST_TRACER_HOOKS */
900 #endif /* __GST_TRACER_UTILS_H__ */