diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-08-19 17:04:28 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-09-20 19:29:21 +0200 |
| commit | 3f806092b5d0f60fe4c7e40399cf1f7ec0e535ec (patch) | |
| tree | c8a052cbaf8b4f8bc4ffb05753d05f4d6887315f | |
| parent | f9078ac398e0765e39f503cdc5bed406d45e0c36 (diff) | |
Remove XMLMetadata from DCP::write_xml and DCP::write_assetmap.
| -rw-r--r-- | src/dcp.cc | 30 | ||||
| -rw-r--r-- | src/dcp.h | 15 | ||||
| -rw-r--r-- | src/wscript | 1 | ||||
| -rw-r--r-- | test/dcp_test.cc | 8 | ||||
| -rw-r--r-- | test/encryption_test.cc | 2 | ||||
| -rw-r--r-- | test/write_subtitle_test.cc | 2 |
6 files changed, 36 insertions, 22 deletions
@@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net> This file is part of libdcp. @@ -378,7 +378,10 @@ DCP::write_volindex (Standard standard) const } void -DCP::write_assetmap (Standard standard, string pkl_uuid, boost::filesystem::path pkl_path, XMLMetadata metadata) const +DCP::write_assetmap ( + Standard standard, string pkl_uuid, boost::filesystem::path pkl_path, + string issuer, string creator, string issue_date, string annotation_text + ) const { boost::filesystem::path p = _directory; @@ -408,20 +411,20 @@ DCP::write_assetmap (Standard standard, string pkl_uuid, boost::filesystem::path } root->add_child("Id")->add_child_text ("urn:uuid:" + make_uuid()); - root->add_child("AnnotationText")->add_child_text (metadata.annotation_text); + root->add_child("AnnotationText")->add_child_text (annotation_text); switch (standard) { case INTEROP: root->add_child("VolumeCount")->add_child_text ("1"); - 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 (issue_date); + root->add_child("Issuer")->add_child_text (issuer); + root->add_child("Creator")->add_child_text (creator); break; case SMPTE: - root->add_child("Creator")->add_child_text (metadata.creator); + root->add_child("Creator")->add_child_text (creator); root->add_child("VolumeCount")->add_child_text ("1"); - root->add_child("IssueDate")->add_child_text (metadata.issue_date); - root->add_child("Issuer")->add_child_text (metadata.issuer); + root->add_child("IssueDate")->add_child_text (issue_date); + root->add_child("Issuer")->add_child_text (issuer); break; default: DCP_ASSERT (false); @@ -455,7 +458,10 @@ DCP::write_assetmap (Standard standard, string pkl_uuid, boost::filesystem::path void DCP::write_xml ( Standard standard, - XMLMetadata metadata, + string issuer, + string creator, + string issue_date, + string annotation_text, shared_ptr<const CertificateChain> signer, NameFormat name_format ) @@ -469,7 +475,7 @@ DCP::write_xml ( shared_ptr<PKL> pkl; if (_pkls.empty()) { - pkl.reset (new PKL (standard, metadata.annotation_text, metadata.issue_date, metadata.issuer, metadata.creator)); + pkl.reset (new PKL(standard, annotation_text, issue_date, issuer, creator)); _pkls.push_back (pkl); BOOST_FOREACH (shared_ptr<Asset> i, assets ()) { i->add_to_pkl (pkl, _directory); @@ -484,7 +490,7 @@ DCP::write_xml ( pkl->write (pkl_path, signer); write_volindex (standard); - write_assetmap (standard, pkl->id(), pkl_path, metadata); + write_assetmap (standard, pkl->id(), pkl_path, issuer, creator, issue_date, annotation_text); } list<shared_ptr<CPL> > @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net> This file is part of libdcp. @@ -38,12 +38,14 @@ #ifndef LIBDCP_DCP_H #define LIBDCP_DCP_H +#include "compose.hpp" #include "types.h" #include "util.h" #include "certificate.h" #include "metadata.h" #include "name_format.h" #include "verify.h" +#include "version.h" #include <boost/shared_ptr.hpp> #include <boost/signals2.hpp> #include <string> @@ -62,7 +64,6 @@ class PKL; class Content; class Reel; class CPL; -class XMLMetadata; class CertificateChain; class DecryptedKDM; class Asset; @@ -111,7 +112,10 @@ public: void write_xml ( Standard standard, - XMLMetadata metadata = XMLMetadata (), + std::string issuer = String::compose("libdcp %1", dcp::version), + std::string creator = String::compose("libdcp %1", dcp::version), + std::string issue_date = LocalTime().as_string(), + std::string annotation_text = String::compose("Created by libdcp %1", dcp::version), boost::shared_ptr<const CertificateChain> signer = boost::shared_ptr<const CertificateChain> (), NameFormat name_format = NameFormat("%t") ); @@ -148,7 +152,10 @@ private: * @param pkl_uuid UUID of our PKL. * @param pkl_path Pathname of our PKL file. */ - void write_assetmap (Standard standard, std::string pkl_uuid, boost::filesystem::path pkl_path, XMLMetadata metadata) const; + void write_assetmap ( + Standard standard, std::string pkl_uuid, boost::filesystem::path pkl_path, + std::string issuer, std::string creator, std::string issue_date, std::string annotation_text + ) const; /** The directory that we are writing to */ boost::filesystem::path _directory; diff --git a/src/wscript b/src/wscript index fd215d76..46b5a5ea 100644 --- a/src/wscript +++ b/src/wscript @@ -124,6 +124,7 @@ def build(bld): chromaticity.h colour_conversion.h combine.h + compose.hpp cpl.h crypto_context.h dcp.h diff --git a/test/dcp_test.cc b/test/dcp_test.cc index 30c5ca30..21ed2f6c 100644 --- a/test/dcp_test.cc +++ b/test/dcp_test.cc @@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE (dcp_test1) xml_meta.issuer = "OpenDCP 0.0.25"; xml_meta.creator = "OpenDCP 0.0.25"; xml_meta.issue_date = "2012-07-17T04:45:18+00:00"; - make_simple("build/test/DCP/dcp_test1")->write_xml (dcp::SMPTE, xml_meta); + make_simple("build/test/DCP/dcp_test1")->write_xml (dcp::SMPTE, xml_meta.issuer, xml_meta.creator, xml_meta.issue_date, xml_meta.annotation_text); /* build/test/DCP/dcp_test1 is checked against test/ref/DCP/dcp_test1 by run/tests */ } @@ -140,7 +140,7 @@ BOOST_AUTO_TEST_CASE (dcp_test2) d.add (cpl); xml_meta.annotation_text = "Created by libdcp"; - d.write_xml (dcp::SMPTE, xml_meta); + d.write_xml (dcp::SMPTE, xml_meta.issuer, xml_meta.creator, xml_meta.issue_date, xml_meta.annotation_text); /* build/test/DCP/dcp_test2 is checked against test/ref/DCP/dcp_test2 by run/tests */ } @@ -246,7 +246,7 @@ BOOST_AUTO_TEST_CASE (dcp_test5) d.add (cpl); xml_meta.annotation_text = "Created by libdcp"; - d.write_xml (dcp::SMPTE, xml_meta); + d.write_xml (dcp::SMPTE, xml_meta.issuer, xml_meta.creator, xml_meta.issue_date, xml_meta.annotation_text); /* build/test/DCP/dcp_test5 is checked against test/ref/DCP/dcp_test5 by run/tests */ } @@ -275,7 +275,7 @@ BOOST_AUTO_TEST_CASE (dcp_test7) xml_meta.issuer = "OpenDCP 0.0.25"; xml_meta.creator = "OpenDCP 0.0.25"; xml_meta.issue_date = "2012-07-17T04:45:18+00:00"; - make_simple("build/test/DCP/dcp_test7")->write_xml (dcp::INTEROP, xml_meta); + make_simple("build/test/DCP/dcp_test7")->write_xml(dcp::INTEROP, xml_meta.issuer, xml_meta.creator, xml_meta.issue_date, xml_meta.annotation_text); /* build/test/DCP/dcp_test7 is checked against test/ref/DCP/dcp_test7 by run/tests */ } diff --git a/test/encryption_test.cc b/test/encryption_test.cc index 4b9e525e..3bb52c2f 100644 --- a/test/encryption_test.cc +++ b/test/encryption_test.cc @@ -141,7 +141,7 @@ BOOST_AUTO_TEST_CASE (encryption_test) d.add (cpl); xml_metadata.annotation_text = "Created by libdcp"; - d.write_xml (dcp::SMPTE, xml_metadata, signer); + d.write_xml (dcp::SMPTE, xml_metadata.issuer, xml_metadata.creator, xml_metadata.issue_date, xml_metadata.annotation_text, signer); dcp::DecryptedKDM kdm ( cpl, diff --git a/test/write_subtitle_test.cc b/test/write_subtitle_test.cc index 266a1039..da2ec35c 100644 --- a/test/write_subtitle_test.cc +++ b/test/write_subtitle_test.cc @@ -377,7 +377,7 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test3) dcp::DCP dcp ("build/test/write_interop_subtitle_test3"); dcp.add (cpl); - dcp.write_xml (dcp::INTEROP, xml_meta); + dcp.write_xml (dcp::INTEROP, xml_meta.issuer, xml_meta.creator, xml_meta.issue_date, xml_meta.annotation_text); check_xml ( dcp::file_to_string("test/ref/write_interop_subtitle_test3/subs.xml"), |
