From: Bastien Nocera Date: Sat, 31 May 2008 16:53:23 +0000 (+0000) Subject: gst/qtdemux/: Improve meta-data handling, add 'comment', 'description' and 'copyright... X-Git-Tag: 1.19.3~509^2~11225 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=facf5d90c709d793bbbf057f2c0b659c5fad29b0;p=platform%2Fupstream%2Fgstreamer.git gst/qtdemux/: Improve meta-data handling, add 'comment', 'description' and 'copyright' tag handling. Original commit message from CVS: Patch by: Bastien Nocera * gst/qtdemux/qtdemux.c: (qtdemux_tag_add_str), (qtdemux_parse_udta): * gst/qtdemux/qtdemux_fourcc.h: Improve meta-data handling, add 'comment', 'description' and 'copyright' tag handling. Fixes #535935 --- diff --git a/ChangeLog b/ChangeLog index 1f956df..90495e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-05-31 Edward Hervey + + Patch by: Bastien Nocera + * gst/qtdemux/qtdemux.c: (qtdemux_tag_add_str), + (qtdemux_parse_udta): + * gst/qtdemux/qtdemux_fourcc.h: + Improve meta-data handling, add 'comment', 'description' and + 'copyright' tag handling. + Fixes #535935 + 2008-05-31 Julien Moutte * gst/qtdemux/qtdemux.c: (gst_qtdemux_find_keyframe), diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index 6b87dad..a1dc609 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -3680,6 +3680,7 @@ qtdemux_tag_add_str (GstQTDemux * qtdemux, const char *tag, GNode * node) char *s; int len; int type; + int offset; data = qtdemux_tree_get_child_by_type (node, FOURCC_data); if (data) { @@ -3697,6 +3698,27 @@ qtdemux_tag_add_str (GstQTDemux * qtdemux, const char *tag, GNode * node) GST_DEBUG_OBJECT (qtdemux, "failed to convert %s tag to UTF-8", tag); } } + } else { + len = QT_UINT32 (node->data); + type = QT_UINT32 ((guint8 *) node->data + 4); + if (type & 0xa9000000) { + /* Type starts with the (C) symbol, so the next 32 bits are + * the language code, which we ignore */ + offset = 12; + GST_DEBUG_OBJECT (qtdemux, "found international text tag"); + } else { + offset = 8; + GST_DEBUG_OBJECT (qtdemux, "found normal text tag"); + } + s = gst_tag_freeform_string_to_utf8 ((char *) node->data + offset, + len - offset, env_vars); + if (s) { + GST_DEBUG_OBJECT (qtdemux, "adding tag %s", GST_STR_NULL (s)); + gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_REPLACE, tag, s, NULL); + g_free (s); + } else { + GST_DEBUG_OBJECT (qtdemux, "failed to convert %s tag to UTF-8", tag); + } } } @@ -3819,15 +3841,15 @@ qtdemux_parse_udta (GstQTDemux * qtdemux, GNode * udta) GNode *node; meta = qtdemux_tree_get_child_by_type (udta, FOURCC_meta); - if (meta == NULL) { - GST_LOG_OBJECT (qtdemux, "no meta"); - return; - } - - ilst = qtdemux_tree_get_child_by_type (meta, FOURCC_ilst); - if (ilst == NULL) { - GST_LOG_OBJECT (qtdemux, "no ilst"); - return; + if (meta != NULL) { + ilst = qtdemux_tree_get_child_by_type (meta, FOURCC_ilst); + if (ilst == NULL) { + GST_LOG_OBJECT (qtdemux, "no ilst"); + return; + } + } else { + ilst = udta; + GST_LOG_OBJECT (qtdemux, "no meta so using udta itself"); } GST_DEBUG_OBJECT (qtdemux, "new tag list"); @@ -3858,6 +3880,21 @@ qtdemux_parse_udta (GstQTDemux * qtdemux, GNode * udta) qtdemux_tag_add_str (qtdemux, GST_TAG_ALBUM, node); } + node = qtdemux_tree_get_child_by_type (ilst, FOURCC__cpy); + if (node) { + qtdemux_tag_add_str (qtdemux, GST_TAG_COPYRIGHT, node); + } + + node = qtdemux_tree_get_child_by_type (ilst, FOURCC__cmt); + if (node) { + qtdemux_tag_add_str (qtdemux, GST_TAG_COMMENT, node); + } + + node = qtdemux_tree_get_child_by_type (ilst, FOURCC__des); + if (node) { + qtdemux_tag_add_str (qtdemux, GST_TAG_DESCRIPTION, node); + } + node = qtdemux_tree_get_child_by_type (ilst, FOURCC__day); if (node) { qtdemux_tag_add_date (qtdemux, GST_TAG_DATE, node); diff --git a/gst/qtdemux/qtdemux_fourcc.h b/gst/qtdemux/qtdemux_fourcc.h index cd8197c..a721ecf 100644 --- a/gst/qtdemux/qtdemux_fourcc.h +++ b/gst/qtdemux/qtdemux_fourcc.h @@ -78,6 +78,9 @@ G_BEGIN_DECLS #define FOURCC_meta GST_MAKE_FOURCC('m','e','t','a') #define FOURCC_ilst GST_MAKE_FOURCC('i','l','s','t') #define FOURCC__nam GST_MAKE_FOURCC(0xa9,'n','a','m') +#define FOURCC__cmt GST_MAKE_FOURCC(0xa9,'c','m','t') +#define FOURCC__des GST_MAKE_FOURCC(0xa9,'d','e','s') +#define FOURCC__cpy GST_MAKE_FOURCC(0xa9,'c','p','y') #define FOURCC__ART GST_MAKE_FOURCC(0xa9,'A','R','T') #define FOURCC__wrt GST_MAKE_FOURCC(0xa9,'w','r','t') #define FOURCC__grp GST_MAKE_FOURCC(0xa9,'g','r','p')