summaryrefslogtreecommitdiff
path: root/src/dcp.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-04-11 22:24:44 +0200
committerCarl Hetherington <cth@carlh.net>2021-04-12 01:22:10 +0200
commit498806d76160a6b1fa0af58e7734c0f553abf12b (patch)
treec5898dca2e84901ea003decb1f3671226d8e53c9 /src/dcp.cc
parent7d66bda50ade8ea618f331b885f1bfa4fa0a2af9 (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.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index 20ff82f8..bcf487e1 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -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;