From a7fa260fb46d40bca1e0faf3210a0c260316a8ad Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 23 Dec 2023 19:45:05 +0100 Subject: Remove checks for referenced DCPs having content in all reels (#2694). I can't see why this was done, other than perhaps to avoid output with no subtitles in a reel (which is not allowed by Bv2.1). But I think even if that does still happen we could make our own reels for the missing ones. --- src/lib/dcp_content.cc | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'src') diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 2d441353a..8d27406fe 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -720,14 +720,6 @@ DCPContent::can_reference_audio (shared_ptr film, string& why_not) c return false; } - for (auto i: decoder->reels()) { - if (!i->main_sound()) { - /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - why_not = _("it does not have sound in all its reels."); - return false; - } - } - /// TRANSLATORS: this string will follow "Cannot reference this DCP: " return can_reference( film, [](shared_ptr c) { @@ -755,22 +747,13 @@ DCPContent::can_reference_text (shared_ptr film, TextType type, stri for (auto i: decoder->reels()) { if (type == TextType::OPEN_SUBTITLE) { - if (!i->main_subtitle()) { - /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - why_not = _("it does not have open subtitles in all its reels."); - return false; - } else if (i->main_subtitle()->entry_point().get_value_or(0) != 0) { + if (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) { - if (i->closed_captions().empty()) { - /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - why_not = _("it does not have closed captions in all its reels."); - return false; - } for (auto j: i->closed_captions()) { if (j->entry_point().get_value_or(0) != 0) { /// TRANSLATORS: this string will follow "Cannot reference this DCP: " -- cgit v1.2.3 From cc26618cf6847d49819332ceeaea6e3bc6d3ea6b Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 25 Dec 2023 01:12:49 +0100 Subject: Don't crash when checking a DCP with no subtitles in some reel. --- src/lib/dcp_content.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 8d27406fe..b9b64149f 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -747,7 +747,7 @@ DCPContent::can_reference_text (shared_ptr film, TextType type, stri for (auto i: decoder->reels()) { if (type == TextType::OPEN_SUBTITLE) { - if (i->main_subtitle()->entry_point().get_value_or(0) != 0) { + 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; -- cgit v1.2.3 From ddf76844f3a682db7ac128318543aecd89ec518f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 29 Dec 2023 01:30:09 +0100 Subject: Don't add an asset that we don't have. --- src/lib/referenced_reel_asset.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/referenced_reel_asset.cc b/src/lib/referenced_reel_asset.cc index bd87b905a..3175d772d 100644 --- a/src/lib/referenced_reel_asset.cc +++ b/src/lib/referenced_reel_asset.cc @@ -116,7 +116,7 @@ get_referenced_reel_assets(shared_ptr film, shared_ptrmain_sound(), reel_trim_start, reel_trim_end, from, frame_rate); } - if (dcp->reference_text(TextType::OPEN_SUBTITLE)) { + if (dcp->reference_text(TextType::OPEN_SUBTITLE) && reel->main_subtitle()) { maybe_add_asset (reel_assets, reel->main_subtitle(), reel_trim_start, reel_trim_end, from, frame_rate); } -- cgit v1.2.3 From 56cef0046ea0fabc39e1bfa5371fce1c76a259d8 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 29 Dec 2023 01:30:22 +0100 Subject: Don't try to add fonts from an asset that we don't have. --- src/lib/font_id_allocator.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/font_id_allocator.cc b/src/lib/font_id_allocator.cc index 70eda2b06..c566c3676 100644 --- a/src/lib/font_id_allocator.cc +++ b/src/lib/font_id_allocator.cc @@ -44,11 +44,15 @@ FontIDAllocator::add_fonts_from_reels(vector> const& reels int reel_index = 0; for (auto reel: reels) { if (auto sub = reel->main_subtitle()) { - add_fonts_from_asset(reel_index, sub->asset()); + if (sub->asset_ref().resolved()) { + add_fonts_from_asset(reel_index, sub->asset()); + } } for (auto ccap: reel->closed_captions()) { - add_fonts_from_asset(reel_index, ccap->asset()); + if (ccap->asset_ref().resolved()) { + add_fonts_from_asset(reel_index, ccap->asset()); + } } ++reel_index; -- cgit v1.2.3 From 23b0ff9c475265fb5309d20fe4094f5a96818d22 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 4 Jan 2024 00:40:03 +0100 Subject: Add dummy subtitle and closed caption reels even when referencing other DCPs (in a VF) that themselves might have missing subtitles for some reels. --- src/lib/writer.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 8863816e8..fbe2d248d 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -41,7 +41,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -930,6 +932,22 @@ void Writer::write (ReferencedReelAsset asset) { _reel_assets.push_back (asset); + + if (dynamic_pointer_cast(asset.asset)) { + _have_subtitles = true; + } else if (auto ccap = dynamic_pointer_cast(asset.asset)) { + /* This feels quite fragile. We have a referenced reel and want to know if it's + * part of a given closed-caption track so that we can fill if it has any + * missing reels. I guess for that purpose almost any DCPTextTrack values are + * fine so long as they are consistent. + */ + DCPTextTrack track; + track.name = ccap->annotation_text().get_value_or(""); + track.language = dcp::LanguageTag(ccap->language().get_value_or("en-US")); + if (_have_closed_captions.find(track) == _have_closed_captions.end()) { + _have_closed_captions.insert(track); + } + } } -- cgit v1.2.3