gstdebugutils.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* GStreamer
  2. * Copyright (C) 2007 Stefan Kost <ensonic@users.sf.net>
  3. *
  4. * gstdebugutils.h: debugging and analysis utillities
  5. *
  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.
  10. *
  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.
  15. *
  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.
  20. */
  21. #ifndef __GSTDEBUGUTILS_H__
  22. #define __GSTDEBUGUTILS_H__
  23. #include <glib.h>
  24. #include <glib-object.h>
  25. #include <gst/gstconfig.h>
  26. #include <gst/gstbin.h>
  27. G_BEGIN_DECLS
  28. /**
  29. * GstDebugGraphDetails:
  30. * @GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE: show caps-name on edges
  31. * @GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS: show caps-details on edges
  32. * @GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS: show modified parameters on
  33. * elements
  34. * @GST_DEBUG_GRAPH_SHOW_STATES: show element states
  35. * @GST_DEBUG_GRAPH_SHOW_FULL_PARAMS: show full element parameter values even
  36. * if they are very long
  37. * @GST_DEBUG_GRAPH_SHOW_ALL: show all the typical details that one might want
  38. * @GST_DEBUG_GRAPH_SHOW_VERBOSE: show all details regardless of how large or
  39. * verbose they make the resulting output
  40. *
  41. * Available details for pipeline graphs produced by GST_DEBUG_BIN_TO_DOT_FILE()
  42. * and GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS().
  43. */
  44. typedef enum {
  45. GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE = (1<<0),
  46. GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS = (1<<1),
  47. GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS = (1<<2),
  48. GST_DEBUG_GRAPH_SHOW_STATES = (1<<3),
  49. GST_DEBUG_GRAPH_SHOW_FULL_PARAMS = (1<<4),
  50. GST_DEBUG_GRAPH_SHOW_ALL = ((1<<4)-1),
  51. GST_DEBUG_GRAPH_SHOW_VERBOSE = (-1)
  52. } GstDebugGraphDetails;
  53. /********** pipeline graphs **********/
  54. gchar * gst_debug_bin_to_dot_data (GstBin *bin, GstDebugGraphDetails details);
  55. void gst_debug_bin_to_dot_file (GstBin *bin, GstDebugGraphDetails details, const gchar *file_name);
  56. void gst_debug_bin_to_dot_file_with_ts (GstBin *bin, GstDebugGraphDetails details, const gchar *file_name);
  57. #ifndef GST_DISABLE_GST_DEBUG
  58. /**
  59. * GST_DEBUG_BIN_TO_DOT_FILE:
  60. * @bin: the top-level pipeline that should be analyzed
  61. * @details: details to show in the graph, e.g. #GST_DEBUG_GRAPH_SHOW_ALL or
  62. * one or more other #GstDebugGraphDetails flags.
  63. * @file_name: output base filename (e.g. "myplayer")
  64. *
  65. * To aid debugging applications one can use this method to write out the whole
  66. * network of gstreamer elements that form the pipeline into an dot file.
  67. * This file can be processed with graphviz to get an image, like this:
  68. * <informalexample><programlisting>
  69. * dot -Tpng -oimage.png graph_lowlevel.dot
  70. * </programlisting></informalexample>
  71. * There is also a utility called xdot which allows you to view the dot file
  72. * directly without converting it first.
  73. *
  74. * The macro is only active if gstreamer is configured with
  75. * &quot;--gst-enable-gst-debug&quot; and the environment variable
  76. * GST_DEBUG_DUMP_DOT_DIR is set to a basepath (e.g. /tmp).
  77. */
  78. #define GST_DEBUG_BIN_TO_DOT_FILE(bin, details, file_name) gst_debug_bin_to_dot_file (bin, details, file_name)
  79. /**
  80. * GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS:
  81. * @bin: the top-level pipeline that should be analyzed
  82. * @details: details to show in the graph, e.g. #GST_DEBUG_GRAPH_SHOW_ALL or
  83. * one or more other #GstDebugGraphDetails flags.
  84. * @file_name: output base filename (e.g. "myplayer")
  85. *
  86. * This works like GST_DEBUG_BIN_TO_DOT_FILE(), but adds the current timestamp
  87. * to the filename, so that it can be used to take multiple snapshots.
  88. */
  89. #define GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(bin, details, file_name) gst_debug_bin_to_dot_file_with_ts (bin, details, file_name)
  90. #else /* GST_DISABLE_GST_DEBUG */
  91. #define GST_DEBUG_BIN_TO_DOT_FILE(bin, details, file_name)
  92. #define GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(bin, details, file_name)
  93. #endif /* GST_DISABLE_GST_DEBUG */
  94. G_END_DECLS
  95. #endif /* __GSTDEBUGUTILS_H__ */