Make CPL metadata writing optional. optional-cpl-metadata
authorCarl Hetherington <cth@carlh.net>
Sun, 9 Oct 2022 12:13:39 +0000 (14:13 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 9 Oct 2022 12:14:31 +0000 (14:14 +0200)
src/cpl.cc
src/cpl.h
src/dcp.cc
src/dcp.h

index ee1817fc57571025f8692a5b25fc0bc2a8644bc7..5404acd98a013dbe456777a4d6c0430e6776126e 100644 (file)
@@ -181,7 +181,7 @@ CPL::set (std::vector<std::shared_ptr<Reel>> reels)
 
 
 void
-CPL::write_xml (boost::filesystem::path file, shared_ptr<const CertificateChain> signer) const
+CPL::write_xml(boost::filesystem::path file, shared_ptr<const CertificateChain> signer, bool write_cpl_metadata) const
 {
        xmlpp::Document doc;
        xmlpp::Element* root;
@@ -225,7 +225,7 @@ CPL::write_xml (boost::filesystem::path file, shared_ptr<const CertificateChain>
        bool first = true;
        for (auto i: _reels) {
                auto asset_list = i->write_to_cpl (reel_list, _standard);
-               if (first && _standard == Standard::SMPTE) {
+               if (first && _standard == Standard::SMPTE && write_cpl_metadata) {
                        maybe_write_composition_metadata_asset (asset_list);
                        first = false;
                }
index c1489a2c0e8efbffa58f31e020205b63bef607a2..aaa827400eebd1e88912701cd7908f2f79e4b412 100644 (file)
--- a/src/cpl.h
+++ b/src/cpl.h
@@ -126,7 +126,8 @@ public:
         */
        void write_xml (
                boost::filesystem::path file,
-               std::shared_ptr<const CertificateChain>
+               std::shared_ptr<const CertificateChain>,
+               bool write_cpl_metadata = true
                ) const;
 
        void resolve_refs (std::vector<std::shared_ptr<Asset>>);
index df5c89b4852c37863e54db522602f4a581576152..d507e951d368591ac2eb4746d752d9f40cdbb960 100644 (file)
@@ -400,7 +400,7 @@ DCP::write_volindex (Standard standard) const
 
 
 void
-DCP::write_xml (shared_ptr<const CertificateChain> signer, NameFormat name_format)
+DCP::write_xml(shared_ptr<const CertificateChain> signer, NameFormat name_format, bool write_cpl_metadata)
 {
        if (_cpls.empty()) {
                throw MiscError ("Cannot write DCP with no CPLs.");
@@ -419,7 +419,7 @@ DCP::write_xml (shared_ptr<const CertificateChain> signer, NameFormat name_forma
        for (auto i: cpls()) {
                NameFormat::Map values;
                values['t'] = "cpl";
-               i->write_xml (_directory / (name_format.get(values, "_" + i->id() + ".xml")), signer);
+               i->write_xml(_directory / (name_format.get(values, "_" + i->id() + ".xml")), signer, write_cpl_metadata);
        }
 
        if (_pkls.empty()) {
index 35e2edf889272378a125c65d49d7dcef513f9e2b..6a8eef15765f226c5ea0d253c2d21ac0496ae5e6 100644 (file)
--- a/src/dcp.h
+++ b/src/dcp.h
@@ -157,7 +157,8 @@ public:
         */
        void write_xml (
                std::shared_ptr<const CertificateChain> signer = std::shared_ptr<const CertificateChain>(),
-               NameFormat name_format = NameFormat("%t")
+               NameFormat name_format = NameFormat("%t"),
+               bool write_cpl_metadata = true
        );
 
        void resolve_refs (std::vector<std::shared_ptr<Asset>> assets);