diff --git a/ChangeLog b/ChangeLog index c6205aa8b1..44292a7f75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-06-20 Sebastian Dröge + + * gst-libs/gst/tag/tags.c: (gst_tag_image_data_to_image_buffer): + Don't increase the size of non-string image buffers by one as this + might in theory confuse decoders. Still increase it by one for string + image buffers to append '\0'. + 2008-06-20 Sebastian Dröge Patch by: Antoine Tremblay diff --git a/gst-libs/gst/tag/tags.c b/gst-libs/gst/tag/tags.c index 78d382b438..d145f6e252 100644 --- a/gst-libs/gst/tag/tags.c +++ b/gst-libs/gst/tag/tags.c @@ -155,6 +155,7 @@ GType gst_tag_image_type_get_type (void) { static GType id; + static GOnce once = G_ONCE_INIT; g_once (&once, (GThreadFunc) register_tag_image_type_enum, &id); @@ -165,6 +166,7 @@ static inline gboolean gst_tag_image_type_is_valid (GstTagImageType type) { GEnumClass *klass; + gboolean res; klass = g_type_class_ref (gst_tag_image_type_get_type ()); @@ -262,7 +264,9 @@ gst_tag_freeform_string_to_utf8 (const gchar * data, gint size, const gchar ** env_vars) { const gchar *cur_loc = NULL; + gsize bytes_read; + gchar *utf8 = NULL; g_return_val_if_fail (data != NULL, NULL); @@ -385,7 +389,9 @@ gst_tag_image_data_to_image_buffer (const guint8 * image_data, guint image_data_len, GstTagImageType image_type) { const gchar *name; + GstBuffer *image; + GstCaps *caps; g_return_val_if_fail (image_data != NULL, NULL); @@ -423,6 +429,12 @@ gst_tag_image_data_to_image_buffer (const guint8 * image_data, goto error; } + /* Decrease size by 1 if we don't have an URI list + * to keep the original size of the image + */ + if (!g_str_equal (name, "text/uri-list")) + GST_BUFFER_SIZE (image) = GST_BUFFER_SIZE (image) - 1; + if (image_type != GST_TAG_IMAGE_TYPE_NONE) { GST_LOG ("Setting image type: %d", image_type); caps = gst_caps_make_writable (caps);