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(-) 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(-) 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(-) 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(-) 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 f5c2b918ebfe18252605a0a2ed9a26d49db3a5f5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 29 Dec 2023 01:31:47 +0100 Subject: Fix libdcp to not crash in some VF verification situations. --- cscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cscript b/cscript index 3903bd074..fde56ad77 100644 --- a/cscript +++ b/cscript @@ -507,7 +507,7 @@ def dependencies(target, options): # Use distro-provided FFmpeg on Arch deps = [] - deps.append(('libdcp', 'v1.8.89')) + deps.append(('libdcp', 'v1.8.92')) deps.append(('libsub', 'v1.6.45')) deps.append(('leqm-nrt', '30dcaea1373ac62fba050e02ce5b0c1085797a23')) deps.append(('rtaudio', 'f619b76')) -- 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(+) 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 From ebecf95d5f3bd55fcf65535fe3e509a5e24c6438 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 29 Dec 2023 00:06:54 +0100 Subject: Add a test. --- test/data | 2 +- test/vf_test.cc | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 2 deletions(-) diff --git a/test/data b/test/data index 154eb8c75..a513e2cd9 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit 154eb8c751e43e350dac04943dc48e6ab7f9c98f +Subproject commit a513e2cd9f48dd0f6f748e4b5a77c559bbf915cf diff --git a/test/vf_test.cc b/test/vf_test.cc index 249f9c5b0..2311e3537 100644 --- a/test/vf_test.cc +++ b/test/vf_test.cc @@ -34,14 +34,20 @@ #include "lib/job_manager.h" #include "lib/make_dcp.h" #include "lib/player.h" +#include "lib/ratio.h" #include "lib/text_content.h" #include "lib/referenced_reel_asset.h" #include "lib/video_content.h" #include "test.h" #include +#include +#include #include -#include +#include #include +#include +#include +#include #include #include @@ -52,6 +58,7 @@ using std::list; using std::make_shared; using std::shared_ptr; using std::string; +using std::vector; using namespace dcpomatic; @@ -470,3 +477,81 @@ BOOST_AUTO_TEST_CASE(test_duplicate_font_id_in_vf) }); } + +BOOST_AUTO_TEST_CASE(test_referencing_ov_with_missing_subtitle_in_some_reels) +{ + auto const path = boost::filesystem::path("build/test/test_referencing_ov_with_missing_subtitle_in_some_reels"); + boost::filesystem::remove_all(path); + + boost::filesystem::create_directories(path / "ov"); + dcp::DCP ov(path / "ov"); + + auto make_picture = [path](string filename) { + auto pic = make_shared(dcp::Fraction(24, 1), dcp::Standard::SMPTE); + auto writer = pic->start_write(path / "ov" / filename, dcp::PictureAsset::Behaviour::MAKE_NEW); + auto frame = dcp::ArrayData("test/data/picture.j2c"); + for (int i = 0; i < 240; ++i) { + writer->write(frame); + } + writer->finalize(); + return pic; + }; + + auto pic1 = make_picture("pic1.mxf"); + auto pic2 = make_picture("pic2.mxf"); + + auto sub1 = make_shared(); + + sub1->add(std::make_shared( + boost::optional(), false, false, false, dcp::Colour(255, 255, 255), + 42, 1, dcp::Time(0, 0, 5, 0, 24), dcp::Time(0, 0, 9, 0, 24), + 0, dcp::HAlign::CENTER, + 0, dcp::VAlign::CENTER, + 0, dcp::Direction::LTR, + "Hello", + dcp::Effect::NONE, dcp::Colour(0, 0, 0), + dcp::Time{}, dcp::Time{}, + 0, vector{} + )); + sub1->write(path / "ov" / "sub.mxf"); + + auto reel1_pic = make_shared(pic1, 0); + auto reel1_sub = make_shared(sub1, dcp::Fraction(24, 1), 240, 0); + + auto reel2_pic = make_shared(pic1, 0); + + auto reel1 = make_shared(reel1_pic, shared_ptr(), reel1_sub); + auto reel2 = make_shared(reel2_pic); + + auto cpl = make_shared("Test CPL", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE); + cpl->add(reel1); + cpl->add(reel2); + + ov.add(cpl); + ov.write_xml(); + + auto dcp_ov = make_shared(path / "ov"); + auto vf = make_shared(path / "vf"); + vf->set_dcp_content_type(DCPContentType::from_isdcf_name("TST")); + vf->set_container(Ratio::from_id("185")); + vf->write_metadata(); + vf->examine_and_add_content(dcp_ov); + BOOST_REQUIRE(!wait_for_jobs()); + vf->set_reel_type(ReelType::BY_VIDEO_CONTENT); + dcp_ov->set_reference_video(true); + dcp_ov->set_reference_text(TextType::OPEN_SUBTITLE, true); + + vf->write_metadata(); + make_dcp(vf, TranscodeJob::ChangedBehaviour::IGNORE); + BOOST_REQUIRE(!wait_for_jobs()); + + vector ignore = { + dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE, + dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME, + dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING, + dcp::VerificationNote::Code::EXTERNAL_ASSET, + }; + + verify_dcp(vf->dir(vf->dcp_name()), ignore); +} + -- cgit v1.2.3