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.
This commit is contained in:
Pavel Kostyuchenko 2010-09-01 11:11:34 +02:00 committed by Sebastian Dröge
parent e9a30e454a
commit 6940559c46

View file

@ -3614,6 +3614,18 @@ gst_matroska_demux_parse_metadata_id_simple_tag (GstMatroskaDemux * demux,
GValue dest = { 0, }; GValue dest = { 0, };
GType dest_type = gst_tag_get_type (tagname_gst); 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); g_value_init (&dest, dest_type);
if (gst_value_deserialize (&dest, value)) { if (gst_value_deserialize (&dest, value)) {
gst_tag_list_add_values (*p_taglist, GST_TAG_MERGE_APPEND, gst_tag_list_add_values (*p_taglist, GST_TAG_MERGE_APPEND,