import shutil
def dependencies(target, options):
- return (('libcxml', 'v0.17.6'), ('openjpeg', 'ad8edaacd54a862940d0a77c41ecda5858b54d6e'), ('asdcplib', '8a4a2f25cac0c58aac1d4267facab20e5ec3b57f'))
+ return (
+ ('libcxml', 'v0.17.8', options),
+ ('openjpeg', 'ad8edaacd54a862940d0a77c41ecda5858b54d6e'),
+ ('asdcplib', '8a4a2f25cac0c58aac1d4267facab20e5ec3b57f')
+ )
def build(target, options):
cmd = './waf configure --disable-examples --disable-dumpimage --disable-benchmarks --prefix=%s' % target.directory
DCP_ASSERT (false);
}
- root->add_child("Id")->add_child_text("urn:uuid:" + _id);
+ cxml::add_text_child(root, "Id", "urn:uuid:" + _id);
if (_annotation_text) {
- root->add_child("AnnotationText")->add_child_text(*_annotation_text);
+ cxml::add_text_child(root, "AnnotationText", *_annotation_text);
}
switch (_standard) {
case Standard::INTEROP:
- root->add_child("VolumeCount")->add_child_text("1");
- root->add_child("IssueDate")->add_child_text(_issue_date);
- root->add_child("Issuer")->add_child_text(_issuer);
- root->add_child("Creator")->add_child_text(_creator);
+ cxml::add_text_child(root, "VolumeCount", "1");
+ cxml::add_text_child(root, "IssueDate", _issue_date);
+ cxml::add_text_child(root, "Issuer", _issuer);
+ cxml::add_text_child(root, "Creator", _creator);
break;
case Standard::SMPTE:
- root->add_child("Creator")->add_child_text(_creator);
- root->add_child("VolumeCount")->add_child_text("1");
- root->add_child("IssueDate")->add_child_text(_issue_date);
- root->add_child("Issuer")->add_child_text(_issuer);
+ cxml::add_text_child(root, "Creator", _creator);
+ cxml::add_text_child(root, "VolumeCount", "1");
+ cxml::add_text_child(root, "IssueDate", _issue_date);
+ cxml::add_text_child(root, "Issuer", _issuer);
break;
default:
DCP_ASSERT (false);
}
- auto asset_list = root->add_child("AssetList");
+ auto asset_list = cxml::add_child(root, "AssetList");
for (auto const& asset: _assets) {
asset.write_xml(asset_list, file.parent_path());
}
void
AssetMap::Asset::write_xml(xmlpp::Element* asset_list, boost::filesystem::path dcp_root_directory) const
{
- auto node = asset_list->add_child("Asset");
- node->add_child("Id")->add_child_text("urn:uuid:" + _id);
+ auto node = cxml::add_child(asset_list, "Asset");
+ cxml::add_text_child(node, "Id", "urn:uuid:" + _id);
if (_pkl) {
- node->add_child("PackingList")->add_child_text("true");
+ cxml::add_text_child(node, "PackingList", "true");
}
- auto chunk_list = node->add_child("ChunkList");
- auto chunk = chunk_list->add_child("Chunk");
+ auto chunk_list = cxml::add_child(node, "ChunkList");
+ auto chunk = cxml::add_child(chunk_list, "Chunk");
auto relative_path = relative_to_root(filesystem::canonical(dcp_root_directory), filesystem::canonical(_path));
DCP_ASSERT(relative_path);
- chunk->add_child("Path")->add_child_text(relative_path->generic_string());
- chunk->add_child("VolumeIndex")->add_child_text("1");
- chunk->add_child("Offset")->add_child_text("0");
- chunk->add_child("Length")->add_child_text(raw_convert<string>(filesystem::file_size(_path)));
+ cxml::add_text_child(chunk, "Path", relative_path->generic_string());
+ cxml::add_text_child(chunk, "VolumeIndex", "1");
+ cxml::add_text_child(chunk, "Offset", "0");
+ cxml::add_text_child(chunk, "Length", raw_convert<string>(filesystem::file_size(_path)));
}
/* <Signer> */
parent->add_child_text(" ");
- auto signer = parent->add_child("Signer");
+ auto signer = cxml::add_child(parent, "Signer");
signer->set_namespace_declaration ("http://www.w3.org/2000/09/xmldsig#", "dsig");
- auto data = signer->add_child("X509Data", "dsig");
- auto serial_element = data->add_child("X509IssuerSerial", "dsig");
- serial_element->add_child("X509IssuerName", "dsig")->add_child_text (leaf().issuer());
- serial_element->add_child("X509SerialNumber", "dsig")->add_child_text (leaf().serial());
- data->add_child("X509SubjectName", "dsig")->add_child_text (leaf().subject());
+ auto data = cxml::add_child(signer, "X509Data", string("dsig"));
+ auto serial_element = cxml::add_child(data, "X509IssuerSerial", string("dsig"));
+ cxml::add_child(serial_element, "X509IssuerName", string("dsig"))->add_child_text(leaf().issuer());
+ cxml::add_child(serial_element, "X509SerialNumber", string("dsig"))->add_child_text(leaf().serial());
+ cxml::add_child(data, "X509SubjectName", string("dsig"))->add_child_text(leaf().subject());
indent (signer, 2);
/* <Signature> */
parent->add_child_text("\n ");
- auto signature = parent->add_child("Signature");
+ auto signature = cxml::add_child(parent, "Signature");
signature->set_namespace_declaration ("http://www.w3.org/2000/09/xmldsig#", "dsig");
signature->set_namespace ("dsig");
parent->add_child_text("\n");
- auto signed_info = signature->add_child ("SignedInfo", "dsig");
- signed_info->add_child("CanonicalizationMethod", "dsig")->set_attribute ("Algorithm", "http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
+ auto signed_info = cxml::add_child(signature, "SignedInfo", string("dsig"));
+ cxml::add_child(signed_info, "CanonicalizationMethod", string("dsig"))->set_attribute("Algorithm", "http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
if (standard == Standard::INTEROP) {
- signed_info->add_child("SignatureMethod", "dsig")->set_attribute("Algorithm", "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
+ cxml::add_child(signed_info, "SignatureMethod", string("dsig"))->set_attribute("Algorithm", "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
} else {
- signed_info->add_child("SignatureMethod", "dsig")->set_attribute("Algorithm", "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
+ cxml::add_child(signed_info, "SignatureMethod", string("dsig"))->set_attribute("Algorithm", "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
}
- auto reference = signed_info->add_child("Reference", "dsig");
+ auto reference = cxml::add_child(signed_info, "Reference", string("dsig"));
reference->set_attribute ("URI", "");
- auto transforms = reference->add_child("Transforms", "dsig");
- transforms->add_child("Transform", "dsig")->set_attribute (
+ auto transforms = cxml::add_child(reference, "Transforms", string("dsig"));
+ cxml::add_child(transforms, "Transform", string("dsig"))->set_attribute(
"Algorithm", "http://www.w3.org/2000/09/xmldsig#enveloped-signature"
);
- reference->add_child("DigestMethod", "dsig")->set_attribute("Algorithm", "http://www.w3.org/2000/09/xmldsig#sha1");
+ cxml::add_child(reference, "DigestMethod", string("dsig"))->set_attribute("Algorithm", "http://www.w3.org/2000/09/xmldsig#sha1");
/* This will be filled in by the signing later */
- reference->add_child("DigestValue", "dsig");
+ cxml::add_child(reference, "DigestValue", string("dsig"));
- signature->add_child("SignatureValue", "dsig");
- signature->add_child("KeyInfo", "dsig");
+ cxml::add_child(signature, "SignatureValue", string("dsig"));
+ cxml::add_child(signature, "KeyInfo", string("dsig"));
add_signature_value (signature, "dsig", true);
}
CertificateChain::add_signature_value (xmlpp::Element* parent, string ns, bool add_indentation) const
{
cxml::Node cp (parent);
- auto key_info = cp.node_child("KeyInfo")->node();
+ auto key_info = dynamic_cast<xmlpp::Element*>(cp.node_child("KeyInfo")->node());
+ DCP_ASSERT(key_info);
/* Add the certificate chain to the KeyInfo child node of parent */
for (auto const& i: leaf_to_root()) {
- auto data = key_info->add_child("X509Data", ns);
+ auto data = cxml::add_child(key_info, "X509Data", ns);
{
- auto serial = data->add_child("X509IssuerSerial", ns);
- serial->add_child("X509IssuerName", ns)->add_child_text (i.issuer ());
- serial->add_child("X509SerialNumber", ns)->add_child_text (i.serial ());
+ auto serial = cxml::add_child(data, "X509IssuerSerial", ns);
+ cxml::add_child(serial, "X509IssuerName", ns)->add_child_text(i.issuer());
+ cxml::add_child(serial, "X509SerialNumber", ns)->add_child_text(i.serial());
}
- data->add_child("X509Certificate", ns)->add_child_text (i.certificate());
+ cxml::add_child(data, "X509Certificate", ns)->add_child_text(i.certificate());
}
auto signature_context = xmlSecDSigCtxCreate (0);
root = doc.create_root_node ("CompositionPlaylist", cpl_smpte_ns);
}
- root->add_child("Id")->add_child_text ("urn:uuid:" + _id);
+ cxml::add_text_child(root, "Id", "urn:uuid:" + _id);
if (_annotation_text) {
- root->add_child("AnnotationText")->add_child_text (*_annotation_text);
+ cxml::add_text_child(root, "AnnotationText", *_annotation_text);
}
- root->add_child("IssueDate")->add_child_text (_issue_date);
- root->add_child("Issuer")->add_child_text (_issuer);
- root->add_child("Creator")->add_child_text (_creator);
- root->add_child("ContentTitleText")->add_child_text (_content_title_text);
- auto content_kind = root->add_child("ContentKind");
+ cxml::add_text_child(root, "IssueDate", _issue_date);
+ cxml::add_text_child(root, "Issuer", _issuer);
+ cxml::add_text_child(root, "Creator", _creator);
+ cxml::add_text_child(root, "ContentTitleText", _content_title_text);
+ auto content_kind = cxml::add_child(root, "ContentKind");
content_kind->add_child_text(_content_kind.name());
if (_content_kind.scope()) {
content_kind->set_attribute("scope", *_content_kind.scope());
_content_versions[0].as_xml (root);
}
- auto rating_list = root->add_child("RatingList");
+ auto rating_list = cxml::add_child(root, "RatingList");
for (auto i: _ratings) {
- i.as_xml (rating_list->add_child("Rating"));
+ i.as_xml(cxml::add_child(rating_list, "Rating"));
}
- auto reel_list = root->add_child ("ReelList");
+ auto reel_list = cxml::add_child(root, "ReelList");
if (_reels.empty()) {
throw NoReelsError ();
reinterpret_cast<ASDCP::MXF::InterchangeObject**>(&soundfield)
);
if (KM_SUCCESS(r)) {
- auto mca_subs = parent->add_child("mca:MCASubDescriptors");
+ auto mca_subs = cxml::add_child(parent, "mca:MCASubDescriptors");
mca_subs->set_namespace_declaration (mca_sub_descriptors_ns, "mca");
mca_subs->set_namespace_declaration (smpte_395_ns, "r0");
mca_subs->set_namespace_declaration (smpte_335_ns, "r1");
- auto sf = mca_subs->add_child("SoundfieldGroupLabelSubDescriptor", "r0");
+ auto sf = cxml::add_child(mca_subs, "SoundfieldGroupLabelSubDescriptor", string("r0"));
char buffer[64];
soundfield->InstanceUID.EncodeString(buffer, sizeof(buffer));
- sf->add_child("InstanceID", "r1")->add_child_text("urn:uuid:" + string(buffer));
+ cxml::add_child(sf, "InstanceID", string("r1"))->add_child_text("urn:uuid:" + string(buffer));
soundfield->MCALabelDictionaryID.EncodeString(buffer, sizeof(buffer));
- sf->add_child("MCALabelDictionaryID", "r1")->add_child_text("urn:smpte:ul:" + string(buffer));
+ cxml::add_child(sf, "MCALabelDictionaryID", string("r1"))->add_child_text("urn:smpte:ul:" + string(buffer));
soundfield->MCALinkID.EncodeString(buffer, sizeof(buffer));
- sf->add_child("MCALinkID", "r1")->add_child_text("urn:uuid:" + string(buffer));
+ cxml::add_child(sf, "MCALinkID", string("r1"))->add_child_text("urn:uuid:" + string(buffer));
soundfield->MCATagSymbol.EncodeString(buffer, sizeof(buffer));
- sf->add_child("MCATagSymbol", "r1")->add_child_text(buffer);
+ cxml::add_child(sf, "MCATagSymbol", string("r1"))->add_child_text(buffer);
if (!soundfield->MCATagName.empty()) {
soundfield->MCATagName.get().EncodeString(buffer, sizeof(buffer));
- sf->add_child("MCATagName", "r1")->add_child_text(buffer);
+ cxml::add_child(sf, "MCATagName", string("r1"))->add_child_text(buffer);
}
if (!soundfield->RFC5646SpokenLanguage.empty()) {
soundfield->RFC5646SpokenLanguage.get().EncodeString(buffer, sizeof(buffer));
- sf->add_child("RFC5646SpokenLanguage", "r1")->add_child_text(buffer);
+ cxml::add_child(sf, "RFC5646SpokenLanguage", string("r1"))->add_child_text(buffer);
}
/* Find the MCA subdescriptors in the MXF so that we can also write them here */
for (auto i: channels) {
auto channel = reinterpret_cast<ASDCP::MXF::AudioChannelLabelSubDescriptor*>(i);
- auto ch = mca_subs->add_child("AudioChannelLabelSubDescriptor", "r0");
+ auto ch = cxml::add_child(mca_subs, "AudioChannelLabelSubDescriptor", string("r0"));
channel->InstanceUID.EncodeString(buffer, sizeof(buffer));
- ch->add_child("InstanceID", "r1")->add_child_text("urn:uuid:" + string(buffer));
+ cxml::add_child(ch, "InstanceID", string("r1"))->add_child_text("urn:uuid:" + string(buffer));
channel->MCALabelDictionaryID.EncodeString(buffer, sizeof(buffer));
- ch->add_child("MCALabelDictionaryID", "r1")->add_child_text("urn:smpte:ul:" + string(buffer));
+ cxml::add_child(ch, "MCALabelDictionaryID", string("r1"))->add_child_text("urn:smpte:ul:" + string(buffer));
channel->MCALinkID.EncodeString(buffer, sizeof(buffer));
- ch->add_child("MCALinkID", "r1")->add_child_text("urn:uuid:" + string(buffer));
+ cxml::add_child(ch, "MCALinkID", string("r1"))->add_child_text("urn:uuid:" + string(buffer));
channel->MCATagSymbol.EncodeString(buffer, sizeof(buffer));
- ch->add_child("MCATagSymbol", "r1")->add_child_text(buffer);
+ cxml::add_child(ch, "MCATagSymbol", string("r1"))->add_child_text(buffer);
if (!channel->MCATagName.empty()) {
channel->MCATagName.get().EncodeString(buffer, sizeof(buffer));
- ch->add_child("MCATagName", "r1")->add_child_text(buffer);
+ cxml::add_child(ch, "MCATagName", string("r1"))->add_child_text(buffer);
}
if (!channel->MCAChannelID.empty()) {
- ch->add_child("MCAChannelID", "r1")->add_child_text(raw_convert<string>(channel->MCAChannelID.get()));
+ cxml::add_child(ch, "MCAChannelID", string("r1"))->add_child_text(raw_convert<string>(channel->MCAChannelID.get()));
}
if (!channel->RFC5646SpokenLanguage.empty()) {
channel->RFC5646SpokenLanguage.get().EncodeString(buffer, sizeof(buffer));
- ch->add_child("RFC5646SpokenLanguage", "r1")->add_child_text(buffer);
+ cxml::add_child(ch, "RFC5646SpokenLanguage", string("r1"))->add_child_text(buffer);
}
if (!channel->SoundfieldGroupLinkID.empty()) {
channel->SoundfieldGroupLinkID.get().EncodeString(buffer, sizeof(buffer));
- ch->add_child("SoundfieldGroupLinkID", "r1")->add_child_text("urn:uuid:" + string(buffer));
+ cxml::add_child(ch, "SoundfieldGroupLinkID", string("r1"))->add_child_text("urn:uuid:" + string(buffer));
}
}
}
return;
}
- auto meta = node->add_child("meta:CompositionMetadataAsset");
+ auto meta = cxml::add_child(node, "meta:CompositionMetadataAsset");
meta->set_namespace_declaration (cpl_metadata_ns, "meta");
- meta->add_child("Id")->add_child_text("urn:uuid:" + _cpl_metadata_id);
+ cxml::add_text_child(meta, "Id", "urn:uuid:" + _cpl_metadata_id);
auto mp = _reels.front()->main_picture();
- meta->add_child("EditRate")->add_child_text(mp->edit_rate().as_string());
- meta->add_child("IntrinsicDuration")->add_child_text(raw_convert<string>(mp->intrinsic_duration()));
+ cxml::add_text_child(meta, "EditRate", mp->edit_rate().as_string());
+ cxml::add_text_child(meta, "IntrinsicDuration", raw_convert<string>(mp->intrinsic_duration()));
- auto fctt = meta->add_child("FullContentTitleText", "meta");
+ auto fctt = cxml::add_child(meta, "FullContentTitleText", string("meta"));
if (_full_content_title_text && !_full_content_title_text->empty()) {
fctt->add_child_text (*_full_content_title_text);
}
}
if (_release_territory) {
- meta->add_child("ReleaseTerritory", "meta")->add_child_text(*_release_territory);
+ cxml::add_child(meta, "ReleaseTerritory", string("meta"))->add_child_text(*_release_territory);
}
if (_version_number) {
- xmlpp::Element* vn = meta->add_child("VersionNumber", "meta");
+ auto vn = cxml::add_child(meta, "VersionNumber", string("meta"));
vn->add_child_text(raw_convert<string>(*_version_number));
if (_status) {
vn->set_attribute("status", status_to_string(*_status));
}
if (_chain) {
- meta->add_child("Chain", "meta")->add_child_text(*_chain);
+ cxml::add_child(meta, "Chain", string("meta"))->add_child_text(*_chain);
}
if (_distributor) {
- meta->add_child("Distributor", "meta")->add_child_text(*_distributor);
+ cxml::add_child(meta, "Distributor", string("meta"))->add_child_text(*_distributor);
}
if (_facility) {
- meta->add_child("Facility", "meta")->add_child_text(*_facility);
+ cxml::add_child(meta, "Facility", string("meta"))->add_child_text(*_facility);
}
if (_content_versions.size() > 1) {
- xmlpp::Element* vc = meta->add_child("AlternateContentVersionList", "meta");
+ auto vc = cxml::add_child(meta, "AlternateContentVersionList", string("meta"));
for (size_t i = 1; i < _content_versions.size(); ++i) {
_content_versions[i].as_xml (vc);
}
}
if (_main_sound_configuration) {
- meta->add_child("MainSoundConfiguration", "meta")->add_child_text(_main_sound_configuration->to_string());
+ cxml::add_child(meta, "MainSoundConfiguration", string("meta"))->add_child_text(_main_sound_configuration->to_string());
}
- meta->add_child("MainSoundSampleRate", "meta")->add_child_text(raw_convert<string>(*_main_sound_sample_rate) + " 1");
+ cxml::add_child(meta, "MainSoundSampleRate", string("meta"))->add_child_text(raw_convert<string>(*_main_sound_sample_rate) + " 1");
- auto stored = meta->add_child("MainPictureStoredArea", "meta");
- stored->add_child("Width", "meta")->add_child_text(raw_convert<string>(_main_picture_stored_area->width));
- stored->add_child("Height", "meta")->add_child_text(raw_convert<string>(_main_picture_stored_area->height));
+ auto stored = cxml::add_child(meta, "MainPictureStoredArea", string("meta"));
+ cxml::add_child(stored, "Width", string("meta"))->add_child_text(raw_convert<string>(_main_picture_stored_area->width));
+ cxml::add_child(stored, "Height", string("meta"))->add_child_text(raw_convert<string>(_main_picture_stored_area->height));
- auto active = meta->add_child("MainPictureActiveArea", "meta");
- active->add_child("Width", "meta")->add_child_text(raw_convert<string>(_main_picture_active_area->width));
- active->add_child("Height", "meta")->add_child_text(raw_convert<string>(_main_picture_active_area->height));
+ auto active = cxml::add_child(meta, "MainPictureActiveArea", string("meta"));
+ cxml::add_child(active, "Width", string("meta"))->add_child_text(raw_convert<string>(_main_picture_active_area->width));
+ cxml::add_child(active, "Height", string("meta"))->add_child_text(raw_convert<string>(_main_picture_active_area->height));
optional<string> first_subtitle_language;
for (auto i: _reels) {
}
lang += i;
}
- meta->add_child("MainSubtitleLanguageList", "meta")->add_child_text(lang);
+ cxml::add_child(meta, "MainSubtitleLanguageList", string("meta"))->add_child_text(lang);
}
- auto metadata_list = meta->add_child("ExtensionMetadataList", "meta");
+ auto metadata_list = cxml::add_child(meta, "ExtensionMetadataList", string("meta"));
auto add_extension_metadata = [metadata_list](string scope, string name, string property_name, string property_value) {
- auto extension = metadata_list->add_child("ExtensionMetadata", "meta");
+ auto extension = cxml::add_child(metadata_list, "ExtensionMetadata", string("meta"));
extension->set_attribute("scope", scope);
- extension->add_child("Name", "meta")->add_child_text(name);
- auto property = extension->add_child("PropertyList", "meta")->add_child("Property", "meta");
- property->add_child("Name", "meta")->add_child_text(property_name);
- property->add_child("Value", "meta")->add_child_text(property_value);
+ cxml::add_child(extension, "Name", string("meta"))->add_child_text(name);
+ auto property = cxml::add_child(cxml::add_child(extension, "PropertyList", string("meta")), "Property", string("meta"));
+ cxml::add_child(property, "Name", string("meta"))->add_child_text(property_name);
+ cxml::add_child(property, "Value", string("meta"))->add_child_text(property_value);
};
/* SMPTE Bv2.1 8.6.3 */
DCP_ASSERT (false);
}
- root->add_child("Index")->add_child_text ("1");
+ cxml::add_text_child(root, "Index", "1");
doc.write_to_file_formatted(dcp::filesystem::fix_long_path(p).string(), "UTF-8");
}
void as_xml (xmlpp::Element* node) const
{
- node->add_child("X509IssuerName", "ds")->add_child_text (x509_issuer_name);
- node->add_child("X509SerialNumber", "ds")->add_child_text (x509_serial_number);
+ cxml::add_child(node, "X509IssuerName", string("ds"))->add_child_text(x509_issuer_name);
+ cxml::add_child(node, "X509SerialNumber", string("ds"))->add_child_text(x509_serial_number);
}
string x509_issuer_name;
void as_xml (xmlpp::Element* node) const
{
- x509_issuer_serial.as_xml (node->add_child ("X509IssuerSerial", "ds"));
- node->add_child("X509Certificate", "ds")->add_child_text (x509_certificate);
+ x509_issuer_serial.as_xml(cxml::add_child(node, "X509IssuerSerial", string("ds")));
+ cxml::add_child(node, "X509Certificate", string("ds"))->add_child_text(x509_certificate);
}
Signer x509_issuer_serial;
void as_xml (xmlpp::Element* node) const
{
node->set_attribute ("URI", uri);
- node->add_child("DigestMethod", "ds")->set_attribute ("Algorithm", "http://www.w3.org/2001/04/xmlenc#sha256");
- node->add_child("DigestValue", "ds")->add_child_text (digest_value);
+ cxml::add_child(node, "DigestMethod", string("ds"))->set_attribute("Algorithm", "http://www.w3.org/2001/04/xmlenc#sha256");
+ cxml::add_child(node, "DigestValue", string("ds"))->add_child_text(digest_value);
}
string uri;
void as_xml (xmlpp::Element* node) const
{
- node->add_child ("CanonicalizationMethod", "ds")->set_attribute (
+ cxml::add_child(node, "CanonicalizationMethod", string("ds"))->set_attribute(
"Algorithm", "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"
);
- node->add_child ("SignatureMethod", "ds")->set_attribute (
+ cxml::add_child(node, "SignatureMethod", string("ds"))->set_attribute(
"Algorithm", "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
);
- authenticated_public.as_xml (node->add_child ("Reference", "ds"));
- authenticated_private.as_xml (node->add_child ("Reference", "ds"));
+ authenticated_public.as_xml(cxml::add_child(node, "Reference", string("ds")));
+ authenticated_private.as_xml(cxml::add_child(node, "Reference", string("ds")));
}
private:
}
}
- void as_xml (xmlpp::Node* node) const
+ void as_xml(xmlpp::Element* element) const
{
- signed_info.as_xml (node->add_child ("SignedInfo", "ds"));
- node->add_child("SignatureValue", "ds")->add_child_text (signature_value);
+ signed_info.as_xml(cxml::add_child(element, "SignedInfo", string("ds")));
+ cxml::add_child(element, "SignatureValue", string("ds"))->add_child_text(signature_value);
- auto key_info_node = node->add_child("KeyInfo", "ds");
+ auto key_info_node = cxml::add_child(element, "KeyInfo", string("ds"));
for (auto i: x509_data) {
- i.as_xml (key_info_node->add_child("X509Data", "ds"));
+ i.as_xml(cxml::add_child(key_info_node, "X509Data", string("ds")));
}
}
references["ID_AuthenticatedPrivate"] = node->set_attribute ("Id", "ID_AuthenticatedPrivate");
for (auto i: encrypted_key) {
- auto encrypted_key = node->add_child ("EncryptedKey", "enc");
+ auto encrypted_key = cxml::add_child(node, "EncryptedKey", string("enc"));
/* XXX: hack for testing with Dolby */
encrypted_key->set_namespace_declaration ("http://www.w3.org/2001/04/xmlenc#", "enc");
- auto encryption_method = encrypted_key->add_child("EncryptionMethod", "enc");
+ auto encryption_method = cxml::add_child(encrypted_key, "EncryptionMethod", string("enc"));
encryption_method->set_attribute ("Algorithm", "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p");
- auto digest_method = encryption_method->add_child ("DigestMethod", "ds");
+ auto digest_method = cxml::add_child(encryption_method, "DigestMethod", string("ds"));
/* XXX: hack for testing with Dolby */
digest_method->set_namespace_declaration ("http://www.w3.org/2000/09/xmldsig#", "ds");
digest_method->set_attribute ("Algorithm", "http://www.w3.org/2000/09/xmldsig#sha1");
- auto cipher_data = encrypted_key->add_child("CipherData", "enc");
- cipher_data->add_child("CipherValue", "enc")->add_child_text (i);
+ auto cipher_data = cxml::add_child(encrypted_key, "CipherData", string("enc"));
+ cxml::add_child(cipher_data, "CipherValue", string("enc"))->add_child_text(i);
}
}
void as_xml (xmlpp::Element* node) const
{
- auto type = node->add_child("KeyType");
+ auto type = cxml::add_child(node, "KeyType");
type->add_child_text (key_type);
- node->add_child("KeyId")->add_child_text ("urn:uuid:" + key_id);
+ cxml::add_text_child(node, "KeyId", "urn:uuid:" + key_id);
/* XXX: this feels like a bit of a hack */
if (key_type == "MDEK") {
type->set_attribute ("scope", "http://www.dolby.com/cp850/2012/KDM#kdm-key-type");
void as_xml (xmlpp::Element* node) const
{
for (auto const& i: typed_key_id) {
- i.as_xml (node->add_child("TypedKeyId"));
+ i.as_xml(cxml::add_child(node, ("TypedKeyId")));
}
}
void as_xml (xmlpp::Element* node) const
{
- node->add_child ("DeviceListIdentifier")->add_child_text ("urn:uuid:" + device_list_identifier);
+ cxml::add_text_child(node, "DeviceListIdentifier", "urn:uuid:" + device_list_identifier);
if (device_list_description) {
- node->add_child ("DeviceListDescription")->add_child_text (device_list_description.get());
+ cxml::add_text_child(node, "DeviceListDescription", device_list_description.get());
}
- auto device_list = node->add_child ("DeviceList");
+ auto device_list = cxml::add_child(node, "DeviceList");
for (auto i: certificate_thumbprints) {
- device_list->add_child("CertificateThumbprint")->add_child_text (i);
+ cxml::add_text_child(device_list, "CertificateThumbprint", i);
}
}
void as_xml (xmlpp::Element* node) const
{
- node->add_child("X509IssuerName", "ds")->add_child_text (x509_issuer_name);
- node->add_child("X509SerialNumber", "ds")->add_child_text (x509_serial_number);
+ cxml::add_child(node, "X509IssuerName", string("ds"))->add_child_text(x509_issuer_name);
+ cxml::add_child(node, "X509SerialNumber", string("ds"))->add_child_text(x509_serial_number);
}
string x509_issuer_name;
void as_xml (xmlpp::Element* node) const
{
- x509_issuer_serial.as_xml (node->add_child ("X509IssuerSerial"));
- node->add_child("X509SubjectName")->add_child_text (x509_subject_name);
+ x509_issuer_serial.as_xml(cxml::add_child(node, "X509IssuerSerial"));
+ cxml::add_text_child(node, "X509SubjectName", x509_subject_name);
}
X509IssuerSerial x509_issuer_serial;
{
node->set_attribute ("xmlns", "http://www.smpte-ra.org/schemas/430-1/2006/KDM");
- recipient.as_xml (node->add_child ("Recipient"));
- node->add_child("CompositionPlaylistId")->add_child_text ("urn:uuid:" + composition_playlist_id);
- node->add_child("ContentTitleText")->add_child_text (content_title_text);
+ recipient.as_xml(cxml::add_child(node, "Recipient"));
+ cxml::add_text_child(node, "CompositionPlaylistId", "urn:uuid:" + composition_playlist_id);
+ cxml::add_text_child(node, "ContentTitleText", content_title_text);
if (content_authenticator) {
- node->add_child("ContentAuthenticator")->add_child_text (content_authenticator.get ());
+ cxml::add_text_child(node, "ContentAuthenticator", content_authenticator.get());
}
- node->add_child("ContentKeysNotValidBefore")->add_child_text (not_valid_before.as_string ());
- node->add_child("ContentKeysNotValidAfter")->add_child_text (not_valid_after.as_string ());
+ cxml::add_text_child(node, "ContentKeysNotValidBefore", not_valid_before.as_string());
+ cxml::add_text_child(node, "ContentKeysNotValidAfter", not_valid_after.as_string());
if (authorized_device_info) {
- authorized_device_info->as_xml (node->add_child ("AuthorizedDeviceInfo"));
+ authorized_device_info->as_xml(cxml::add_child(node, "AuthorizedDeviceInfo"));
}
- key_id_list.as_xml (node->add_child ("KeyIdList"));
+ key_id_list.as_xml(cxml::add_child(node, "KeyIdList"));
if (disable_forensic_marking_picture || disable_forensic_marking_audio) {
- auto forensic_mark_flag_list = node->add_child ("ForensicMarkFlagList");
+ auto forensic_mark_flag_list = cxml::add_child(node, "ForensicMarkFlagList");
if (disable_forensic_marking_picture) {
- forensic_mark_flag_list->add_child("ForensicMarkFlag")->add_child_text(picture_disable);
+ cxml::add_text_child(forensic_mark_flag_list, "ForensicMarkFlag", picture_disable);
}
if (disable_forensic_marking_audio) {
auto mrkflg = audio_disable;
if (*disable_forensic_marking_audio > 0) {
mrkflg += String::compose ("-above-channel-%1", *disable_forensic_marking_audio);
}
- forensic_mark_flag_list->add_child("ForensicMarkFlag")->add_child_text (mrkflg);
+ cxml::add_text_child(forensic_mark_flag_list, "ForensicMarkFlag", mrkflg);
}
}
}
void as_xml (xmlpp::Element* node) const
{
- kdm_required_extensions.as_xml (node->add_child ("KDMRequiredExtensions"));
+ kdm_required_extensions.as_xml(cxml::add_child(node, "KDMRequiredExtensions"));
}
KDMRequiredExtensions kdm_required_extensions;
{
references["ID_AuthenticatedPublic"] = node->set_attribute ("Id", "ID_AuthenticatedPublic");
- node->add_child("MessageId")->add_child_text ("urn:uuid:" + message_id);
- node->add_child("MessageType")->add_child_text ("http://www.smpte-ra.org/430-1/2006/KDM#kdm-key-type");
+ cxml::add_text_child(node, "MessageId", "urn:uuid:" + message_id);
+ cxml::add_text_child(node, "MessageType", "http://www.smpte-ra.org/430-1/2006/KDM#kdm-key-type");
if (annotation_text) {
- node->add_child("AnnotationText")->add_child_text (annotation_text.get ());
+ cxml::add_text_child(node, "AnnotationText", annotation_text.get());
}
- node->add_child("IssueDate")->add_child_text (issue_date);
+ cxml::add_text_child(node, "IssueDate", issue_date);
- signer.as_xml (node->add_child ("Signer"));
- required_extensions.as_xml (node->add_child ("RequiredExtensions"));
+ signer.as_xml(cxml::add_child(node, "Signer"));
+ required_extensions.as_xml(cxml::add_child(node, "RequiredExtensions"));
- node->add_child ("NonCriticalExtensions");
+ cxml::add_child(node, "NonCriticalExtensions");
}
string message_id;
shared_ptr<xmlpp::Document> as_xml () const
{
- shared_ptr<xmlpp::Document> document (new xmlpp::Document ());
- xmlpp::Element* root = document->create_root_node ("DCinemaSecurityMessage", "http://www.smpte-ra.org/schemas/430-3/2006/ETM");
+ auto document = make_shared<xmlpp::Document>();
+ auto root = document->create_root_node("DCinemaSecurityMessage", "http://www.smpte-ra.org/schemas/430-3/2006/ETM");
root->set_namespace_declaration ("http://www.w3.org/2000/09/xmldsig#", "ds");
root->set_namespace_declaration ("http://www.w3.org/2001/04/xmlenc#", "enc");
map<string, xmlpp::Attribute *> references;
- authenticated_public.as_xml (root->add_child ("AuthenticatedPublic"), references);
- authenticated_private.as_xml (root->add_child ("AuthenticatedPrivate"), references);
- signature.as_xml (root->add_child ("Signature", "ds"));
+ authenticated_public.as_xml(cxml::add_child(root, "AuthenticatedPublic"), references);
+ authenticated_private.as_xml(cxml::add_child(root, "AuthenticatedPrivate"), references);
+ signature.as_xml(cxml::add_child(root, "Signature", string("ds")));
for (auto i: references) {
xmlAddID (0, document->cobj(), (const xmlChar *) i.first.c_str(), i.second->cobj());
auto root = doc.create_root_node ("DCSubtitle");
root->set_attribute ("Version", "1.0");
- root->add_child("SubtitleID")->add_child_text (_id);
- root->add_child("MovieTitle")->add_child_text (_movie_title);
- root->add_child("ReelNumber")->add_child_text (raw_convert<string> (_reel_number));
- root->add_child("Language")->add_child_text (_language);
+ cxml::add_text_child(root, "SubtitleID", _id);
+ cxml::add_text_child(root, "MovieTitle", _movie_title);
+ cxml::add_text_child(root, "ReelNumber", raw_convert<string> (_reel_number));
+ cxml::add_text_child(root, "Language", _language);
for (auto i: _load_font_nodes) {
- auto load_font = root->add_child("LoadFont");
+ auto load_font = cxml::add_child(root, "LoadFont");
load_font->set_attribute ("Id", i->id);
load_font->set_attribute ("URI", i->uri);
}
pkl = doc.create_root_node("PackingList", pkl_smpte_ns);
}
- pkl->add_child("Id")->add_child_text ("urn:uuid:" + _id);
+ cxml::add_text_child(pkl, "Id", "urn:uuid:" + _id);
if (_annotation_text) {
- pkl->add_child("AnnotationText")->add_child_text (*_annotation_text);
+ cxml::add_text_child(pkl, "AnnotationText", *_annotation_text);
}
- pkl->add_child("IssueDate")->add_child_text (_issue_date);
- pkl->add_child("Issuer")->add_child_text (_issuer);
- pkl->add_child("Creator")->add_child_text (_creator);
+ cxml::add_text_child(pkl, "IssueDate", _issue_date);
+ cxml::add_text_child(pkl, "Issuer", _issuer);
+ cxml::add_text_child(pkl, "Creator", _creator);
- auto asset_list = pkl->add_child("AssetList");
+ auto asset_list = cxml::add_child(pkl, "AssetList");
for (auto i: _assets) {
- auto asset = asset_list->add_child("Asset");
- asset->add_child("Id")->add_child_text ("urn:uuid:" + i->id());
+ auto asset = cxml::add_child(asset_list, "Asset");
+ cxml::add_text_child(asset, "Id", "urn:uuid:" + i->id());
if (i->annotation_text()) {
- asset->add_child("AnnotationText")->add_child_text (*i->annotation_text());
+ cxml::add_text_child(asset, "AnnotationText", *i->annotation_text());
}
- asset->add_child("Hash")->add_child_text (i->hash());
- asset->add_child("Size")->add_child_text (raw_convert<string>(i->size()));
- asset->add_child("Type")->add_child_text (i->type());
+ cxml::add_text_child(asset, "Hash", i->hash());
+ cxml::add_text_child(asset, "Size", raw_convert<string>(i->size()));
+ cxml::add_text_child(asset, "Type", i->type());
if (auto filename = i->original_filename()) {
- asset->add_child("OriginalFileName")->add_child_text(*filename);
+ cxml::add_text_child(asset, "OriginalFileName", *filename);
}
}
void
Rating::as_xml (xmlpp::Element* parent) const
{
- parent->add_child("Agency")->add_child_text(agency);
- parent->add_child("Label")->add_child_text(label);
+ cxml::add_text_child(parent, "Agency", agency);
+ cxml::add_text_child(parent, "Label", label);
}
xmlpp::Element *
Reel::write_to_cpl (xmlpp::Element* node, Standard standard) const
{
- auto reel = node->add_child ("Reel");
- reel->add_child("Id")->add_child_text("urn:uuid:" + _id);
- xmlpp::Element* asset_list = reel->add_child ("AssetList");
+ auto reel = cxml::add_child(node, "Reel");
+ cxml::add_text_child(reel, "Id", "urn:uuid:" + _id);
+ auto asset_list = cxml::add_child(reel, "AssetList");
if (_main_markers) {
_main_markers->write_to_cpl (asset_list, standard);
}
-xmlpp::Node*
-ReelAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+xmlpp::Element*
+ReelAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
{
- auto a = node->add_child (cpl_node_name (standard));
+ auto a = cxml::add_child(node, cpl_node_name(standard));
auto const attr = cpl_node_attribute (standard);
if (!attr.first.empty ()) {
a->set_attribute (attr.first, attr.second);
if (!ns.first.empty()) {
a->set_namespace_declaration (ns.first, ns.second);
}
- a->add_child("Id")->add_child_text ("urn:uuid:" + _id);
+ cxml::add_text_child(a, "Id", "urn:uuid:" + _id);
/* Empty <AnnotationText> tags cause refusal to play on some Sony SRX320 / LMT3000 systems (DoM bug #2124) */
if (_annotation_text && !_annotation_text->empty()) {
- a->add_child("AnnotationText")->add_child_text(*_annotation_text);
+ cxml::add_text_child(a, "AnnotationText", *_annotation_text);
}
- a->add_child("EditRate")->add_child_text (_edit_rate.as_string());
- a->add_child("IntrinsicDuration")->add_child_text (raw_convert<string> (_intrinsic_duration));
+ cxml::add_text_child(a, "EditRate", _edit_rate.as_string());
+ cxml::add_text_child(a, "IntrinsicDuration", raw_convert<string>(_intrinsic_duration));
if (_entry_point) {
- a->add_child("EntryPoint")->add_child_text(raw_convert<string>(*_entry_point));
+ cxml::add_text_child(a, "EntryPoint", raw_convert<string>(*_entry_point));
}
if (_duration) {
- a->add_child("Duration")->add_child_text(raw_convert<string>(*_duration));
+ cxml::add_text_child(a, "Duration", raw_convert<string>(*_duration));
}
return a;
}
explicit ReelAsset (std::shared_ptr<const cxml::Node>);
- virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const;
+ virtual xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const;
virtual bool encryptable () const {
return false;
}
-xmlpp::Node *
-ReelAtmosAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+xmlpp::Element*
+ReelAtmosAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
{
auto asset = ReelFileAsset::write_to_cpl (node, standard);
- asset->add_child("axd:DataType")->add_child_text("urn:smpte:ul:060e2b34.04010105.0e090604.00000000");
+ cxml::add_text_child(asset, "axd:DataType", "urn:smpte:ul:060e2b34.04010105.0e090604.00000000");
return asset;
}
return asset_of_type<AtmosAsset>();
}
- xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override;
+ xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override;
bool equals(std::shared_ptr<const ReelAtmosAsset>, EqualityOptions const&, NoteHandler) const;
private:
}
-xmlpp::Node *
-ReelFileAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+xmlpp::Element*
+ReelFileAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
{
- auto asset = ReelAsset::write_to_cpl (node, standard);
+ auto asset = ReelAsset::write_to_cpl(node, standard);
if (_key_id) {
- asset->add_child("KeyId")->add_child_text("urn:uuid:" + *_key_id);
+ cxml::add_text_child(asset, "KeyId", "urn:uuid:" + *_key_id);
}
if (_hash) {
- asset->add_child("Hash")->add_child_text(*_hash);
+ cxml::add_text_child(asset, "Hash", *_hash);
}
return asset;
}
ReelFileAsset (std::shared_ptr<Asset> asset, boost::optional<std::string> key_id, std::string id, Fraction edit_rate, int64_t intrinsic_duration, int64_t entry_point);
explicit ReelFileAsset (std::shared_ptr<const cxml::Node> node);
- virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override;
+ virtual xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override;
/** @return a Ref to our actual asset */
Ref const & asset_ref () const {
}
-xmlpp::Node *
-ReelInteropClosedCaptionAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+xmlpp::Element*
+ReelInteropClosedCaptionAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
{
auto asset = ReelClosedCaptionAsset::write_to_cpl (node, standard);
if (_language) {
- asset->add_child("Language")->add_child_text(*_language);
+ cxml::add_text_child(asset, "Language", *_language);
}
return asset;
}
return asset_of_type<InteropSubtitleAsset>();
}
- xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override;
+ xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override;
private:
std::string cpl_node_name (Standard) const override;
}
-xmlpp::Node*
-ReelMarkersAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+xmlpp::Element*
+ReelMarkersAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
{
int const tcr = edit_rate().numerator / edit_rate().denominator;
auto asset = ReelAsset::write_to_cpl (node, standard);
- auto ml = asset->add_child("MarkerList");
+ auto ml = cxml::add_child(asset, "MarkerList");
for (auto const& i: _markers) {
- auto m = ml->add_child("Marker");
- m->add_child("Label")->add_child_text(marker_to_string(i.first));
- m->add_child("Offset")->add_child_text(raw_convert<string>(i.second.as_editable_units_ceil(tcr)));
+ auto m = cxml::add_child(ml, "Marker");
+ cxml::add_text_child(m, "Label", marker_to_string(i.first));
+ cxml::add_text_child(m, "Offset", raw_convert<string>(i.second.as_editable_units_ceil(tcr)));
}
return asset;
ReelMarkersAsset (Fraction edit_rate, int64_t intrinsic_duration);
explicit ReelMarkersAsset (std::shared_ptr<const cxml::Node>);
- xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override;
+ xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override;
bool equals(std::shared_ptr<const ReelMarkersAsset>, EqualityOptions const&, NoteHandler) const;
void set (Marker, Time);
}
-xmlpp::Node*
-ReelPictureAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+xmlpp::Element*
+ReelPictureAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
{
auto asset = ReelFileAsset::write_to_cpl (node, standard);
- asset->add_child("FrameRate")->add_child_text(String::compose("%1 %2", _frame_rate.numerator, _frame_rate.denominator));
+ cxml::add_text_child(asset, "FrameRate", String::compose("%1 %2", _frame_rate.numerator, _frame_rate.denominator));
if (standard == Standard::INTEROP) {
}
}
- asset->add_child("ScreenAspectRatio")->add_child_text(raw_convert<string>(closest.get(), 2, true));
+ cxml::add_text_child(asset, "ScreenAspectRatio", raw_convert<string>(closest.get(), 2, true));
} else {
- asset->add_child("ScreenAspectRatio")->add_child_text(
- String::compose ("%1 %2", _screen_aspect_ratio.numerator, _screen_aspect_ratio.denominator)
+ cxml::add_text_child(
+ asset,
+ "ScreenAspectRatio",
+ String::compose("%1 %2", _screen_aspect_ratio.numerator, _screen_aspect_ratio.denominator)
);
}
return asset_of_type<PictureAsset>();
}
- virtual xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override;
+ virtual xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override;
bool equals(std::shared_ptr<const ReelPictureAsset>, EqualityOptions const&, NoteHandler) const;
/** @return picture frame rate */
}
-xmlpp::Node *
-ReelSMPTEClosedCaptionAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+xmlpp::Element*
+ReelSMPTEClosedCaptionAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
{
auto asset = ReelClosedCaptionAsset::write_to_cpl (node, standard);
if (_language) {
- asset->add_child("Language", "tt")->add_child_text(*_language);
+ cxml::add_child(asset, "Language", string("tt"))->add_child_text(*_language);
}
return asset;
}
return asset_of_type<const SMPTESubtitleAsset>();
}
- xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override;
+ xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override;
private:
}
-xmlpp::Node *
-ReelSubtitleAsset::write_to_cpl (xmlpp::Node* node, Standard standard) const
+xmlpp::Element *
+ReelSubtitleAsset::write_to_cpl(xmlpp::Element* node, Standard standard) const
{
auto asset = ReelFileAsset::write_to_cpl (node, standard);
if (_language) {
- asset->add_child("Language")->add_child_text(*_language);
+ cxml::add_text_child(asset, "Language", *_language);
}
return asset;
}
return asset_of_type<SubtitleAsset>();
}
- xmlpp::Node* write_to_cpl (xmlpp::Node* node, Standard standard) const override;
+ xmlpp::Element* write_to_cpl(xmlpp::Element* node, Standard standard) const override;
bool equals(std::shared_ptr<const ReelSubtitleAsset>, EqualityOptions const&, NoteHandler) const;
auto root = doc.create_root_node ("SubtitleReel");
DCP_ASSERT (_xml_id);
- root->add_child("Id")->add_child_text("urn:uuid:" + *_xml_id);
- root->add_child("ContentTitleText")->add_child_text(_content_title_text);
+ cxml::add_text_child(root, "Id", "urn:uuid:" + *_xml_id);
+ cxml::add_text_child(root, "ContentTitleText", _content_title_text);
if (_annotation_text) {
- root->add_child("AnnotationText")->add_child_text(_annotation_text.get());
+ cxml::add_text_child(root, "AnnotationText", _annotation_text.get());
}
- root->add_child("IssueDate")->add_child_text(_issue_date.as_string(false, false));
+ cxml::add_text_child(root, "IssueDate", _issue_date.as_string(false, false));
if (_reel_number) {
- root->add_child("ReelNumber")->add_child_text(raw_convert<string>(_reel_number.get()));
+ cxml::add_text_child(root, "ReelNumber", raw_convert<string>(_reel_number.get()));
}
if (_language) {
- root->add_child("Language")->add_child_text(_language.get());
+ cxml::add_text_child(root, "Language", _language.get());
}
- root->add_child("EditRate")->add_child_text(_edit_rate.as_string());
- root->add_child("TimeCodeRate")->add_child_text(raw_convert<string>(_time_code_rate));
+ cxml::add_text_child(root, "EditRate", _edit_rate.as_string());
+ cxml::add_text_child(root, "TimeCodeRate", raw_convert<string>(_time_code_rate));
if (_start_time) {
- root->add_child("StartTime")->add_child_text(_start_time.get().as_string(Standard::SMPTE));
+ cxml::add_text_child(root, "StartTime", _start_time.get().as_string(Standard::SMPTE));
}
for (auto i: _load_font_nodes) {
- auto load_font = root->add_child("LoadFont");
+ auto load_font = cxml::add_child(root, "LoadFont");
load_font->add_child_text ("urn:uuid:" + i->urn);
load_font->set_attribute ("ID", i->id);
}
- subtitles_as_xml (root->add_child("SubtitleList"), _time_code_rate, Standard::SMPTE);
+ subtitles_as_xml(cxml::add_child(root, "SubtitleList"), _time_code_rate, Standard::SMPTE);
return format_xml(doc, std::make_pair(string{}, schema_namespace()));
}
xmlpp::Element*
order::Font::as_xml (xmlpp::Element* parent, Context&) const
{
- auto e = parent->add_child("Font");
+ auto e = cxml::add_child(parent, "Font");
for (const auto& i: _values) {
e->set_attribute (i.first, i.second);
}
order::String::as_xml (xmlpp::Element* parent, Context& context) const
{
if (fabs(_space_before) > SPACE_BEFORE_EPSILON) {
- auto space = parent->add_child("Space");
+ auto space = cxml::add_child(parent, "Space");
auto size = raw_convert<string>(_space_before, 2);
if (context.standard == Standard::INTEROP) {
size += "em";
xmlpp::Element*
order::Text::as_xml (xmlpp::Element* parent, Context& context) const
{
- auto e = parent->add_child ("Text");
+ auto e = cxml::add_child(parent, "Text");
position_align(e, context, _h_align, _h_position, _v_align, _v_position, _z_position);
}
for (auto const& ruby: _rubies) {
- auto xml = e->add_child("Ruby");
- xml->add_child("Rb")->add_child_text(ruby.base);
- auto rt = xml->add_child("Rt");
+ auto xml = cxml::add_child(e, "Ruby");
+ cxml::add_child(xml, "Rb")->add_child_text(ruby.base);
+ auto rt = cxml::add_child(xml, "Rt");
rt->add_child_text(ruby.annotation);
rt->set_attribute("Size", dcp::raw_convert<string>(ruby.size, 6));
rt->set_attribute("Position", ruby.position == RubyPosition::BEFORE ? "before" : "after");
xmlpp::Element*
order::Subtitle::as_xml (xmlpp::Element* parent, Context& context) const
{
- auto e = parent->add_child ("Subtitle");
+ auto e = cxml::add_child(parent, "Subtitle");
e->set_attribute ("SpotNumber", raw_convert<string> (context.spot_number++));
e->set_attribute ("TimeIn", _in.rebase(context.time_code_rate).as_string(context.standard));
e->set_attribute ("TimeOut", _out.rebase(context.time_code_rate).as_string(context.standard));
xmlpp::Element *
order::Image::as_xml (xmlpp::Element* parent, Context& context) const
{
- auto e = parent->add_child ("Image");
+ auto e = cxml::add_child(parent, "Image");
position_align(e, context, _h_align, _h_position, _v_align, _v_position, _z_position);
if (context.standard == Standard::SMPTE) {
void
ContentVersion::as_xml (xmlpp::Element* parent) const
{
- auto cv = parent->add_child("ContentVersion");
- cv->add_child("Id")->add_child_text(id);
- cv->add_child("LabelText")->add_child_text(label_text);
+ auto cv = cxml::add_child(parent, "ContentVersion");
+ cxml::add_text_child(cv, "Id", id);
+ cxml::add_text_child(cv, "LabelText", label_text);
}
void
Luminance::as_xml (xmlpp::Element* parent, string ns) const
{
- auto lum = parent->add_child("Luminance", ns);
+ auto lum = cxml::add_child(parent, "Luminance", ns);
lum->set_attribute("units", unit_to_string(_unit));
lum->add_child_text(raw_convert<string>(_value, 3));
}
{
xmlpp::Document doc;
auto root = doc.create_root_node("Foo");
- root->add_child("Empty");
- root->add_child("Text")->add_child_text("Hello world");
- root->add_child("Font")->add_child("Text")->add_child_text("Say what");
- auto fred = root->add_child("Text")->add_child("Font");
+ cxml::add_child(root, "Empty");
+ cxml::add_text_child(root, "Text", "Hello world");
+ cxml::add_text_child(cxml::add_child(root, "Font"), "Text", "Say what");
+ auto fred = cxml::add_child(cxml::add_child(root, "Text"), "Font");
fred->set_attribute("bob", "job");
fred->add_child_text("Fred");
- fred->add_child("Text")->add_child_text("Jim");
+ cxml::add_text_child(fred, "Text", "Jim");
fred->add_child_text("Sheila");
BOOST_REQUIRE_EQUAL (dcp::SubtitleAsset::format_xml(doc, make_pair(string{}, string{"fred"})),
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
{
xmlpp::Document doc;
auto root = doc.create_root_node("Foo");
- root->add_child("Bar")->add_child_text("Don't panic & xml \"is\" 'great' & < > —");
+ cxml::add_text_child(root, "Bar", "Don't panic & xml \"is\" 'great' & < > —");
BOOST_REQUIRE_EQUAL(dcp::SubtitleAsset::format_xml(doc, {}),
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<Foo>\n"