diff options
Diffstat (limited to 'gst-libs')
-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 { |