From 9acb2e83ed4a39ece8d39dd479c160b79b02d7ab Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 5 Feb 2014 11:18:01 +0000 Subject: [PATCH] Tidy up metadata handling. --- src/cpl.cc | 14 +++++++------- src/cpl.h | 8 +++++--- src/dcp.cc | 7 ++++++- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/cpl.cc b/src/cpl.cc index 215640d3..cd255309 100644 --- a/src/cpl.cc +++ b/src/cpl.cc @@ -74,8 +74,9 @@ CPL::CPL (boost::filesystem::path file) _id = _id.substr (9); } _annotation_text = f.optional_string_child ("AnnotationText").get_value_or (""); - _issue_date = f.string_child ("IssueDate"); - _creator = f.optional_string_child ("Creator").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 content_version = f.optional_node_child ("ContentVersion"); @@ -106,11 +107,10 @@ CPL::add (boost::shared_ptr reel) /** Write an CompositonPlaylist XML file. * @param file Filename to write. * @param standard INTEROP or SMPTE. - * @param metadata Metadata to use. * @param signer Signer to sign the CPL, or 0 to add no signature. */ void -CPL::write_xml (boost::filesystem::path file, Standard standard, XMLMetadata metadata, shared_ptr signer) const +CPL::write_xml (boost::filesystem::path file, Standard standard, shared_ptr signer) const { xmlpp::Document doc; xmlpp::Element* root; @@ -126,9 +126,9 @@ CPL::write_xml (boost::filesystem::path file, Standard standard, XMLMetadata met 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("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)); { diff --git a/src/cpl.h b/src/cpl.h index d28737e1..6af7fe56 100644 --- a/src/cpl.h +++ b/src/cpl.h @@ -24,6 +24,7 @@ #include "certificates.h" #include "key.h" #include "asset.h" +#include "metadata.h" #include #include #include @@ -103,7 +104,6 @@ public: void write_xml ( boost::filesystem::path file, Standard standard, - XMLMetadata, boost::shared_ptr ) const; @@ -117,8 +117,10 @@ protected: private: std::string _annotation_text; ///< - std::string _issue_date; ///< - std::string _creator; ///< + /** , and . These are grouped + * because they occur together in a few places. + */ + XMLMetadata _metadata; std::string _content_title_text; ///< ContentKind _content_kind; ///< std::string _content_version_id; ///< in diff --git a/src/dcp.cc b/src/dcp.cc index 2588c654..36eedcf7 100644 --- a/src/dcp.cc +++ b/src/dcp.cc @@ -322,6 +322,11 @@ DCP::write_assetmap (Standard standard, string pkl_uuid, int pkl_length, XMLMeta doc.write_to_file (p.string (), "UTF-8"); } +/** Write all the XML files for this DCP. + * @param standand INTEROP or SMPTE. + * @param metadata Metadata to use for PKL and asset map files. + * @param signer Signer to use, or 0. + */ void DCP::write_xml ( Standard standard, @@ -332,7 +337,7 @@ DCP::write_xml ( list > cpl = cpls (); for (list >::const_iterator i = cpl.begin(); i != cpl.end(); ++i) { string const filename = (*i)->id() + "_cpl.xml"; - (*i)->write_xml (_directory / filename, standard, metadata, signer); + (*i)->write_xml (_directory / filename, standard, signer); } string const pkl_uuid = make_uuid (); -- 2.30.2