diff options
Diffstat (limited to 'src/dcp.cc')
| -rw-r--r-- | src/dcp.cc | 32 |
1 files changed, 17 insertions, 15 deletions
@@ -52,7 +52,7 @@ #include "metadata.h" #include "mono_picture_asset.h" #include "picture_asset.h" -#include "pkl.h" +#include "pkl_internal.h" #include "raw_convert.h" #include "reel_asset.h" #include "reel_subtitle_asset.h" @@ -168,13 +168,20 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m boost::throw_exception (XMLError ("No packing lists found in asset map")); } + auto pkl_assets = vector<PKLAsset>(); + + bool first = true; for (auto i: pkl_paths) { - _pkls.push_back (make_shared<PKL>(_directory / i)); + auto metadata = read_pkl(_directory / i, pkl_assets); + if (first) { + _metadata = metadata; + first = false; + } } /* Now we have: paths - map of files in the DCP that are not PKLs; key is ID, value is path. - _pkls - PKL objects for each PKL. + pkl_assets - all the assets from all the PKLs that we found. Read all the assets from the asset map. */ @@ -184,10 +191,10 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m */ vector<shared_ptr<Asset>> other_assets; - for (auto i: paths) { - auto path = _directory / i.second; + for (auto const& id_and_path: paths) { + auto path = _directory / id_and_path.second; - if (i.second.empty()) { + if (id_and_path.second.empty()) { /* I can't see how this is valid, but it's been seen in the wild with a DCP that claims to come from ClipsterDCI 5.10.0.5. @@ -206,21 +213,16 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m } /* Find the <Type> for this asset from the PKL that contains the asset */ - optional<string> pkl_type; - for (auto j: _pkls) { - pkl_type = j->type(i.first); - if (pkl_type) { - break; - } - } - - if (!pkl_type) { + auto pkl_asset_with_id = std::find_if(pkl_assets.begin(), pkl_assets.end(), [](PKLAsset const& a) { return a.id() == id_and_path.first; }); + if (pkl_asset_with_id != pkl_assets.end() { /* This asset is in the ASSETMAP but not mentioned in any PKL so we don't * need to worry about it. */ continue; } + auto pkl_type = pkl_asset_with_id->type(); + auto remove_parameters = [](string const& n) { return n.substr(0, n.find(";")); }; |
