film->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE,
+ dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE
+ });
boost::filesystem::path p (test_film_dir ("4k_test"));
p /= film->dcp_name ();
&cl
);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film, {dcp::VerificationNote::Code::MISSING_CPL_METADATA});
auto ref = TestPaths::private_data() / "atmos_asset.mxf";
BOOST_REQUIRE (mxf_atmos_files_same(ref, dcp_file(film, "atmos"), true));
/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/audio_processor_test.cc
* @brief Test audio processors.
* @ingroup feature
*/
+
#include "lib/audio_processor.h"
#include "lib/analyse_audio_job.h"
#include "lib/dcp_content_type.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
+
using std::shared_ptr;
+using std::make_shared;
+
/** Test the mid-side decoder for analysis and DCP-making */
BOOST_AUTO_TEST_CASE (audio_processor_test)
{
- shared_ptr<Film> film = new_test_film ("audio_processor_test");
+ auto film = new_test_film ("audio_processor_test");
film->set_name ("audio_processor_test");
- shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/white.wav"));
+ auto c = make_shared<FFmpegContent>("test/data/white.wav");
film->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs());
film->set_audio_processor (AudioProcessor::from_id ("mid-side-decoder"));
/* Analyse the audio and check it doesn't crash */
- shared_ptr<AnalyseAudioJob> job (new AnalyseAudioJob (film, film->playlist(), false));
+ auto job = make_shared<AnalyseAudioJob> (film, film->playlist(), false);
JobManager::instance()->add (job);
BOOST_REQUIRE (!wait_for_jobs());
/* Make a DCP and check it */
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film, {dcp::VerificationNote::Code::MISSING_CPL_METADATA});
check_dcp ("test/data/audio_processor_test", film->dir (film->dcp_name ()));
}
content->subtitle->set_burn (true);
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
check_dcp ("test/data/burnt_subtitle_test_subrip", film->dir (film->dcp_name ()));
}
content->only_text()->set_type (TextType::CLOSED_CAPTION);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::INVALID_CLOSED_CAPTION_LINE_LENGTH,
+ dcp::VerificationNote::Code::MISSING_CPL_METADATA
+ });
/* Just check to see that there's a CCAP in the CPL: this
check could be better!
/*
- Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2019-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/dcp_decoder_test.cc
* @brief Test DCPDecoder class.
* @ingroup selfcontained
*/
+
#include "lib/film.h"
#include "lib/dcp_content.h"
#include "lib/dcp_decoder.h"
#include <boost/test/unit_test.hpp>
#include <iostream>
+
using std::list;
using std::string;
using std::vector;
using std::make_shared;
using std::shared_ptr;
+
/* Check that DCPDecoder reuses old data when it should */
BOOST_AUTO_TEST_CASE (check_reuse_old_data_test)
{
/* Make some DCPs */
- auto ov = new_test_film2 ("check_reuse_old_data_ov");
- ov->examine_and_add_content (content_factory("test/data/flat_red.png").front());
- BOOST_REQUIRE (!wait_for_jobs());
- ov->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ auto ov = new_test_film2 ("check_reuse_old_data_ov", {content_factory("test/data/flat_red.png").front()});
+ make_and_verify_dcp (ov);
- auto vf = new_test_film2 ("check_reuse_old_data_vf");
auto ov_content = make_shared<DCPContent>(ov->dir(ov->dcp_name(false)));
- vf->examine_and_add_content (ov_content);
- vf->examine_and_add_content (content_factory("test/data/L.wav").front());
- BOOST_REQUIRE (!wait_for_jobs());
+ auto vf = new_test_film2 ("check_reuse_old_data_vf", {ov_content, content_factory("test/data/L.wav").front()});
ov_content->set_reference_video (true);
- vf->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
auto encrypted = new_test_film2 ("check_reuse_old_data_decrypted");
encrypted->examine_and_add_content (content_factory("test/data/flat_red.png").front());
BOOST_REQUIRE (!wait_for_jobs());
encrypted->set_encrypted (true);
- encrypted->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (encrypted);
dcp::DCP encrypted_dcp (encrypted->dir(encrypted->dcp_name()));
encrypted_dcp.read ();
/*
- Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/digest_test.cc
* @brief Check computed DCP digests against references calculated by the `openssl` binary.
* @ingroup feature
*/
+
#include "lib/film.h"
#include "lib/image_content.h"
#include "lib/dcp_content_type.h"
#include <dcp/reel_picture_asset.h>
#include <boost/test/unit_test.hpp>
+
using std::list;
using std::string;
using std::shared_ptr;
+using std::make_shared;
+
static string
openssl_hash (boost::filesystem::path file)
{
- FILE* pipe = popen (String::compose ("openssl sha1 -binary %1 | openssl base64 -e", file.string()).c_str (), "r");
+ auto pipe = popen (String::compose ("openssl sha1 -binary %1 | openssl base64 -e", file.string()).c_str (), "r");
BOOST_REQUIRE (pipe);
char buffer[128];
string output;
return output;
}
+
/** Test the digests made by the DCP writing code on a multi-reel DCP */
BOOST_AUTO_TEST_CASE (digest_test)
{
- shared_ptr<Film> film = new_test_film ("digest_test");
+ auto film = new_test_film ("digest_test");
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
film->set_name ("digest_test");
- shared_ptr<ImageContent> r (new ImageContent("test/data/flat_red.png"));
- shared_ptr<ImageContent> g (new ImageContent("test/data/flat_green.png"));
- shared_ptr<ImageContent> b (new ImageContent("test/data/flat_blue.png"));
+ auto r = make_shared<ImageContent>("test/data/flat_red.png");
+ auto g = make_shared<ImageContent>("test/data/flat_green.png");
+ auto b = make_shared<ImageContent>("test/data/flat_blue.png");
film->examine_and_add_content (r);
film->examine_and_add_content (g);
film->examine_and_add_content (b);
BOOST_REQUIRE (!wait_for_jobs());
BOOST_CHECK (Config::instance()->master_encoding_threads() > 1);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
dcp::DCP dcp (film->dir (film->dcp_name ()));
dcp.read ();
/*
- Copyright (C) 2016-2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/ffmpeg_audio_only_test.cc
* @brief Test FFmpeg content with audio but no video.
* @ingroup feature
*/
+
#include "lib/film.h"
#include "lib/ffmpeg_content.h"
#include "lib/dcp_content_type.h"
#include <boost/test/unit_test.hpp>
#include <iostream>
+
using std::min;
+using std::shared_ptr;
+using std::make_shared;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
-using std::shared_ptr;
-static SNDFILE* ref = 0;
+
+static SNDFILE* ref = nullptr;
static int ref_buffer_size = 0;
-static float* ref_buffer = 0;
+static float* ref_buffer = nullptr;
+
static void
audio (std::shared_ptr<AudioBuffers> audio, int channels)
}
}
+
/** Test the FFmpeg code with audio-only content */
static shared_ptr<Film>
test (boost::filesystem::path file)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_audio_only_test");
+ auto film = new_test_film ("ffmpeg_audio_only_test");
film->set_name ("test_film");
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
- shared_ptr<FFmpegContent> c (new FFmpegContent(file));
+ auto c = make_shared<FFmpegContent>(file);
film->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs());
film->write_metadata ();
/* See if can make a DCP without any errors */
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film, {dcp::VerificationNote::Code::MISSING_CPL_METADATA});
BOOST_CHECK (!JobManager::instance()->errors());
/* Compare the audio data player reads with what libsndfile reads */
ref_buffer_size = info.samplerate * info.channels;
ref_buffer = new float[ref_buffer_size];
- shared_ptr<Player> player (new Player(film));
+ auto player = make_shared<Player>(film);
player->Audio.connect (bind (&audio, _1, info.channels));
while (!player->pass ()) {}
return film;
}
+
BOOST_AUTO_TEST_CASE (ffmpeg_audio_only_test1)
{
/* S16 */
- shared_ptr<Film> film = test ("test/data/staircase.wav");
+ auto film = test ("test/data/staircase.wav");
/* Compare the audio data in the DCP with what libsndfile reads */
/* We don't want to test anything that requires resampling */
BOOST_REQUIRE_EQUAL (info.samplerate, 48000);
- int16_t* buffer = new int16_t[info.channels * 2000];
+ auto buffer = new int16_t[info.channels * 2000];
dcp::SoundAsset asset (dcp_file(film, "pcm"));
- shared_ptr<dcp::SoundAssetReader> reader = asset.start_read ();
+ auto reader = asset.start_read ();
for (int i = 0; i < asset.intrinsic_duration(); ++i) {
- shared_ptr<const dcp::SoundFrame> frame = reader->get_frame(i);
+ auto frame = reader->get_frame(i);
sf_count_t this_time = min (info.frames, sf_count_t(2000));
sf_readf_short (ref, buffer, this_time);
for (int j = 0; j < this_time; ++j) {
delete[] buffer;
}
+
BOOST_AUTO_TEST_CASE (ffmpeg_audio_only_test2)
{
/* S32 1 channel */
- shared_ptr<Film> film = test ("test/data/sine_440.wav");
+ auto film = test ("test/data/sine_440.wav");
/* Compare the audio data in the DCP with what libsndfile reads */
/* We don't want to test anything that requires resampling */
BOOST_REQUIRE_EQUAL (info.samplerate, 48000);
- int32_t* buffer = new int32_t[info.channels * 2000];
+ auto buffer = new int32_t[info.channels * 2000];
dcp::SoundAsset asset (dcp_file(film, "pcm"));
- shared_ptr<dcp::SoundAssetReader> reader = asset.start_read ();
+ auto reader = asset.start_read ();
for (int i = 0; i < asset.intrinsic_duration(); ++i) {
- shared_ptr<const dcp::SoundFrame> frame = reader->get_frame(i);
+ auto frame = reader->get_frame(i);
sf_count_t this_time = min (info.frames, sf_count_t(2000));
sf_readf_int (ref, buffer, this_time);
for (int j = 0; j < this_time; ++j) {
delete[] buffer;
}
+
BOOST_AUTO_TEST_CASE (ffmpeg_audio_only_test3)
{
/* S24 1 channel */
- shared_ptr<Film> film = test ("test/data/sine_24_48_440.wav");
+ auto film = test ("test/data/sine_24_48_440.wav");
/* Compare the audio data in the DCP with what libsndfile reads */
/* We don't want to test anything that requires resampling */
BOOST_REQUIRE_EQUAL (info.samplerate, 48000);
- int32_t* buffer = new int32_t[info.channels * 2000];
+ auto buffer = new int32_t[info.channels * 2000];
dcp::SoundAsset asset (dcp_file(film, "pcm"));
- shared_ptr<dcp::SoundAssetReader> reader = asset.start_read ();
+ auto reader = asset.start_read ();
for (int i = 0; i < asset.intrinsic_duration(); ++i) {
- shared_ptr<const dcp::SoundFrame> frame = reader->get_frame(i);
+ auto frame = reader->get_frame(i);
sf_count_t this_time = min (info.frames, sf_count_t(2000));
sf_readf_int (ref, buffer, this_time);
for (int j = 0; j < this_time; ++j) {
/*
- Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/ffmpeg_audio_test.cc
* @brief Test reading audio from an FFmpeg file.
* @ingroup feature
*/
+
#include "lib/ffmpeg_content.h"
#include "lib/film.h"
#include "lib/dcp_content_type.h"
#include <dcp/reel.h>
#include <boost/test/unit_test.hpp>
+
+using std::make_shared;
using std::string;
using std::shared_ptr;
+
BOOST_AUTO_TEST_CASE (ffmpeg_audio_test)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_audio_test");
+ auto film = new_test_film ("ffmpeg_audio_test");
film->set_name ("ffmpeg_audio_test");
- shared_ptr<FFmpegContent> c (new FFmpegContent ("test/data/staircase.mov"));
+ auto c = make_shared<FFmpegContent> ("test/data/staircase.mov");
film->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs());
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
- film->make_dcp ();
- film->write_metadata ();
-
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
boost::filesystem::path path = "build/test";
path /= "ffmpeg_audio_test";
dcp::DCP check (path.string ());
check.read ();
- shared_ptr<const dcp::ReelSoundAsset> sound_asset = check.cpls().front()->reels().front()->main_sound ();
+ auto sound_asset = check.cpls().front()->reels().front()->main_sound ();
BOOST_CHECK (sound_asset);
BOOST_CHECK_EQUAL (sound_asset->asset()->channels (), 6);
int frame = 0;
while (n < sound_asset->asset()->intrinsic_duration()) {
- shared_ptr<const dcp::SoundFrame> sound_frame = sound_asset->asset()->start_read()->get_frame (frame++);
+ auto sound_frame = sound_asset->asset()->start_read()->get_frame (frame++);
uint8_t const * d = sound_frame->data ();
for (int i = 0; i < sound_frame->size(); i += (3 * sound_asset->asset()->channels())) {
}
}
+
/** Decode a file containing truehd so we can profile it; this is with the player set to normal */
BOOST_AUTO_TEST_CASE (ffmpeg_audio_test2)
{
- shared_ptr<Film> film = new_test_film2 ("ffmpeg_audio_test2");
- shared_ptr<Content> content = content_factory(TestPaths::private_data() / "wayne.mkv").front();
+ auto film = new_test_film2 ("ffmpeg_audio_test2");
+ auto content = content_factory(TestPaths::private_data() / "wayne.mkv").front();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<Player> player (new Player(film));
+ auto player = make_shared<Player>(film);
while (!player->pass ()) {}
}
+
/** Decode a file containing truehd so we can profile it; this is with the player set to fast */
BOOST_AUTO_TEST_CASE (ffmpeg_audio_test3)
{
- shared_ptr<Film> film = new_test_film2 ("ffmpeg_audio_test3");
- shared_ptr<Content> content = content_factory(TestPaths::private_data() / "wayne.mkv").front();
+ auto film = new_test_film2 ("ffmpeg_audio_test3");
+ auto content = content_factory(TestPaths::private_data() / "wayne.mkv").front();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<Player> player (new Player(film));
+ auto player = make_shared<Player>(film);
player->set_fast ();
while (!player->pass ()) {}
}
/** Decode a file whose audio previously crashed DCP-o-matic (#1857) */
BOOST_AUTO_TEST_CASE (ffmpeg_audio_test4)
{
- shared_ptr<Film> film = new_test_film2 ("ffmpeg_audio_test4");
- shared_ptr<Content> content = content_factory(TestPaths::private_data() / "Actuellement aout 2020.wmv").front();
+ auto film = new_test_film2 ("ffmpeg_audio_test4");
+ auto content = content_factory(TestPaths::private_data() / "Actuellement aout 2020.wmv").front();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<Player> player (new Player(film));
+ auto player = make_shared<Player>(film);
player->set_fast ();
BOOST_CHECK_NO_THROW (while (!player->pass()) {});
}
*/
+
#include "lib/ffmpeg_encoder.h"
#include "lib/film.h"
#include "lib/ffmpeg_content.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
+
using std::string;
using std::shared_ptr;
using std::make_shared;
using boost::optional;
using namespace dcpomatic;
+
static void
ffmpeg_content_test (int number, boost::filesystem::path content, ExportFormat format)
{
cl.run ();
}
+
/** Red / green / blue MP4 -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test1)
{
ffmpeg_content_test (1, "test/data/test.mp4", ExportFormat::PRORES);
}
+
/** Dolby Aurora trailer VOB -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test2)
{
ffmpeg_content_test (2, TestPaths::private_data() / "dolby_aurora.vob", ExportFormat::PRORES);
}
+
/** Sintel trailer -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test3)
{
ffmpeg_content_test (3, TestPaths::private_data() / "Sintel_Trailer1.480p.DivX_Plus_HD.mkv", ExportFormat::PRORES);
}
+
/** Big Buck Bunny trailer -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test4)
{
ffmpeg_content_test (4, TestPaths::private_data() / "big_buck_bunny_trailer_480p.mov", ExportFormat::PRORES);
}
+
/** Still image -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test5)
{
auto film = new_test_film ("ffmpeg_encoder_prores_test5");
film->set_name ("ffmpeg_encoder_prores_test5");
- shared_ptr<ImageContent> c (new ImageContent(TestPaths::private_data() / "bbc405.png"));
+ auto c = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
c->video->set_length (240);
film->write_metadata ();
- shared_ptr<Job> job (new TranscodeJob (film));
+ auto job = make_shared<TranscodeJob> (film);
FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test5.mov", ExportFormat::PRORES, false, false, false, 23);
encoder.go ();
}
+
/** Subs -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test6)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_encoder_prores_test6");
+ auto film = new_test_film ("ffmpeg_encoder_prores_test6");
film->set_name ("ffmpeg_encoder_prores_test6");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip2.srt"));
+ auto s = make_shared<StringTextFileContent>("test/data/subrip2.srt");
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
s->only_text()->set_colour (dcp::Colour (255, 255, 0));
s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255));
film->write_metadata();
- shared_ptr<Job> job (new TranscodeJob (film));
+ auto job = make_shared<TranscodeJob> (film);
FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test6.mov", ExportFormat::PRORES, false, false, false, 23);
encoder.go ();
}
+
/** Video + subs -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test7)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_encoder_prores_test7");
+ auto film = new_test_film ("ffmpeg_encoder_prores_test7");
film->set_name ("ffmpeg_encoder_prores_test7");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
+ auto c = make_shared<FFmpegContent>("test/data/test.mp4");
film->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip.srt"));
+ auto s = make_shared<StringTextFileContent>("test/data/subrip.srt");
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
s->only_text()->set_colour (dcp::Colour (255, 255, 0));
s->only_text()->set_effect (dcp::Effect::SHADOW);
s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255));
- shared_ptr<Job> job (new TranscodeJob (film));
+ auto job = make_shared<TranscodeJob> (film);
FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test7.mov", ExportFormat::PRORES, false, false, false, 23);
encoder.go ();
}
+
/** Red / green / blue MP4 -> H264 */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test1)
{
ffmpeg_content_test(1, "test/data/test.mp4", ExportFormat::H264_AAC);
}
+
/** Just subtitles -> H264 */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test2)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_encoder_h264_test2");
+ auto film = new_test_film ("ffmpeg_encoder_h264_test2");
film->set_name ("ffmpeg_encoder_h264_test2");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip2.srt"));
+ auto s = make_shared<StringTextFileContent>("test/data/subrip2.srt");
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
s->only_text()->set_colour (dcp::Colour (255, 255, 0));
s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255));
film->write_metadata();
- shared_ptr<Job> job (new TranscodeJob (film));
+ auto job = make_shared<TranscodeJob> (film);
FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test2.mp4", ExportFormat::H264_AAC, false, false, false, 23);
encoder.go ();
}
+
/** Video + subs -> H264 */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test3)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_encoder_h264_test3");
+ auto film = new_test_film ("ffmpeg_encoder_h264_test3");
film->set_name ("ffmpeg_encoder_h264_test3");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
+ auto c = make_shared<FFmpegContent>("test/data/test.mp4");
film->examine_and_add_content (c);
- BOOST_REQUIRE (!wait_for_jobs ());
+ BOOST_REQUIRE (!wait_for_jobs());
- shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip.srt"));
+ auto s = make_shared<StringTextFileContent>("test/data/subrip.srt");
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
s->only_text()->set_colour (dcp::Colour (255, 255, 0));
s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255));
film->write_metadata();
- shared_ptr<Job> job (new TranscodeJob (film));
+ auto job = make_shared<TranscodeJob> (film);
FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test3.mp4", ExportFormat::H264_AAC, false, false, false, 23);
encoder.go ();
}
+
/** Scope-in-flat DCP -> H264 */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test4)
{
- shared_ptr<Film> film = new_test_film2("ffmpeg_encoder_h264_test4");
- film->examine_and_add_content(shared_ptr<DCPContent>(new DCPContent("test/data/scope_dcp")));
+ auto film = new_test_film2("ffmpeg_encoder_h264_test4", {make_shared<DCPContent>("test/data/scope_dcp")});
BOOST_REQUIRE(!wait_for_jobs());
film->set_container(Ratio::from_id("185"));
- shared_ptr<Job> job(new TranscodeJob(film));
+ auto job = make_shared<TranscodeJob>(film);
FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test4.mp4", ExportFormat::H264_AAC, false, false, false, 23);
encoder.go();
}
+
/** Test mixdown from 5.1 to stereo */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test5)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_transcoder_h264_test5");
+ auto film = new_test_film ("ffmpeg_transcoder_h264_test5");
film->set_name ("ffmpeg_transcoder_h264_test5");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<FFmpegContent> L (new FFmpegContent("test/data/L.wav"));
+ auto L = make_shared<FFmpegContent>("test/data/L.wav");
film->examine_and_add_content (L);
- shared_ptr<FFmpegContent> R (new FFmpegContent("test/data/R.wav"));
+ auto R = make_shared<FFmpegContent>("test/data/R.wav");
film->examine_and_add_content (R);
- shared_ptr<FFmpegContent> C (new FFmpegContent("test/data/C.wav"));
+ auto C = make_shared<FFmpegContent>("test/data/C.wav");
film->examine_and_add_content (C);
- shared_ptr<FFmpegContent> Ls (new FFmpegContent("test/data/Ls.wav"));
+ auto Ls = make_shared<FFmpegContent>("test/data/Ls.wav");
film->examine_and_add_content (Ls);
- shared_ptr<FFmpegContent> Rs (new FFmpegContent("test/data/Rs.wav"));
+ auto Rs = make_shared<FFmpegContent>("test/data/Rs.wav");
film->examine_and_add_content (Rs);
- shared_ptr<FFmpegContent> Lfe (new FFmpegContent("test/data/Lfe.wav"));
+ auto Lfe = make_shared<FFmpegContent>("test/data/Lfe.wav");
film->examine_and_add_content (Lfe);
BOOST_REQUIRE (!wait_for_jobs ());
map.set (0, 5, 1);
Rs->audio->set_mapping (map);
- shared_ptr<Job> job (new TranscodeJob (film));
+ auto job = make_shared<TranscodeJob> (film);
FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test5.mp4", ExportFormat::H264_AAC, true, false, false, 23);
encoder.go ();
check_ffmpeg ("build/test/ffmpeg_encoder_h264_test5.mp4", "test/data/ffmpeg_encoder_h264_test5.mp4", 1);
}
+
/** Test export of a VF */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test6)
{
- shared_ptr<Film> film = new_test_film2 ("ffmpeg_encoder_h264_test6_ov");
- film->examine_and_add_content (shared_ptr<ImageContent>(new ImageContent(TestPaths::private_data() / "bbc405.png")));
- BOOST_REQUIRE (!wait_for_jobs());
- film->make_dcp ();
+ auto film = new_test_film2 ("ffmpeg_encoder_h264_test6_ov");
+ film->examine_and_add_content (make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png"));
BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
- shared_ptr<Film> film2 = new_test_film2 ("ffmpeg_encoder_h264_test6_vf");
- shared_ptr<DCPContent> ov (new DCPContent("build/test/ffmpeg_encoder_h264_test6_ov/" + film->dcp_name(false)));
+ auto film2 = new_test_film2 ("ffmpeg_encoder_h264_test6_vf");
+ auto ov = make_shared<DCPContent>("build/test/ffmpeg_encoder_h264_test6_ov/" + film->dcp_name(false));
film2->examine_and_add_content (ov);
BOOST_REQUIRE (!wait_for_jobs());
ov->set_reference_video (true);
- shared_ptr<Content> subs = content_factory("test/data/subrip.srt").front();
+ auto subs = content_factory("test/data/subrip.srt").front();
film2->examine_and_add_content (subs);
BOOST_REQUIRE (!wait_for_jobs());
for (auto i: subs->text) {
i->set_use (true);
}
- shared_ptr<Job> job (new TranscodeJob (film2));
+ auto job = make_shared<TranscodeJob> (film2);
FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test6_vf.mp4", ExportFormat::H264_AAC, true, false, false, 23);
encoder.go ();
}
+
/** Test export of a 3D DCP in a 2D project */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test7)
{
- shared_ptr<Film> film = new_test_film2 ("ffmpeg_encoder_h264_test7_data");
- shared_ptr<Content> L (shared_ptr<ImageContent>(new ImageContent(TestPaths::private_data() / "bbc405.png")));
- film->examine_and_add_content (L);
- shared_ptr<Content> R (shared_ptr<ImageContent>(new ImageContent(TestPaths::private_data() / "bbc405.png")));
- film->examine_and_add_content (R);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto L = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png");
+ auto R = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png");
+ auto film = new_test_film2 ("ffmpeg_encoder_h264_test7_data", {L, R});
L->video->set_frame_type (VideoFrameType::THREE_D_LEFT);
L->set_position (film, DCPTime());
R->video->set_frame_type (VideoFrameType::THREE_D_RIGHT);
R->set_position (film, DCPTime());
film->set_three_d (true);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
- shared_ptr<Film> film2 = new_test_film2 ("ffmpeg_encoder_h264_test7_export");
- shared_ptr<Content> dcp (new DCPContent(film->dir(film->dcp_name())));
- film2->examine_and_add_content (dcp);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto dcp = make_shared<DCPContent>(film->dir(film->dcp_name()));
+ auto film2 = new_test_film2 ("ffmpeg_encoder_h264_test7_export", {dcp});
- shared_ptr<Job> job (new TranscodeJob (film2));
+ auto job = make_shared<TranscodeJob> (film2);
FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test7.mp4", ExportFormat::H264_AAC, true, false, false, 23);
encoder.go ();
}
/*
- Copyright (C) 2016-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/file_naming_test.cc
* @brief Test how files in DCPs are named.
* @ingroup feature
*/
+
#include "test.h"
#include "lib/config.h"
#include "lib/film.h"
#include <boost/test/unit_test.hpp>
#include <boost/regex.hpp>
+
using std::string;
using std::shared_ptr;
+using std::make_shared;
+
class Keep
{
dcp::NameFormat _format;
};
+
BOOST_AUTO_TEST_CASE (file_naming_test)
{
Keep k;
- Config::instance()->set_dcp_asset_filename_format (dcp::NameFormat ("%c"));
+ Config::instance()->set_dcp_asset_filename_format (dcp::NameFormat("%c"));
- shared_ptr<Film> film = new_test_film ("file_naming_test");
+ auto film = new_test_film ("file_naming_test");
film->set_name ("file_naming_test");
film->set_video_frame_rate (24);
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
- shared_ptr<FFmpegContent> r (new FFmpegContent("test/data/flat_red.png"));
+ auto r = make_shared<FFmpegContent>("test/data/flat_red.png");
film->examine_and_add_content (r);
- shared_ptr<FFmpegContent> g (new FFmpegContent("test/data/flat_green.png"));
+ auto g = make_shared<FFmpegContent>("test/data/flat_green.png");
film->examine_and_add_content (g);
- shared_ptr<FFmpegContent> b (new FFmpegContent("test/data/flat_blue.png"));
+ auto b = make_shared<FFmpegContent>("test/data/flat_blue.png");
film->examine_and_add_content (b);
BOOST_REQUIRE (!wait_for_jobs());
film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
film->write_metadata ();
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE,
+ dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE
+ });
int got[3] = { 0, 0, 0 };
- for (
- boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (film->file(film->dcp_name()));
- i != boost::filesystem::directory_iterator();
- ++i) {
- if (boost::regex_match(i->path().string(), boost::regex(".*flat_red\\.png_.*\\.mxf"))) {
+ for (auto i: boost::filesystem::directory_iterator(film->file(film->dcp_name()))) {
+ if (boost::regex_match(i.path().string(), boost::regex(".*flat_red\\.png_.*\\.mxf"))) {
++got[0];
- } else if (boost::regex_match(i->path().string(), boost::regex(".*flat_green\\.png_.*\\.mxf"))) {
+ } else if (boost::regex_match(i.path().string(), boost::regex(".*flat_green\\.png_.*\\.mxf"))) {
++got[1];
- } else if (boost::regex_match(i->path().string(), boost::regex(".*flat_blue\\.png_.*\\.mxf"))) {
+ } else if (boost::regex_match(i.path().string(), boost::regex(".*flat_blue\\.png_.*\\.mxf"))) {
++got[2];
}
}
}
}
+
BOOST_AUTO_TEST_CASE (file_naming_test2)
{
Keep k;
Config::instance()->set_dcp_asset_filename_format (dcp::NameFormat ("%c"));
- shared_ptr<Film> film = new_test_film ("file_naming_test2");
+ auto film = new_test_film ("file_naming_test2");
film->set_name ("file_naming_test2");
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
boost::filesystem::path::imbue(std::locale());
#endif
- shared_ptr<FFmpegContent> r (new FFmpegContent("test/data/flät_red.png"));
+ auto r = make_shared<FFmpegContent>("test/data/flät_red.png");
film->examine_and_add_content (r);
- shared_ptr<FFmpegContent> g (new FFmpegContent("test/data/flat_green.png"));
+ auto g = make_shared<FFmpegContent>("test/data/flat_green.png");
film->examine_and_add_content (g);
- shared_ptr<FFmpegContent> b (new FFmpegContent("test/data/flat_blue.png"));
+ auto b = make_shared<FFmpegContent>("test/data/flat_blue.png");
film->examine_and_add_content (b);
BOOST_REQUIRE (!wait_for_jobs());
b->video->set_length (24);
film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE,
+ dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE
+ });
int got[3] = { 0, 0, 0 };
- for (
- boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (film->file(film->dcp_name()));
- i != boost::filesystem::directory_iterator();
- ++i) {
- if (boost::regex_match(i->path().string(), boost::regex(".*flat_red\\.png_.*\\.mxf"))) {
+ for (auto i: boost::filesystem::directory_iterator (film->file(film->dcp_name()))) {
+ if (boost::regex_match(i.path().string(), boost::regex(".*flat_red\\.png_.*\\.mxf"))) {
++got[0];
- } else if (boost::regex_match(i->path().string(), boost::regex(".*flat_green\\.png_.*\\.mxf"))) {
+ } else if (boost::regex_match(i.path().string(), boost::regex(".*flat_green\\.png_.*\\.mxf"))) {
++got[1];
- } else if (boost::regex_match(i->path().string(), boost::regex(".*flat_blue\\.png_.*\\.mxf"))) {
+ } else if (boost::regex_match(i.path().string(), boost::regex(".*flat_blue\\.png_.*\\.mxf"))) {
++got[2];
}
}
A->set_encrypted (true);
BOOST_CHECK (!wait_for_jobs ());
- A->make_dcp ();
- BOOST_CHECK (!wait_for_jobs ());
+ make_and_verify_dcp (A);
dcp::DCP A_dcp ("build/test/import_dcp_test/" + A->dcp_name());
A_dcp.read ();
JobManager::instance()->add (make_shared<ExamineContentJob>(B, d));
BOOST_CHECK (!wait_for_jobs ());
- B->make_dcp ();
- BOOST_CHECK (!wait_for_jobs ());
+ make_and_verify_dcp (B);
/* Should be 1s red, 1s green, 1s blue */
check_dcp ("test/data/import_dcp_test2", "build/test/import_dcp_test2/" + B->dcp_name());
content->video->set_length (24 * 60 * 10);
- film->set_marker(dcp::Marker::FFOC, dcpomatic::DCPTime::from_seconds(1.91));
+ film->set_marker(dcp::Marker::FFOC, dcpomatic::DCPTime::from_frames(1, 24));
film->set_marker(dcp::Marker::FFMC, dcpomatic::DCPTime::from_seconds(9.4));
film->set_marker(dcp::Marker::LFMC, dcpomatic::DCPTime::from_seconds(9.99));
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
/* Import the DCP to a new film and check the markers */
auto imported = make_shared<DCPContent>(film->dir(film->dcp_name()));
BOOST_CHECK_EQUAL (imported->markers().size(), 4U);
auto markers = imported->markers();
- BOOST_REQUIRE(markers.find(dcp::Marker::FFOC) != markers.end());
- BOOST_CHECK(markers[dcp::Marker::FFOC] == dcpomatic::ContentTime(184000));
BOOST_REQUIRE(markers.find(dcp::Marker::FFMC) != markers.end());
BOOST_CHECK(markers[dcp::Marker::FFMC] == dcpomatic::ContentTime(904000));
BOOST_REQUIRE(markers.find(dcp::Marker::LFMC) != markers.end());
BOOST_CHECK_EQUAL (reloaded->markers().size(), 4U);
markers = reloaded->markers();
- BOOST_REQUIRE(markers.find(dcp::Marker::FFOC) != markers.end());
- BOOST_CHECK(markers[dcp::Marker::FFOC] == dcpomatic::ContentTime(184000));
BOOST_REQUIRE(markers.find(dcp::Marker::FFMC) != markers.end());
BOOST_CHECK(markers[dcp::Marker::FFMC] == dcpomatic::ContentTime(904000));
BOOST_REQUIRE(markers.find(dcp::Marker::LFMC) != markers.end());
vector<string> cv = { "Fred "};
film->set_content_versions (cv);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
/* Import the DCP to a new film and check the metadata */
auto film2 = new_test_film2 ("import_dcp_metadata_test2");
/*
- Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/bandwidth_test.cc
* @brief Test whether we output whatever J2K bandwidth is requested.
* @ingroup feature
*/
+
#include "test.h"
#include "lib/dcp_content_type.h"
#include "lib/film.h"
#include <boost/test/unit_test.hpp>
+using std::make_shared;
using std::string;
using std::shared_ptr;
+
static void
check (int target_bits_per_second)
{
int const duration = 10;
string const name = "bandwidth_test_" + dcp::raw_convert<string> (target_bits_per_second);
- shared_ptr<Film> film = new_test_film (name);
+ auto film = new_test_film (name);
film->set_name (name);
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
film->set_j2k_bandwidth (target_bits_per_second);
- shared_ptr<ImageContent> content (new ImageContent(TestPaths::private_data() / "prophet_frame.tiff"));
+ auto content = make_shared<ImageContent>(TestPaths::private_data() / "prophet_frame.tiff");
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs());
content->video->set_length (24 * duration);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE,
+ dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE,
+ dcp::VerificationNote::Code::NEARLY_INVALID_PICTURE_FRAME_SIZE_IN_BYTES
+ });
- boost::filesystem::directory_iterator i (boost::filesystem::path ("build") / "test" / name / "video");
+ boost::filesystem::directory_iterator i (boost::filesystem::path("build") / "test" / name / "video");
boost::filesystem::path test = *i++;
- BOOST_REQUIRE (i == boost::filesystem::directory_iterator ());
+ BOOST_REQUIRE (i == boost::filesystem::directory_iterator());
double actual_bits_per_second = boost::filesystem::file_size(test) * 8.0 / duration;
BOOST_CHECK ((actual_bits_per_second / target_bits_per_second) < 1.15);
}
+
BOOST_AUTO_TEST_CASE (bandwidth_test)
{
check (50000000);
BOOST_REQUIRE (!wait_for_jobs());
film->set_interop (false);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
dcp::DCP dcp (String::compose("build/test/%1/%2", name, film->dcp_name()));
dcp.read ();
film->set_interop (false);
film->set_marker (dcp::Marker::FFOC, dcpomatic::DCPTime::from_seconds(1));
film->set_marker (dcp::Marker::LFOC, dcpomatic::DCPTime::from_seconds(9));
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::INCORRECT_FFOC,
+ dcp::VerificationNote::Code::INCORRECT_LFOC
+ });
dcp::DCP dcp (String::compose("build/test/%1/%2", name, film->dcp_name()));
dcp.read ();
/*
- Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "lib/dcp_encoder.h"
#include "lib/writer.h"
#include "lib/transcode_job.h"
#include <boost/test/unit_test.hpp>
#include <boost/algorithm/string.hpp>
+
using std::getline;
using std::ifstream;
using std::string;
using std::dynamic_pointer_cast;
using std::shared_ptr;
+
static
void
check (string name, int check_full, int check_repeat)
BOOST_CHECK_EQUAL (repeat, check_repeat);
}
+
/** Make a 2D DCP out of a 2D still and check that the J2K encoding is only done once for each frame */
BOOST_AUTO_TEST_CASE (optimise_stills_test1)
{
- shared_ptr<Film> film = new_test_film ("optimise_stills_test1");
+ auto film = new_test_film ("optimise_stills_test1");
LogSwitcher ls (film->log());
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<Content> content = content_factory("test/data/flat_red.png").front ();
+ auto content = content_factory("test/data/flat_red.png").front ();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film);
check ("optimise_stills_test1", 1, 10 * 24 - 1);
}
+
/** Make a 3D DCP out of a 3D L/R still and check that the J2K encoding is only done once for L and R */
BOOST_AUTO_TEST_CASE (optimise_stills_test2)
{
- shared_ptr<Film> film = new_test_film ("optimise_stills_test2");
+ auto film = new_test_film ("optimise_stills_test2");
LogSwitcher ls (film->log());
film->set_container (Ratio::from_id ("185"));
- film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
+ film->set_dcp_content_type (DCPContentType::from_isdcf_name("TLR"));
film->set_name ("frobozz");
- shared_ptr<Content> content = content_factory("test/data/flat_red.png").front ();
+ auto content = content_factory("test/data/flat_red.png").front();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
content->video->set_frame_type (VideoFrameType::THREE_D_LEFT_RIGHT);
film->set_three_d (true);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film);
check ("optimise_stills_test2", 2, 10 * 48 - 2);
}
BOOST_CHECK (player->_black.done());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
dcp::DCP back (film->dir(film->dcp_name()));
back.read ();
/*
- Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/player_test.cc
* @brief Test Player class.
* @ingroup selfcontained
*/
+
#include "lib/film.h"
#include "lib/ffmpeg_content.h"
#include "lib/dcp_content_type.h"
#include <boost/algorithm/string.hpp>
#include <iostream>
+
using std::cout;
using std::list;
using std::pair;
using std::shared_ptr;
+using std::make_shared;
using boost::bind;
using boost::optional;
#if BOOST_VERSION >= 106100
#endif
using namespace dcpomatic;
+
static shared_ptr<AudioBuffers> accumulated;
+
static void
accumulate (shared_ptr<AudioBuffers> audio, DCPTime)
{
accumulated->append (audio);
}
+
/** Check that the Player correctly generates silence when used with a silent FFmpegContent */
BOOST_AUTO_TEST_CASE (player_silence_padding_test)
{
- shared_ptr<Film> film = new_test_film ("player_silence_padding_test");
+ auto film = new_test_film ("player_silence_padding_test");
film->set_name ("player_silence_padding_test");
- shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
+ auto c = std::make_shared<FFmpegContent>("test/data/test.mp4");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
film->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs());
- accumulated.reset (new AudioBuffers (film->audio_channels(), 0));
+ accumulated = std::make_shared<AudioBuffers>(film->audio_channels(), 0);
- shared_ptr<Player> player (new Player(film));
+ auto player = std::make_shared<Player>(film);
player->Audio.connect (bind (&accumulate, _1, _2));
while (!player->pass ()) {}
BOOST_REQUIRE (accumulated->frames() >= 48000);
}
}
+
/* Test insertion of black frames between separate bits of video content */
BOOST_AUTO_TEST_CASE (player_black_fill_test)
{
- shared_ptr<Film> film = new_test_film ("black_fill_test");
+ auto film = new_test_film ("black_fill_test");
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
film->set_name ("black_fill_test");
film->set_container (Ratio::from_id ("185"));
film->set_sequence (false);
film->set_interop (false);
- shared_ptr<ImageContent> contentA (new ImageContent("test/data/simple_testcard_640x480.png"));
- shared_ptr<ImageContent> contentB (new ImageContent("test/data/simple_testcard_640x480.png"));
+ auto contentA = std::make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
+ auto contentB = std::make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
film->examine_and_add_content (contentA);
film->examine_and_add_content (contentB);
contentB->set_position (film, DCPTime::from_frames(7, film->video_frame_rate()));
contentB->video->set_custom_ratio (1.85);
- film->make_dcp ();
-
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE,
+ dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE
+ });
boost::filesystem::path ref;
ref = "test";
check_dcp (ref.string(), check.string());
}
+
/** Check behaviour with an awkward playlist whose data does not end on a video frame start */
BOOST_AUTO_TEST_CASE (player_subframe_test)
{
- shared_ptr<Film> film = new_test_film ("reels_test7");
+ auto film = new_test_film ("reels_test7");
film->set_name ("reels_test7");
- film->set_container (Ratio::from_id ("185"));
- film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
- shared_ptr<Content> A = content_factory("test/data/flat_red.png").front();
+ film->set_container (Ratio::from_id("185"));
+ film->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
+ auto A = content_factory("test/data/flat_red.png").front();
film->examine_and_add_content (A);
- BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<Content> B = content_factory("test/data/awkward_length.wav").front();
+ BOOST_REQUIRE (!wait_for_jobs());
+ auto B = content_factory("test/data/awkward_length.wav").front();
film->examine_and_add_content (B);
- BOOST_REQUIRE (!wait_for_jobs ());
+ BOOST_REQUIRE (!wait_for_jobs());
film->set_video_frame_rate (24);
A->video->set_length (3 * 24);
/* Length should be rounded up from B's length to the next video frame */
BOOST_CHECK (film->length() == DCPTime::from_frames(3 * 24 + 1, 24));
- shared_ptr<Player> player (new Player(film));
+ auto player = std::make_shared<Player>(film);
player->setup_pieces ();
BOOST_REQUIRE_EQUAL (player->_black._periods.size(), 1U);
BOOST_CHECK (player->_black._periods.front() == DCPTimePeriod(DCPTime::from_frames(3 * 24, 24), DCPTime::from_frames(3 * 24 + 1, 24)));
BOOST_CHECK (player->_silent._periods.front() == DCPTimePeriod(DCPTime(289920), DCPTime::from_frames(3 * 24 + 1, 24)));
}
+
static Frame video_frames;
static Frame audio_frames;
+
static void
video (shared_ptr<PlayerVideo>, DCPTime)
{
audio_frames += audio->frames();
}
+
/** Check with a video-only file that the video and audio emissions happen more-or-less together */
BOOST_AUTO_TEST_CASE (player_interleave_test)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_transcoder_basic_test_subs");
+ auto film = new_test_film ("ffmpeg_transcoder_basic_test_subs");
film->set_name ("ffmpeg_transcoder_basic_test");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
+ auto c = std::make_shared<FFmpegContent>("test/data/test.mp4");
film->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip.srt"));
+ auto s = std::make_shared<StringTextFileContent>("test/data/subrip.srt");
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<Player> player (new Player(film));
+ auto player = std::make_shared<Player>(film);
player->Video.connect (bind (&video, _1, _2));
player->Audio.connect (bind (&audio, _1, _2));
video_frames = audio_frames = 0;
}
}
+
/** Test some seeks towards the start of a DCP with awkward subtitles; see mantis #1085
* and a number of others. I thought this was a player seek bug but in fact it was
* caused by the subtitle starting just after the start of the video frame and hence
*/
BOOST_AUTO_TEST_CASE (player_seek_test)
{
- shared_ptr<Film> film (new Film (optional<boost::filesystem::path>()));
- shared_ptr<DCPContent> dcp (new DCPContent(TestPaths::private_data() / "awkward_subs"));
+ auto film = std::make_shared<Film>(optional<boost::filesystem::path>());
+ auto dcp = std::make_shared<DCPContent>(TestPaths::private_data() / "awkward_subs");
film->examine_and_add_content (dcp, true);
BOOST_REQUIRE (!wait_for_jobs ());
dcp->only_text()->set_use (true);
- shared_ptr<Player> player (new Player(film));
+ auto player = std::make_shared<Player>(film);
player->set_fast ();
player->set_always_burn_open_subtitles ();
player->set_play_referenced ();
- shared_ptr<Butler> butler (new Butler (film, player, AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true));
+ auto butler = std::make_shared<Butler>(film, player, AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true);
butler->disable_audio();
for (int i = 0; i < 10; ++i) {
- DCPTime t = DCPTime::from_frames (i, 24);
+ auto t = DCPTime::from_frames (i, 24);
butler->seek (t, true);
- pair<shared_ptr<PlayerVideo>, DCPTime> video = butler->get_video(true, 0);
+ auto video = butler->get_video(true, 0);
BOOST_CHECK_EQUAL(video.second.get(), t.get());
write_image(video.first->image(bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true), String::compose("build/test/player_seek_test_%1.png", i));
/* This 14.08 is empirically chosen (hopefully) to accept changes in rendering between the reference and a test machine
}
}
+
/** Test some more seeks towards the start of a DCP with awkward subtitles */
BOOST_AUTO_TEST_CASE (player_seek_test2)
{
- shared_ptr<Film> film (new Film (optional<boost::filesystem::path>()));
- shared_ptr<DCPContent> dcp (new DCPContent(TestPaths::private_data() / "awkward_subs2"));
+ auto film = std::make_shared<Film>(optional<boost::filesystem::path>());
+ auto dcp = std::make_shared<DCPContent>(TestPaths::private_data() / "awkward_subs2");
film->examine_and_add_content (dcp, true);
BOOST_REQUIRE (!wait_for_jobs ());
dcp->only_text()->set_use (true);
- shared_ptr<Player> player (new Player(film));
+ auto player = std::make_shared<Player>(film);
player->set_fast ();
player->set_always_burn_open_subtitles ();
player->set_play_referenced ();
- shared_ptr<Butler> butler (new Butler(film, player, AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true));
+ auto butler = std::make_shared<Butler>(film, player, AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true);
butler->disable_audio();
butler->seek(DCPTime::from_seconds(5), true);
for (int i = 0; i < 10; ++i) {
- DCPTime t = DCPTime::from_seconds(5) + DCPTime::from_frames (i, 24);
+ auto t = DCPTime::from_seconds(5) + DCPTime::from_frames (i, 24);
butler->seek (t, true);
- pair<shared_ptr<PlayerVideo>, DCPTime> video = butler->get_video(true, 0);
+ auto video = butler->get_video(true, 0);
BOOST_CHECK_EQUAL(video.second.get(), t.get());
write_image(
video.first->image(bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true), String::compose("build/test/player_seek_test2_%1.png", i)
}
}
+
/** Test a bug when trimmed content follows other content */
BOOST_AUTO_TEST_CASE (player_trim_test)
{
- shared_ptr<Film> film = new_test_film2 ("player_trim_test");
- shared_ptr<Content> A = content_factory("test/data/flat_red.png").front();
+ auto film = new_test_film2 ("player_trim_test");
+ auto A = content_factory("test/data/flat_red.png").front();
film->examine_and_add_content (A);
BOOST_REQUIRE (!wait_for_jobs ());
A->video->set_length (10 * 24);
- shared_ptr<Content> B = content_factory("test/data/flat_red.png").front();
+ auto B = content_factory("test/data/flat_red.png").front();
film->examine_and_add_content (B);
BOOST_REQUIRE (!wait_for_jobs ());
B->video->set_length (10 * 24);
B->set_position (film, DCPTime::from_seconds(10));
B->set_trim_start (ContentTime::from_seconds (2));
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film);
}
+
struct Sub {
PlayerText text;
TextType type;
DCPTimePeriod period;
};
+
static void
store (list<Sub>* out, PlayerText text, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period)
{
out->push_back (s);
}
+
/** Test ignoring both video and audio */
BOOST_AUTO_TEST_CASE (player_ignore_video_and_audio_test)
{
- shared_ptr<Film> film = new_test_film2 ("player_ignore_video_and_audio_test");
- shared_ptr<Content> ff = content_factory(TestPaths::private_data() / "boon_telly.mkv").front();
+ auto film = new_test_film2 ("player_ignore_video_and_audio_test");
+ auto ff = content_factory(TestPaths::private_data() / "boon_telly.mkv").front();
film->examine_and_add_content (ff);
- shared_ptr<Content> text = content_factory("test/data/subrip.srt").front();
+ auto text = content_factory("test/data/subrip.srt").front();
film->examine_and_add_content (text);
BOOST_REQUIRE (!wait_for_jobs());
text->only_text()->set_type (TextType::CLOSED_CAPTION);
text->only_text()->set_use (true);
- shared_ptr<Player> player (new Player(film));
+ auto player = std::make_shared<Player>(film);
player->set_ignore_video ();
player->set_ignore_audio ();
BOOST_CHECK_EQUAL (out.size(), 6U);
}
+
/** Trigger a crash due to the assertion failure in Player::emit_audio */
BOOST_AUTO_TEST_CASE (player_trim_crash)
{
- shared_ptr<Film> film = new_test_film2 ("player_trim_crash");
- shared_ptr<Content> boon = content_factory(TestPaths::private_data() / "boon_telly.mkv").front();
+ auto film = new_test_film2 ("player_trim_crash");
+ auto boon = content_factory(TestPaths::private_data() / "boon_telly.mkv").front();
film->examine_and_add_content (boon);
BOOST_REQUIRE (!wait_for_jobs());
- shared_ptr<Player> player (new Player(film));
+ auto player = std::make_shared<Player>(film);
player->set_fast ();
- shared_ptr<Butler> butler (new Butler(film, player, AudioMapping(), 6, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true));
+ auto butler = std::make_shared<Butler>(film, player, AudioMapping(), 6, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true);
/* Wait for the butler to fill */
dcpomatic_sleep_seconds (5);
butler->rethrow ();
}
+
/** Test a crash when the gap between the last audio and the start of a silent period is more than 1 sample */
BOOST_AUTO_TEST_CASE (player_silence_crash)
{
- shared_ptr<Film> film = new_test_film2 ("player_silence_crash");
- shared_ptr<Content> sine = content_factory("test/data/impulse_train.wav").front();
+ auto film = new_test_film2 ("player_silence_crash");
+ auto sine = content_factory("test/data/impulse_train.wav").front();
film->examine_and_add_content (sine);
BOOST_REQUIRE (!wait_for_jobs());
sine->set_video_frame_rate (23.976);
film->write_metadata ();
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film, {dcp::VerificationNote::Code::MISSING_CPL_METADATA});
}
+
/** Test a crash when processing a 3D DCP */
BOOST_AUTO_TEST_CASE (player_3d_test_1)
{
- shared_ptr<Film> film = new_test_film2 ("player_3d_test_1a");
- shared_ptr<Content> left = content_factory("test/data/flat_red.png").front();
+ auto film = new_test_film2 ("player_3d_test_1a");
+ auto left = content_factory("test/data/flat_red.png").front();
film->examine_and_add_content (left);
- shared_ptr<Content> right = content_factory("test/data/flat_blue.png").front();
+ auto right = content_factory("test/data/flat_blue.png").front();
film->examine_and_add_content (right);
BOOST_REQUIRE (!wait_for_jobs());
right->set_position (film, DCPTime());
film->set_three_d (true);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
- shared_ptr<Film> film2 = new_test_film2 ("player_3d_test_1b");
- shared_ptr<Content> dcp(new DCPContent(film->dir(film->dcp_name())));
- film2->examine_and_add_content (dcp);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto dcp = std::make_shared<DCPContent>(film->dir(film->dcp_name()));
+ auto film2 = new_test_film2 ("player_3d_test_1b", {dcp});
film2->set_three_d (true);
- film2->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film2);
}
+
/** Test a crash when processing a 3D DCP as content in a 2D project */
BOOST_AUTO_TEST_CASE (player_3d_test_2)
{
- shared_ptr<Film> film = new_test_film2 ("player_3d_test_2a");
- shared_ptr<Content> left = content_factory("test/data/flat_red.png").front();
- film->examine_and_add_content (left);
- shared_ptr<Content> right = content_factory("test/data/flat_blue.png").front();
- film->examine_and_add_content (right);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto left = content_factory("test/data/flat_red.png").front();
+ auto right = content_factory("test/data/flat_blue.png").front();
+ auto film = new_test_film2 ("player_3d_test_2a", {left, right});
left->video->set_frame_type (VideoFrameType::THREE_D_LEFT);
left->set_position (film, DCPTime());
right->set_position (film, DCPTime());
film->set_three_d (true);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
- shared_ptr<Film> film2 = new_test_film2 ("player_3d_test_2b");
- shared_ptr<Content> dcp(new DCPContent(film->dir(film->dcp_name())));
- film2->examine_and_add_content (dcp);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto dcp = std::make_shared<DCPContent>(film->dir(film->dcp_name()));
+ auto film2 = new_test_film2 ("player_3d_test_2b", {dcp});
- film2->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film2);
}
+
/** Test a crash when there is video-only content at the end of the DCP and a frame-rate conversion is happening;
* #1691.
*/
BOOST_AUTO_TEST_CASE (player_silence_at_end_crash)
{
/* 25fps DCP with some audio */
- shared_ptr<Film> film1 = new_test_film2 ("player_silence_at_end_crash_1");
- shared_ptr<Content> content1 = content_factory("test/data/flat_red.png").front();
- film1->examine_and_add_content (content1);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto content1 = content_factory("test/data/flat_red.png").front();
+ auto film1 = new_test_film2 ("player_silence_at_end_crash_1", {content1});
content1->video->set_length (25);
film1->set_video_frame_rate (25);
- film1->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film1);
/* Make another project importing this DCP */
- shared_ptr<Film> film2 = new_test_film2 ("player_silence_at_end_crash_2");
- shared_ptr<Content> content2(new DCPContent(film1->dir(film1->dcp_name())));
- film2->examine_and_add_content (content2);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto content2 = std::make_shared<DCPContent>(film1->dir(film1->dcp_name()));
+ auto film2 = new_test_film2 ("player_silence_at_end_crash_2", {content2});
/* and importing just the video MXF on its own at the end */
optional<boost::filesystem::path> video;
- for (boost::filesystem::directory_iterator i(film1->dir(film1->dcp_name())); i != boost::filesystem::directory_iterator(); ++i) {
- if (boost::starts_with(i->path().filename().string(), "j2c_")) {
- video = i->path();
+ for (auto i: boost::filesystem::directory_iterator(film1->dir(film1->dcp_name()))) {
+ if (boost::starts_with(i.path().filename().string(), "j2c_")) {
+ video = i.path();
}
}
BOOST_REQUIRE (video);
- shared_ptr<Content> content3 = content_factory(*video).front();
+ auto content3 = content_factory(*video).front();
film2->examine_and_add_content (content3);
BOOST_REQUIRE (!wait_for_jobs());
content3->set_position (film2, DCPTime::from_seconds(1.5));
film2->set_video_frame_rate (24);
- film2->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film2);
}
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE,
+ dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE
+ });
boost::filesystem::path const video = "build/test/recover_test_2d/video/185_2K_02543352c540f4b083bff3f1e309d4a9_24_100000000_P_S_0_1200000.mxf";
boost::filesystem::copy_file (
/*
- Copyright (C) 2017-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "lib/ffmpeg_content.h"
#include "lib/content_factory.h"
#include "lib/text_content.h"
#include <boost/test/unit_test.hpp>
#include <iostream>
+
using std::string;
using std::vector;
using std::shared_ptr;
-using boost::optional;
using std::dynamic_pointer_cast;
+using std::make_shared;
+using boost::optional;
+
/** Check for bug #1126 whereby making a new DCP using the same video asset as an old one
* corrupts the old one.
BOOST_AUTO_TEST_CASE (remake_id_test1)
{
/* Make a DCP */
- shared_ptr<Film> film = new_test_film2 ("remake_id_test1_1");
- shared_ptr<Content> content = content_factory("test/data/flat_red.png").front();
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs ());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ auto content = content_factory("test/data/flat_red.png").front();
+ auto film = new_test_film2 ("remake_id_test1_1", {content});
+ make_and_verify_dcp (film);
/* Copy the video file */
- boost::filesystem::path first_video = dcp_file(film, "j2c");
+ auto first_video = dcp_file(film, "j2c");
boost::filesystem::copy_file (first_video, first_video.string() + ".copy");
/* Make a new DCP with the same video file */
film->set_name ("remake_id_test1_2");
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film);
/* Check that the video in the first DCP hasn't changed */
check_file (first_video, first_video.string() + ".copy");
}
+
/** Check for bug #1232 where remaking an encrypted DCP causes problems with HMAC IDs (?) */
BOOST_AUTO_TEST_CASE (remake_id_test2)
{
/* Make a DCP */
- shared_ptr<Film> film = new_test_film2 ("remake_id_test2_1");
- shared_ptr<Content> content = content_factory("test/data/flat_red.png").front();
- film->examine_and_add_content (content);
+ auto content = content_factory("test/data/flat_red.png").front();
+ auto film = new_test_film2 ("remake_id_test2_1", {content});
film->set_encrypted (true);
- BOOST_REQUIRE (!wait_for_jobs ());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film);
/* Remove and remake it */
boost::filesystem::remove_all(film->dir(film->dcp_name()));
- film->make_dcp();
- BOOST_REQUIRE(!wait_for_jobs());
+ make_and_verify_dcp (film);
/* Find the CPL */
optional<boost::filesystem::path> cpl;
- for (boost::filesystem::directory_iterator i(film->dir(film->dcp_name())); i != boost::filesystem::directory_iterator(); ++i) {
- if (i->path().filename().string().substr(0, 4) == "cpl_") {
- cpl = i->path();
+ for (auto i: boost::filesystem::directory_iterator(film->dir(film->dcp_name()))) {
+ if (i.path().filename().string().substr(0, 4) == "cpl_") {
+ cpl = i.path();
}
}
BOOST_REQUIRE(cpl);
/* Make a DKDM */
- dcp::EncryptedKDM kdm = film->make_kdm (
+ auto kdm = film->make_kdm (
Config::instance()->decryption_chain()->leaf(),
vector<string>(),
*cpl,
);
/* Import the DCP into a new film */
- shared_ptr<Film> film2 = new_test_film2("remake_id_test2_2");
- shared_ptr<DCPContent> dcp_content(new DCPContent(film->dir(film->dcp_name())));
- film2->examine_and_add_content(dcp_content);
- BOOST_REQUIRE(!wait_for_jobs());
+ auto dcp_content = make_shared<DCPContent>(film->dir(film->dcp_name()));
+ auto film2 = new_test_film2("remake_id_test2_2", {dcp_content});
dcp_content->add_kdm(kdm);
- JobManager::instance()->add(shared_ptr<Job>(new ExamineContentJob(film2, dcp_content)));
- BOOST_REQUIRE(!wait_for_jobs());
- film2->make_dcp();
+ JobManager::instance()->add(make_shared<ExamineContentJob>(film2, dcp_content));
BOOST_REQUIRE(!wait_for_jobs());
+ make_and_verify_dcp (film2);
}
/*
- Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "lib/ffmpeg_content.h"
#include "lib/content_factory.h"
#include "lib/text_content.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
+
using std::shared_ptr;
using std::dynamic_pointer_cast;
+
/** Check that if we remake a DCP having turned off subtitles the code notices
* and doesn't re-use the old video data.
*/
BOOST_AUTO_TEST_CASE (remake_with_subtitle_test)
{
- shared_ptr<Film> film = new_test_film2 ("remake_with_subtitle_test");
- shared_ptr<FFmpegContent> content = dynamic_pointer_cast<FFmpegContent>(content_factory(TestPaths::private_data() / "prophet_short_clip.mkv").front());
+ auto film = new_test_film2 ("remake_with_subtitle_test");
+ auto content = dynamic_pointer_cast<FFmpegContent>(content_factory(TestPaths::private_data() / "prophet_short_clip.mkv").front());
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
content->only_text()->set_burn (true);
content->only_text()->set_use (true);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film);
boost::filesystem::remove_all (film->dir (film->dcp_name(), false));
content->only_text()->set_use (false);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film);
check_one_frame (film->dir(film->dcp_name()), 325, TestPaths::private_data() / "prophet_frame_325_no_subs.j2c");
}
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/scaling_test.cc
* @brief Test scaling and black-padding of images from a still-image source.
* @ingroup feature
*/
+
#include <boost/test/unit_test.hpp>
#include "lib/image_content.h"
#include "lib/ratio.h"
#include "lib/video_content.h"
#include "test.h"
+
using std::string;
using std::shared_ptr;
+using std::make_shared;
+
static void scaling_test_for (shared_ptr<Film> film, shared_ptr<Content> content, float ratio, std::string image, string container)
{
content->video->set_custom_ratio (ratio);
film->set_container (Ratio::from_id (container));
film->set_interop (false);
- film->make_dcp ();
-
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE,
+ dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE
+ });
boost::filesystem::path ref;
ref = "test";
check_dcp (ref.string(), check.string());
}
+
BOOST_AUTO_TEST_CASE (scaling_test)
{
- shared_ptr<Film> film = new_test_film ("scaling_test");
- film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
+ auto film = new_test_film ("scaling_test");
+ film->set_dcp_content_type (DCPContentType::from_isdcf_name("FTR"));
film->set_name ("scaling_test");
- shared_ptr<ImageContent> imc (new ImageContent("test/data/simple_testcard_640x480.png"));
+ auto imc = make_shared<ImageContent>("test/data/simple_testcard_640x480.png");
film->examine_and_add_content (imc);
/*
- Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/skip_frame_test.cc
* @brief Test the skip of frames by the player when putting a 48fps
* source into a 24fps DCP.
* @see test/repeat_frame_test.cc
*/
+
#include <boost/test/unit_test.hpp>
#include "test.h"
#include "lib/film.h"
#include "lib/dcp_content_type.h"
#include "lib/video_content.h"
+
using std::shared_ptr;
+using std::make_shared;
+
BOOST_AUTO_TEST_CASE (skip_frame_test)
{
- shared_ptr<Film> film = new_test_film ("skip_frame_test");
+ auto film = new_test_film ("skip_frame_test");
film->set_name ("skip_frame_test");
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
film->set_interop (false);
- shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/count300bd48.m2ts"));
+ auto c = make_shared<FFmpegContent>("test/data/count300bd48.m2ts");
film->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs());
film->write_metadata ();
film->set_video_frame_rate (24);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
/* Should be white numbers on a black background counting up from 2 in steps of 2
up to 300.
/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/srt_subtitle_test.cc
* @brief Test writing DCPs with subtitles from .srt.
* @ingroup feature
*/
+
#include "lib/film.h"
#include "lib/string_text_file_content.h"
#include "lib/dcp_content_type.h"
#include <boost/algorithm/string.hpp>
#include <list>
+
using std::string;
using std::list;
using std::shared_ptr;
+using std::make_shared;
using namespace dcpomatic;
+
/** Make a very short DCP with a single subtitle from .srt with no specified fonts */
BOOST_AUTO_TEST_CASE (srt_subtitle_test)
{
- shared_ptr<Film> film = new_test_film ("srt_subtitle_test");
+ auto film = new_test_film ("srt_subtitle_test");
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
film->set_audio_channels (6);
film->set_interop (false);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent("test/data/subrip2.srt"));
+ auto content = make_shared<StringTextFileContent>("test/data/subrip2.srt");
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs());
content->only_text()->set_use (true);
content->only_text()->set_burn (false);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::MISSING_CPL_METADATA
+ });
+
/* Should be blank video with a subtitle MXF */
check_dcp ("test/data/srt_subtitle_test", film->dir (film->dcp_name ()));
}
+
/** Same again but with a `font' specified */
BOOST_AUTO_TEST_CASE (srt_subtitle_test2)
{
- shared_ptr<Film> film = new_test_film ("srt_subtitle_test2");
+ auto film = new_test_film ("srt_subtitle_test2");
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
film->set_audio_channels (6);
film->set_interop (false);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent ("test/data/subrip2.srt"));
+ auto content = make_shared<StringTextFileContent> ("test/data/subrip2.srt");
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs());
/* Use test/data/subrip2.srt as if it were a font file */
content->only_text()->fonts().front()->set_file("test/data/subrip2.srt");
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::MISSING_CPL_METADATA
+ });
/* Should be blank video with a subtitle MXF */
check_dcp ("test/data/srt_subtitle_test2", film->dir (film->dcp_name ()));
}
+
static void
check_subtitle_file (shared_ptr<Film> film, boost::filesystem::path ref)
{
/* Find the subtitle file and check it */
- list<string> ignore;
- ignore.push_back ("SubtitleID");
- check_xml (subtitle_file(film), ref, ignore);
+ check_xml (subtitle_file(film), ref, {"SubtitleID"});
}
+
/** Make another DCP with a longer .srt file */
BOOST_AUTO_TEST_CASE (srt_subtitle_test3)
{
Cleanup cl;
- shared_ptr<StringTextFileContent> content (new StringTextFileContent(TestPaths::private_data() / "Ankoemmling_short.srt"));
- shared_ptr<Film> film = new_test_film2 ("srt_subtitle_test3", { content }, &cl);
+ auto content = make_shared<StringTextFileContent>(TestPaths::private_data() / "Ankoemmling_short.srt");
+ auto film = new_test_film2 ("srt_subtitle_test3", { content }, &cl);
film->set_name ("frobozz");
film->set_interop (true);
cl.run ();
}
+
/** Build a small DCP with no picture and a single subtitle overlaid onto it */
BOOST_AUTO_TEST_CASE (srt_subtitle_test4)
{
- shared_ptr<Film> film = new_test_film ("srt_subtitle_test4");
+ auto film = new_test_film ("srt_subtitle_test4");
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
film->set_interop (false);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent("test/data/subrip2.srt"));
+ auto content = make_shared<StringTextFileContent>("test/data/subrip2.srt");
content->only_text()->set_use (true);
content->only_text()->set_burn (false);
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::MISSING_CPL_METADATA
+ });
/* Should be blank video with MXF subtitles */
check_dcp ("test/data/xml_subtitle_test", film->dir (film->dcp_name ()));
}
+
/** Check the subtitle XML when there are two subtitle files in the project */
BOOST_AUTO_TEST_CASE (srt_subtitle_test5)
{
- shared_ptr<Film> film = new_test_film ("srt_subtitle_test5");
+ auto film = new_test_film ("srt_subtitle_test5");
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
film->set_interop (true);
film->set_sequence (false);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent("test/data/subrip2.srt"));
+ auto content = make_shared<StringTextFileContent>("test/data/subrip2.srt");
content->only_text()->set_use (true);
content->only_text()->set_burn (false);
film->examine_and_add_content (content);
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs());
content->set_position (film, DCPTime());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
- film->write_metadata ();
+ make_and_verify_dcp (film, {dcp::VerificationNote::Code::INVALID_STANDARD});
check_dcp ("test/data/xml_subtitle_test2", film->dir (film->dcp_name ()));
}
+
BOOST_AUTO_TEST_CASE (srt_subtitle_test6)
{
- shared_ptr<Film> film = new_test_film2 ("srt_subtitle_test6");
+ auto content = make_shared<StringTextFileContent>("test/data/frames.srt");
+ auto film = new_test_film2 ("srt_subtitle_test6", {content});
film->set_interop (false);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent("test/data/frames.srt"));
content->only_text()->set_use (true);
content->only_text()->set_burn (false);
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs ());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
- film->write_metadata ();
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::MISSING_CPL_METADATA,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING,
+ });
check_dcp ("test/data/srt_subtitle_test6", film->dir(film->dcp_name()));
}
+
#if 0
/* XXX: this is disabled; there is some difference in font rendering
between the test machine and others.
/*
- Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "lib/string_text_file_content.h"
#include "lib/film.h"
#include "lib/ratio.h"
#include <dcp/raw_convert.h>
#include <boost/test/unit_test.hpp>
-using std::string;
-using std::shared_ptr;
+
using std::dynamic_pointer_cast;
+using std::make_shared;
+using std::shared_ptr;
+using std::string;
+
/* Check that ReelNumber is setup correctly when making multi-reel subtitled DCPs */
BOOST_AUTO_TEST_CASE (subtitle_reel_number_test)
{
- shared_ptr<Film> film = new_test_film ("subtitle_reel_number_test");
+ auto film = new_test_film ("subtitle_reel_number_test");
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<StringTextFileContent> content (new StringTextFileContent("test/data/subrip5.srt"));
+ auto content = make_shared<StringTextFileContent>("test/data/subrip5.srt");
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
content->only_text()->set_use (true);
film->set_reel_type (ReelType::BY_LENGTH);
film->set_interop (true);
film->set_reel_length (1024 * 1024 * 512);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film, {dcp::VerificationNote::Code::INVALID_STANDARD});
dcp::DCP dcp ("build/test/subtitle_reel_number_test/" + film->dcp_name());
dcp.read ();
film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film, {dcp::VerificationNote::Code::INVALID_STANDARD});
dcp::DCP dcp ("build/test/subtitle_reel_test/" + film->dcp_name());
dcp.read ();
auto subs = content_factory("test/data/15s.srt").front();
film->examine_and_add_content (subs);
BOOST_REQUIRE (!wait_for_jobs());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING
+ });
dcp::DCP dcp ("build/test/subtitle_in_all_reels_test/" + film->dcp_name());
dcp.read ();
ccap2->text.front()->set_type (TextType::CLOSED_CAPTION);
ccap2->text.front()->set_dcp_track (DCPTextTrack("Other", "en-GB"));
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING
+ });
dcp::DCP dcp ("build/test/closed_captions_in_all_reels_test/" + film->dcp_name());
dcp.read ();
/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
#include "lib/film.h"
#include "lib/dcp_subtitle_content.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
+
+using std::make_shared;
using std::shared_ptr;
-using namespace dcpomatic;
+
/** Check for no crash when trimming DCP subtitles (#1275) */
BOOST_AUTO_TEST_CASE (subtitle_trim_test1)
{
- shared_ptr<Film> film = new_test_film2 ("subtitle_trim_test1");
- shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent ("test/data/dcp_sub5.xml"));
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs ());
+ auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub5.xml");
+ auto film = new_test_film2 ("subtitle_trim_test1", {content});
- content->set_trim_end (ContentTime::from_seconds (2));
+ content->set_trim_end (dcpomatic::ContentTime::from_seconds(2));
film->write_metadata ();
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::MISSING_CPL_METADATA
+ });
}
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
film->set_three_d (true);
- film->make_dcp ();
- film->write_metadata ();
-
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film);
}
+
/** Basic sanity check of THREE_D_ALTERNATE; at the moment this is just to make sure
* that such a transcode completes without error.
*/
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
film->set_three_d (true);
- film->make_dcp ();
- film->write_metadata ();
-
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film);
}
+
/** Basic sanity check of THREE_D_LEFT and THREE_D_RIGHT; at the moment this is just to make sure
* that such a transcode completes without error.
*/
R->video->set_frame_type (VideoFrameType::THREE_D_RIGHT);
film->set_three_d (true);
- film->make_dcp ();
- film->write_metadata ();
-
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film);
}
+
BOOST_AUTO_TEST_CASE (threed_test4)
{
auto film = new_test_film2 ("threed_test4");
R->set_trim_end (dcpomatic::ContentTime::from_seconds(22));
film->set_three_d (true);
- film->make_dcp ();
- film->write_metadata ();
-
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film, {dcp::VerificationNote::Code::INVALID_PICTURE_ASSET_RESOLUTION_FOR_3D});
}
+
BOOST_AUTO_TEST_CASE (threed_test5)
{
auto film = new_test_film2 ("threed_test5");
R->set_trim_end (dcpomatic::ContentTime::from_seconds(3 * 60 + 20));
film->set_three_d (true);
- film->make_dcp ();
- film->write_metadata ();
-
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film, {dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_2K});
}
+
BOOST_AUTO_TEST_CASE (threed_test6)
{
auto film = new_test_film2 ("threed_test6");
R->video->set_frame_type (VideoFrameType::THREE_D_RIGHT);
film->set_three_d (true);
- film->make_dcp ();
- film->write_metadata ();
-
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
check_dcp ("test/data/threed_test6", film->dir(film->dcp_name()));
}
+
/** Check 2D content set as being 3D; this should give an informative error */
BOOST_AUTO_TEST_CASE (threed_test7)
{
/*
- Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/vf_kdm_test.cc
* @brief Test encrypted VF creation and import
* @ingroup feature
*/
+
#include "test.h"
#include "lib/film.h"
#include "lib/dcp_subtitle_content.h"
#include <dcp/cpl.h>
#include <boost/test/unit_test.hpp>
-using std::vector;
-using std::string;
+
+using std::make_shared;
using std::shared_ptr;
+using std::string;
+using std::vector;
+
BOOST_AUTO_TEST_CASE (vf_kdm_test)
{
/* Make an encrypted DCP from test.mp4 */
- shared_ptr<Film> A = new_test_film ("vf_kdm_test_ov");
+ auto A = new_test_film ("vf_kdm_test_ov");
A->set_container (Ratio::from_id ("185"));
A->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
A->set_name ("frobozz");
A->set_interop (true);
- shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
+ auto c = make_shared<FFmpegContent>("test/data/test.mp4");
A->examine_and_add_content (c);
A->set_encrypted (true);
BOOST_REQUIRE (!wait_for_jobs());
- A->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (A, {dcp::VerificationNote::Code::INVALID_STANDARD});
dcp::DCP A_dcp ("build/test/vf_kdm_test_ov/" + A->dcp_name());
A_dcp.read ();
- Config::instance()->set_decryption_chain (shared_ptr<dcp::CertificateChain> (new dcp::CertificateChain (openssl_path ())));
+ Config::instance()->set_decryption_chain (make_shared<dcp::CertificateChain>(openssl_path()));
- dcp::EncryptedKDM A_kdm = A->make_kdm (
- Config::instance()->decryption_chain()->leaf (),
+ auto A_kdm = A->make_kdm (
+ Config::instance()->decryption_chain()->leaf(),
vector<string>(),
A_dcp.cpls().front()->file().get(),
- dcp::LocalTime ("2030-07-21T00:00:00+00:00"),
- dcp::LocalTime ("2031-07-21T00:00:00+00:00"),
+ dcp::LocalTime("2030-07-21T00:00:00+00:00"),
+ dcp::LocalTime("2031-07-21T00:00:00+00:00"),
dcp::Formulation::MODIFIED_TRANSITIONAL_1,
true, 0
);
/* Import A into a new project, with the required KDM, and make a VF that refers to it */
- shared_ptr<Film> B = new_test_film ("vf_kdm_test_vf");
- B->set_container (Ratio::from_id ("185"));
- B->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
+ auto B = new_test_film ("vf_kdm_test_vf");
+ B->set_container (Ratio::from_id("185"));
+ B->set_dcp_content_type (DCPContentType::from_isdcf_name("TLR"));
B->set_name ("frobozz");
B->set_interop (true);
- shared_ptr<DCPContent> d (new DCPContent ("build/test/vf_kdm_test_ov/" + A->dcp_name()));
+ auto d = make_shared<DCPContent>("build/test/vf_kdm_test_ov/" + A->dcp_name());
d->add_kdm (A_kdm);
d->set_reference_video (true);
B->examine_and_add_content (d);
B->set_encrypted (true);
BOOST_REQUIRE (!wait_for_jobs());
- B->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (B, {dcp::VerificationNote::Code::INVALID_STANDARD, dcp::VerificationNote::Code::EXTERNAL_ASSET});
dcp::DCP B_dcp ("build/test/vf_kdm_test_vf/" + B->dcp_name());
B_dcp.read ();
- dcp::EncryptedKDM B_kdm = B->make_kdm (
+ auto B_kdm = B->make_kdm (
Config::instance()->decryption_chain()->leaf (),
vector<string>(),
B_dcp.cpls().front()->file().get(),
This KDM should decrypt assets from the OV too.
*/
- shared_ptr<Film> C = new_test_film ("vf_kdm_test_check");
+ auto C = new_test_film ("vf_kdm_test_check");
C->set_container (Ratio::from_id ("185"));
C->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
C->set_name ("frobozz");
C->set_interop (true);
- shared_ptr<DCPContent> e (new DCPContent ("build/test/vf_kdm_test_vf/" + B->dcp_name()));
+ auto e = make_shared<DCPContent>("build/test/vf_kdm_test_vf/" + B->dcp_name());
e->add_kdm (B_kdm);
e->add_ov ("build/test/vf_kdm_test_ov/" + A->dcp_name());
C->examine_and_add_content (e);
BOOST_REQUIRE (!wait_for_jobs());
- C->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (C, {dcp::VerificationNote::Code::INVALID_STANDARD});
/* Should be 1s red, 1s green, 1s blue */
check_dcp ("test/data/vf_kdm_test_check", "build/test/vf_kdm_test_check/" + C->dcp_name());
/*
- Copyright (C) 2015-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/vf_Test.cc
* @brief Various VF-related tests.
* @ingroup feature
*/
+
#include "lib/film.h"
#include "lib/dcp_content.h"
#include "lib/ffmpeg_content.h"
#include <boost/test/unit_test.hpp>
#include <iostream>
+
using std::list;
using std::string;
using std::cout;
using std::shared_ptr;
+using std::make_shared;
using std::dynamic_pointer_cast;
using namespace dcpomatic;
+
/** Test the logic which decides whether a DCP can be referenced or not */
BOOST_AUTO_TEST_CASE (vf_test1)
{
- shared_ptr<Film> film = new_test_film ("vf_test1");
+ auto film = new_test_film ("vf_test1");
film->set_interop (false);
- shared_ptr<DCPContent> dcp (new DCPContent ("test/data/reels_test2"));
+ auto dcp = make_shared<DCPContent>("test/data/reels_test2");
film->examine_and_add_content (dcp);
BOOST_REQUIRE (!wait_for_jobs());
BOOST_CHECK (!dcp->can_reference_text(film, TextType::OPEN_SUBTITLE, why_not));
BOOST_CHECK (!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
- shared_ptr<FFmpegContent> other (new FFmpegContent("test/data/test.mp4"));
+ auto other = make_shared<FFmpegContent>("test/data/test.mp4");
film->examine_and_add_content (other);
BOOST_REQUIRE (!wait_for_jobs());
BOOST_CHECK (!other->audio);
BOOST_CHECK (!dcp->can_reference_text(film, TextType::CLOSED_CAPTION, why_not));
}
+
/** Make a OV with video and audio and a VF referencing the OV and adding subs */
BOOST_AUTO_TEST_CASE (vf_test2)
{
/* Make the OV */
- shared_ptr<Film> ov = new_test_film ("vf_test2_ov");
- ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
+ auto ov = new_test_film ("vf_test2_ov");
+ ov->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
ov->set_name ("vf_test2_ov");
- shared_ptr<Content> video = content_factory ("test/data/flat_red.png").front();
+ auto video = content_factory("test/data/flat_red.png").front();
ov->examine_and_add_content (video);
BOOST_REQUIRE (!wait_for_jobs());
video->video->set_length (24 * 5);
- shared_ptr<Content> audio = content_factory ("test/data/white.wav").front();
+ auto audio = content_factory("test/data/white.wav").front();
ov->examine_and_add_content (audio);
BOOST_REQUIRE (!wait_for_jobs());
- ov->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (ov);
/* Make the VF */
- shared_ptr<Film> vf = new_test_film ("vf_test2_vf");
+ auto vf = new_test_film ("vf_test2_vf");
vf->set_name ("vf_test2_vf");
- vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
+ vf->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- shared_ptr<DCPContent> dcp (new DCPContent(ov->dir (ov->dcp_name ())));
- BOOST_REQUIRE (dcp);
+ auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
vf->examine_and_add_content (dcp);
BOOST_REQUIRE (!wait_for_jobs());
dcp->set_reference_video (true);
dcp->set_reference_audio (true);
- shared_ptr<Content> sub = content_factory("test/data/subrip4.srt").front();
+ auto sub = content_factory("test/data/subrip4.srt").front();
vf->examine_and_add_content (sub);
BOOST_REQUIRE (!wait_for_jobs());
- vf->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
- vf->write_metadata ();
+ make_and_verify_dcp (
+ vf,
+ {
+ dcp::VerificationNote::Code::EXTERNAL_ASSET,
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION
+ });
- dcp::DCP ov_c (ov->dir (ov->dcp_name ()));
+ dcp::DCP ov_c (ov->dir(ov->dcp_name()));
ov_c.read ();
BOOST_REQUIRE_EQUAL (ov_c.cpls().size(), 1U);
- BOOST_REQUIRE_EQUAL (ov_c.cpls().front()->reels().size(), 1U);
- BOOST_REQUIRE (ov_c.cpls().front()->reels().front()->main_picture());
- string const pic_id = ov_c.cpls().front()->reels().front()->main_picture()->id();
- BOOST_REQUIRE (ov_c.cpls().front()->reels().front()->main_sound());
- string const sound_id = ov_c.cpls().front()->reels().front()->main_sound()->id();
- BOOST_REQUIRE (!ov_c.cpls().front()->reels().front()->main_subtitle());
-
- dcp::DCP vf_c (vf->dir (vf->dcp_name ()));
+ BOOST_REQUIRE_EQUAL (ov_c.cpls()[0]->reels().size(), 1U);
+ BOOST_REQUIRE (ov_c.cpls()[0]->reels()[0]->main_picture());
+ string const pic_id = ov_c.cpls()[0]->reels()[0]->main_picture()->id();
+ BOOST_REQUIRE (ov_c.cpls()[0]->reels()[0]->main_sound());
+ string const sound_id = ov_c.cpls()[0]->reels()[0]->main_sound()->id();
+ BOOST_REQUIRE (!ov_c.cpls()[0]->reels()[0]->main_subtitle());
+
+ dcp::DCP vf_c (vf->dir(vf->dcp_name()));
vf_c.read ();
BOOST_REQUIRE_EQUAL (vf_c.cpls().size(), 1U);
- BOOST_REQUIRE_EQUAL (vf_c.cpls().front()->reels().size(), 1U);
- BOOST_REQUIRE (vf_c.cpls().front()->reels().front()->main_picture());
- BOOST_CHECK_EQUAL (vf_c.cpls().front()->reels().front()->main_picture()->id(), pic_id);
- BOOST_REQUIRE (vf_c.cpls().front()->reels().front()->main_sound());
- BOOST_CHECK_EQUAL (vf_c.cpls().front()->reels().front()->main_sound()->id(), sound_id);
- BOOST_REQUIRE (vf_c.cpls().front()->reels().front()->main_subtitle());
+ BOOST_REQUIRE_EQUAL (vf_c.cpls()[0]->reels().size(), 1U);
+ BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_picture());
+ BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_picture()->id(), pic_id);
+ BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_sound());
+ BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_sound()->id(), sound_id);
+ BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_subtitle());
}
+
/** Test creation of a VF using a trimmed OV; the output should have entry point /
* duration altered to effect the trimming.
*/
BOOST_AUTO_TEST_CASE (vf_test3)
{
/* Make the OV */
- shared_ptr<Film> ov = new_test_film ("vf_test3_ov");
+ auto ov = new_test_film ("vf_test3_ov");
ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
ov->set_name ("vf_test3_ov");
- shared_ptr<Content> video = content_factory("test/data/flat_red.png").front();
+ auto video = content_factory("test/data/flat_red.png").front();
ov->examine_and_add_content (video);
BOOST_REQUIRE (!wait_for_jobs());
video->video->set_length (24 * 5);
- shared_ptr<Content> audio = content_factory("test/data/white.wav").front();
+ auto audio = content_factory("test/data/white.wav").front();
ov->examine_and_add_content (audio);
BOOST_REQUIRE (!wait_for_jobs());
- ov->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (ov);
/* Make the VF */
- shared_ptr<Film> vf = new_test_film ("vf_test3_vf");
+ auto vf = new_test_film ("vf_test3_vf");
vf->set_name ("vf_test3_vf");
- vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
+ vf->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- shared_ptr<DCPContent> dcp (new DCPContent(ov->dir(ov->dcp_name())));
+ auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
BOOST_REQUIRE (dcp);
dcp->set_trim_start (ContentTime::from_seconds (1));
dcp->set_trim_end (ContentTime::from_seconds (1));
BOOST_REQUIRE (!wait_for_jobs());
dcp->set_reference_video (true);
dcp->set_reference_audio (true);
- vf->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
- vf->write_metadata ();
+ make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
- dcp::DCP vf_c (vf->dir (vf->dcp_name ()));
+ dcp::DCP vf_c (vf->dir(vf->dcp_name()));
vf_c.read ();
BOOST_REQUIRE_EQUAL (vf_c.cpls().size(), 1U);
- BOOST_REQUIRE_EQUAL (vf_c.cpls().front()->reels().size(), 1U);
- BOOST_REQUIRE (vf_c.cpls().front()->reels().front()->main_picture());
- BOOST_CHECK_EQUAL (vf_c.cpls().front()->reels().front()->main_picture()->entry_point().get_value_or(0), 24);
- BOOST_CHECK_EQUAL (vf_c.cpls().front()->reels().front()->main_picture()->actual_duration(), 72);
- BOOST_REQUIRE (vf_c.cpls().front()->reels().front()->main_sound());
- BOOST_CHECK_EQUAL (vf_c.cpls().front()->reels().front()->main_sound()->entry_point().get_value_or(0), 24);
- BOOST_CHECK_EQUAL (vf_c.cpls().front()->reels().front()->main_sound()->actual_duration(), 72);
+ BOOST_REQUIRE_EQUAL (vf_c.cpls()[0]->reels().size(), 1U);
+ BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_picture());
+ BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_picture()->entry_point().get_value_or(0), 24);
+ BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_picture()->actual_duration(), 72);
+ BOOST_REQUIRE (vf_c.cpls()[0]->reels()[0]->main_sound());
+ BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_sound()->entry_point().get_value_or(0), 24);
+ BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels()[0]->main_sound()->actual_duration(), 72);
}
+
/** Make a OV with video and audio and a VF referencing the OV and adding some more video */
BOOST_AUTO_TEST_CASE (vf_test4)
{
/* Make the OV */
- shared_ptr<Film> ov = new_test_film ("vf_test4_ov");
+ auto ov = new_test_film ("vf_test4_ov");
ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
ov->set_name ("vf_test4_ov");
- shared_ptr<Content> video = content_factory("test/data/flat_red.png").front();
+ auto video = content_factory("test/data/flat_red.png").front();
ov->examine_and_add_content (video);
BOOST_REQUIRE (!wait_for_jobs());
video->video->set_length (24 * 5);
- shared_ptr<Content> audio = content_factory("test/data/white.wav").front();
+ auto audio = content_factory("test/data/white.wav").front();
ov->examine_and_add_content (audio);
BOOST_REQUIRE (!wait_for_jobs());
- ov->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (ov);
/* Make the VF */
- shared_ptr<Film> vf = new_test_film ("vf_test4_vf");
+ auto vf = new_test_film ("vf_test4_vf");
vf->set_name ("vf_test4_vf");
- vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
+ vf->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
vf->set_sequence (false);
- shared_ptr<DCPContent> dcp (new DCPContent(ov->dir(ov->dcp_name())));
+ auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
BOOST_REQUIRE (dcp);
vf->examine_and_add_content (dcp);
BOOST_REQUIRE (!wait_for_jobs());
dcp->set_position(vf, DCPTime::from_seconds(10));
dcp->set_reference_video (true);
dcp->set_reference_audio (true);
- shared_ptr<Content> more_video = content_factory("test/data/flat_red.png").front();
+ auto more_video = content_factory("test/data/flat_red.png").front();
vf->examine_and_add_content (more_video);
BOOST_REQUIRE (!wait_for_jobs());
more_video->set_position (vf, DCPTime());
vf->write_metadata ();
- vf->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
- dcp::DCP ov_c (ov->dir (ov->dcp_name ()));
+ dcp::DCP ov_c (ov->dir(ov->dcp_name()));
ov_c.read ();
BOOST_REQUIRE_EQUAL (ov_c.cpls().size(), 1U);
- BOOST_REQUIRE_EQUAL (ov_c.cpls().front()->reels().size(), 1U);
- BOOST_REQUIRE (ov_c.cpls().front()->reels().front()->main_picture());
- string const pic_id = ov_c.cpls().front()->reels().front()->main_picture()->id();
- BOOST_REQUIRE (ov_c.cpls().front()->reels().front()->main_sound());
- string const sound_id = ov_c.cpls().front()->reels().front()->main_sound()->id();
- BOOST_REQUIRE (!ov_c.cpls().front()->reels().front()->main_subtitle());
+ BOOST_REQUIRE_EQUAL (ov_c.cpls()[0]->reels().size(), 1U);
+ BOOST_REQUIRE (ov_c.cpls()[0]->reels()[0]->main_picture());
+ string const pic_id = ov_c.cpls()[0]->reels()[0]->main_picture()->id();
+ BOOST_REQUIRE (ov_c.cpls()[0]->reels()[0]->main_sound());
+ string const sound_id = ov_c.cpls()[0]->reels()[0]->main_sound()->id();
+ BOOST_REQUIRE (!ov_c.cpls()[0]->reels()[0]->main_subtitle());
dcp::DCP vf_c (vf->dir (vf->dcp_name ()));
vf_c.read ();
BOOST_REQUIRE_EQUAL (vf_c.cpls().size(), 1U);
- BOOST_REQUIRE_EQUAL (vf_c.cpls().front()->reels().size(), 2U);
- BOOST_REQUIRE (vf_c.cpls().front()->reels().back()->main_picture());
- BOOST_CHECK_EQUAL (vf_c.cpls().front()->reels().back()->main_picture()->id(), pic_id);
- BOOST_REQUIRE (vf_c.cpls().front()->reels().back()->main_sound());
- BOOST_CHECK_EQUAL (vf_c.cpls().front()->reels().back()->main_sound()->id(), sound_id);
+ BOOST_REQUIRE_EQUAL (vf_c.cpls()[0]->reels().size(), 2U);
+ BOOST_REQUIRE (vf_c.cpls()[0]->reels().back()->main_picture());
+ BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels().back()->main_picture()->id(), pic_id);
+ BOOST_REQUIRE (vf_c.cpls()[0]->reels().back()->main_sound());
+ BOOST_CHECK_EQUAL (vf_c.cpls()[0]->reels().back()->main_sound()->id(), sound_id);
}
+
/** Test bug #1495 */
BOOST_AUTO_TEST_CASE (vf_test5)
{
/* Make the OV */
- shared_ptr<Film> ov = new_test_film ("vf_test5_ov");
+ auto ov = new_test_film ("vf_test5_ov");
ov->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
ov->set_reel_type (ReelType::BY_VIDEO_CONTENT);
for (int i = 0; i < 3; ++i) {
- shared_ptr<Content> video = content_factory("test/data/flat_red.png").front();
+ auto video = content_factory("test/data/flat_red.png").front();
ov->examine_and_add_content (video);
BOOST_REQUIRE (!wait_for_jobs());
video->video->set_length (24 * 10);
}
BOOST_REQUIRE (!wait_for_jobs());
- ov->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (ov);
/* Make the VF */
- shared_ptr<Film> vf = new_test_film ("vf_test5_vf");
+ auto vf = new_test_film ("vf_test5_vf");
vf->set_name ("vf_test5_vf");
vf->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
vf->set_sequence (false);
- shared_ptr<DCPContent> dcp (new DCPContent(ov->dir(ov->dcp_name())));
+ auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
BOOST_REQUIRE (dcp);
vf->examine_and_add_content (dcp);
BOOST_REQUIRE (!wait_for_jobs());
dcp->set_reference_video (true);
dcp->set_reference_audio (true);
dcp->set_trim_end (ContentTime::from_seconds(15));
- vf->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
/* Check that the selected reel assets are right */
- shared_ptr<Player> player (new Player(vf));
- list<ReferencedReelAsset> a = player->get_reel_assets();
+ auto player = make_shared<Player>(vf);
+ auto a = player->get_reel_assets();
BOOST_REQUIRE_EQUAL (a.size(), 4U);
- list<ReferencedReelAsset>::const_iterator i = a.begin();
+ auto i = a.begin();
BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(0), DCPTime(960000)));
++i;
BOOST_CHECK (i->period == DCPTimePeriod(DCPTime(0), DCPTime(960000)));
++i;
}
+
/** Test bug #1528 */
BOOST_AUTO_TEST_CASE (vf_test6)
{
/* Make the OV */
- shared_ptr<Film> ov = new_test_film ("vf_test6_ov");
+ auto ov = new_test_film ("vf_test6_ov");
ov->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
ov->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- shared_ptr<Content> video = content_factory("test/data/flat_red.png").front();
+ auto video = content_factory("test/data/flat_red.png").front();
ov->examine_and_add_content (video);
BOOST_REQUIRE (!wait_for_jobs());
video->video->set_length (24 * 10);
- ov->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (ov);
/* Make the VF */
- shared_ptr<Film> vf = new_test_film ("vf_test6_vf");
+ auto vf = new_test_film ("vf_test6_vf");
vf->set_name ("vf_test6_vf");
vf->set_dcp_content_type (DCPContentType::from_isdcf_name("TST"));
vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
vf->set_sequence (false);
- shared_ptr<DCPContent> dcp (new DCPContent(ov->dir(ov->dcp_name())));
- BOOST_REQUIRE (dcp);
+ auto dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
vf->examine_and_add_content (dcp);
BOOST_REQUIRE (!wait_for_jobs());
dcp->set_reference_video (true);
dcp->set_reference_audio (true);
- shared_ptr<Content> sub = content_factory("test/data/15s.srt").front();
+ auto sub = content_factory("test/data/15s.srt").front();
vf->examine_and_add_content (sub);
BOOST_REQUIRE (!wait_for_jobs());
- vf->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (
+ vf,
+ {
+ dcp::VerificationNote::Code::EXTERNAL_ASSET,
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME
+ });
}
+
/** Test bug #1643 (the second part; referring fails if there are gaps) */
BOOST_AUTO_TEST_CASE (vf_test7)
{
/* First OV */
- shared_ptr<Film> ov1 = new_test_film2 ("vf_test7_ov1");
+ auto ov1 = new_test_film2 ("vf_test7_ov1", {content_factory("test/data/flat_red.png").front()});
ov1->set_video_frame_rate (24);
- ov1->examine_and_add_content (content_factory("test/data/flat_red.png").front());
- BOOST_REQUIRE (!wait_for_jobs());
- ov1->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (ov1);
/* Second OV */
- shared_ptr<Film> ov2 = new_test_film2 ("vf_test7_ov2");
+ auto ov2 = new_test_film2 ("vf_test7_ov2", {content_factory("test/data/flat_red.png").front()});
ov2->set_video_frame_rate (24);
- ov2->examine_and_add_content (content_factory("test/data/flat_red.png").front());
- BOOST_REQUIRE (!wait_for_jobs());
- ov2->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (ov2);
/* VF */
- shared_ptr<Film> vf = new_test_film2 ("vf_test7_vf");
- shared_ptr<DCPContent> ov1_dcp (new DCPContent(ov1->dir(ov1->dcp_name())));
- vf->examine_and_add_content (ov1_dcp);
- shared_ptr<DCPContent> ov2_dcp (new DCPContent(ov1->dir(ov1->dcp_name())));
- vf->examine_and_add_content (ov2_dcp);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto ov1_dcp = make_shared<DCPContent>(ov1->dir(ov1->dcp_name()));
+ auto ov2_dcp = make_shared<DCPContent>(ov2->dir(ov2->dcp_name()));
+ auto vf = new_test_film2 ("vf_test7_vf", {ov1_dcp, ov2_dcp});
vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
ov1_dcp->set_reference_video (true);
ov2_dcp->set_reference_video (true);
ov1_dcp->set_position (vf, DCPTime::from_seconds(1));
ov2_dcp->set_position (vf, DCPTime::from_seconds(20));
vf->write_metadata ();
- vf->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (vf);
}