gst-libs/gst/tag/gstvorbistag.c: Parse dates that are followed by a time as well (#357532).

Original commit message from CVS:
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_add):
Parse dates that are followed by a time as well (#357532).
* tests/check/libs/tag.c: (test_vorbis_tags):
Add unit test for this.
This commit is contained in:
Tim-Philipp Müller 2006-09-25 10:21:31 +00:00
parent f306655319
commit 787e58107c
3 changed files with 29 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2006-09-25 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_add):
Parse dates that are followed by a time as well (#357532).
* tests/check/libs/tag.c: (test_vorbis_tags):
Add unit test for this.
2006-09-23 Tim-Philipp Müller <tim at centricular dot net>
* gst/audioconvert/gstaudioconvert.c: (make_lossless_changes),

View file

@ -244,7 +244,10 @@ gst_vorbis_tag_add (GstTagList * list, const gchar * tag, const gchar * value)
d = strtoul (check, &check, 10);
}
}
if (*check == '\0' && y != 0 && g_date_valid_dmy (d, m, y)) {
/* date might be followed by a time */
if ((*check == '\0' || g_ascii_isspace (*check)) && y != 0 &&
g_date_valid_dmy (d, m, y)) {
GDate *date;
date = g_date_new_dmy (d, m, y);

View file

@ -497,6 +497,23 @@ GST_START_TEST (test_vorbis_tags)
gst_buffer_unref (buf);
}
/* check date with time */
{
GDate *date = NULL;
list = gst_tag_list_new ();
gst_vorbis_tag_add (list, "DATE", "2006-09-25 22:02:38");
fail_unless (gst_tag_list_get_date_index (list, GST_TAG_DATE, 0, &date));
fail_unless (date != NULL);
fail_unless (g_date_get_day (date) == 25);
fail_unless (g_date_get_month (date) == G_DATE_SEPTEMBER);
fail_unless (g_date_get_year (date) == 2006);
g_date_free (date);
gst_tag_list_free (list);
}
}
GST_END_TEST;