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,
85 extern GQuark _priv_gst_tracer_quark_table[GST_TRACER_QUARK_MAX];
87 #define GST_TRACER_QUARK(q) _priv_gst_tracer_quark_table[GST_TRACER_QUARK_##q]
89 /* tracing module helpers */
96 extern gboolean _priv_tracer_enabled;
97 /* key are hook-id quarks, values are GstTracerHook */
98 extern GHashTable *_priv_tracers;
100 #define GST_TRACER_IS_ENABLED (_priv_tracer_enabled)
102 #define GST_TRACER_TS \
103 GST_CLOCK_DIFF (_priv_gst_start_time, gst_util_get_timestamp ())
107 #define GST_TRACER_ARGS h->tracer, ts
108 #define GST_TRACER_DISPATCH(key,type,args) G_STMT_START{ \
109 if (GST_TRACER_IS_ENABLED) { \
110 GstClockTime ts = GST_TRACER_TS; \
113 __l = g_hash_table_lookup (_priv_tracers, GINT_TO_POINTER (key)); \
114 for (__n = __l; __n; __n = g_list_next (__n)) { \
115 h = (GstTracerHook *) __n->data; \
116 ((type)(h->func)) args; \
118 __l = g_hash_table_lookup (_priv_tracers, NULL); \
119 for (__n = __l; __n; __n = g_list_next (__n)) { \
120 h = (GstTracerHook *) __n->data; \
121 ((type)(h->func)) args; \
127 * GstTracerHookPadPushPre:
128 * @self: the tracer instance
129 * @ts: the current timestamp
131 * @buffer: the buffer
133 * Pre-hook for gst_pad_push() named "pad-push-pre".
135 typedef void (*GstTracerHookPadPushPre) (GObject *self, GstClockTime ts,
136 GstPad *pad, GstBuffer *buffer);
137 #define GST_TRACER_PAD_PUSH_PRE(pad, buffer) G_STMT_START{ \
138 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PUSH_PRE), \
139 GstTracerHookPadPushPre, (GST_TRACER_ARGS, pad, buffer)); \
143 * GstTracerHookPadPushPost:
144 * @self: the tracer instance
145 * @ts: the current timestamp
147 * @res: the result of gst_pad_push()
149 * Post-hook for gst_pad_push() named "pad-push-post".
151 typedef void (*GstTracerHookPadPushPost) (GObject * self, GstClockTime ts,
152 GstPad *pad, GstFlowReturn res);
153 #define GST_TRACER_PAD_PUSH_POST(pad, res) G_STMT_START{ \
154 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PUSH_POST), \
155 GstTracerHookPadPushPost, (GST_TRACER_ARGS, pad, res)); \
159 * GstTracerHookPadPushListPre:
160 * @self: the tracer instance
161 * @ts: the current timestamp
163 * @list: the buffer-list
165 * Pre-hook for gst_pad_push_list() named "pad-push-list-pre".
167 typedef void (*GstTracerHookPadPushListPre) (GObject *self, GstClockTime ts,
168 GstPad *pad, GstBufferList *list);
169 #define GST_TRACER_PAD_PUSH_LIST_PRE(pad, list) G_STMT_START{ \
170 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PUSH_LIST_PRE), \
171 GstTracerHookPadPushListPre, (GST_TRACER_ARGS, pad, list)); \
175 * GstTracerHookPadPushListPost:
176 * @self: the tracer instance
177 * @ts: the current timestamp
179 * @res: the result of gst_pad_push_list()
181 * Post-hook for gst_pad_push_list() named "pad-push-list-post".
183 typedef void (*GstTracerHookPadPushListPost) (GObject *self, GstClockTime ts,
186 #define GST_TRACER_PAD_PUSH_LIST_POST(pad, res) G_STMT_START{ \
187 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PUSH_LIST_POST), \
188 GstTracerHookPadPushListPost, (GST_TRACER_ARGS, pad, res)); \
192 * GstTracerHookPadPullRangePre:
193 * @self: the tracer instance
194 * @ts: the current timestamp
196 * @offset: the stream offset
197 * @size: the requested size
199 * Pre-hook for gst_pad_pull_range() named "pad-pull-range-pre".
201 typedef void (*GstTracerHookPadPullRangePre) (GObject *self, GstClockTime ts,
202 GstPad *pad, guint64 offset, guint size);
203 #define GST_TRACER_PAD_PULL_RANGE_PRE(pad, offset, size) G_STMT_START{ \
204 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PULL_RANGE_PRE), \
205 GstTracerHookPadPullRangePre, (GST_TRACER_ARGS, pad, offset, size)); \
209 * GstTracerHookPadPullRangePost:
210 * @self: the tracer instance
211 * @ts: the current timestamp
213 * @buffer: the buffer
214 * @res: the result of gst_pad_pull_range()
216 * Post-hook for gst_pad_pull_range() named "pad-pull-range-post".
218 typedef void (*GstTracerHookPadPullRangePost) (GObject *self, GstClockTime ts,
219 GstPad *pad, GstBuffer *buffer, GstFlowReturn res);
220 #define GST_TRACER_PAD_PULL_RANGE_POST(pad, buffer, res) G_STMT_START{ \
221 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PULL_RANGE_POST), \
222 GstTracerHookPadPullRangePost, (GST_TRACER_ARGS, pad, buffer, res)); \
226 * GstTracerHookPadPushEventPre:
227 * @self: the tracer instance
228 * @ts: the current timestamp
232 * Pre-hook for gst_pad_push_event() named "pad-push-event-pre".
234 typedef void (*GstTracerHookPadPushEventPre) (GObject *self, GstClockTime ts,
235 GstPad *pad, GstEvent *event);
236 #define GST_TRACER_PAD_PUSH_EVENT_PRE(pad, event) G_STMT_START{ \
237 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PUSH_EVENT_PRE), \
238 GstTracerHookPadPushEventPre, (GST_TRACER_ARGS, pad, event)); \
242 * GstTracerHookPadPushEventPost:
243 * @self: the tracer instance
244 * @ts: the current timestamp
246 * @res: the result of gst_pad_push_event()
248 * Post-hook for gst_pad_push_event() named "pad-push-event-post".
250 typedef void (*GstTracerHookPadPushEventPost) (GObject *self, GstClockTime ts,
251 GstPad *pad, gboolean res);
252 #define GST_TRACER_PAD_PUSH_EVENT_POST(pad, res) G_STMT_START{ \
253 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_PUSH_EVENT_POST), \
254 GstTracerHookPadPushEventPost, (GST_TRACER_ARGS, pad, res)); \
258 * GstTracerHookPadQueryPre:
259 * @self: the tracer instance
260 * @ts: the current timestamp
264 * Pre-hook for gst_pad_query() named "pad-query-pre".
266 typedef void (*GstTracerHookPadQueryPre) (GObject *self, GstClockTime ts,
267 GstPad *pad, GstQuery *query);
268 #define GST_TRACER_PAD_QUERY_PRE(pad, query) G_STMT_START{ \
269 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_QUERY_PRE), \
270 GstTracerHookPadQueryPre, (GST_TRACER_ARGS, pad, query)); \
274 * GstTracerHookPadQueryPost:
275 * @self: the tracer instance
276 * @ts: the current timestamp
279 * @res: the result of gst_pad_query()
281 * Post-hook for gst_pad_query() named "pad-query-post".
283 typedef void (*GstTracerHookPadQueryPost) (GObject *self, GstClockTime ts,
284 GstPad *pad, GstQuery *query, gboolean res);
285 #define GST_TRACER_PAD_QUERY_POST(pad, query, res) G_STMT_START{ \
286 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_QUERY_POST), \
287 GstTracerHookPadQueryPost, (GST_TRACER_ARGS, pad, query, res)); \
291 * GstTracerHookElementPostMessagePre:
292 * @self: the tracer instance
293 * @ts: the current timestamp
294 * @element: the element
295 * @message: the message
297 * Pre-hook for gst_element_post_message() named "element-post-message-pre".
299 typedef void (*GstTracerHookElementPostMessagePre) (GObject *self,
300 GstClockTime ts, GstElement *element, GstMessage *message);
301 #define GST_TRACER_ELEMENT_POST_MESSAGE_PRE(element, message) G_STMT_START{ \
302 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_POST_MESSAGE_PRE), \
303 GstTracerHookElementPostMessagePre, (GST_TRACER_ARGS, element, message)); \
307 * GstTracerHookElementPostMessagePost:
308 * @self: the tracer instance
309 * @ts: the current timestamp
310 * @element: the element
311 * @res: the result of gst_element_post_message()
313 * Pre-hook for gst_element_post_message() named "element-post-message-post".
315 typedef void (*GstTracerHookElementPostMessagePost) (GObject *self,
316 GstClockTime ts, GstElement *element, gboolean res);
317 #define GST_TRACER_ELEMENT_POST_MESSAGE_POST(element, res) G_STMT_START{ \
318 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_POST_MESSAGE_POST), \
319 GstTracerHookElementPostMessagePost, (GST_TRACER_ARGS, element, res)); \
323 * GstTracerHookElementQueryPre:
324 * @self: the tracer instance
325 * @ts: the current timestamp
326 * @element: the element
329 * Pre-hook for gst_element_query() named "element-query-pre".
331 typedef void (*GstTracerHookElementQueryPre) (GObject *self, GstClockTime ts,
332 GstElement *element, GstQuery *query);
333 #define GST_TRACER_ELEMENT_QUERY_PRE(element, query) G_STMT_START{ \
334 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_QUERY_PRE), \
335 GstTracerHookElementQueryPre, (GST_TRACER_ARGS, element, query)); \
339 * GstTracerHookElementQueryPost:
340 * @self: the tracer instance
341 * @ts: the current timestamp
342 * @element: the element
344 * @res: the result of gst_element_query()
346 * Post-hook for gst_element_query() named "element-query-post".
348 typedef void (*GstTracerHookElementQueryPost) (GObject *self, GstClockTime ts,
349 GstElement *element, GstQuery *query, gboolean res);
350 #define GST_TRACER_ELEMENT_QUERY_POST(element, query, res) G_STMT_START{ \
351 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_QUERY_POST), \
352 GstTracerHookElementQueryPost, (GST_TRACER_ARGS, element, query, res)); \
356 * GstTracerHookElementNew:
357 * @self: the tracer instance
358 * @ts: the current timestamp
359 * @element: the element
361 * Hook for whenever a new element is created, named "element-new".
363 typedef void (*GstTracerHookElementNew) (GObject *self, GstClockTime ts,
364 GstElement *element);
365 #define GST_TRACER_ELEMENT_NEW(element) G_STMT_START{ \
366 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_NEW), \
367 GstTracerHookElementNew, (GST_TRACER_ARGS, element)); \
371 * GstTracerHookElementAddPad:
372 * @self: the tracer instance
373 * @ts: the current timestamp
374 * @element: the element
377 * Hook for gst_element_add_pad() named "element-add-pad".
379 typedef void (*GstTracerHookElementAddPad) (GObject *self, GstClockTime ts,
380 GstElement *element, GstPad *pad);
381 #define GST_TRACER_ELEMENT_ADD_PAD(element, pad) G_STMT_START{ \
382 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_ADD_PAD), \
383 GstTracerHookElementAddPad, (GST_TRACER_ARGS, element, pad)); \
387 * GstTracerHookElementRemovePad:
388 * @self: the tracer instance
389 * @ts: the current timestamp
390 * @element: the element
393 * Hook for gst_element_remove_pad() named "element-remove-pad".
395 typedef void (*GstTracerHookElementRemovePad) (GObject *self, GstClockTime ts,
396 GstElement *element, GstPad *pad);
397 #define GST_TRACER_ELEMENT_REMOVE_PAD(element, pad) G_STMT_START{ \
398 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_REMOVE_PAD), \
399 GstTracerHookElementRemovePad, (GST_TRACER_ARGS, element, pad)); \
403 * GstTracerHookElementChangeStatePre:
404 * @self: the tracer instance
405 * @ts: the current timestamp
406 * @element: the element
407 * @transition: the transition
409 * Pre-hook for gst_element_change_state() named "element-change-state-pre".
411 typedef void (*GstTracerHookElementChangeStatePre) (GObject *self,
412 GstClockTime ts, GstElement *element, GstStateChange transition);
413 #define GST_TRACER_ELEMENT_CHANGE_STATE_PRE(element, transition) G_STMT_START{ \
414 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_CHANGE_STATE_PRE), \
415 GstTracerHookElementChangeStatePre, (GST_TRACER_ARGS, element, transition)); \
419 * GstTracerHookElementChangeStatePost:
420 * @self: the tracer instance
421 * @ts: the current timestamp
422 * @element: the element
423 * @transition: the transition
424 * @result: the result of gst_pad_push()
426 * Post-hook for gst_element_change_state() named "element-change-state-post".
428 typedef void (*GstTracerHookElementChangeStatePost) (GObject *self,
429 GstClockTime ts, GstElement *element, GstStateChange transition,
430 GstStateChangeReturn result);
431 #define GST_TRACER_ELEMENT_CHANGE_STATE_POST(element, transition, result) G_STMT_START{ \
432 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_ELEMENT_CHANGE_STATE_POST), \
433 GstTracerHookElementChangeStatePost, (GST_TRACER_ARGS, element, transition, result)); \
437 * GstTracerHookBinAddPre:
438 * @self: the tracer instance
439 * @ts: the current timestamp
441 * @element: the element
443 * Pre-hook for gst_bin_add() named "bin-add-pre".
445 typedef void (*GstTracerHookBinAddPre) (GObject *self, GstClockTime ts,
446 GstBin *bin, GstElement *element);
447 #define GST_TRACER_BIN_ADD_PRE(bin, element) G_STMT_START{ \
448 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_BIN_ADD_PRE), \
449 GstTracerHookBinAddPre, (GST_TRACER_ARGS, bin, element)); \
453 * GstTracerHookBinAddPost:
454 * @self: the tracer instance
455 * @ts: the current timestamp
457 * @element: the element
458 * @result: the result of gst_bin_add()
460 * Post-hook for gst_bin_add() named "bin-add-post".
462 typedef void (*GstTracerHookBinAddPost) (GObject *self, GstClockTime ts,
463 GstBin *bin, GstElement *element, gboolean result);
464 #define GST_TRACER_BIN_ADD_POST(bin, element, result) G_STMT_START{ \
465 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_BIN_ADD_POST), \
466 GstTracerHookBinAddPost, (GST_TRACER_ARGS, bin, element, result)); \
470 * GstTracerHookBinRemovePre:
471 * @self: the tracer instance
472 * @ts: the current timestamp
474 * @element: the element
476 * Pre-hook for gst_bin_remove() named "bin-remove-pre".
478 typedef void (*GstTracerHookBinRemovePre) (GObject *self, GstClockTime ts,
479 GstBin *bin, GstElement *element);
480 #define GST_TRACER_BIN_REMOVE_PRE(bin, element) G_STMT_START{ \
481 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_BIN_REMOVE_PRE), \
482 GstTracerHookBinRemovePre, (GST_TRACER_ARGS, bin, element)); \
486 * GstTracerHookBinRemovePost:
487 * @self: the tracer instance
488 * @ts: the current timestamp
490 * @result: the result of gst_bin_remove()
492 * Post-hook for gst_bin_remove() named "bin-remove-post".
494 typedef void (*GstTracerHookBinRemovePost) (GObject *self, GstClockTime ts,
495 GstBin *bin, gboolean result);
496 #define GST_TRACER_BIN_REMOVE_POST(bin, result) G_STMT_START{ \
497 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_BIN_REMOVE_POST), \
498 GstTracerHookBinRemovePost, (GST_TRACER_ARGS, bin, result)); \
502 * GstTracerHookPadLinkPre:
503 * @self: the tracer instance
504 * @ts: the current timestamp
505 * @srcpad: the srcpad
506 * @sinkpad: the sinkpad
508 * Pre-hook for gst_pad_link() named "pad-link-pre".
510 typedef void (*GstTracerHookPadLinkPre) (GObject *self, GstClockTime ts,
511 GstPad *srcpad, GstPad *sinkpad);
512 #define GST_TRACER_PAD_LINK_PRE(srcpad, sinkpad) G_STMT_START{ \
513 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_LINK_PRE), \
514 GstTracerHookPadLinkPre, (GST_TRACER_ARGS, srcpad, sinkpad)); \
518 * GstTracerHookPadLinkPost:
519 * @self: the tracer instance
520 * @ts: the current timestamp
521 * @srcpad: the srcpad
522 * @sinkpad: the sinkpad
523 * @result: the result of gst_pad_link()
525 * Post-hook for gst_pad_link() named "pad-link-post".
527 typedef void (*GstTracerHookPadLinkPost) (GObject *self, GstClockTime ts,
528 GstPad *srcpad, GstPad *sinkpad, GstPadLinkReturn result);
529 #define GST_TRACER_PAD_LINK_POST(srcpad, sinkpad, result) G_STMT_START{ \
530 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_LINK_POST), \
531 GstTracerHookPadLinkPost, (GST_TRACER_ARGS, srcpad, sinkpad, result)); \
535 * GstTracerHookPadUnlinkPre:
536 * @self: the tracer instance
537 * @ts: the current timestamp
538 * @srcpad: the srcpad
539 * @sinkpad: the sinkpad
541 * Pre-hook for gst_pad_unlink() named "pad-unlink-pre".
543 typedef void (*GstTracerHookPadUnlinkPre) (GObject *self, GstClockTime ts,
544 GstPad *srcpad, GstPad *sinkpad);
545 #define GST_TRACER_PAD_UNLINK_PRE(srcpad, sinkpad) G_STMT_START{ \
546 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_UNLINK_PRE), \
547 GstTracerHookPadUnlinkPre, (GST_TRACER_ARGS, srcpad, sinkpad)); \
551 * GstTracerHookPadUnlinkPost:
552 * @self: the tracer instance
553 * @ts: the current timestamp
554 * @srcpad: the srcpad
555 * @sinkpad: the sinkpad
556 * @result: the result of gst_pad_push()
558 * Post-hook for gst_pad_unlink() named "pad-unlink-post".
560 typedef void (*GstTracerHookPadUnlinkPost) (GObject *self, GstClockTime ts,
561 GstPad *srcpad, GstPad *sinkpad, gboolean result);
562 #define GST_TRACER_PAD_UNLINK_POST(srcpad, sinkpad, result) G_STMT_START{ \
563 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_PAD_UNLINK_POST), \
564 GstTracerHookPadUnlinkPost, (GST_TRACER_ARGS, srcpad, sinkpad, result)); \
568 * GstTracerHookMiniObjectCreated:
569 * @self: the tracer instance
570 * @ts: the current timestamp
571 * @object: the mini object being created
573 * Hook called when a #GstMiniObject is created named "mini-object-created".
575 typedef void (*GstTracerHookMiniObjectCreated) (GObject *self, GstClockTime ts,
576 GstMiniObject *object);
577 #define GST_TRACER_MINI_OBJECT_CREATED(object) G_STMT_START{ \
578 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MINI_OBJECT_CREATED), \
579 GstTracerHookMiniObjectCreated, (GST_TRACER_ARGS, object)); \
583 * GstTracerHookMiniObjectDestroyed:
584 * @self: the tracer instance
585 * @ts: the current timestamp
586 * @object: the mini object being destroyed
588 * Hook called when a #GstMiniObject is being destroyed named
589 * "mini-object-destroyed".
591 typedef void (*GstTracerHookMiniObjectDestroyed) (GObject *self, GstClockTime ts,
592 GstMiniObject *object);
593 #define GST_TRACER_MINI_OBJECT_DESTROYED(object) G_STMT_START{ \
594 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MINI_OBJECT_DESTROYED), \
595 GstTracerHookMiniObjectDestroyed, (GST_TRACER_ARGS, object)); \
599 * GstTracerHookObjectUnreffed:
600 * @self: the tracer instance
601 * @ts: the current timestamp
602 * @object: the object being unreffed
603 * @new_refcount: the new refcount after unrefing @object
605 * Hook called when a #GstObject is being unreffed named
608 typedef void (*GstTracerHookObjectUnreffed) (GObject *self, GstClockTime ts,
609 GstObject *object, gint new_refcount);
610 #define GST_TRACER_OBJECT_UNREFFED(object, new_refcount) G_STMT_START{ \
611 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_OBJECT_UNREFFED), \
612 GstTracerHookObjectUnreffed, (GST_TRACER_ARGS, object, new_refcount)); \
616 * GstTracerHookObjectReffed:
617 * @self: the tracer instance
618 * @ts: the current timestamp
619 * @object: the object being reffed
620 * @new_refcount: the new refcount after refing @object
622 * Hook called when a #GstObject is being reffed named
625 typedef void (*GstTracerHookObjectReffed) (GObject *self, GstClockTime ts,
626 GstObject *object, gint new_refcount);
627 #define GST_TRACER_OBJECT_REFFED(object, new_refcount) G_STMT_START{ \
628 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_OBJECT_REFFED), \
629 GstTracerHookObjectReffed, (GST_TRACER_ARGS, object, new_refcount)); \
633 * GstTracerHookMiniObjectUnreffed:
634 * @self: the tracer instance
635 * @ts: the current timestamp
636 * @object: the mini object being unreffed
637 * @new_refcount: the new refcount after unrefing @object
639 * Hook called when a #GstMiniObject is being unreffed named
640 * "mini-object-unreffed".
642 typedef void (*GstTracerHookMiniObjectUnreffed) (GObject *self, GstClockTime ts,
643 GstMiniObject *object, gint new_refcount);
644 #define GST_TRACER_MINI_OBJECT_UNREFFED(object, new_refcount) G_STMT_START{ \
645 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MINI_OBJECT_UNREFFED), \
646 GstTracerHookMiniObjectUnreffed, (GST_TRACER_ARGS, object, new_refcount)); \
650 * GstTracerHookMiniObjectReffed:
651 * @self: the tracer instance
652 * @ts: the current timestamp
653 * @object: the mini object being reffed
654 * @new_refcount: the new refcount after refing @object
656 * Hook called when a #GstMiniObject is being reffed named
657 * "mini-object-reffed".
659 typedef void (*GstTracerHookMiniObjectReffed) (GObject *self, GstClockTime ts,
660 GstMiniObject *object, gint new_refcount);
661 #define GST_TRACER_MINI_OBJECT_REFFED(object, new_refcount) G_STMT_START{ \
662 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_MINI_OBJECT_REFFED), \
663 GstTracerHookMiniObjectReffed, (GST_TRACER_ARGS, object, new_refcount)); \
667 * GstTracerHookObjectCreated:
668 * @self: the tracer instance
669 * @ts: the current timestamp
670 * @object: the object being created
672 * Hook called when a #GstObject is created named "object-created".
674 typedef void (*GstTracerHookObjectCreated) (GObject *self, GstClockTime ts,
676 #define GST_TRACER_OBJECT_CREATED(object) G_STMT_START{ \
677 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_OBJECT_CREATED), \
678 GstTracerHookObjectCreated, (GST_TRACER_ARGS, object)); \
682 * GstTracerHookObjectDestroyed:
683 * @self: the tracer instance
684 * @ts: the current timestamp
685 * @object: the object being destroyed
687 * Hook called when a #GstObject is being destroyed named
688 * "object-destroyed".
690 typedef void (*GstTracerHookObjectDestroyed) (GObject *self, GstClockTime ts,
692 #define GST_TRACER_OBJECT_DESTROYED(object) G_STMT_START{ \
693 GST_TRACER_DISPATCH(GST_TRACER_QUARK(HOOK_OBJECT_DESTROYED), \
694 GstTracerHookObjectDestroyed, (GST_TRACER_ARGS, object)); \
698 #else /* !GST_DISABLE_GST_TRACER_HOOKS */
701 _priv_gst_tracing_init (void)
703 GST_DEBUG ("Tracing hooks are disabled");
707 _priv_gst_tracing_deinit (void)
711 #define GST_TRACER_PAD_PUSH_PRE(pad, buffer)
712 #define GST_TRACER_PAD_PUSH_POST(pad, res)
713 #define GST_TRACER_PAD_PUSH_LIST_PRE(pad, list)
714 #define GST_TRACER_PAD_PUSH_LIST_POST(pad, res)
715 #define GST_TRACER_PAD_PULL_RANGE_PRE(pad, offset, size)
716 #define GST_TRACER_PAD_PULL_RANGE_POST(pad, buffer, res)
717 #define GST_TRACER_PAD_PUSH_EVENT_PRE(pad, event)
718 #define GST_TRACER_PAD_PUSH_EVENT_POST(pad, res)
719 #define GST_TRACER_PAD_QUERY_PRE(pad, query)
720 #define GST_TRACER_PAD_QUERY_POST(pad, query, res)
721 #define GST_TRACER_ELEMENT_POST_MESSAGE_PRE(element, message)
722 #define GST_TRACER_ELEMENT_POST_MESSAGE_POST(element, res)
723 #define GST_TRACER_ELEMENT_QUERY_PRE(element, query)
724 #define GST_TRACER_ELEMENT_QUERY_POST(element, query, res)
725 #define GST_TRACER_ELEMENT_NEW(element)
726 #define GST_TRACER_ELEMENT_ADD_PAD(element, pad)
727 #define GST_TRACER_ELEMENT_REMOVE_PAD(element, pad)
728 #define GST_TRACER_ELEMENT_CHANGE_STATE_PRE(element, transition)
729 #define GST_TRACER_ELEMENT_CHANGE_STATE_POST(element, transition, res)
730 #define GST_TRACER_BIN_ADD_PRE(bin, element)
731 #define GST_TRACER_BIN_ADD_POST(bin, element, res)
732 #define GST_TRACER_BIN_REMOVE_PRE(bin, element)
733 #define GST_TRACER_BIN_REMOVE_POST(bin, res)
734 #define GST_TRACER_PAD_LINK_PRE(srcpad, sinkpad)
735 #define GST_TRACER_PAD_LINK_POST(srcpad, sinkpad, res)
736 #define GST_TRACER_PAD_UNLINK_PRE(srcpad, sinkpad)
737 #define GST_TRACER_PAD_UNLINK_POST(srcpad, sinkpad, res)
738 #define GST_TRACER_MINI_OBJECT_CREATED(object)
739 #define GST_TRACER_MINI_OBJECT_DESTROYED(object)
740 #define GST_TRACER_MINI_OBJECT_REFFED(object, new_refcount)
741 #define GST_TRACER_MINI_OBJECT_UNREFFED(object, new_refcount)
742 #define GST_TRACER_OBJECT_CREATED(object)
743 #define GST_TRACER_OBJECT_DESTROYED(object)
744 #define GST_TRACER_OBJECT_REFFED(object, new_refcount)
745 #define GST_TRACER_OBJECT_UNREFFED(object, new_refcount)
747 #endif /* GST_DISABLE_GST_TRACER_HOOKS */
751 #endif /* __GST_TRACER_UTILS_H__ */