ext/gnomevfs/: Use gst_tag_freeform_string_to_utf8() here, which also takes into...
authorTim-Philipp Müller <tim@centricular.net>
Tue, 11 Dec 2007 17:14:13 +0000 (17:14 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Tue, 11 Dec 2007 17:14:13 +0000 (17:14 +0000)
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
ext/gnomevfs/Makefile.am
ext/gnomevfs/gstgnomevfssrc.c

index b17dbcf..0d76d0d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-12-11  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * 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  <wim.taymans@gmail.com>
 
        * gst/audioconvert/Makefile.am:
index cfad81d..626c47d 100644 (file)
@@ -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 = \
index 4d8bf19..ac2b0cf 100644 (file)
 #include <string.h>
 
 #include <gst/gst.h>
+#include <gst/tag/tag.h>
+
 /* gnome-vfs.h doesn't include the following header, which we need: */
 #include <libgnomevfs/gnome-vfs-standard-callbacks.h>
 
@@ -482,35 +484,13 @@ 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