From c8af2199d324ee9b055777fda0800b9438ab7262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 5 Sep 2007 16:23:21 +0000 Subject: [PATCH] gst/qtdemux/: Don't assume tags are encoded as UTF-8 (#473670). Original commit message from CVS: * gst/qtdemux/Makefile.am: * gst/qtdemux/qtdemux.c: Don't assume tags are encoded as UTF-8 (#473670). --- ChangeLog | 6 ++++++ gst/qtdemux/Makefile.am | 5 +++-- gst/qtdemux/qtdemux.c | 17 +++++++++++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b8e6117f67..a587f071f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-09-05 Tim-Philipp Müller + + * gst/qtdemux/Makefile.am: + * gst/qtdemux/qtdemux.c: + Don't assume tags are encoded as UTF-8 (#473670). + 2007-09-05 Tim-Philipp Müller * sys/v4l2/gstv4l2src.c: diff --git a/gst/qtdemux/Makefile.am b/gst/qtdemux/Makefile.am index 2c4aa52ad0..8363cdace4 100644 --- a/gst/qtdemux/Makefile.am +++ b/gst/qtdemux/Makefile.am @@ -2,8 +2,9 @@ plugin_LTLIBRARIES = libgstqtdemux.la libgstqtdemux_la_CFLAGS = ${GST_CFLAGS} $(GST_PLUGINS_BASE_CFLAGS) -libgstqtdemux_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(ZLIB_LIBS) \ - -lgstrtp-@GST_MAJORMINOR@ +libgstqtdemux_la_LIBADD = \ + $(GST_PLUGINS_BASE_LIBS) -lgstrtp-@GST_MAJORMINOR@ -lgsttag-@GST_MAJORMINOR@ \ + $(GST_BASE_LIBS) $(ZLIB_LIBS) libgstqtdemux_la_LDFLAGS = ${GST_PLUGIN_LDFLAGS} libgstqtdemux_la_SOURCES = quicktime.c gstrtpxqtdepay.c qtdemux.c qtdemux_types.c qtdemux_dump.c diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index 531a1eff14..6be21a90e0 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -51,6 +51,8 @@ #include "gst/gst-i18n-plugin.h" +#include + #include "qtdemux_types.h" #include "qtdemux_dump.h" #include "qtdemux_fourcc.h" @@ -3268,6 +3270,7 @@ unknown_stream: static void qtdemux_tag_add_str (GstQTDemux * qtdemux, const char *tag, GNode * node) { + const gchar *env_vars[] = { "GST_QT_TAG_ENCODING", "GST_TAG_ENCODING", NULL }; GNode *data; char *s; int len; @@ -3278,10 +3281,16 @@ qtdemux_tag_add_str (GstQTDemux * qtdemux, const char *tag, GNode * node) len = QT_UINT32 (data->data); type = QT_UINT32 ((guint8 *) data->data + 8); if (type == 0x00000001) { - s = g_strndup ((char *) data->data + 16, len - 16); - GST_DEBUG_OBJECT (qtdemux, "adding tag %s", s); - gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_REPLACE, tag, s, NULL); - g_free (s); + s = gst_tag_freeform_string_to_utf8 ((char *) data->data + 16, len - 16, + 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); + } } } }