diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2005-03-21 16:50:10 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2005-03-21 16:50:10 +0000 |
commit | 5786a1b63cb44e357f30f73ec01b5924bc8a1c5d (patch) | |
tree | 754b797cf9c717fb204ca0cd81792290c57992ae /gst-libs/gst | |
parent | 91cd203946e822d1427a095f53cc7e4877f95a38 (diff) | |
download | gst-plugins-bad-5786a1b63cb44e357f30f73ec01b5924bc8a1c5d.tar.gz gst-plugins-bad-5786a1b63cb44e357f30f73ec01b5924bc8a1c5d.tar.bz2 gst-plugins-bad-5786a1b63cb44e357f30f73ec01b5924bc8a1c5d.zip |
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)
Diffstat (limited to 'gst-libs/gst')
-rw-r--r-- | gst-libs/gst/riff/riff-read.c | 53 |
1 files changed, 39 insertions, 14 deletions
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 { |