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 /** We accept and ignore some warnings / errors but everything else is bad */
51 vector<dcp::VerificationNote::Code> ignore = {
52 dcp::VerificationNote::Code::EMPTY_ASSET_PATH,
53 dcp::VerificationNote::Code::EXTERNAL_ASSET,
54 dcp::VerificationNote::Code::THREED_ASSET_MARKED_AS_TWOD,
57 LOG_GENERAL ("Reading %1 DCP directories", _dcp_content->directories().size());
58 for (auto i: _dcp_content->directories()) {
59 auto dcp = make_shared<dcp::DCP>(i);
60 vector<dcp::VerificationNote> notes;
61 dcp->read (¬es, true);
64 if (std::find(ignore.begin(), ignore.end(), j.code()) != ignore.end()) {
65 LOG_WARNING("Ignoring: %1", dcp::note_to_string(j));
67 boost::throw_exception(dcp::ReadError(dcp::note_to_string(j)));
72 LOG_GENERAL ("Reading DCP %1: %2 CPLs", i.string(), dcp->cpls().size());
73 for (auto i: dcp->cpls()) {
81 i->resolve_refs(j->assets());
86 if (_dcp_content->kdm ()) {
87 auto k = decrypt_kdm_with_helpful_error (_dcp_content->kdm().get());