summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-08-27 00:17:58 +0200
committerCarl Hetherington <cth@carlh.net>2023-08-27 00:17:58 +0200
commit6e49be4baede66ce5f89c45fffafb6bdfff95401 (patch)
treecbadf655da758e69ee5fabb49d3ed15bc458c17f
parentee0908336e86d7b92f421fdd10f0334d76fa4c11 (diff)
Fix refusal to reference overlapping but different text content (#2599).
-rw-r--r--src/lib/dcp_content.cc4
-rw-r--r--test/vf_test.cc26
2 files changed, 28 insertions, 2 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index 928ba3381..770e5bfad 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -787,8 +787,8 @@ DCPContent::can_reference_text (shared_ptr<const Film> film, TextType type, stri
/// TRANSLATORS: this string will follow "Cannot reference this DCP: "
return can_reference(
film,
- [](shared_ptr<const Content> c) {
- return !c->text.empty();
+ [type](shared_ptr<const Content> c) {
+ return std::find_if(c->text.begin(), c->text.end(), [type](shared_ptr<const TextContent> t) { return t->type() == type; }) != c->text.end();
},
_("they overlap other text content; remove the other content."),
why_not
diff --git a/test/vf_test.cc b/test/vf_test.cc
index 3705635c2..ecd615d98 100644
--- a/test/vf_test.cc
+++ b/test/vf_test.cc
@@ -31,6 +31,7 @@
#include "lib/ffmpeg_content.h"
#include "lib/film.h"
#include "lib/player.h"
+#include "lib/text_content.h"
#include "lib/referenced_reel_asset.h"
#include "lib/video_content.h"
#include "test.h"
@@ -397,3 +398,28 @@ BOOST_AUTO_TEST_CASE (test_vf_with_trimmed_multi_reel_dcp)
make_and_verify_dcp (vf, { dcp::VerificationNote::Code::EXTERNAL_ASSET });
}
+
+/** Test bug #2599: unable to reference open subtitles in an OV when creating a VF that adds closed captions */
+BOOST_AUTO_TEST_CASE(test_referencing_ov_with_subs_when_adding_ccaps)
+{
+ string const name("test_referencing_ov_with_subs_when_adding_ccaps");
+ auto subs = content_factory("test/data/15s.srt");
+ auto ov = new_test_film2(name + "_ov", subs);
+ make_and_verify_dcp(
+ ov,
+ {
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::MISSING_CPL_METADATA
+ });
+
+ auto ccaps = content_factory("test/data/15s.srt")[0];
+ auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name(false)));
+ auto vf = new_test_film2(name + "_vf", { ov_dcp, ccaps });
+ ccaps->text[0]->set_type(TextType::CLOSED_CAPTION);
+
+ string why_not;
+ BOOST_CHECK(ov_dcp->can_reference_text(vf, TextType::OPEN_SUBTITLE, why_not));
+ std::cout << why_not << "\n";
+}
+