diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-10-20 21:22:17 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-02-16 01:20:38 +0100 |
| commit | 0cb5e386c282ae34dd065e7e294030969645913e (patch) | |
| tree | bac83ad896e18c4f576e60971089fb3288cc8073 /src/lib/dcp_content.cc | |
| parent | 4cb6ab669032ef0584fde63e62addfe8a71a484c (diff) | |
Replace find_and_resolve_cpls() with storing all CPL IDs in DCPContent (sometimes).
In some places we need other details than the ID, but in lots of places
this saves some disk searching.
Diffstat (limited to 'src/lib/dcp_content.cc')
| -rw-r--r-- | src/lib/dcp_content.cc | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 6e071e5c0..98c49fae4 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -145,7 +145,17 @@ DCPContent::DCPContent(cxml::ConstNodePtr node, boost::optional<boost::filesyste if (ck) { _content_kind = dcp::ContentKind::from_name(*ck); } - _cpl = node->optional_string_child("CPL"); + for (auto cpl: node->node_children("CPL")) { + _cpls.push_back(cpl->content()); + if (auto selected = cpl->optional_bool_attribute("selected")) { + if (selected) { + _cpl = cpl->content(); + } + } + } + if (!_cpl && !_cpls.empty()) { + _cpl = _cpls.front(); + } for (auto i: node->node_children("ReelLength")) { _reel_lengths.push_back(raw_convert<int64_t>(i->content())); } @@ -340,6 +350,7 @@ DCPContent::examine(shared_ptr<Job> job, bool tolerant) _video_encoding = examiner->video_encoding(); _three_d = examiner->three_d(); _content_kind = examiner->content_kind(); + _cpls = examiner->cpls(); _cpl = examiner->cpl(); _reel_lengths = examiner->reel_lengths(); _markers = examiner->markers(); @@ -466,8 +477,12 @@ DCPContent::as_xml(xmlpp::Element* element, bool with_paths, PathBehaviour path_ if (_content_kind) { cxml::add_text_child(element, "ContentKind", _content_kind->name()); } - if (_cpl) { - cxml::add_text_child(element, "CPL", _cpl.get()); + for (auto cpl: _cpls) { + auto e = cxml::add_child(element, "CPL"); + e->add_child_text(cpl); + if (cpl == _cpl) { + e->set_attribute("selected", "1"); + } } for (auto i: _reel_lengths) { cxml::add_text_child(element, "ReelLength", fmt::to_string(i)); |
