mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
gst-libs/gst/tag/tags.c: Don't increase the size of non-string image buffers by one as this might in theory confuse d...
Original commit message from CVS: * 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'.
This commit is contained in:
parent
1a71c15677
commit
31f3f65d53
2 changed files with 19 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
2008-06-20 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
* 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 <slomo@circular-chaos.org>
|
||||
|
||||
Patch by: Antoine Tremblay <hexa00 at gmail dot com>
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue