diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-10-20 21:22:17 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-02-03 21:37:04 +0100 |
| commit | eda0b0b0ffecf2d6d67407303a1bd45659ccdfce (patch) | |
| tree | c57cda863071ca7af8de20ac9bce128b45d93289 /src/lib/dcp_content.cc | |
| parent | 9b841fddd3aa4a1117b03299bce964c5e4b205d9 (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 e239e7b70..20d6bac48 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -144,7 +144,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())); } @@ -323,6 +333,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(); @@ -445,8 +456,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)); |
