From 03ab3610c76eae0223a02c8871f6f58d114446ed Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Tue, 11 Nov 2008 19:52:05 +0000 Subject: gst/qtdemux/: Add cover and alternative copyright tag, and enhance some existing ones by marking them as container at... Original commit message from CVS: * gst/qtdemux/qtdemux.c: (qtdemux_tag_add_tmpo), (qtdemux_tag_add_covr), (qtdemux_parse_udta): * gst/qtdemux/qtdemux_fourcc.h: * gst/qtdemux/qtdemux_types.c: Add cover and alternative copyright tag, and enhance some existing ones by marking them as container atoms. --- gst/qtdemux/qtdemux.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'gst/qtdemux/qtdemux.c') diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index 6d371931..2dddd27b 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -3958,7 +3958,7 @@ qtdemux_tag_add_tmpo (GstQTDemux * qtdemux, const char *tag1, GNode * node) type = QT_UINT32 ((guint8 *) data->data + 8); GST_DEBUG_OBJECT (qtdemux, "have tempo tag, type=%d,len=%d", type, len); /* some files wrongly have a type 0x0f=15, but it should be 0x15 */ - if ((type == 0x00000015 || type == 0x0000000f) && len >= 16) { + if ((type == 0x00000015 || type == 0x0000000f) && len >= 18) { n1 = QT_UINT16 ((guint8 *) data->data + 16); if (n1) { /* do not add bpm=0 */ @@ -3970,6 +3970,30 @@ qtdemux_tag_add_tmpo (GstQTDemux * qtdemux, const char *tag1, GNode * node) } } +static void +qtdemux_tag_add_covr (GstQTDemux * qtdemux, const char *tag1, GNode * node) +{ + GNode *data; + int len; + int type; + GstBuffer *buf; + + data = qtdemux_tree_get_child_by_type (node, FOURCC_data); + if (data) { + len = QT_UINT32 (data->data); + type = QT_UINT32 ((guint8 *) data->data + 8); + GST_DEBUG_OBJECT (qtdemux, "have covr tag, type=%d,len=%d", type, len); + if ((type == 0x0000000d || type == 0x0000000e) && len > 16) { + if ((buf = gst_tag_image_data_to_image_buffer (data->data + 16, len - 16, + GST_TAG_IMAGE_TYPE_NONE))) { + GST_DEBUG_OBJECT (qtdemux, "adding tag size %d", len - 16); + gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_REPLACE, + tag1, buf, NULL); + } + } + } +} + static void qtdemux_tag_add_date (GstQTDemux * qtdemux, const char *tag, GNode * node) { @@ -4108,6 +4132,10 @@ qtdemux_parse_udta (GstQTDemux * qtdemux, GNode * udta) node = qtdemux_tree_get_child_by_type (ilst, FOURCC__cpy); if (node) { qtdemux_tag_add_str (qtdemux, GST_TAG_COPYRIGHT, node); + } else { + node = qtdemux_tree_get_child_by_type (ilst, FOURCC_cprt); + if (node) + qtdemux_tag_add_str (qtdemux, GST_TAG_COPYRIGHT, node); } node = qtdemux_tree_get_child_by_type (ilst, FOURCC__cmt); @@ -4163,6 +4191,11 @@ qtdemux_parse_udta (GstQTDemux * qtdemux, GNode * udta) qtdemux_tag_add_tmpo (qtdemux, GST_TAG_BEATS_PER_MINUTE, node); } + node = qtdemux_tree_get_child_by_type (ilst, FOURCC_covr); + if (node) { + qtdemux_tag_add_covr (qtdemux, GST_TAG_PREVIEW_IMAGE, node); + } + node = qtdemux_tree_get_child_by_type (ilst, FOURCC_keyw); if (node) { qtdemux_tag_add_str (qtdemux, GST_TAG_KEYWORDS, node); -- cgit