utils: add gst_utils_dump_buffer()

Useful for debugging.
This commit is contained in:
Havard Graff 2017-10-26 12:09:07 +02:00 committed by Tim-Philipp Müller
parent c44edd95e7
commit eb9ac74362
4 changed files with 23 additions and 0 deletions

View file

@ -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

View file

@ -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:

View file

@ -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;

View file

@ -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