From 5786a1b63cb44e357f30f73ec01b5924bc8a1c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 21 Mar 2005 16:50:10 +0000 Subject: GST_TAG_DATE takes a date in julian calendar days, not a year (partially fixes #170306) Original commit message from CVS: GST_TAG_DATE takes a date in julian calendar days, not a year (partially fixes #170306) --- gst-libs/gst/riff/riff-read.c | 53 +++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 14 deletions(-) (limited to 'gst-libs/gst/riff') diff --git a/gst-libs/gst/riff/riff-read.c b/gst-libs/gst/riff/riff-read.c index 21cdbbca..ebcc2080 100644 --- a/gst-libs/gst/riff/riff-read.c +++ b/gst-libs/gst/riff/riff-read.c @@ -933,20 +933,45 @@ gst_riff_read_info (GstRiffRead * riff) } if (name && name[0] != '\0') { - GValue src = { 0 } - , dest = { - 0}; - GType dest_type = gst_tag_get_type (type); - - have_tags = TRUE; - g_value_init (&src, G_TYPE_STRING); - g_value_set_string (&src, name); - g_value_init (&dest, dest_type); - g_value_transform (&src, &dest); - g_value_unset (&src); - gst_tag_list_add_values (taglist, GST_TAG_MERGE_APPEND, - type, &dest, NULL); - g_value_unset (&dest); + if (strcmp (type, GST_TAG_DATE) == 0) { + GDate *date; + guint y, d = 1, m = 1; + gchar *check = name; + + y = strtoul (check, &check, 10); + if (*check == '-') { + check++; + m = strtoul (check, &check, 10); + if (*check == '-') { + check++; + d = strtoul (check, &check, 10); + } + } + if (*check != '\0') + break; + if (y == 0) + break; + date = g_date_new_dmy (d, m, y); + y = g_date_get_julian (date); + g_date_free (date); + gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, type, y, NULL); + have_tags = TRUE; + } else { + GValue src = { 0, }; + GValue dest = { 0, }; + + GType dest_type = gst_tag_get_type (type); + + have_tags = TRUE; + g_value_init (&src, G_TYPE_STRING); + g_value_set_string (&src, name); + g_value_init (&dest, dest_type); + g_value_transform (&src, &dest); + g_value_unset (&src); + gst_tag_list_add_values (taglist, GST_TAG_MERGE_APPEND, + type, &dest, NULL); + g_value_unset (&dest); + } } g_free (name); } else { -- cgit v1.2.1