summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <teuf@gnome.org>2004-06-09 22:12:33 +0000
committerChristophe Fergeau <teuf@gnome.org>2004-06-09 22:12:33 +0000
commit7a3955fdc8d335589b55f0ffd695c3b0642d5340 (patch)
tree7a3f944d52f12cfab354ce152ddaed3b384df705
parent851ad864d06cfd8cf8ac33113436b9e5b955b353 (diff)
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--ChangeLog6
-rw-r--r--gst/tags/gstvorbistag.c14
2 files changed, 18 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 949800076..bf4711a9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);