diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-04-11 22:24:44 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-04-12 01:22:10 +0200 |
| commit | 498806d76160a6b1fa0af58e7734c0f553abf12b (patch) | |
| tree | c5898dca2e84901ea003decb1f3671226d8e53c9 /src/dcp.cc | |
| parent | 7d66bda50ade8ea618f331b885f1bfa4fa0a2af9 (diff) | |
Specify CPL standard on construction.
Then choose which standard DCP should use based on the CPL(s).
Diffstat (limited to 'src/dcp.cc')
| -rw-r--r-- | src/dcp.cc | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -67,6 +67,7 @@ #include <libxml++/libxml++.h> #include <boost/filesystem.hpp> #include <boost/algorithm/string.hpp> +#include <numeric> using std::string; @@ -229,7 +230,7 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m if (root == "CompositionPlaylist") { auto cpl = make_shared<CPL>(path); - if (_standard && cpl->standard() && cpl->standard().get() != _standard.get() && notes) { + if (_standard && cpl->standard() != _standard.get() && notes) { notes->push_back ({VerificationNote::Type::ERROR, VerificationNote::Code::MISMATCHED_STANDARD}); } _cpls.push_back (cpl); @@ -469,7 +470,6 @@ DCP::write_assetmap ( void DCP::write_xml ( - Standard standard, string issuer, string creator, string issue_date, @@ -478,10 +478,24 @@ DCP::write_xml ( NameFormat name_format ) { + if (_cpls.empty()) { + throw MiscError ("Cannot write DCP with no CPLs."); + } + + auto standard = std::accumulate ( + std::next(_cpls.begin()), _cpls.end(), _cpls[0]->standard(), + [](Standard s, shared_ptr<CPL> c) { + if (s != c->standard()) { + throw MiscError ("Cannot make DCP with mixed Interop and SMPTE CPLs."); + } + return s; + } + ); + for (auto i: cpls()) { NameFormat::Map values; values['t'] = "cpl"; - i->write_xml (_directory / (name_format.get(values, "_" + i->id() + ".xml")), standard, signer); + i->write_xml (_directory / (name_format.get(values, "_" + i->id() + ".xml")), signer); } shared_ptr<PKL> pkl; |
