diff --git a/ChangeLog b/ChangeLog index 5b3bddcc8d..7e194b9825 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-03-27 Tim-Philipp Müller + + * gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_add): + * tests/check/libs/tag.c: (GST_START_TEST): + Make sure we parse floating-point numbers in vorbis comments + correctly with either '.' or ',' as separator, no matter what + the current locale is. Add unit test for this too. + 2007-03-26 Tim-Philipp Müller Patch by: René Stadler diff --git a/gst-libs/gst/tag/gstvorbistag.c b/gst-libs/gst/tag/gstvorbistag.c index 4d5c98f12e..7721e2ff85 100644 --- a/gst-libs/gst/tag/gstvorbistag.c +++ b/gst-libs/gst/tag/gstvorbistag.c @@ -235,8 +235,13 @@ gst_vorbis_tag_add (GstTagList * list, const gchar * tag, const gchar * value) break; } case G_TYPE_DOUBLE:{ - gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, g_strtod (value, - NULL), NULL); + gchar *c; + + c = g_strdup (value); + g_strdelimit (c, ",", '.'); + gst_tag_list_add (list, GST_TAG_MERGE_APPEND, gst_tag, + g_strtod (c, NULL), NULL); + g_free (c); break; } default:{ diff --git a/tests/check/libs/tag.c b/tests/check/libs/tag.c index d343ccb442..2f3c5c8c4a 100644 --- a/tests/check/libs/tag.c +++ b/tests/check/libs/tag.c @@ -310,16 +310,18 @@ GST_START_TEST (test_vorbis_tags) ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_EXTENDED_COMMENT, "RuBuWuHash=1337BA42F91"); + gst_vorbis_tag_add (list, "REPLAYGAIN_REFERENCE_LOUDNESS", "89."); + ASSERT_TAG_LIST_HAS_DOUBLE (list, GST_TAG_REFERENCE_LEVEL, 89.); gst_vorbis_tag_add (list, "REPLAYGAIN_TRACK_GAIN", "+12.36"); ASSERT_TAG_LIST_HAS_DOUBLE (list, GST_TAG_TRACK_GAIN, +12.36); gst_vorbis_tag_add (list, "REPLAYGAIN_TRACK_PEAK", "0.96349"); ASSERT_TAG_LIST_HAS_DOUBLE (list, GST_TAG_TRACK_PEAK, 0.96349); gst_vorbis_tag_add (list, "REPLAYGAIN_ALBUM_GAIN", "+10.12"); ASSERT_TAG_LIST_HAS_DOUBLE (list, GST_TAG_ALBUM_GAIN, +10.12); - gst_vorbis_tag_add (list, "REPLAYGAIN_ALBUM_PEAK", "0.98107"); + /* now check that we can parse floating point numbers with any separator + * (',' or '.') regardless of the current locale */ + gst_vorbis_tag_add (list, "REPLAYGAIN_ALBUM_PEAK", "0,98107"); ASSERT_TAG_LIST_HAS_DOUBLE (list, GST_TAG_ALBUM_PEAK, 0.98107); - gst_vorbis_tag_add (list, "REPLAYGAIN_REFERENCE_LOUDNESS", "89."); - ASSERT_TAG_LIST_HAS_DOUBLE (list, GST_TAG_REFERENCE_LEVEL, 89.); /* make sure we can convert back and forth without loss */ {