From 257a20e77ab617989b8a435773cbcb2e206ce26a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 5 Jun 2007 16:20:44 +0000 Subject: [PATCH] gst-libs/gst/riff/: Use gst_tag_utf8_from_freeform_string() from libgsttag instead of our own implementation. Original commit message from CVS: * gst-libs/gst/riff/Makefile.am: * gst-libs/gst/riff/riff-read.c: (gst_riff_parse_info): Use gst_tag_utf8_from_freeform_string() from libgsttag instead of our own implementation. --- ChangeLog | 9 ++++- gst-libs/gst/riff/Makefile.am | 3 +- gst-libs/gst/riff/riff-read.c | 75 +---------------------------------- 3 files changed, 12 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index da7cdaa451..6431f153ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-06-05 Tim-Philipp Müller + + * gst-libs/gst/riff/Makefile.am: + * gst-libs/gst/riff/riff-read.c: (gst_riff_parse_info): + Use gst_tag_utf8_from_freeform_string() from libgsttag instead of + our own implementation. + 2007-06-05 Wim Taymans * gst-libs/gst/rtp/gstbasertpdepayload.c: @@ -59,7 +66,7 @@ (gst_multi_fd_sink_handle_client_write), (gst_multi_fd_sink_handle_clients): * gst/tcp/gstmultifdsink.h: - Add support for remuve_flush. + Add support for remove_flush. 2007-06-05 Wim Taymans diff --git a/gst-libs/gst/riff/Makefile.am b/gst-libs/gst/riff/Makefile.am index 39ceeaa5cf..fd230da661 100644 --- a/gst-libs/gst/riff/Makefile.am +++ b/gst-libs/gst/riff/Makefile.am @@ -12,6 +12,7 @@ libgstriff_@GST_MAJORMINOR@include_HEADERS = \ riff-read.h libgstriff_@GST_MAJORMINOR@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) \ - $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la + $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \ + $(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_MAJORMINOR@.la libgstriff_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) libgstriff_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) diff --git a/gst-libs/gst/riff/riff-read.c b/gst-libs/gst/riff/riff-read.c index 1c32edca38..a8dc5e4877 100644 --- a/gst-libs/gst/riff/riff-read.c +++ b/gst-libs/gst/riff/riff-read.c @@ -25,6 +25,7 @@ #include #include +#include #include "riff-read.h" @@ -577,78 +578,6 @@ too_small: } } -static gchar * -freeform_string_to_utf8 (const gchar * data, gint size, const gchar ** env_vars) -{ - const gchar *env = NULL; - gsize bytes_read; - gchar *utf8 = NULL; - - g_return_val_if_fail (data != NULL, NULL); - - if (size < 0) - size = strlen (data); - - /* Should we try the charsets specified - * via environment variables FIRST ? */ - if (g_utf8_validate (data, size, NULL)) - return g_strndup (data, size); - - while ((env == NULL || *env == '\0') && env_vars && *env_vars != NULL) { - env = g_getenv (*env_vars); - ++env_vars; - } - - /* Try charsets specified via the environment */ - if (env != NULL && *env != '\0') { - gchar **c, **csets; - - csets = g_strsplit (env, G_SEARCHPATH_SEPARATOR_S, -1); - - for (c = csets; c && *c; ++c) { - if ((utf8 = g_convert (data, size, "UTF-8", *c, &bytes_read, NULL, NULL))) { - if (bytes_read == size) { - g_strfreev (csets); - goto beach; - } - g_free (utf8); - utf8 = NULL; - } - } - - g_strfreev (csets); - } - - /* Try current locale (if not UTF-8) */ - if (!g_get_charset (&env)) { - if ((utf8 = g_locale_to_utf8 (data, size, &bytes_read, NULL, NULL))) { - if (bytes_read == size) { - goto beach; - } - g_free (utf8); - utf8 = NULL; - } - } - - /* Try ISO-8859-1 */ - utf8 = g_convert (data, size, "UTF-8", "ISO-8859-1", &bytes_read, NULL, NULL); - if (utf8 != NULL && bytes_read == size) { - goto beach; - } - - g_free (utf8); - return NULL; - -beach: - - g_strchomp (utf8); - if (utf8 && utf8[0] != '\0') - return utf8; - - g_free (utf8); - return NULL; -} - /** * gst_riff_parse_info: * @element: caller element (used for debugging/error). @@ -776,7 +705,7 @@ gst_riff_parse_info (GstElement * element, }; gchar *val; - val = freeform_string_to_utf8 ((gchar *) data, tsize, env_vars); + val = gst_tag_freeform_string_to_utf8 ((gchar *) data, tsize, env_vars); if (val) { gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, type, val, NULL);