From 5a48fb7cdb2ff34fcf8523bd7a3ae0f5587361ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 16 Dec 2013 11:35:12 +0100 Subject: [PATCH] vorbistag: Read image-type from the GstSample info struct But for backwards compatibility keep reading it from the caps and only use the info struct if the caps don't contain the image-type. --- gst-libs/gst/tag/gstvorbistag.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gst-libs/gst/tag/gstvorbistag.c b/gst-libs/gst/tag/gstvorbistag.c index ae4702c073..130b5b22e0 100644 --- a/gst-libs/gst/tag/gstvorbistag.c +++ b/gst-libs/gst/tag/gstvorbistag.c @@ -568,10 +568,23 @@ gst_tag_to_metadata_block_picture (const gchar * tag, mime_type = "-->"; mime_type_len = strlen (mime_type); + /* FIXME 2.0: Remove the image-type reading from the caps, this was + * a bug until 1.2.2. The image-type is only supposed to be in the + * info structure */ gst_structure_get (mime_struct, "image-type", GST_TYPE_TAG_IMAGE_TYPE, &image_type, "width", G_TYPE_INT, &width, "height", G_TYPE_INT, &height, NULL); + if (image_type == GST_TAG_IMAGE_TYPE_NONE) { + const GstStructure *info_struct; + + info_struct = gst_sample_get_info (sample); + if (info_struct && gst_structure_has_name (info_struct, "GstTagImageInfo")) { + gst_structure_get (info_struct, "image-type", GST_TYPE_TAG_IMAGE_TYPE, + &image_type, NULL); + } + } + metadata_block_len = 32 + mime_type_len + gst_buffer_get_size (buffer); gst_byte_writer_init_with_size (&writer, metadata_block_len, TRUE);