From eb9ac7436237d18ed1144b745ac69130274afb91 Mon Sep 17 00:00:00 2001 From: Havard Graff Date: Thu, 26 Oct 2017 12:09:07 +0200 Subject: utils: add gst_utils_dump_buffer() Useful for debugging. --- docs/gst/gstreamer-sections.txt | 1 + gst/gstutils.c | 18 ++++++++++++++++++ gst/gstutils.h | 3 +++ win32/common/libgstreamer.def | 1 + 4 files changed, 23 insertions(+) diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 0c60dbc195..6385ca67ee 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -3574,6 +3574,7 @@ GFLOAT_TO_LE gst_guint64_to_gdouble gst_gdouble_to_guint64 +gst_util_dump_buffer gst_util_dump_mem gst_util_uint64_scale gst_util_uint64_scale_round diff --git a/gst/gstutils.c b/gst/gstutils.c index 601d553553..9372e4e1db 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -86,6 +86,24 @@ gst_util_dump_mem (const guchar * mem, guint size) g_string_free (chars, TRUE); } +/** + * gst_util_dump_buffer: + * @buf: a #GstBuffer whose memory to dump + * + * Dumps the buffer memory into a hex representation. Useful for debugging. + * + * Since: 1.14 + */ +void +gst_util_dump_buffer (GstBuffer * buf) +{ + GstMapInfo map; + + if (gst_buffer_map (buf, &map, GST_MAP_READ)) { + gst_util_dump_mem (map.data, map.size); + gst_buffer_unmap (buf, &map); + } +} /** * gst_util_set_value_from_string: diff --git a/gst/gstutils.h b/gst/gstutils.h index 1ff94e306e..e891f1b89b 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -47,6 +47,9 @@ gboolean gst_util_get_object_array (GObject * object, const gchar * GST_EXPORT void gst_util_dump_mem (const guchar *mem, guint size); +GST_EXPORT +void gst_util_dump_buffer (GstBuffer * buf); + GST_EXPORT guint64 gst_util_gdouble_to_guint64 (gdouble value) G_GNUC_CONST; diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def index b063dcbecb..71a61eeb41 100644 --- a/win32/common/libgstreamer.def +++ b/win32/common/libgstreamer.def @@ -1581,6 +1581,7 @@ EXPORTS gst_uri_type_get_type gst_util_array_binary_search gst_util_double_to_fraction + gst_util_dump_buffer gst_util_dump_mem gst_util_fraction_add gst_util_fraction_compare -- cgit v1.2.1