From 0ccae0d0c92b1de011b3e2e869389932808e8f0f Mon Sep 17 00:00:00 2001 From: Rintaro Kuroiwa Date: Fri, 10 Jan 2014 15:53:20 -0800 Subject: [PATCH] Add namespace info to MPD Change-Id: Ie12ebb1fef24d60ff7b8644406931a2677d7033e --- mpd/base/mpd_builder.cc | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/mpd/base/mpd_builder.cc b/mpd/base/mpd_builder.cc index 6abdd45cc4..3e1e730579 100644 --- a/mpd/base/mpd_builder.cc +++ b/mpd/base/mpd_builder.cc @@ -17,6 +17,24 @@ using xml::XmlNode; using xml::RepresentationXmlNode; using xml::AdaptationSetXmlNode; +namespace { + +void AddMpdNameSpaceInfo(XmlNode* mpd) { + DCHECK(mpd); + + static const char kXmlNamespace[] = "urn:mpeg:DASH:schema:MPD:2011"; + mpd->SetStringAttribute("xmlns", kXmlNamespace); + static const char kXmlNamespaceXsi[] = "http://www.w3.org/2001/XMLSchema-instance"; + mpd->SetStringAttribute("xmlns:xsi", kXmlNamespaceXsi); + static const char kXmlNamespaceXlink[] = "http://www.w3.org/1999/xlink"; + mpd->SetStringAttribute("xmlns:xlink", kXmlNamespaceXlink); + static const char kDashSchemaMpd2011[] = + "urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd"; + mpd->SetStringAttribute("xsi:schemaLocation", kDashSchemaMpd2011); +} + +} // namespace + MpdBuilder::MpdBuilder(MpdType type) : type_(type), adaptation_sets_deleter_(&adaptation_sets_) {} @@ -81,13 +99,7 @@ xmlDocPtr MpdBuilder::GenerateMpd() { static const char kXmlVersion[] = "1.0"; xml::ScopedXmlPtr::type doc(xmlNewDoc(BAD_CAST kXmlVersion)); XmlNode mpd("MPD"); - - static const char kXmlSchema[] = "http://www.w3.org/2001/XMLSchema-instance"; - mpd.SetStringAttribute("xmlns:xsi", kXmlSchema); - - static const char kDashSchemaMpd2011[] = - "urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd"; - mpd.SetStringAttribute("xsi:schemaLocation", kDashSchemaMpd2011); + AddMpdNameSpaceInfo(&mpd); // Currently set to 2. Does this need calculation? const int kMinBufferTime = 2;