diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-03-06 01:17:59 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-03-11 09:25:26 +0100 |
| commit | 394516c351602f58150bdbbb4e61c45163927147 (patch) | |
| tree | dd941b3632b44e79bf035600a5a3bac8a9c39570 /src/lib/dcp_content.cc | |
| parent | 8c06e7d56542d16ea6e596056801270bae6d09e6 (diff) | |
Use stored has_non_zero_entry_point() instead of parsing the DCP again (#2524).
Diffstat (limited to 'src/lib/dcp_content.cc')
| -rw-r--r-- | src/lib/dcp_content.cc | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 35ef15442..e583578ec 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -750,37 +750,16 @@ DCPContent::can_reference_audio (shared_ptr<const Film> film, string& why_not) c bool DCPContent::can_reference_text (shared_ptr<const Film> film, TextType type, string& why_not) const { - shared_ptr<DCPDecoder> decoder; - try { - decoder = make_shared<DCPDecoder>(film, shared_from_this(), false, film->tolerant(), shared_ptr<DCPDecoder>()); - } catch (dcp::ReadError &) { - /* We couldn't read the DCP, so it's probably missing */ - return false; - } catch (DCPError &) { - /* We couldn't read the DCP, so it's probably missing */ - return false; - } catch (dcp::KDMDecryptionError &) { - /* We have an incorrect KDM */ + if (_has_non_zero_entry_point[TextType::OPEN_SUBTITLE]) { + /// TRANSLATORS: this string will follow "Cannot reference this DCP: " + why_not = _("one of its subtitle reels has a non-zero entry point so it must be re-written."); return false; } - for (auto i: decoder->reels()) { - if (type == TextType::OPEN_SUBTITLE) { - if (i->main_subtitle() && i->main_subtitle()->entry_point().get_value_or(0) != 0) { - /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - why_not = _("one of its subtitle reels has a non-zero entry point so it must be re-written."); - return false; - } - } - if (type == TextType::CLOSED_CAPTION) { - for (auto j: i->closed_captions()) { - if (j->entry_point().get_value_or(0) != 0) { - /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - why_not = _("one of its closed caption has a non-zero entry point so it must be re-written."); - return false; - } - } - } + if (_has_non_zero_entry_point[TextType::CLOSED_CAPTION]) { + /// TRANSLATORS: this string will follow "Cannot reference this DCP: " + why_not = _("one of its closed caption has a non-zero entry point so it must be re-written."); + return false; } if (trim_start() != dcpomatic::ContentTime()) { |
