diff options
author | Christophe Fergeau <teuf@gnome.org> | 2004-06-09 22:12:33 +0000 |
---|---|---|
committer | Christophe Fergeau <teuf@gnome.org> | 2004-06-09 22:12:33 +0000 |
commit | 7a3955fdc8d335589b55f0ffd695c3b0642d5340 (patch) | |
tree | 7a3f944d52f12cfab354ce152ddaed3b384df705 | |
parent | 851ad864d06cfd8cf8ac33113436b9e5b955b353 (diff) | |
download | gstreamer-plugins-base-7a3955fdc8d335589b55f0ffd695c3b0642d5340.tar.gz |
gst/tags/gstvorbistag.c: make sure parsed vorbis comments are properly encoded in UTF-8 before adding them to a GstTa...
Original commit message from CVS:
2004-06-10 Christophe Fergeau <teuf@gnome.org>
* gst/tags/gstvorbistag.c: (gst_vorbis_tag_add): make sure parsed
vorbis comments are properly encoded in UTF-8 before adding them
to a GstTagList
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gst/tags/gstvorbistag.c | 14 |
2 files changed, 18 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2004-06-10 Christophe Fergeau <teuf@gnome.org> + + * gst/tags/gstvorbistag.c: (gst_vorbis_tag_add): make sure parsed + vorbis comments are properly encoded in UTF-8 before adding them + to a GstTagList + 2004-06-09 Benjamin Otte <otte@gnome.org> * ext/alsa/gstalsa.c: (add_channels): diff --git a/gst/tags/gstvorbistag.c b/gst/tags/gstvorbistag.c index 18ce40aed..986a7bc80 100644 --- a/gst/tags/gstvorbistag.c +++ b/gst/tags/gstvorbistag.c @@ -319,9 +319,19 @@ gst_vorbis_tag_add (GstTagList * list, const gchar * tag, const gchar * value) gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, tmp, NULL); } break; - case G_TYPE_STRING: - gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, value, NULL); + case G_TYPE_STRING:{ + gchar *valid; + + if (!g_utf8_validate (value, -1, (const gchar **) &valid)) { + valid = g_strndup (value, valid - value); + g_warning ("Invalid vorbis comment tag, truncated it to %s\n", valid); + } else { + valid = g_strdup (value); + } + gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, valid, NULL); + g_free (valid); break; + } case G_TYPE_DOUBLE: gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, g_strtod (value, NULL), NULL); |