summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2008-05-31 16:53:23 +0000
committerEdward Hervey <bilboed@bilboed.com>2008-05-31 16:53:23 +0000
commitfacf5d90c709d793bbbf057f2c0b659c5fad29b0 (patch)
treee65c8ae68526945a271eca0ac21f73fab35ea3df /gst
parentc39a49245f5f742865cb3b87e28e3c16fbfef76d (diff)
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
Diffstat (limited to 'gst')
-rw-r--r--gst/qtdemux/qtdemux.c55
-rw-r--r--gst/qtdemux/qtdemux_fourcc.h3
2 files changed, 49 insertions, 9 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index 6b87dad0..a1dc6097 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 cd8197c3..a721ecf4 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')