Add a new utility function for XmlNode
Add AddDescriptor function to add new descriptor nodes with schemeIdUri and value fields. Change-Id: I423e642939fdef99764a67da74d4efd4d32aefe8
This commit is contained in:
parent
796974d2a1
commit
15a4f0553c
|
@ -237,19 +237,24 @@ bool RepresentationBaseXmlNode::AddContentProtectionElements(
|
||||||
void RepresentationBaseXmlNode::AddSupplementalProperty(
|
void RepresentationBaseXmlNode::AddSupplementalProperty(
|
||||||
const std::string& scheme_id_uri,
|
const std::string& scheme_id_uri,
|
||||||
const std::string& value) {
|
const std::string& value) {
|
||||||
XmlNode supplemental_property("SupplementalProperty");
|
AddDescriptor("SupplementalProperty", scheme_id_uri, value);
|
||||||
supplemental_property.SetStringAttribute("schemeIdUri", scheme_id_uri);
|
|
||||||
supplemental_property.SetStringAttribute("value", value);
|
|
||||||
AddChild(supplemental_property.PassScopedPtr());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RepresentationBaseXmlNode::AddEssentialProperty(
|
void RepresentationBaseXmlNode::AddEssentialProperty(
|
||||||
const std::string& scheme_id_uri,
|
const std::string& scheme_id_uri,
|
||||||
const std::string& value) {
|
const std::string& value) {
|
||||||
XmlNode essential_property("EssentialProperty");
|
AddDescriptor("EssentialProperty", scheme_id_uri, value);
|
||||||
essential_property.SetStringAttribute("schemeIdUri", scheme_id_uri);
|
}
|
||||||
essential_property.SetStringAttribute("value", value);
|
|
||||||
AddChild(essential_property.PassScopedPtr());
|
bool RepresentationBaseXmlNode::AddDescriptor(
|
||||||
|
const std::string& descriptor_name,
|
||||||
|
const std::string& scheme_id_uri,
|
||||||
|
const std::string& value) {
|
||||||
|
XmlNode descriptor(descriptor_name.c_str());
|
||||||
|
descriptor.SetStringAttribute("schemeIdUri", scheme_id_uri);
|
||||||
|
if (!value.empty())
|
||||||
|
descriptor.SetStringAttribute("value", value);
|
||||||
|
return AddChild(descriptor.PassScopedPtr());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RepresentationBaseXmlNode::AddContentProtectionElement(
|
bool RepresentationBaseXmlNode::AddContentProtectionElement(
|
||||||
|
@ -289,19 +294,12 @@ AdaptationSetXmlNode::~AdaptationSetXmlNode() {}
|
||||||
void AdaptationSetXmlNode::AddAccessibilityElement(
|
void AdaptationSetXmlNode::AddAccessibilityElement(
|
||||||
const std::string& scheme_id_uri,
|
const std::string& scheme_id_uri,
|
||||||
const std::string& value) {
|
const std::string& value) {
|
||||||
XmlNode accessibility("Accessibility");
|
AddDescriptor("Accessibility", scheme_id_uri, value);
|
||||||
accessibility.SetStringAttribute("schemeIdUri", scheme_id_uri);
|
|
||||||
if (!value.empty())
|
|
||||||
accessibility.SetStringAttribute("value", value);
|
|
||||||
AddChild(accessibility.PassScopedPtr());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdaptationSetXmlNode::AddRoleElement(const std::string& scheme_id_uri,
|
void AdaptationSetXmlNode::AddRoleElement(const std::string& scheme_id_uri,
|
||||||
const std::string& value) {
|
const std::string& value) {
|
||||||
XmlNode role("Role");
|
AddDescriptor("Role", scheme_id_uri, value);
|
||||||
role.SetStringAttribute("schemeIdUri", scheme_id_uri);
|
|
||||||
role.SetStringAttribute("value", value);
|
|
||||||
AddChild(role.PassScopedPtr());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RepresentationXmlNode::RepresentationXmlNode()
|
RepresentationXmlNode::RepresentationXmlNode()
|
||||||
|
@ -461,12 +459,8 @@ bool RepresentationXmlNode::AddAudioChannelInfo(const AudioInfo& audio_info) {
|
||||||
"urn:mpeg:dash:23003:3:audio_channel_configuration:2011";
|
"urn:mpeg:dash:23003:3:audio_channel_configuration:2011";
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlNode audio_channel_config("AudioChannelConfiguration");
|
return AddDescriptor("AudioChannelConfiguration", audio_channel_config_scheme,
|
||||||
audio_channel_config.SetStringAttribute("schemeIdUri",
|
audio_channel_config_value);
|
||||||
audio_channel_config_scheme);
|
|
||||||
audio_channel_config.SetStringAttribute("value", audio_channel_config_value);
|
|
||||||
|
|
||||||
return AddChild(audio_channel_config.PassScopedPtr());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MPD expects one number for sampling frequency, or if it is a range it should
|
// MPD expects one number for sampling frequency, or if it is a range it should
|
||||||
|
|
|
@ -117,6 +117,14 @@ class RepresentationBaseXmlNode : public XmlNode {
|
||||||
protected:
|
protected:
|
||||||
explicit RepresentationBaseXmlNode(const char* name);
|
explicit RepresentationBaseXmlNode(const char* name);
|
||||||
|
|
||||||
|
/// Add a Descriptor.
|
||||||
|
/// @param descriptor_name is the name of the descriptor.
|
||||||
|
/// @param scheme_id_uri is content of the schemeIdUri attribute.
|
||||||
|
/// @param value is the content of value attribute.
|
||||||
|
bool AddDescriptor(const std::string& descriptor_name,
|
||||||
|
const std::string& scheme_id_uri,
|
||||||
|
const std::string& value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool AddContentProtectionElement(
|
bool AddContentProtectionElement(
|
||||||
const ContentProtectionElement& content_protection_element);
|
const ContentProtectionElement& content_protection_element);
|
||||||
|
|
Loading…
Reference in New Issue