summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavard Graff <havard.graff@gmail.com>2017-10-26 12:09:07 +0200
committerTim-Philipp Müller <tim@centricular.com>2017-11-24 13:40:33 +0100
commiteb9ac7436237d18ed1144b745ac69130274afb91 (patch)
tree64380f1b05b9a75c70252df22f7ed3f2ca4d274c
parentc44edd95e7279a7981a22c35b525a648c8ffffcc (diff)
downloadgstreamer-eb9ac7436237d18ed1144b745ac69130274afb91.tar.gz
utils: add gst_utils_dump_buffer()
Useful for debugging.
-rw-r--r--docs/gst/gstreamer-sections.txt1
-rw-r--r--gst/gstutils.c18
-rw-r--r--gst/gstutils.h3
-rw-r--r--win32/common/libgstreamer.def1
4 files changed, 23 insertions, 0 deletions
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
@@ -48,6 +48,9 @@ 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;
GST_EXPORT
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