qtdemux: add XMP parsing support

Use xmp helpers to parse XMP metadata in udta atom.

Fixes #609539
This commit is contained in:
Thiago Santos 2010-03-05 11:06:47 -03:00
parent 5b357ce22e
commit 5efda5caf7
2 changed files with 29 additions and 0 deletions

View file

@ -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

View file

@ -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__ */