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.
This commit is contained in:
Tim-Philipp Müller 2007-06-05 16:20:44 +00:00
parent 9dac555993
commit 257a20e77a
3 changed files with 12 additions and 75 deletions

View file

@ -1,3 +1,10 @@
2007-06-05 Tim-Philipp Müller <tim at centricular dot net>
* 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 <wim@fluendo.com> 2007-06-05 Wim Taymans <wim@fluendo.com>
* gst-libs/gst/rtp/gstbasertpdepayload.c: * gst-libs/gst/rtp/gstbasertpdepayload.c:
@ -59,7 +66,7 @@
(gst_multi_fd_sink_handle_client_write), (gst_multi_fd_sink_handle_client_write),
(gst_multi_fd_sink_handle_clients): (gst_multi_fd_sink_handle_clients):
* gst/tcp/gstmultifdsink.h: * gst/tcp/gstmultifdsink.h:
Add support for remuve_flush. Add support for remove_flush.
2007-06-05 Wim Taymans <wim@fluendo.com> 2007-06-05 Wim Taymans <wim@fluendo.com>

View file

@ -12,6 +12,7 @@ libgstriff_@GST_MAJORMINOR@include_HEADERS = \
riff-read.h riff-read.h
libgstriff_@GST_MAJORMINOR@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) \ 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_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstriff_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) libgstriff_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)

View file

@ -25,6 +25,7 @@
#include <string.h> #include <string.h>
#include <gst/gstutils.h> #include <gst/gstutils.h>
#include <gst/tag/tag.h>
#include "riff-read.h" #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: * gst_riff_parse_info:
* @element: caller element (used for debugging/error). * @element: caller element (used for debugging/error).
@ -776,7 +705,7 @@ gst_riff_parse_info (GstElement * element,
}; };
gchar *val; 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) { if (val) {
gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, type, val, NULL); gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, type, val, NULL);