From 6940559c4688e57106f1c384a3320fb3329e88fc Mon Sep 17 00:00:00 2001 From: Pavel Kostyuchenko Date: Wed, 1 Sep 2010 11:11:34 +0200 Subject: [PATCH] matroskademux: Relax parsing of date tags Before we required a complete date in matroskademux but in id3demux for example only the year or year and month was possible too. Fixes bug #628454. --- gst/matroska/matroska-demux.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index b607df678e..924780518c 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -3614,6 +3614,18 @@ gst_matroska_demux_parse_metadata_id_simple_tag (GstMatroskaDemux * demux, GValue dest = { 0, }; GType dest_type = gst_tag_get_type (tagname_gst); + /* Ensure that any date string is complete */ + if (dest_type == GST_TYPE_DATE) { + guint year = 1901, month = 1, day = 1; + + /* Dates can be yyyy-MM-dd, yyyy-MM or yyyy, but we need + * the first type */ + if (sscanf (value, "%04u-%02u-%02u", &year, &month, &day) != 0) { + g_free (value); + value = g_strdup_printf ("%04u-%02u-%02u", year, month, day); + } + } + g_value_init (&dest, dest_type); if (gst_value_deserialize (&dest, value)) { gst_tag_list_add_values (*p_taglist, GST_TAG_MERGE_APPEND,