From fe67fbb1ffc8e628f348b8f4a05d3e9bd51b6b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 11 Dec 2007 17:14:13 +0000 Subject: [PATCH] ext/gnomevfs/: Use gst_tag_freeform_string_to_utf8() here, which also takes into account any character sets specified... Original commit message from CVS: * ext/gnomevfs/Makefile.am: * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_unicodify): Use gst_tag_freeform_string_to_utf8() here, which also takes into account any character sets specified by the user via environment variables. --- ChangeLog | 8 ++++++++ ext/gnomevfs/Makefile.am | 7 +++++-- ext/gnomevfs/gstgnomevfssrc.c | 34 +++++++--------------------------- 3 files changed, 20 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index b17dbcfe94..0d76d0d43b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-12-11 Tim-Philipp Müller + + * ext/gnomevfs/Makefile.am: + * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_unicodify): + Use gst_tag_freeform_string_to_utf8() here, which also takes + into account any character sets specified by the user via + environment variables. + 2007-12-10 Wim Taymans * gst/audioconvert/Makefile.am: diff --git a/ext/gnomevfs/Makefile.am b/ext/gnomevfs/Makefile.am index cfad81d4b6..626c47d8b2 100644 --- a/ext/gnomevfs/Makefile.am +++ b/ext/gnomevfs/Makefile.am @@ -6,8 +6,11 @@ libgstgnomevfs_la_SOURCES = \ gstgnomevfssrc.c \ gstgnomevfsuri.c -libgstgnomevfs_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(GNOME_VFS_CFLAGS) -libgstgnomevfs_la_LIBADD = $(GST_BASE_LIBS) $(GNOME_VFS_LIBS) +libgstgnomevfs_la_CFLAGS = \ + $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(GNOME_VFS_CFLAGS) +libgstgnomevfs_la_LIBADD = \ + $(top_builddir)/gst-libs/gst/tag/libgsttag-$(GST_MAJORMINOR).la \ + $(GST_BASE_LIBS) $(GNOME_VFS_LIBS) libgstgnomevfs_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) noinst_HEADERS = \ diff --git a/ext/gnomevfs/gstgnomevfssrc.c b/ext/gnomevfs/gstgnomevfssrc.c index 4d8bf19291..ac2b0cf7a0 100644 --- a/ext/gnomevfs/gstgnomevfssrc.c +++ b/ext/gnomevfs/gstgnomevfssrc.c @@ -101,6 +101,8 @@ #include #include +#include + /* gnome-vfs.h doesn't include the following header, which we need: */ #include @@ -481,36 +483,14 @@ gst_gnome_vfs_src_get_property (GObject * object, guint prop_id, GValue * value, } } -static char * -unicodify (const char *str, int len, ...) -{ - char *ret = NULL, *cset; - va_list args; - gsize bytes_read, bytes_written; - - if (g_utf8_validate (str, len, NULL)) - return g_strndup (str, len >= 0 ? len : strlen (str)); - - va_start (args, len); - while ((cset = va_arg (args, char *)) != NULL) - { - if (!strcmp (cset, "locale")) - ret = g_locale_to_utf8 (str, len, &bytes_read, &bytes_written, NULL); - else - ret = g_convert (str, len, "UTF-8", cset, - &bytes_read, &bytes_written, NULL); - if (ret) - break; - } - va_end (args); - - return ret; -} - static char * gst_gnome_vfs_src_unicodify (const char *str) { - return unicodify (str, -1, "locale", "ISO-8859-1", NULL); + const gchar *env_vars[] = { "GST_ICY_TAG_ENCODING", + "GST_TAG_ENCODING", NULL + }; + + return gst_tag_freeform_string_to_utf8 (str, -1, env_vars); } static void