diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-06-28 23:56:22 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-06-28 23:56:26 +0200 |
| commit | 1c10ba0bbe5d3f476cfb5a65191774b69670616d (patch) | |
| tree | 4c3b22a8a0fd12cd5bdcbc3a892462be0b21ed5d /src/lib/dcp_content.cc | |
| parent | 8b45384a7c9162d30309345ae863b4cab86aeda1 (diff) | |
wip2801-cap
Diffstat (limited to 'src/lib/dcp_content.cc')
| -rw-r--r-- | src/lib/dcp_content.cc | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index b4e979481..7f60105df 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -36,7 +36,7 @@ #include <dcp/dcp.h> #include <dcp/raw_convert.h> #include <dcp/exceptions.h> -#include <dcp/reel_closed_caption_asset.h> +#include <dcp/reel_caption_asset.h> #include <dcp/reel_picture_asset.h> #include <dcp/reel_subtitle_asset.h> #include <dcp/reel.h> @@ -124,9 +124,13 @@ DCPContent::DCPContent (cxml::ConstNodePtr node, int version) _reference_audio = node->optional_bool_child ("ReferenceAudio").get_value_or (false); if (version >= 37) { _reference_text[TextType::OPEN_SUBTITLE] = node->optional_bool_child("ReferenceOpenSubtitle").get_value_or(false); + _reference_text[TextType::OPEN_CAPTION] = node->optional_bool_child("ReferenceOpenCaption").get_value_or(false); + _reference_text[TextType::CLOSED_SUBTITLE] = node->optional_bool_child("ReferenceClosedSubtitle").get_value_or(false); _reference_text[TextType::CLOSED_CAPTION] = node->optional_bool_child("ReferenceClosedCaption").get_value_or(false); } else { _reference_text[TextType::OPEN_SUBTITLE] = node->optional_bool_child("ReferenceSubtitle").get_value_or(false); + _reference_text[TextType::OPEN_CAPTION] = false; + _reference_text[TextType::CLOSED_SUBTITLE] = false; _reference_text[TextType::CLOSED_CAPTION] = false; } if (node->optional_string_child("Standard")) { @@ -296,9 +300,25 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) new_text.push_back (c); } + for (int i = 0; i < examiner->text_count(TextType::OPEN_CAPTION); ++i) { + auto c = make_shared<TextContent>(this, TextType::OPEN_CAPTION, TextType::OPEN_CAPTION); + c->set_language (examiner->open_caption_language()); + examiner->add_fonts(c); + new_text.push_back(c); + } + + int index = 0; + + for (int i = 0; i < examiner->text_count(TextType::CLOSED_SUBTITLE); ++i) { + auto c = make_shared<TextContent>(this, TextType::CLOSED_SUBTITLE, TextType::CLOSED_SUBTITLE); + c->set_dcp_track (examiner->dcp_text_track(index++)); + examiner->add_fonts(c); + new_text.push_back(c); + } + for (int i = 0; i < examiner->text_count(TextType::CLOSED_CAPTION); ++i) { auto c = make_shared<TextContent>(this, TextType::CLOSED_CAPTION, TextType::CLOSED_CAPTION); - c->set_dcp_track (examiner->dcp_text_track(i)); + c->set_dcp_track (examiner->dcp_text_track(index++)); examiner->add_fonts(c); new_text.push_back (c); } @@ -765,9 +785,21 @@ DCPContent::can_reference_text (shared_ptr<const Film> film, TextType type, stri return false; } + if (_has_non_zero_entry_point[TextType::OPEN_CAPTION]) { + /// TRANSLATORS: this string will follow "Cannot reference this DCP: " + why_not = _("one of its caption reels has a non-zero entry point so it must be re-written."); + return false; + } + + if (_has_non_zero_entry_point[TextType::CLOSED_SUBTITLE]) { + /// TRANSLATORS: this string will follow "Cannot reference this DCP: " + why_not = _("one of its closed subtitles 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."); + why_not = _("one of its closed captions has a non-zero entry point so it must be re-written."); return false; } |
