* Since: 0.10.29
*/
GstTagList *
-gst_tag_list_from_xmp_buffer (const GstBuffer * buffer)
+gst_tag_list_from_xmp_buffer (GstBuffer * buffer)
{
GstTagList *list = NULL;
- const gchar *xps, *xp1, *xp2, *xpe, *ns, *ne;
- guint len, max_ft_len;
+ gchar *xps, *xp1, *xp2, *xpe, *ns, *ne;
+ gsize len, max_ft_len;
gboolean in_tag;
gchar *part, *pp;
guint i;
XmpTag *context_tag = NULL;
GstXmpNamespaceMap ns_map[] = {
- {"dc", NULL},
- {"exif", NULL},
- {"tiff", NULL},
- {"xap", NULL},
- {"photoshop", NULL},
- {"Iptc4xmpCore", NULL},
- {"Iptc4xmpExt", NULL},
+ {"dc", NULL}
+ ,
+ {"exif", NULL}
+ ,
+ {"tiff", NULL}
+ ,
+ {"xap", NULL}
+ ,
+ {"photoshop", NULL}
+ ,
+ {"Iptc4xmpCore", NULL}
+ ,
+ {"Iptc4xmpExt", NULL}
+ ,
{NULL, NULL}
};
xmp_tags_initialize ();
g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL);
- g_return_val_if_fail (GST_BUFFER_SIZE (buffer) > 0, NULL);
GST_LOG ("Starting xmp parsing");
- xps = (const gchar *) GST_BUFFER_DATA (buffer);
- len = GST_BUFFER_SIZE (buffer);
+ xps = gst_buffer_map (buffer, &len, NULL, GST_MAP_READ);
+ g_return_val_if_fail (len > 0, NULL);
+
xpe = &xps[len + 1];
/* check header and footer */
}
g_free (part);
+ gst_buffer_unmap (buffer, xps, len);
+
return list;
/* Errors */
XmpSerializationData serialization_data;
GString *data;
guint i;
+ gsize bsize;
+ gpointer bdata;
serialization_data.data = g_string_sized_new (4096);
serialization_data.schemas = schemas;
g_string_append_printf (data, "<?xpacket end=\"%c\"?>\n",
(read_only ? 'r' : 'w'));
+ bsize = data->len + 1;
+ bdata = g_string_free (data, FALSE);
+
buffer = gst_buffer_new ();
- GST_BUFFER_SIZE (buffer) = data->len + 1;
- GST_BUFFER_DATA (buffer) = (guint8 *) g_string_free (data, FALSE);
- GST_BUFFER_MALLOCDATA (buffer) = GST_BUFFER_DATA (buffer);
+ gst_buffer_take_memory (buffer,
+ gst_memory_new_wrapped (0, bdata, g_free, bsize, 0, bsize));
return buffer;
}