mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +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>
|
2008-06-20 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
Patch by: Antoine Tremblay <hexa00 at gmail dot com>
|
Patch by: Antoine Tremblay <hexa00 at gmail dot com>
|
||||||
|
|
|
@ -155,6 +155,7 @@ GType
|
||||||
gst_tag_image_type_get_type (void)
|
gst_tag_image_type_get_type (void)
|
||||||
{
|
{
|
||||||
static GType id;
|
static GType id;
|
||||||
|
|
||||||
static GOnce once = G_ONCE_INIT;
|
static GOnce once = G_ONCE_INIT;
|
||||||
|
|
||||||
g_once (&once, (GThreadFunc) register_tag_image_type_enum, &id);
|
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)
|
gst_tag_image_type_is_valid (GstTagImageType type)
|
||||||
{
|
{
|
||||||
GEnumClass *klass;
|
GEnumClass *klass;
|
||||||
|
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
klass = g_type_class_ref (gst_tag_image_type_get_type ());
|
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 ** env_vars)
|
||||||
{
|
{
|
||||||
const gchar *cur_loc = NULL;
|
const gchar *cur_loc = NULL;
|
||||||
|
|
||||||
gsize bytes_read;
|
gsize bytes_read;
|
||||||
|
|
||||||
gchar *utf8 = NULL;
|
gchar *utf8 = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (data != NULL, 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)
|
guint image_data_len, GstTagImageType image_type)
|
||||||
{
|
{
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
|
|
||||||
GstBuffer *image;
|
GstBuffer *image;
|
||||||
|
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
|
||||||
g_return_val_if_fail (image_data != NULL, NULL);
|
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;
|
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) {
|
if (image_type != GST_TAG_IMAGE_TYPE_NONE) {
|
||||||
GST_LOG ("Setting image type: %d", image_type);
|
GST_LOG ("Setting image type: %d", image_type);
|
||||||
caps = gst_caps_make_writable (caps);
|
caps = gst_caps_make_writable (caps);
|
||||||
|
|
Loading…
Reference in a new issue