2 Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
22 /** @file test/vf_Test.cc
23 * @brief Various VF-related tests.
28 #include "lib/content_factory.h"
29 #include "lib/dcp_content.h"
30 #include "lib/dcp_content_type.h"
31 #include "lib/examine_content_job.h"
32 #include "lib/ffmpeg_content.h"
34 #include "lib/job_manager.h"
35 #include "lib/make_dcp.h"
36 #include "lib/player.h"
37 #include "lib/ratio.h"
38 #include "lib/text_content.h"
39 #include "lib/referenced_reel_asset.h"
40 #include "lib/video_content.h"
43 #include <dcp/mono_picture_asset.h>
44 #include <dcp/picture_asset_writer.h>
46 #include <dcp/reel_mono_picture_asset.h>
47 #include <dcp/reel_sound_asset.h>
48 #include <dcp/reel_smpte_subtitle_asset.h>
49 #include <dcp/smpte_subtitle_asset.h>
50 #include <dcp/subtitle_string.h>
51 #include <boost/test/unit_test.hpp>
56 using std::dynamic_pointer_cast;
58 using std::make_shared;
59 using std::shared_ptr;
62 using namespace dcpomatic;
65 /** Test the logic which decides whether a DCP can be referenced or not */
66 BOOST_AUTO_TEST_CASE (vf_test1)
68 auto film = new_test_film ("vf_test1");
69 film->set_interop (false);
70 auto dcp = make_shared<DCPContent>("test/data/reels_test2");
71 film->examine_and_add_content (dcp);
72 BOOST_REQUIRE (!wait_for_jobs());
74 /* Multi-reel DCP can't be referenced if we are using a single reel for the project */
75 film->set_reel_type (ReelType::SINGLE);
76 film->set_audio_channels(16);
78 BOOST_CHECK (!dcp->can_reference_video(film, why_not));
79 BOOST_CHECK (!dcp->can_reference_audio(film, why_not));
80 BOOST_CHECK (!dcp->can_reference_text(film, TextType::OPEN_SUBTITLE, why_not));
81 BOOST_CHECK (!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
83 /* Multi-reel DCP can be referenced if we are using by-video-content */
84 film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
85 BOOST_CHECK (dcp->can_reference_video(film, why_not));
86 BOOST_CHECK (dcp->can_reference_audio(film, why_not));
87 /* (but reels_test2 has no texts to reference) */
88 BOOST_CHECK (!dcp->can_reference_text(film, TextType::OPEN_SUBTITLE, why_not));
89 BOOST_CHECK (!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
91 auto other = make_shared<FFmpegContent>("test/data/test.mp4");
92 film->examine_and_add_content (other);
93 BOOST_REQUIRE (!wait_for_jobs());
94 BOOST_CHECK (!other->audio);
96 /* Not possible if there is overlap; we only check video here as that's all test.mp4 has */
97 other->set_position (film, DCPTime());
98 BOOST_CHECK (!dcp->can_reference_video(film, why_not));
100 /* This should not be considered an overlap */
101 other->set_position (film, dcp->end(film));
102 BOOST_CHECK (dcp->can_reference_video(film, why_not));
103 BOOST_CHECK (dcp->can_reference_audio(film, why_not));
104 /* (reels_test2 has no texts to reference) */
105 BOOST_CHECK (!dcp->can_reference_text(film, TextType::OPEN_SUBTITLE, why_not));
106 BOOST_CHECK (!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
110 /** Make a OV with video and audio and a VF referencing the OV and adding subs */
111 BOOST_AUTO_TEST_CASE (vf_test2)
114 auto ov = new_test_film ("vf_test2_ov");
115 ov->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
116 ov->set_name ("vf_test2_ov");
117 auto video = content_factory("test/data/flat_red.png")[0];
118 ov->examine_and_add_content (video);
119 BOOST_REQUIRE (!wait_for_jobs());
120 video->video->set_length (24 * 5);
121 auto audio = content_factory("test/data/white.wav")[0];
122 ov->examine_and_add_content (audio);
123 BOOST_REQUIRE (!wait_for_jobs());
124 make_and_verify_dcp (ov);
127 auto vf = new_test_film ("vf_test2_vf");
128 vf->set_name ("vf_test2_vf");
129 vf->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
130 vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
131 auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
132 vf->examine_and_add_content (dcp);
133 BOOST_REQUIRE (!wait_for_jobs());
134 dcp->set_reference_video (true);
135 dcp->set_reference_audio (true);
136 auto sub = content_factory("test/data/subrip4.srt")[0];
137 vf->examine_and_add_content (sub);
138 BOOST_REQUIRE (!wait_for_jobs());
139 make_and_verify_dcp (
142 dcp::VerificationNote::Code::EXTERNAL_ASSET,
143 dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
144 dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
145 dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION
150 dcp::DCP ov_c (ov->dir(ov->dcp_name()));
152 BOOST_REQUIRE_EQUAL (ov_c.cpls().size(), 1U);
153 BOOST_REQUIRE_EQUAL (ov_c.cpls()[0]->reels().size(), 1U);
154 BOOST_REQUIRE (ov_c.cpls()[0]->reels()[0]->main_picture());
155 string const pic_id = ov_c.cpls()[0]->reels()[0]->main_picture()->id();
156 BOOST_REQUIRE (ov_c.cpls()[0]->reels()[0]->main_sound());
157 string const sound_id = ov_c.cpls()[0]->reels()[0]->main_sound()->id();
158 BOOST_REQUIRE (!ov_c.cpls()[0]->reels()[0]->main_subtitle());
160 dcp::DCP vf_c (vf->dir(vf->dcp_name()));
162 BOOST_REQUIRE_EQUAL (vf_c.cpls().size(), 1U);
163 BOOST_REQUIRE_EQUAL (vf_c.cpls()[0]->reels().size(), 1U);
164 BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_picture());
165 BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_picture()->id(), pic_id);
166 BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_sound());
167 BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_sound()->id(), sound_id);
168 BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_subtitle());
172 /** Test creation of a VF using a trimmed OV; the output should have entry point /
173 * duration altered to effect the trimming.
175 BOOST_AUTO_TEST_CASE (vf_test3)
178 auto ov = new_test_film ("vf_test3_ov");
179 ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
180 ov->set_name ("vf_test3_ov");
181 auto video = content_factory("test/data/flat_red.png")[0];
182 ov->examine_and_add_content (video);
183 BOOST_REQUIRE (!wait_for_jobs());
184 video->video->set_length (24 * 5);
185 auto audio = content_factory("test/data/white.wav")[0];
186 ov->examine_and_add_content (audio);
187 BOOST_REQUIRE (!wait_for_jobs());
188 make_and_verify_dcp (ov);
191 auto vf = new_test_film ("vf_test3_vf");
192 vf->set_name ("vf_test3_vf");
193 vf->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
194 vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
195 auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
197 dcp->set_trim_start(vf, ContentTime::from_seconds (1));
198 dcp->set_trim_end (ContentTime::from_seconds (1));
199 vf->examine_and_add_content (dcp);
200 BOOST_REQUIRE (!wait_for_jobs());
201 dcp->set_reference_video (true);
202 dcp->set_reference_audio (true);
203 make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
205 dcp::DCP vf_c (vf->dir(vf->dcp_name()));
207 BOOST_REQUIRE_EQUAL (vf_c.cpls().size(), 1U);
208 BOOST_REQUIRE_EQUAL (vf_c.cpls()[0]->reels().size(), 1U);
209 BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_picture());
210 BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_picture()->entry_point().get_value_or(0), 24);
211 BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_picture()->actual_duration(), 72);
212 BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_sound());
213 BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_sound()->entry_point().get_value_or(0), 24);
214 BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_sound()->actual_duration(), 72);
218 /** Make a OV with video and audio and a VF referencing the OV and adding some more video */
219 BOOST_AUTO_TEST_CASE (vf_test4)
222 auto ov = new_test_film ("vf_test4_ov");
223 ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
224 ov->set_name ("vf_test4_ov");
225 auto video = content_factory("test/data/flat_red.png")[0];
226 ov->examine_and_add_content (video);
227 BOOST_REQUIRE (!wait_for_jobs());
228 video->video->set_length (24 * 5);
229 auto audio = content_factory("test/data/white.wav")[0];
230 ov->examine_and_add_content (audio);
231 BOOST_REQUIRE (!wait_for_jobs());
232 make_and_verify_dcp (ov);
235 auto vf = new_test_film ("vf_test4_vf");
236 vf->set_name ("vf_test4_vf");
237 vf->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
238 vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
239 vf->set_sequence (false);
240 auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
242 vf->examine_and_add_content (dcp);
243 BOOST_REQUIRE (!wait_for_jobs());
244 dcp->set_position(vf, DCPTime::from_seconds(10));
245 dcp->set_reference_video (true);
246 dcp->set_reference_audio (true);
247 auto more_video = content_factory("test/data/flat_red.png")[0];
248 vf->examine_and_add_content (more_video);
249 BOOST_REQUIRE (!wait_for_jobs());
250 more_video->set_position (vf, DCPTime());
251 vf->write_metadata ();
252 make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
254 dcp::DCP ov_c (ov->dir(ov->dcp_name()));
256 BOOST_REQUIRE_EQUAL (ov_c.cpls().size(), 1U);
257 BOOST_REQUIRE_EQUAL (ov_c.cpls()[0]->reels().size(), 1U);
258 BOOST_REQUIRE (ov_c.cpls()[0]->reels()[0]->main_picture());
259 string const pic_id = ov_c.cpls()[0]->reels()[0]->main_picture()->id();
260 BOOST_REQUIRE (ov_c.cpls()[0]->reels()[0]->main_sound());
261 string const sound_id = ov_c.cpls()[0]->reels()[0]->main_sound()->id();
262 BOOST_REQUIRE (!ov_c.cpls()[0]->reels()[0]->main_subtitle());
264 dcp::DCP vf_c (vf->dir (vf->dcp_name ()));
266 BOOST_REQUIRE_EQUAL (vf_c.cpls().size(), 1U);
267 BOOST_REQUIRE_EQUAL (vf_c.cpls()[0]->reels().size(), 2U);
268 BOOST_REQUIRE (vf_c.cpls()[0]->reels().back()->main_picture());
269 BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels().back()->main_picture()->id(), pic_id);
270 BOOST_REQUIRE (vf_c.cpls()[0]->reels().back()->main_sound());
271 BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels().back()->main_sound()->id(), sound_id);
275 /** Test bug #1495 */
276 BOOST_AUTO_TEST_CASE (vf_test5)
279 auto ov = new_test_film ("vf_test5_ov");
280 ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
281 ov->set_reel_type (ReelType::BY_VIDEO_CONTENT);
282 for (int i = 0; i < 3; ++i) {
283 auto video = content_factory("test/data/flat_red.png")[0];
284 ov->examine_and_add_content (video);
285 BOOST_REQUIRE (!wait_for_jobs());
286 video->video->set_length (24 * 10);
289 BOOST_REQUIRE (!wait_for_jobs());
290 make_and_verify_dcp (ov);
293 auto vf = new_test_film ("vf_test5_vf");
294 vf->set_name ("vf_test5_vf");
295 vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
296 vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
297 vf->set_sequence (false);
298 auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
300 vf->examine_and_add_content (dcp);
301 BOOST_REQUIRE (!wait_for_jobs());
302 dcp->set_reference_video (true);
303 dcp->set_reference_audio (true);
304 dcp->set_trim_end (ContentTime::from_seconds(15));
305 make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
307 /* Check that the selected reel assets are right */
308 auto a = get_referenced_reel_assets(vf, vf->playlist());
309 BOOST_REQUIRE_EQUAL (a.size(), 4U);
311 BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(0), DCPTime(960000)));
313 BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(0), DCPTime(960000)));
315 BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(960000), DCPTime(1440000)));
317 BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(960000), DCPTime(1440000)));
322 /** Test bug #1528 */
323 BOOST_AUTO_TEST_CASE (vf_test6)
326 auto ov = new_test_film ("vf_test6_ov");
327 ov->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
328 ov->set_reel_type (ReelType::BY_VIDEO_CONTENT);
329 auto video = content_factory("test/data/flat_red.png")[0];
330 ov->examine_and_add_content (video);
331 BOOST_REQUIRE (!wait_for_jobs());
332 video->video->set_length (24 * 10);
333 make_and_verify_dcp (ov);
336 auto vf = new_test_film ("vf_test6_vf");
337 vf->set_name ("vf_test6_vf");
338 vf->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
339 vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
340 vf->set_sequence (false);
341 auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
342 vf->examine_and_add_content (dcp);
343 BOOST_REQUIRE (!wait_for_jobs());
344 dcp->set_reference_video (true);
345 dcp->set_reference_audio (true);
347 auto sub = content_factory("test/data/15s.srt")[0];
348 vf->examine_and_add_content (sub);
349 BOOST_REQUIRE (!wait_for_jobs());
351 make_and_verify_dcp (
354 dcp::VerificationNote::Code::EXTERNAL_ASSET,
355 dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
356 dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME
363 /** Test bug #1643 (the second part; referring fails if there are gaps) */
364 BOOST_AUTO_TEST_CASE (vf_test7)
367 auto ov1 = new_test_film2 ("vf_test7_ov1", {content_factory("test/data/flat_red.png")[0]});
368 ov1->set_video_frame_rate (24);
369 make_and_verify_dcp (ov1);
372 auto ov2 = new_test_film2 ("vf_test7_ov2", {content_factory("test/data/flat_red.png")[0]});
373 ov2->set_video_frame_rate (24);
374 make_and_verify_dcp (ov2);
377 auto ov1_dcp = make_shared<DCPContent>(ov1->dir(ov1->dcp_name()));
378 auto ov2_dcp = make_shared<DCPContent>(ov2->dir(ov2->dcp_name()));
379 auto vf = new_test_film2 ("vf_test7_vf", {ov1_dcp, ov2_dcp});
380 vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
381 ov1_dcp->set_reference_video (true);
382 ov2_dcp->set_reference_video (true);
383 ov1_dcp->set_position (vf, DCPTime::from_seconds(1));
384 ov2_dcp->set_position (vf, DCPTime::from_seconds(20));
385 vf->write_metadata ();
386 make_and_verify_dcp (vf);
390 /** Test bug #2116 */
391 BOOST_AUTO_TEST_CASE (test_vf_with_trimmed_multi_reel_dcp)
393 /* Make an OV with 3 reels */
394 std::vector<std::shared_ptr<Content>> ov_content;
395 for (int i = 0; i < 3; ++i) {
396 auto c = content_factory("test/data/flat_red.png")[0];
397 c->video->set_length(240);
398 ov_content.push_back(c);
400 auto ov = new_test_film2 ("test_vf_with_trimmed_multi_reel_dcp_ov", ov_content);
401 ov->set_reel_type(ReelType::BY_VIDEO_CONTENT);
402 make_and_verify_dcp (ov);
404 /* Make a VF with a specific arrangement */
405 auto vf_image = content_factory("test/data/flat_red.png")[0];
406 auto vf_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
407 auto vf = new_test_film2 ("test_vf_with_trimmed_multi_reel_dcp_vf", { vf_image, vf_dcp });
408 vf->set_reel_type(ReelType::BY_VIDEO_CONTENT);
409 vf_dcp->set_reference_video(true);
410 vf_dcp->set_reference_audio(true);
411 vf_dcp->set_trim_start(vf, ContentTime::from_seconds(10));
412 vf_dcp->set_position(vf, DCPTime::from_seconds(10));
413 make_and_verify_dcp(vf, { dcp::VerificationNote::Code::EXTERNAL_ASSET }, false);
417 /** Test bug #2599: unable to reference open subtitles in an OV when creating a VF that adds closed captions */
418 BOOST_AUTO_TEST_CASE(test_referencing_ov_with_subs_when_adding_ccaps)
420 string const name("test_referencing_ov_with_subs_when_adding_ccaps");
421 auto subs = content_factory("test/data/15s.srt");
422 auto ov = new_test_film2(name + "_ov", subs);
426 dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
427 dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
428 dcp::VerificationNote::Code::MISSING_CPL_METADATA
431 auto ccaps = content_factory("test/data/15s.srt")[0];
432 auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name(false)));
433 auto vf = new_test_film2(name + "_vf", { ov_dcp, ccaps });
434 ccaps->text[0]->set_type(TextType::CLOSED_CAPTION);
437 BOOST_CHECK(ov_dcp->can_reference_text(vf, TextType::OPEN_SUBTITLE, why_not));
438 std::cout << why_not << "\n";
442 BOOST_AUTO_TEST_CASE(test_duplicate_font_id_in_vf)
444 string const name("test_duplicate_font_id_in_vf");
445 auto subs = content_factory("test/data/15s.srt");
446 auto ov = new_test_film2(name + "_ov", subs);
450 dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
451 dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
452 dcp::VerificationNote::Code::MISSING_CPL_METADATA
455 auto ccaps = content_factory("test/data/15s.srt")[0];
456 auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name(false)));
457 auto vf = new_test_film2(name + "_vf", { ov_dcp, ccaps });
458 ov_dcp->set_reference_audio(true);
459 ov_dcp->set_reference_video(true);
460 ov_dcp->text[0]->set_use(true);
461 ccaps->text[0]->set_type(TextType::CLOSED_CAPTION);
463 BOOST_CHECK_MESSAGE(ov_dcp->can_reference_text(vf, TextType::OPEN_SUBTITLE, why_not), why_not);
464 ov_dcp->set_reference_text(TextType::OPEN_SUBTITLE, true);
465 vf->write_metadata();
466 make_dcp(vf, TranscodeJob::ChangedBehaviour::IGNORE);
467 BOOST_REQUIRE(!wait_for_jobs());
469 auto vf_dcp = make_shared<DCPContent>(vf->dir(vf->dcp_name(false)));
471 auto test = new_test_film2(name + "_test", { vf_dcp });
472 vf_dcp->add_ov(ov->dir(ov->dcp_name(false)));
473 JobManager::instance()->add(make_shared<ExamineContentJob>(test, vf_dcp));
474 BOOST_CHECK(!wait_for_jobs());
479 dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
480 dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
481 dcp::VerificationNote::Code::MISSING_CPL_METADATA,
486 BOOST_AUTO_TEST_CASE(test_referencing_ov_with_missing_subtitle_in_some_reels)
488 auto const path = boost::filesystem::path("build/test/test_referencing_ov_with_missing_subtitle_in_some_reels");
489 boost::filesystem::remove_all(path);
491 boost::filesystem::create_directories(path / "ov");
492 dcp::DCP ov(path / "ov");
494 auto make_picture = [path](string filename) {
495 auto pic = make_shared<dcp::MonoPictureAsset>(dcp::Fraction(24, 1), dcp::Standard::SMPTE);
496 auto writer = pic->start_write(path / "ov" / filename, dcp::PictureAsset::Behaviour::MAKE_NEW);
497 auto frame = dcp::ArrayData("test/data/picture.j2c");
498 for (int i = 0; i < 240; ++i) {
499 writer->write(frame);
505 auto pic1 = make_picture("pic1.mxf");
506 auto pic2 = make_picture("pic2.mxf");
508 auto sub1 = make_shared<dcp::SMPTESubtitleAsset>();
510 sub1->add(std::make_shared<dcp::SubtitleString>(
511 boost::optional<string>(), false, false, false, dcp::Colour(255, 255, 255),
512 42, 1, dcp::Time(0, 0, 5, 0, 24), dcp::Time(0, 0, 9, 0, 24),
513 0, dcp::HAlign::CENTER,
514 0, dcp::VAlign::CENTER,
515 0, dcp::Direction::LTR,
517 dcp::Effect::NONE, dcp::Colour(0, 0, 0),
518 dcp::Time{}, dcp::Time{},
519 0, vector<dcp::Ruby>{}
521 sub1->write(path / "ov" / "sub.mxf");
523 auto reel1_pic = make_shared<dcp::ReelMonoPictureAsset>(pic1, 0);
524 auto reel1_sub = make_shared<dcp::ReelSMPTESubtitleAsset>(sub1, dcp::Fraction(24, 1), 240, 0);
526 auto reel2_pic = make_shared<dcp::ReelMonoPictureAsset>(pic1, 0);
528 auto reel1 = make_shared<dcp::Reel>(reel1_pic, shared_ptr<dcp::ReelSoundAsset>(), reel1_sub);
529 auto reel2 = make_shared<dcp::Reel>(reel2_pic);
531 auto cpl = make_shared<dcp::CPL>("Test CPL", dcp::ContentKind::FEATURE, dcp::Standard::SMPTE);
538 auto dcp_ov = make_shared<DCPContent>(path / "ov");
539 auto vf = make_shared<Film>(path / "vf");
540 vf->set_dcp_content_type(DCPContentType::from_isdcf_name("TST"));
541 vf->set_container(Ratio::from_id("185"));
542 vf->write_metadata();
543 vf->examine_and_add_content(dcp_ov);
544 BOOST_REQUIRE(!wait_for_jobs());
545 vf->set_reel_type(ReelType::BY_VIDEO_CONTENT);
546 dcp_ov->set_reference_video(true);
547 dcp_ov->set_reference_text(TextType::OPEN_SUBTITLE, true);
549 vf->write_metadata();
550 make_dcp(vf, TranscodeJob::ChangedBehaviour::IGNORE);
551 BOOST_REQUIRE(!wait_for_jobs());
553 vector<dcp::VerificationNote::Code> ignore = {
554 dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
555 dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
556 dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING,
557 dcp::VerificationNote::Code::EXTERNAL_ASSET,
560 verify_dcp(vf->dir(vf->dcp_name()), ignore);
564 /* Test bug #2703: a VF that refers to some OV subs does not get the correct subtitle language in the ISDCF name */
565 BOOST_AUTO_TEST_CASE(ov_subs_in_vf_name)
567 auto subs = content_factory("test/data/short.srt")[0];
568 auto ov = new_test_film2("ov_subs_in_vf_name_ov", { subs });
569 subs->only_text()->set_language(dcp::LanguageTag("de"));
573 dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
574 dcp::VerificationNote::Code::MISSING_CPL_METADATA
577 auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
578 auto vf = new_test_film2("ov_subs_in_vf_name_vf", { ov_dcp });
580 ov_dcp->set_reference_text(TextType::OPEN_SUBTITLE, true);
581 vf->_isdcf_date = boost::gregorian::date(2023, boost::gregorian::Jan, 18);
583 BOOST_CHECK_EQUAL(vf->isdcf_name(false), "Foo_TST-1_F_XX-DE_51-HI-VI_2K_20230118_SMPTE_VF");