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.
This commit is contained in:
Tim-Philipp Müller 2007-12-11 17:14:13 +00:00
parent 802b38c200
commit fe67fbb1ff
3 changed files with 20 additions and 29 deletions

View file

@ -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:

View 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 = \

View file

@ -101,6 +101,8 @@
#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>
@ -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