From 063dc1712e969e5d68c0f255fc68f970a177b0c2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 28 Jul 2012 11:54:38 +0100 Subject: [PATCH] tag: fix up EXIF writer for GstBuffer -> GstSample --- gst-libs/gst/tag/gstexiftag.c | 14 +++++++++----- tests/check/libs/tag.c | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/gst-libs/gst/tag/gstexiftag.c b/gst-libs/gst/tag/gstexiftag.c index 76fd943..e55add4 100644 --- a/gst-libs/gst/tag/gstexiftag.c +++ b/gst-libs/gst/tag/gstexiftag.c @@ -900,6 +900,7 @@ write_exif_undefined_tag_from_taglist (GstExifWriter * writer, guint8 *data = NULL; gsize size = 0; gint tag_size = gst_tag_list_get_tag_size (taglist, exiftag->gst_tag); + GstSample *sample = NULL; GstBuffer *buf = NULL; if (tag_size != 1) { @@ -916,8 +917,9 @@ write_exif_undefined_tag_from_taglist (GstExifWriter * writer, size = strlen ((gchar *) data); /* no need to +1, undefined doesn't require it */ break; default: - if (G_VALUE_TYPE (value) == GST_TYPE_BUFFER) { - buf = gst_value_get_buffer (value); + if (G_VALUE_TYPE (value) == GST_TYPE_SAMPLE) { + sample = gst_value_get_sample (value); + buf = gst_sample_get_buffer (sample); gst_buffer_map (buf, &info, GST_MAP_READ); data = info.data; size = info.size; @@ -1349,15 +1351,17 @@ parse_exif_undefined_tag (GstExifReader * reader, const GstExifTagMatch * tag, } tagtype = gst_tag_get_type (tag->gst_tag); - if (tagtype == GST_TYPE_BUFFER) { + if (tagtype == GST_TYPE_SAMPLE) { + GstSample *sample; GstBuffer *buf; buf = gst_buffer_new_wrapped (data, count); data = NULL; + sample = gst_sample_new (buf, NULL, NULL, NULL); gst_tag_list_add (reader->taglist, GST_TAG_MERGE_APPEND, tag->gst_tag, - buf, NULL); - + sample, NULL); + gst_sample_unref (sample); gst_buffer_unref (buf); } else if (tagtype == G_TYPE_STRING) { gst_tag_list_add (reader->taglist, GST_TAG_MERGE_REPLACE, tag->gst_tag, diff --git a/tests/check/libs/tag.c b/tests/check/libs/tag.c index b49d0d2..09b5197 100644 --- a/tests/check/libs/tag.c +++ b/tests/check/libs/tag.c @@ -1734,14 +1734,14 @@ GST_START_TEST (test_exif_tags_serialization_deserialization) do_simple_exif_tag_serialization_deserialization (GST_TAG_DATE_TIME, &value); g_value_unset (&value); - g_value_init (&value, GST_TYPE_BUFFER); + g_value_init (&value, GST_TYPE_SAMPLE); buf = gst_buffer_new_and_alloc (1024); gst_buffer_map (buf, &map, GST_MAP_WRITE); data = map.data; for (i = 0; i < 1024; i++) data[i] = i % 255; gst_buffer_unmap (buf, &map); - gst_value_set_buffer (&value, buf); + gst_value_take_sample (&value, gst_sample_new (buf, NULL, NULL, NULL)); gst_buffer_unref (buf); do_simple_exif_tag_serialization_deserialization (GST_TAG_APPLICATION_DATA, &value); -- 2.7.4