From aa7a3cb24f33d580cab067a81c505c9ff0d3fd72 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Fri, 22 Apr 2016 17:04:57 -0300 Subject: [PATCH] dash: strip lead/trailing whitespace from descriptortype attributes The spec says it is xs:anyURI and leading and trailing whitespace are to be ignored https://bugzilla.gnome.org/show_bug.cgi?id=758064 --- ext/dash/gstmpdparser.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index 3f34aeea3b..dd83165917 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -38,6 +38,8 @@ static gboolean gst_mpdparser_get_xml_prop_validated_string (xmlNode * a_node, gboolean (*validator) (const char *)); static gboolean gst_mpdparser_get_xml_prop_string (xmlNode * a_node, const gchar * property_name, gchar ** property_value); +static gboolean gst_mpdparser_get_xml_prop_string_stripped (xmlNode * a_node, + const gchar * property_name, gchar ** property_value); static gboolean gst_mpdparser_get_xml_ns_prop_string (xmlNode * a_node, const gchar * ns_name, const gchar * property_name, gchar ** property_value); @@ -310,6 +312,18 @@ gst_mpdparser_get_xml_prop_string (xmlNode * a_node, property_value, NULL); } +static gboolean +gst_mpdparser_get_xml_prop_string_stripped (xmlNode * a_node, + const gchar * property_name, gchar ** property_value) +{ + gboolean ret; + ret = + gst_mpdparser_get_xml_prop_string (a_node, property_name, property_value); + if (ret) + *property_value = g_strstrip (*property_value); + return ret; +} + static gboolean gst_mpdparser_validate_no_whitespace (const char *s) { @@ -1291,7 +1305,7 @@ gst_mpdparser_parse_descriptor_type_node (GList ** list, xmlNode * a_node) *list = g_list_append (*list, new_descriptor); GST_LOG ("attributes of %s node:", a_node->name); - gst_mpdparser_get_xml_prop_string (a_node, "schemeIdUri", + gst_mpdparser_get_xml_prop_string_stripped (a_node, "schemeIdUri", &new_descriptor->schemeIdUri); if (!gst_mpdparser_get_xml_prop_string (a_node, "value", &new_descriptor->value)) {