mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
gst-libs/gst/tag/gstvorbistag.c: Also accept partial dates with only year and month, like 1999-12-00 (fixes #410396 e...
Original commit message from CVS: * gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_add): Also accept partial dates with only year and month, like 1999-12-00 (fixes #410396 even more). * tests/check/libs/tag.c: (GST_START_TEST): Add unit test for the above.
This commit is contained in:
parent
5de913c273
commit
4462906be4
3 changed files with 31 additions and 4 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2007-03-10 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_add):
|
||||||
|
Also accept partial dates with only year and month,
|
||||||
|
like 1999-12-00 (fixes #410396 even more).
|
||||||
|
|
||||||
|
* tests/check/libs/tag.c: (GST_START_TEST):
|
||||||
|
Add unit test for the above.
|
||||||
|
|
||||||
2007-03-10 Tim-Philipp Müller <tim at centricular dot net>
|
2007-03-10 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* tests/check/elements/subparse.c: (GST_START_TEST),
|
* tests/check/elements/subparse.c: (GST_START_TEST),
|
||||||
|
|
|
@ -254,10 +254,12 @@ gst_vorbis_tag_add (GstTagList * list, const gchar * tag, const gchar * value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y != 0 && m == 0 && d == 0) {
|
/* accept dates like 2007-00-00 and 2007-05-00 */
|
||||||
/* accept dates of the form 2007-00-00 as 2007-01-01 */
|
if (y != 0) {
|
||||||
m = 1;
|
if (m == 0 && d == 0)
|
||||||
d = 1;
|
m = d = 1;
|
||||||
|
else if (m != 0 && d == 0)
|
||||||
|
d = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* date might be followed by a time */
|
/* date might be followed by a time */
|
||||||
|
|
|
@ -530,6 +530,22 @@ GST_START_TEST (test_vorbis_tags)
|
||||||
g_date_free (date);
|
g_date_free (date);
|
||||||
gst_tag_list_free (list);
|
gst_tag_list_free (list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check date with valid month, but day of 00 */
|
||||||
|
{
|
||||||
|
GDate *date = NULL;
|
||||||
|
|
||||||
|
list = gst_tag_list_new ();
|
||||||
|
gst_vorbis_tag_add (list, "DATE", "1992-05-00");
|
||||||
|
|
||||||
|
fail_unless (gst_tag_list_get_date_index (list, GST_TAG_DATE, 0, &date));
|
||||||
|
fail_unless (date != NULL);
|
||||||
|
fail_unless (g_date_get_year (date) == 1992);
|
||||||
|
fail_unless (g_date_get_month (date) == G_DATE_MAY);
|
||||||
|
|
||||||
|
g_date_free (date);
|
||||||
|
gst_tag_list_free (list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
Loading…
Reference in a new issue