From 5efda5caf7d5ce050a200d747a2989b74c077b28 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Fri, 5 Mar 2010 11:06:47 -0300 Subject: [PATCH] qtdemux: add XMP parsing support Use xmp helpers to parse XMP metadata in udta atom. Fixes #609539 --- gst/qtdemux/qtdemux.c | 27 +++++++++++++++++++++++++++ gst/qtdemux/qtdemux_fourcc.h | 2 ++ 2 files changed, 29 insertions(+) diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index c8bc326c9c..99904044e2 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -6636,6 +6636,7 @@ qtdemux_parse_udta (GstQTDemux * qtdemux, GNode * udta) { GNode *meta; GNode *ilst; + GNode *xmp_; GNode *node; gint i; @@ -6675,6 +6676,32 @@ qtdemux_parse_udta (GstQTDemux * qtdemux, GNode * udta) g_node_children_foreach (ilst, G_TRAVERSE_ALL, (GNodeForeachFunc) qtdemux_tag_add_blob, qtdemux); + /* parse up XMP_ node if existing */ + xmp_ = qtdemux_tree_get_child_by_type (udta, FOURCC_XMP_); + if (xmp_ != NULL) { + GstBuffer *buf; + GstTagList *taglist; + + buf = gst_buffer_new (); + GST_BUFFER_DATA (buf) = ((guint8 *) xmp_->data) + 8; + GST_BUFFER_SIZE (buf) = QT_UINT32 ((guint8 *) xmp_->data) - 8; + + taglist = gst_tag_list_from_xmp_buffer (buf); + gst_buffer_unref (buf); + if (taglist) { + if (qtdemux->tag_list) { + GST_DEBUG_OBJECT (qtdemux, "Found XMP tags"); + + /* prioritize native tags using _KEEP mode */ + gst_tag_list_insert (qtdemux->tag_list, taglist, GST_TAG_MERGE_KEEP); + gst_tag_list_free (taglist); + } else + qtdemux->tag_list = taglist; + } + } else { + GST_DEBUG_OBJECT (qtdemux, "No XMP_ node found"); + } + } typedef struct diff --git a/gst/qtdemux/qtdemux_fourcc.h b/gst/qtdemux/qtdemux_fourcc.h index 57a2e63936..deccee26cb 100644 --- a/gst/qtdemux/qtdemux_fourcc.h +++ b/gst/qtdemux/qtdemux_fourcc.h @@ -201,6 +201,8 @@ G_BEGIN_DECLS #define FOURCC_tCt_ GST_MAKE_FOURCC('t','C','t','#') #define FOURCC_tCtC GST_MAKE_FOURCC('t','C','t','C') +#define FOURCC_XMP_ GST_MAKE_FOURCC('X','M','P','_') + G_END_DECLS #endif /* __GST_QTDEMUX_FOURCC_H__ */