mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 04:56:24 +00:00
gst/qtdemux/: Improve meta-data handling, add 'comment', 'description' and 'copyright' tag handling.
Original commit message from CVS: Patch by: Bastien Nocera <hadess at hadess dot net> * 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
This commit is contained in:
parent
c39a49245f
commit
facf5d90c7
3 changed files with 59 additions and 9 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2008-05-31 Edward Hervey <edward.hervey@collabora.co.uk>
|
||||
|
||||
Patch by: Bastien Nocera <hadess at hadess dot net>
|
||||
* 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 <julien@fluendo.com>
|
||||
|
||||
* gst/qtdemux/qtdemux.c: (gst_qtdemux_find_keyframe),
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue