summaryrefslogtreecommitdiff
path: root/src/cpl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpl.cc')
-rw-r--r--src/cpl.cc63
1 files changed, 31 insertions, 32 deletions
diff --git a/src/cpl.cc b/src/cpl.cc
index d7f3a79a..bb2ada64 100644
--- a/src/cpl.cc
+++ b/src/cpl.cc
@@ -61,33 +61,32 @@ CPL::CPL (boost::filesystem::path file)
: Asset (file)
, _content_kind (FEATURE)
{
- cxml::Document f ("CompositionPlaylist");
- f.read_file (file);
+ cxml::NodePtr f = cxml::read_file (file);
- _id = f.string_child ("Id");
+ _id = f->string_child ("Id");
if (_id.length() > 9) {
_id = _id.substr (9);
}
- _annotation_text = f.optional_string_child ("AnnotationText").get_value_or ("");
- _metadata.issuer = f.optional_string_child ("Issuer").get_value_or ("");
- _metadata.creator = f.optional_string_child ("Creator").get_value_or ("");
- _metadata.issue_date = f.string_child ("IssueDate");
- _content_title_text = f.string_child ("ContentTitleText");
- _content_kind = content_kind_from_string (f.string_child ("ContentKind"));
- shared_ptr<cxml::Node> content_version = f.optional_node_child ("ContentVersion");
+ _annotation_text = f->optional_string_child ("AnnotationText").get_value_or ("");
+ _metadata.issuer = f->optional_string_child ("Issuer").get_value_or ("");
+ _metadata.creator = f->optional_string_child ("Creator").get_value_or ("");
+ _metadata.issue_date = f->string_child ("IssueDate");
+ _content_title_text = f->string_child ("ContentTitleText");
+ _content_kind = content_kind_from_string (f->string_child ("ContentKind"));
+ cxml::NodePtr content_version = f->optional_child ("ContentVersion");
if (content_version) {
_content_version_id = content_version->optional_string_child ("Id").get_value_or ("");
_content_version_label_text = content_version->string_child ("LabelText");
content_version->done ();
}
- f.ignore_child ("RatingList");
+ f->ignore_child ("RatingList");
_reels = type_grand_children<Reel> (f, "ReelList", "Reel");
- f.ignore_child ("Issuer");
- f.ignore_child ("Signer");
- f.ignore_child ("Signature");
+ f->ignore_child ("Issuer");
+ f->ignore_child ("Signer");
+ f->ignore_child ("Signature");
- f.done ();
+ f->done ();
}
/** Add a reel to this CPL.
@@ -107,33 +106,33 @@ CPL::add (boost::shared_ptr<Reel> reel)
void
CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptr<const Signer> signer) const
{
- xmlpp::Document doc;
- xmlpp::Element* root;
+ cxml::NodePtr root (new cxml::Node);
+ root->set_name ("CompositonPlaylist");
if (standard == INTEROP) {
- root = doc.create_root_node ("CompositionPlaylist", "http://www.digicine.com/PROTO-ASDCP-CPL-20040511#");
+ root->set_attribute ("xmlns", "http://www.digicine.com/PROTO-ASDCP-CPL-20040511#");
} else {
- root = doc.create_root_node ("CompositionPlaylist", "http://www.smpte-ra.org/schemas/429-7/2006/CPL");
+ root->set_attribute ("xmlns", "http://www.smpte-ra.org/schemas/429-7/2006/CPL");
}
if (signer) {
- root->set_namespace_declaration ("http://www.w3.org/2000/09/xmldsig#", "dsig");
+ root->set_attribute ("xmlns:dsig", "http://www.w3.org/2000/09/xmldsig#");
}
- root->add_child("Id")->add_child_text ("urn:uuid:" + _id);
- root->add_child("AnnotationText")->add_child_text (_annotation_text);
- root->add_child("IssueDate")->add_child_text (_metadata.issue_date);
- root->add_child("Issuer")->add_child_text (_metadata.issuer);
- root->add_child("Creator")->add_child_text (_metadata.creator);
- root->add_child("ContentTitleText")->add_child_text (_content_title_text);
- root->add_child("ContentKind")->add_child_text (content_kind_to_string (_content_kind));
+ root->add_child("Id")->set_content ("urn:uuid:" + _id);
+ root->add_child("AnnotationText")->set_content (_annotation_text);
+ root->add_child("IssueDate")->set_content (_metadata.issue_date);
+ root->add_child("Issuer")->set_content (_metadata.issuer);
+ root->add_child("Creator")->set_content (_metadata.creator);
+ root->add_child("ContentTitleText")->set_content (_content_title_text);
+ root->add_child("ContentKind")->set_content (content_kind_to_string (_content_kind));
{
- xmlpp::Node* cv = root->add_child ("ContentVersion");
- cv->add_child ("Id")->add_child_text (_content_version_id);
- cv->add_child ("LabelText")->add_child_text (_content_version_label_text);
+ cxml::NodePtr cv = root->add_child ("ContentVersion");
+ cv->add_child ("Id")->set_content (_content_version_id);
+ cv->add_child ("LabelText")->set_content (_content_version_label_text);
}
root->add_child("RatingList");
- xmlpp::Element* reel_list = root->add_child ("ReelList");
+ cxml::NodePtr reel_list = root->add_child ("ReelList");
for (list<shared_ptr<Reel> >::const_iterator i = _reels.begin(); i != _reels.end(); ++i) {
(*i)->write_to_cpl (reel_list, standard);
@@ -144,7 +143,7 @@ CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptr<cons
}
/* This must not be the _formatted version otherwise signature digests will be wrong */
- doc.write_to_file (file.string (), "UTF-8");
+ cxml::write_to_file (root, file.string ());
set_file (file);
}