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
This commit is contained in:
Vivia Nikolaidou 2014-07-21 13:48:31 +03:00 committed by Tim-Philipp Müller
parent 368d75fe75
commit fe67cd3d00

View file

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