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).
This commit is contained in:
Tim-Philipp Müller 2007-09-05 16:23:21 +00:00
parent 7c69e90236
commit c8af2199d3
3 changed files with 22 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2007-09-05 Tim-Philipp Müller <tim at centricular dot net>
* 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 <tim at centricular dot net> 2007-09-05 Tim-Philipp Müller <tim at centricular dot net>
* sys/v4l2/gstv4l2src.c: * sys/v4l2/gstv4l2src.c:

View file

@ -2,8 +2,9 @@
plugin_LTLIBRARIES = libgstqtdemux.la plugin_LTLIBRARIES = libgstqtdemux.la
libgstqtdemux_la_CFLAGS = ${GST_CFLAGS} $(GST_PLUGINS_BASE_CFLAGS) libgstqtdemux_la_CFLAGS = ${GST_CFLAGS} $(GST_PLUGINS_BASE_CFLAGS)
libgstqtdemux_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(ZLIB_LIBS) \ libgstqtdemux_la_LIBADD = \
-lgstrtp-@GST_MAJORMINOR@ $(GST_PLUGINS_BASE_LIBS) -lgstrtp-@GST_MAJORMINOR@ -lgsttag-@GST_MAJORMINOR@ \
$(GST_BASE_LIBS) $(ZLIB_LIBS)
libgstqtdemux_la_LDFLAGS = ${GST_PLUGIN_LDFLAGS} libgstqtdemux_la_LDFLAGS = ${GST_PLUGIN_LDFLAGS}
libgstqtdemux_la_SOURCES = quicktime.c gstrtpxqtdepay.c qtdemux.c qtdemux_types.c qtdemux_dump.c libgstqtdemux_la_SOURCES = quicktime.c gstrtpxqtdepay.c qtdemux.c qtdemux_types.c qtdemux_dump.c

View file

@ -51,6 +51,8 @@
#include "gst/gst-i18n-plugin.h" #include "gst/gst-i18n-plugin.h"
#include <gst/tag/tag.h>
#include "qtdemux_types.h" #include "qtdemux_types.h"
#include "qtdemux_dump.h" #include "qtdemux_dump.h"
#include "qtdemux_fourcc.h" #include "qtdemux_fourcc.h"
@ -3268,6 +3270,7 @@ unknown_stream:
static void static void
qtdemux_tag_add_str (GstQTDemux * qtdemux, const char *tag, GNode * node) 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; GNode *data;
char *s; char *s;
int len; int len;
@ -3278,10 +3281,16 @@ qtdemux_tag_add_str (GstQTDemux * qtdemux, const char *tag, GNode * node)
len = QT_UINT32 (data->data); len = QT_UINT32 (data->data);
type = QT_UINT32 ((guint8 *) data->data + 8); type = QT_UINT32 ((guint8 *) data->data + 8);
if (type == 0x00000001) { if (type == 0x00000001) {
s = g_strndup ((char *) data->data + 16, len - 16); s = gst_tag_freeform_string_to_utf8 ((char *) data->data + 16, len - 16,
GST_DEBUG_OBJECT (qtdemux, "adding tag %s", s); env_vars);
gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_REPLACE, tag, s, NULL); if (s) {
g_free (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);
}
} }
} }
} }