2 Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 #include "compose.hpp"
24 #include "dcp_content.h"
25 #include "dcpomatic_log.h"
29 #include <dcp/decrypted_kdm.h>
30 #include <dcp/exceptions.h>
37 using std::shared_ptr;
38 using std::make_shared;
39 using std::dynamic_pointer_cast;
43 /** Find all the CPLs in our directories, cross-add assets and return the CPLs */
44 list<shared_ptr<dcp::CPL>>
47 list<shared_ptr<dcp::DCP>> dcps;
48 list<shared_ptr<dcp::CPL>> cpls;
50 LOG_GENERAL ("Reading %1 DCP directories", _dcp_content->directories().size());
51 for (auto i: _dcp_content->directories()) {
52 auto dcp = make_shared<dcp::DCP>(i);
53 vector<dcp::VerificationNote> notes;
54 dcp->read (¬es, true);
56 /** We accept and ignore EMPTY_ASSET_PATH and EXTERNAL_ASSET but everything else is bad */
58 if (j.code() == dcp::VerificationNote::Code::EMPTY_ASSET_PATH || j.code() == dcp::VerificationNote::Code::EXTERNAL_ASSET) {
59 LOG_WARNING("Empty path in ASSETMAP of %1", i.string());
61 boost::throw_exception(dcp::ReadError(dcp::note_to_string(j)));
66 LOG_GENERAL ("Reading DCP %1: %2 CPLs", i.string(), dcp->cpls().size());
67 for (auto i: dcp->cpls()) {
75 i->resolve_refs(j->assets());
80 if (_dcp_content->kdm ()) {
81 auto k = decrypt_kdm_with_helpful_error (_dcp_content->kdm().get());