summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-07-11 01:01:36 +0200
committerCarl Hetherington <cth@carlh.net>2025-07-11 22:54:06 +0200
commitd8f671167eb15cccf8cdad817cecd8086b4091da (patch)
tree9b714dfe91bbe61e1d41e856c9a462e10aaff228
parentf0de76caf400db21137c711fcc1c2dcbe4614838 (diff)
Don't try to add unused fonts to the DCP (#3059).
With interop there can be only one font, and we need to make sure it's not one that isn't even being used.
-rw-r--r--src/lib/player.cc6
-rw-r--r--test/vf_test.cc51
2 files changed, 55 insertions, 2 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index ef6280a3a..53ce612e1 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -606,8 +606,10 @@ Player::get_subtitle_fonts()
vector<shared_ptr<Font>> fonts;
for (auto piece: _pieces) {
for (auto text: piece->content->text) {
- auto text_fonts = text->fonts();
- copy(text_fonts.begin(), text_fonts.end(), back_inserter(fonts));
+ if (text->use()) {
+ auto text_fonts = text->fonts();
+ copy(text_fonts.begin(), text_fonts.end(), back_inserter(fonts));
+ }
}
}
diff --git a/test/vf_test.cc b/test/vf_test.cc
index a0c48c5a6..dac7dbcf7 100644
--- a/test/vf_test.cc
+++ b/test/vf_test.cc
@@ -194,6 +194,7 @@ BOOST_AUTO_TEST_CASE (vf_test3)
}
+
/** Make a OV with video and audio and a VF referencing the OV and adding some more video */
BOOST_AUTO_TEST_CASE (vf_test4)
{
@@ -538,3 +539,53 @@ BOOST_AUTO_TEST_CASE(ov_subs_in_vf_name)
BOOST_CHECK_EQUAL(vf->isdcf_name(false), "Foo_TST-1_F_XX-DE_51-HI-VI_2K_20230118_SMPTE_VF");
}
+
+
+/* Test bug #3059: a VF with subs ends up with the font from the OV's subs */
+BOOST_AUTO_TEST_CASE(vf_subs_get_font_from_ov)
+{
+ auto subs = content_factory("test/data/short.srt")[0];
+ auto picture = content_factory("test/data/flat_red.png")[0];
+ auto ov = new_test_film("vf_subs_get_font_from_ov_ov", { picture, subs });
+ ov->set_interop(true);
+ subs->text[0]->set_language(dcp::LanguageTag("de"));
+
+ make_and_verify_dcp(
+ ov,
+ {
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::MISSING_CPL_METADATA,
+ dcp::VerificationNote::Code::INVALID_STANDARD
+ });
+
+ auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
+
+ auto subs2 = content_factory("test/data/short.srt")[0];
+ auto vf = new_test_film("vf_subs_get_font_from_ov_vf", { ov_dcp, subs2 });
+ vf->set_interop(true);
+ vf->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+ subs2->text[0]->set_language(dcp::LanguageTag("de"));
+ subs2->text[0]->get_font("")->set_file("test/data/Inconsolata-VF.ttf");
+ ov_dcp->set_reference_video(true);
+ ov_dcp->set_reference_audio(true);
+
+ make_and_verify_dcp(
+ vf,
+ {
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::MISSING_CPL_METADATA,
+ dcp::VerificationNote::Code::EXTERNAL_ASSET,
+ dcp::VerificationNote::Code::INVALID_STANDARD
+ });
+
+ optional<boost::filesystem::path> font_dir;
+ for (auto i: boost::filesystem::directory_iterator(vf->dir(vf->dcp_name()))) {
+ if (boost::filesystem::is_directory(i)) {
+ font_dir = i;
+ }
+ }
+
+ BOOST_REQUIRE(font_dir);
+ auto vf_font = find_file(*font_dir, "font");
+ check_file("test/data/Inconsolata-VF.ttf", vf_font);
+}