Commit 726f2c17 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

Make sure we parse floating-point numbers in vorbis comments correctly with...

Make sure we parse floating-point numbers in vorbis comments correctly with either '.' or ',' as separator, no matter...

Original commit message from CVS:
* 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.
parent a6457e16
2007-03-27 Tim-Philipp Müller <tim at centricular dot net>
* 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 <tim at centricular dot net>
 
Patch by: René Stadler <mail at renestadler de>
......@@ -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:{
......
......@@ -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 */
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment