2 * Copyright (C) 2007 Stefan Kost <ensonic@users.sf.net>
4 * gstdebugutils.c: debugging and analysis utillities
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.
22 * edge [ constraint=false ];
23 * this creates strange graphs ("minlen=0" is better)
24 * try puting src/sink ghostpads for each bin into invisible clusters
26 * for more compact nodes, try
27 * - changing node-shape from box into record
28 * - use labels like : element [ label="{element | <src> src | <sink> sink}"]
29 * - point to record-connectors : element1:src -> element2:sink
30 * - we use head/tail labels for pad-caps right now
31 * - this does not work well, as dot seems to not look at their size when
33 * - we could add the caps to the pad itself, then we should use one line per
34 * caps (simple caps = one line)
37 #include "gst_private.h"
38 #include "gstdebugutils.h"
40 #ifndef GST_DISABLE_GST_DEBUG
49 #include "gstobject.h"
50 #include "gstghostpad.h"
55 /*** PIPELINE GRAPHS **********************************************************/
57 extern const gchar *priv_gst_dump_dot_dir; /* NULL *//* set from gst.c */
59 #define PARAM_MAX_LENGTH 80
61 const gchar spaces[] = {
68 #define MAKE_INDENT(indent) \
69 &spaces[MAX (sizeof (spaces) - (1 + (indent) * 2), 0)]
72 debug_dump_make_object_name (GstObject * obj)
74 return g_strcanon (g_strdup_printf ("%s_%p", GST_OBJECT_NAME (obj), obj),
75 G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "_", '_');
79 debug_dump_get_element_state (GstElement * element)
81 gchar *state_name = NULL;
82 const gchar *state_icons = "~0-=>";
83 GstState state = GST_STATE_VOID_PENDING, pending = GST_STATE_VOID_PENDING;
85 gst_element_get_state (element, &state, &pending, 0);
86 if (pending == GST_STATE_VOID_PENDING) {
87 gboolean is_locked = gst_element_is_locked_state (element);
88 state_name = g_strdup_printf ("\\n[%c]%s", state_icons[state],
89 (is_locked ? "(locked)" : ""));
91 state_name = g_strdup_printf ("\\n[%c] -> [%c]", state_icons[state],
92 state_icons[pending]);
98 debug_dump_get_element_params (GstElement * element,
99 GstDebugGraphDetails details)
101 gchar *param_name = NULL;
102 GParamSpec **properties, *property;
103 GValue value = { 0, };
104 guint i, number_of_properties;
105 gchar *tmp, *value_str;
106 const gchar *ellipses;
108 /* get paramspecs and show non-default properties */
110 g_object_class_list_properties (G_OBJECT_CLASS (GST_ELEMENT_GET_CLASS
111 (element)), &number_of_properties);
113 for (i = 0; i < number_of_properties; i++) {
114 property = properties[i];
116 /* skip some properties */
117 if (!(property->flags & G_PARAM_READABLE))
119 if (!strcmp (property->name, "name"))
122 g_value_init (&value, property->value_type);
123 g_object_get_property (G_OBJECT (element), property->name, &value);
124 if (!(g_param_value_defaults (property, &value))) {
125 tmp = g_strdup_value_contents (&value);
126 value_str = g_strescape (tmp, NULL);
129 /* too long, ellipsize */
130 if (!(details & GST_DEBUG_GRAPH_SHOW_FULL_PARAMS) &&
131 strlen (value_str) > PARAM_MAX_LENGTH)
141 if (details & GST_DEBUG_GRAPH_SHOW_FULL_PARAMS) {
142 param_name = g_strdup_printf ("%s\\n%s=%s", tmp, property->name,
145 param_name = g_strdup_printf ("%s\\n%s=%."
146 G_STRINGIFY (PARAM_MAX_LENGTH) "s%s", tmp, property->name,
147 value_str, ellipses);
155 g_value_unset (&value);
163 debug_dump_pad (GstPad * pad, const gchar * color_name,
164 const gchar * element_name, GstDebugGraphDetails details, GString * str,
167 GstPadTemplate *pad_templ;
168 GstPadPresence presence;
170 const gchar *style_name;
171 const gchar *spc = MAKE_INDENT (indent);
173 pad_name = debug_dump_make_object_name (GST_OBJECT (pad));
175 /* pad availability */
176 style_name = "filled,solid";
177 if ((pad_templ = gst_pad_get_pad_template (pad))) {
178 presence = GST_PAD_TEMPLATE_PRESENCE (pad_templ);
179 gst_object_unref (pad_templ);
180 if (presence == GST_PAD_SOMETIMES) {
181 style_name = "filled,dotted";
182 } else if (presence == GST_PAD_REQUEST) {
183 style_name = "filled,dashed";
186 if (details & GST_DEBUG_GRAPH_SHOW_STATES) {
188 const gchar *activation_mode = "-><";
189 const gchar *task_mode = "";
192 GST_OBJECT_LOCK (pad);
193 task = GST_PAD_TASK (pad);
195 switch (gst_task_get_state (task)) {
196 case GST_TASK_STARTED:
199 case GST_TASK_PAUSED:
203 /* Invalid task state, ignoring */
207 GST_OBJECT_UNLOCK (pad);
209 /* check if pad flags */
211 GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKED) ? 'B' : 'b';
213 GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_FLUSHING) ? 'F' : 'f';
215 GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLAG_BLOCKING) ? 'B' : 'b';
218 g_string_append_printf (str,
219 "%s %s_%s [color=black, fillcolor=\"%s\", label=\"%s\\n[%c][%s]%s\", height=\"0.2\", style=\"%s\"];\n",
220 spc, element_name, pad_name, color_name, GST_OBJECT_NAME (pad),
221 activation_mode[pad->mode], pad_flags, task_mode, style_name);
223 g_string_append_printf (str,
224 "%s %s_%s [color=black, fillcolor=\"%s\", label=\"%s\", height=\"0.2\", style=\"%s\"];\n",
225 spc, element_name, pad_name, color_name, GST_OBJECT_NAME (pad),
233 debug_dump_element_pad (GstPad * pad, GstElement * element,
234 GstDebugGraphDetails details, GString * str, const gint indent)
236 GstElement *target_element;
237 GstPad *target_pad, *tmp_pad;
240 gchar *target_element_name;
241 const gchar *color_name;
243 dir = gst_pad_get_direction (pad);
244 element_name = debug_dump_make_object_name (GST_OBJECT (element));
245 if (GST_IS_GHOST_PAD (pad)) {
247 (dir == GST_PAD_SRC) ? "#ffdddd" : ((dir ==
248 GST_PAD_SINK) ? "#ddddff" : "#ffffff");
249 /* output target-pad so that it belongs to this element */
250 if ((tmp_pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad)))) {
251 if ((target_pad = gst_pad_get_peer (tmp_pad))) {
252 gchar *pad_name, *target_pad_name;
253 const gchar *spc = MAKE_INDENT (indent);
255 if ((target_element = gst_pad_get_parent_element (target_pad))) {
256 target_element_name =
257 debug_dump_make_object_name (GST_OBJECT (target_element));
259 target_element_name = g_strdup ("");
261 debug_dump_pad (target_pad, color_name, target_element_name, details,
263 /* src ghostpad relationship */
264 pad_name = debug_dump_make_object_name (GST_OBJECT (pad));
265 target_pad_name = debug_dump_make_object_name (GST_OBJECT (target_pad));
266 if (dir == GST_PAD_SRC) {
267 g_string_append_printf (str,
268 "%s%s_%s -> %s_%s [style=dashed, minlen=0]\n", spc,
269 target_element_name, target_pad_name, element_name, pad_name);
271 g_string_append_printf (str,
272 "%s%s_%s -> %s_%s [style=dashed, minlen=0]\n", spc,
273 element_name, pad_name, target_element_name, target_pad_name);
275 g_free (target_pad_name);
276 g_free (target_element_name);
278 gst_object_unref (target_element);
279 gst_object_unref (target_pad);
282 gst_object_unref (tmp_pad);
286 (dir == GST_PAD_SRC) ? "#ffaaaa" : ((dir ==
287 GST_PAD_SINK) ? "#aaaaff" : "#cccccc");
290 debug_dump_pad (pad, color_name, element_name, details, str, indent);
291 g_free (element_name);
295 string_append_field (GQuark field, const GValue * value, gpointer ptr)
297 GString *str = (GString *) ptr;
298 gchar *value_str = gst_value_serialize (value);
299 gchar *esc_value_str;
301 if (value_str == NULL) {
302 g_string_append_printf (str, " %18s: NULL\\l", g_quark_to_string (field));
306 /* some enums can become really long */
307 if (strlen (value_str) > 25) {
311 value_str[25] = '\0';
313 /* mirror any brackets and quotes */
314 if (value_str[0] == '<')
315 value_str[pos--] = '>';
316 if (value_str[0] == '[')
317 value_str[pos--] = ']';
318 if (value_str[0] == '(')
319 value_str[pos--] = ')';
320 if (value_str[0] == '{')
321 value_str[pos--] = '}';
322 if (value_str[0] == '"')
323 value_str[pos--] = '"';
325 value_str[pos--] = ' ';
327 value_str[pos--] = '.';
328 value_str[pos--] = '.';
329 value_str[pos--] = '.';
331 esc_value_str = g_strescape (value_str, NULL);
333 g_string_append_printf (str, " %18s: %s\\l", g_quark_to_string (field),
337 g_free (esc_value_str);
342 debug_dump_describe_caps (GstCaps * caps, GstDebugGraphDetails details)
346 if (details & GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS) {
348 if (gst_caps_is_any (caps) || gst_caps_is_empty (caps)) {
349 media = gst_caps_to_string (caps);
356 for (i = 0; i < gst_caps_get_size (caps); i++) {
358 STRUCTURE_ESTIMATED_STRING_LEN (gst_caps_get_structure (caps, i));
361 str = g_string_sized_new (slen);
362 for (i = 0; i < gst_caps_get_size (caps); i++) {
363 GstCapsFeatures *features = __gst_caps_get_features_unchecked (caps, i);
364 GstStructure *structure = gst_caps_get_structure (caps, i);
366 g_string_append (str, gst_structure_get_name (structure));
368 if (features && (gst_caps_features_is_any (features)
369 || !gst_caps_features_is_equal (features,
370 GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY))) {
371 g_string_append_c (str, '(');
372 priv_gst_caps_features_append_to_gstring (features, str);
373 g_string_append_c (str, ')');
375 g_string_append (str, "\\l");
377 gst_structure_foreach (structure, string_append_field, (gpointer) str);
380 media = g_string_free (str, FALSE);
384 if (GST_CAPS_IS_SIMPLE (caps))
386 g_strdup (gst_structure_get_name (gst_caps_get_structure (caps, 0)));
388 media = g_strdup ("*");
394 debug_dump_element_pad_link (GstPad * pad, GstElement * element,
395 GstDebugGraphDetails details, GString * str, const gint indent)
397 GstElement *peer_element;
399 GstCaps *caps, *peer_caps;
401 gchar *media_src = NULL, *media_sink = NULL;
402 gchar *pad_name, *element_name;
403 gchar *peer_pad_name, *peer_element_name;
404 const gchar *spc = MAKE_INDENT (indent);
406 if ((peer_pad = gst_pad_get_peer (pad))) {
407 if ((details & GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE) ||
408 (details & GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS)
410 caps = gst_pad_get_current_caps (pad);
412 caps = gst_pad_get_pad_template_caps (pad);
413 peer_caps = gst_pad_get_current_caps (peer_pad);
415 peer_caps = gst_pad_get_pad_template_caps (peer_pad);
417 media = debug_dump_describe_caps (caps, details);
418 /* check if peer caps are different */
419 if (peer_caps && !gst_caps_is_equal (caps, peer_caps)) {
422 tmp = debug_dump_describe_caps (peer_caps, details);
423 if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
432 gst_caps_unref (peer_caps);
433 gst_caps_unref (caps);
436 pad_name = debug_dump_make_object_name (GST_OBJECT (pad));
438 element_name = debug_dump_make_object_name (GST_OBJECT (element));
440 element_name = g_strdup ("");
442 peer_pad_name = debug_dump_make_object_name (GST_OBJECT (peer_pad));
443 if ((peer_element = gst_pad_get_parent_element (peer_pad))) {
445 debug_dump_make_object_name (GST_OBJECT (peer_element));
447 peer_element_name = g_strdup ("");
452 g_string_append_printf (str, "%s%s_%s -> %s_%s [label=\"%s\"]\n", spc,
453 element_name, pad_name, peer_element_name, peer_pad_name, media);
455 } else if (media_src && media_sink) {
456 /* dot has some issues with placement of head and taillabels,
457 * we need an empty label to make space */
458 g_string_append_printf (str,
459 "%s%s_%s -> %s_%s [labeldistance=\"10\", labelangle=\"0\", "
461 "taillabel=\"%s\", headlabel=\"%s\"]\n",
462 spc, element_name, pad_name, peer_element_name, peer_pad_name,
463 media_src, media_sink);
467 g_string_append_printf (str, "%s%s_%s -> %s_%s\n", spc,
468 element_name, pad_name, peer_element_name, peer_pad_name);
472 g_free (element_name);
473 g_free (peer_pad_name);
474 g_free (peer_element_name);
476 gst_object_unref (peer_element);
477 gst_object_unref (peer_pad);
482 debug_dump_element_pads (GstIterator * pad_iter, GstPad * pad,
483 GstElement * element, GstDebugGraphDetails details, GString * str,
484 const gint indent, guint * num_pads, gchar * cluster_name,
485 gchar ** first_pad_name)
487 GValue item = { 0, };
489 const gchar *spc = MAKE_INDENT (indent);
493 switch (gst_iterator_next (pad_iter, &item)) {
494 case GST_ITERATOR_OK:
495 pad = g_value_get_object (&item);
497 g_string_append_printf (str, "%ssubgraph cluster_%s {\n", spc,
499 g_string_append_printf (str, "%s label=\"\";\n", spc);
500 g_string_append_printf (str, "%s style=\"invis\";\n", spc);
501 (*first_pad_name) = debug_dump_make_object_name (GST_OBJECT (pad));
503 debug_dump_element_pad (pad, element, details, str, indent);
505 g_value_reset (&item);
507 case GST_ITERATOR_RESYNC:
508 gst_iterator_resync (pad_iter);
510 case GST_ITERATOR_ERROR:
511 case GST_ITERATOR_DONE:
517 g_string_append_printf (str, "%s}\n\n", spc);
522 * debug_dump_element:
523 * @bin: the bin that should be analyzed
524 * @out: file to write to
525 * @indent: level of graph indentation
527 * Helper for gst_debug_bin_to_dot_file() to recursively dump a pipeline.
530 debug_dump_element (GstBin * bin, GstDebugGraphDetails details,
531 GString * str, const gint indent)
533 GstIterator *element_iter, *pad_iter;
534 gboolean elements_done, pads_done;
535 GValue item = { 0, };
536 GValue item2 = { 0, };
539 guint src_pads, sink_pads;
540 gchar *src_pad_name = NULL, *sink_pad_name = NULL;
542 gchar *state_name = NULL;
543 gchar *param_name = NULL;
544 const gchar *spc = MAKE_INDENT (indent);
546 element_iter = gst_bin_iterate_elements (bin);
547 elements_done = FALSE;
548 while (!elements_done) {
549 switch (gst_iterator_next (element_iter, &item)) {
550 case GST_ITERATOR_OK:
551 element = g_value_get_object (&item);
552 element_name = debug_dump_make_object_name (GST_OBJECT (element));
554 if (details & GST_DEBUG_GRAPH_SHOW_STATES) {
555 state_name = debug_dump_get_element_state (GST_ELEMENT (element));
557 if (details & GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS) {
558 param_name = debug_dump_get_element_params (GST_ELEMENT (element),
562 g_string_append_printf (str, "%ssubgraph cluster_%s {\n", spc,
564 g_string_append_printf (str, "%s fontname=\"Bitstream Vera Sans\";\n",
566 g_string_append_printf (str, "%s fontsize=\"8\";\n", spc);
567 g_string_append_printf (str, "%s style=\"filled,rounded\";\n", spc);
568 g_string_append_printf (str, "%s color=black;\n", spc);
569 g_string_append_printf (str, "%s label=\"%s\\n%s%s%s\";\n", spc,
570 G_OBJECT_TYPE_NAME (element), GST_OBJECT_NAME (element),
571 (state_name ? state_name : ""), (param_name ? param_name : "")
582 src_pads = sink_pads = 0;
583 if ((pad_iter = gst_element_iterate_sink_pads (element))) {
584 gchar *cluster_name = g_strdup_printf ("%s_sink", element_name);
585 debug_dump_element_pads (pad_iter, pad, element, details, str,
586 indent + 1, &sink_pads, cluster_name, &sink_pad_name);
587 g_free (cluster_name);
588 gst_iterator_free (pad_iter);
590 if ((pad_iter = gst_element_iterate_src_pads (element))) {
591 gchar *cluster_name = g_strdup_printf ("%s_src", element_name);
592 debug_dump_element_pads (pad_iter, pad, element, details, str,
593 indent + 1, &src_pads, cluster_name, &src_pad_name);
594 g_free (cluster_name);
595 gst_iterator_free (pad_iter);
597 if (sink_pads && src_pads) {
598 /* add invisible link from first sink to first src pad */
599 g_string_append_printf (str,
600 "%s %s_%s -> %s_%s [style=\"invis\"];\n",
601 spc, element_name, sink_pad_name, element_name, src_pad_name);
603 g_free (sink_pad_name);
604 g_free (src_pad_name);
605 g_free (element_name);
606 sink_pad_name = src_pad_name = NULL;
607 if (GST_IS_BIN (element)) {
608 g_string_append_printf (str, "%s fillcolor=\"#ffffff\";\n", spc);
610 debug_dump_element (GST_BIN (element), details, str, indent + 1);
612 if (src_pads && !sink_pads)
613 g_string_append_printf (str, "%s fillcolor=\"#ffaaaa\";\n", spc);
614 else if (!src_pads && sink_pads)
615 g_string_append_printf (str, "%s fillcolor=\"#aaaaff\";\n", spc);
616 else if (src_pads && sink_pads)
617 g_string_append_printf (str, "%s fillcolor=\"#aaffaa\";\n", spc);
619 g_string_append_printf (str, "%s fillcolor=\"#ffffff\";\n", spc);
621 g_string_append_printf (str, "%s}\n\n", spc);
622 if ((pad_iter = gst_element_iterate_pads (element))) {
625 switch (gst_iterator_next (pad_iter, &item2)) {
626 case GST_ITERATOR_OK:
627 pad = g_value_get_object (&item2);
628 if (gst_pad_is_linked (pad)) {
629 if (gst_pad_get_direction (pad) == GST_PAD_SRC) {
630 debug_dump_element_pad_link (pad, element, details, str,
633 GstPad *peer_pad = gst_pad_get_peer (pad);
636 if (!GST_IS_GHOST_PAD (peer_pad)
637 && GST_IS_PROXY_PAD (peer_pad)) {
638 debug_dump_element_pad_link (peer_pad, NULL, details,
641 gst_object_unref (peer_pad);
645 g_value_reset (&item2);
647 case GST_ITERATOR_RESYNC:
648 gst_iterator_resync (pad_iter);
650 case GST_ITERATOR_ERROR:
651 case GST_ITERATOR_DONE:
656 g_value_unset (&item2);
657 gst_iterator_free (pad_iter);
659 g_value_reset (&item);
661 case GST_ITERATOR_RESYNC:
662 gst_iterator_resync (element_iter);
664 case GST_ITERATOR_ERROR:
665 case GST_ITERATOR_DONE:
666 elements_done = TRUE;
671 g_value_unset (&item);
672 gst_iterator_free (element_iter);
676 debug_dump_header (GstBin * bin, GstDebugGraphDetails details, GString * str)
678 gchar *state_name = NULL;
679 gchar *param_name = NULL;
681 if (details & GST_DEBUG_GRAPH_SHOW_STATES) {
682 state_name = debug_dump_get_element_state (GST_ELEMENT (bin));
684 if (details & GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS) {
685 param_name = debug_dump_get_element_params (GST_ELEMENT (bin), details);
689 g_string_append_printf (str,
690 "digraph pipeline {\n"
692 " fontname=\"sans\";\n"
693 " fontsize=\"10\";\n"
697 " label=\"<%s>\\n%s%s%s\";\n"
698 " node [style=\"filled,rounded\", shape=box, fontsize=\"9\", fontname=\"sans\", margin=\"0.0,0.0\"];\n"
699 " edge [labelfontsize=\"6\", fontsize=\"9\", fontname=\"monospace\"];\n"
703 " margin=\"0.05,0.05\",\n"
704 " style=\"filled\",\n"
705 " label=\"Legend\\lElement-States: [~] void-pending, [0] null, [-] ready, [=] paused, [>] playing\\lPad-Activation: [-] none, [>] push, [<] pull\\lPad-Flags: [b]locked, [f]lushing, [b]locking; upper-case is set\\lPad-Task: [T] has started task, [t] has paused task\\l\",\n"
707 "\n", G_OBJECT_TYPE_NAME (bin), GST_OBJECT_NAME (bin),
708 (state_name ? state_name : ""), (param_name ? param_name : "")
718 debug_dump_footer (GString * str)
720 g_string_append_printf (str, "}\n");
724 * gst_debug_bin_to_dot_data:
725 * @bin: the top-level pipeline that should be analyzed
727 * To aid debugging applications one can use this method to obtain the whole
728 * network of gstreamer elements that form the pipeline into an dot file.
729 * This data can be processed with graphviz to get an image.
731 * Returns: (transfer full): a string containing the pipeline in graphviz
735 gst_debug_bin_to_dot_data (GstBin * bin, GstDebugGraphDetails details)
739 g_return_val_if_fail (GST_IS_BIN (bin), NULL);
741 str = g_string_new (NULL);
743 debug_dump_header (bin, details, str);
744 debug_dump_element (bin, details, str, 1);
745 debug_dump_footer (str);
747 return g_string_free (str, FALSE);
751 * gst_debug_bin_to_dot_file:
752 * @bin: the top-level pipeline that should be analyzed
753 * @file_name: output base filename (e.g. "myplayer")
755 * To aid debugging applications one can use this method to write out the whole
756 * network of gstreamer elements that form the pipeline into an dot file.
757 * This file can be processed with graphviz to get an image.
758 * <informalexample><programlisting>
759 * dot -Tpng -oimage.png graph_lowlevel.dot
760 * </programlisting></informalexample>
763 gst_debug_bin_to_dot_file (GstBin * bin, GstDebugGraphDetails details,
764 const gchar * file_name)
766 gchar *full_file_name = NULL;
769 g_return_if_fail (GST_IS_BIN (bin));
771 if (G_LIKELY (priv_gst_dump_dot_dir == NULL))
775 file_name = g_get_application_name ();
777 file_name = "unnamed";
780 full_file_name = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s.dot",
781 priv_gst_dump_dot_dir, file_name);
783 if ((out = fopen (full_file_name, "wb"))) {
786 buf = gst_debug_bin_to_dot_data (bin, details);
792 GST_INFO ("wrote bin graph to : '%s'", full_file_name);
794 GST_WARNING ("Failed to open file '%s' for writing: %s", full_file_name,
797 g_free (full_file_name);
801 * gst_debug_bin_to_dot_file_with_ts:
802 * @bin: the top-level pipeline that should be analyzed
803 * @file_name: output base filename (e.g. "myplayer")
805 * This works like gst_debug_bin_to_dot_file(), but adds the current timestamp
806 * to the filename, so that it can be used to take multiple snapshots.
809 gst_debug_bin_to_dot_file_with_ts (GstBin * bin,
810 GstDebugGraphDetails details, const gchar * file_name)
812 gchar *ts_file_name = NULL;
813 GstClockTime elapsed;
815 g_return_if_fail (GST_IS_BIN (bin));
818 file_name = g_get_application_name ();
820 file_name = "unnamed";
824 elapsed = GST_CLOCK_DIFF (_priv_gst_info_start_time,
825 gst_util_get_timestamp ());
827 /* we don't use GST_TIME_FORMAT as such filenames would fail on some
828 * filesystems like fat */
830 g_strdup_printf ("%u.%02u.%02u.%09u-%s", GST_TIME_ARGS (elapsed),
833 gst_debug_bin_to_dot_file (bin, details, ts_file_name);
834 g_free (ts_file_name);
836 #else /* !GST_DISABLE_GST_DEBUG */
837 #ifndef GST_REMOVE_DISABLED
839 gst_debug_bin_to_dot_file (GstBin * bin, GstDebugGraphDetails details,
840 const gchar * file_name)
845 gst_debug_bin_to_dot_file_with_ts (GstBin * bin, GstDebugGraphDetails details,
846 const gchar * file_name)
849 #endif /* GST_REMOVE_DISABLED */
850 #endif /* GST_DISABLE_GST_DEBUG */