summaryrefslogtreecommitdiff
path: root/tools/gst-discoverer.c
diff options
context:
space:
mode:
authorVivia Nikolaidou <n.vivia@gmail.com>2014-07-21 13:48:31 +0300
committerTim-Philipp Müller <tim@centricular.com>2014-07-21 12:42:32 +0100
commitfe67cd3d002afec55a2a69a01c8cb51ee76d6a88 (patch)
tree2e0cf2bd919efd45ecf2031585e11a7172efa298 /tools/gst-discoverer.c
parent368d75fe75d0043e0cf90dffdac71fc3b75c28a1 (diff)
downloadgstreamer-plugins-base-fe67cd3d002afec55a2a69a01c8cb51ee76d6a88.tar.gz
discoverer: prettier image tag printing
Rather than dumping the serialized sample value, the code now prints the number of bytes in the buffer, then the caps in a human-readable format. https://bugzilla.gnome.org/show_bug.cgi?id=733482
Diffstat (limited to 'tools/gst-discoverer.c')
-rw-r--r--tools/gst-discoverer.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/tools/gst-discoverer.c b/tools/gst-discoverer.c
index db351b33f..1f0b4d0f7 100644
--- a/tools/gst-discoverer.c
+++ b/tools/gst-discoverer.c
@@ -309,7 +309,27 @@ print_tag_foreach (const GstTagList * tags, const gchar * tag,
if (G_VALUE_HOLDS_STRING (&val))
str = g_value_dup_string (&val);
- else
+ else if (G_VALUE_TYPE (&val) == GST_TYPE_SAMPLE) {
+ GstSample *sample = gst_value_get_sample (&val);
+ GstBuffer *img = gst_sample_get_buffer (sample);
+ GstCaps *caps = gst_sample_get_caps (sample);
+
+ if (img) {
+ if (caps) {
+ gchar *caps_str;
+
+ caps_str = gst_caps_to_string (caps);
+ str = g_strdup_printf ("buffer of %" G_GSIZE_FORMAT " bytes, "
+ "type: %s", gst_buffer_get_size (img), caps_str);
+ g_free (caps_str);
+ } else {
+ str = g_strdup_printf ("buffer of %" G_GSIZE_FORMAT " bytes",
+ gst_buffer_get_size (img));
+ }
+ } else {
+ str = g_strdup ("NULL buffer");
+ }
+ } else
str = gst_value_serialize (&val);
g_print ("%*s%s: %s\n", 2 * depth, " ", gst_tag_get_nick (tag), str);