{
Cleanup cl;
- auto film = new_test_film2 ("atmos_passthrough_test", &cl);
- auto ref = TestPaths::private_data() / "atmos_asset.mxf";
- auto content = content_factory (TestPaths::private_data() / "atmos_asset.mxf").front();
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto film = new_test_film2 (
+ "atmos_passthrough_test",
+ { content_factory(TestPaths::private_data() / "atmos_asset.mxf").front() },
+ &cl
+ );
film->make_dcp ();
BOOST_REQUIRE (!wait_for_jobs());
+ auto ref = TestPaths::private_data() / "atmos_asset.mxf";
BOOST_REQUIRE (mxf_atmos_files_same(ref, dcp_file(film, "atmos"), true));
cl.run ();
{
Cleanup cl;
- auto film = new_test_film2 ("atmos_encrypted_passthrough_test", &cl);
auto ref = TestPaths::private_data() / "atmos_asset.mxf";
auto content = content_factory (TestPaths::private_data() / "atmos_asset.mxf").front();
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto film = new_test_film2 ("atmos_encrypted_passthrough_test", {content}, &cl);
film->set_encrypted (true);
film->_key = dcp::Key ("4fac12927eb122af1c2781aa91f3a4cc");
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_CPL_METADATA });
BOOST_REQUIRE (!mxf_atmos_files_same(ref, dcp_file(film, "atmos")));
optional<int>()
);
- auto film2 = new_test_film2 ("atmos_encrypted_passthrough_test2", &cl);
auto content2 = make_shared<DCPContent>(film->dir(film->dcp_name()));
content2->add_kdm (kdm);
- film2->examine_and_add_content (content2);
- BOOST_REQUIRE (!wait_for_jobs());
-
- film2->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ auto film2 = new_test_film2 ("atmos_encrypted_passthrough_test2", {content2}, &cl);
+ make_and_verify_dcp (film2, { dcp::VerificationNote::Code::MISSING_CPL_METADATA });
BOOST_CHECK (mxf_atmos_files_same(ref, dcp_file(film2, "atmos"), true));
/*
- 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.
*/
+
/** @defgroup feature Tests of features */
/** @file test/audio_delay_test.cc
* The output is checked algorithmically using knowledge of the input.
*/
-#include <boost/test/unit_test.hpp>
-#include <dcp/sound_frame.h>
+
+#include "lib/audio_content.h"
+#include "lib/dcp_content_type.h"
+#include "lib/ffmpeg_content.h"
+#include "lib/film.h"
+#include "lib/ratio.h"
+#include "test.h"
#include <dcp/cpl.h>
#include <dcp/reel.h>
+#include <dcp/reel_sound_asset.h>
#include <dcp/sound_asset.h>
#include <dcp/sound_asset_reader.h>
-#include <dcp/reel_sound_asset.h>
-#include "lib/ffmpeg_content.h"
-#include "lib/dcp_content_type.h"
-#include "lib/ratio.h"
-#include "lib/film.h"
-#include "lib/audio_content.h"
-#include "test.h"
+#include <dcp/sound_frame.h>
+#include <boost/test/unit_test.hpp>
#include <iostream>
-using std::string;
+
using std::cout;
-using boost::lexical_cast;
+using std::make_shared;
using std::shared_ptr;
+using std::string;
+using boost::lexical_cast;
+
static
void test_audio_delay (int delay_in_ms)
BOOST_TEST_MESSAGE ("Testing delay of " << delay_in_ms);
string const film_name = "audio_delay_test_" + lexical_cast<string> (delay_in_ms);
- shared_ptr<Film> film = new_test_film (film_name);
- film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
- film->set_container (Ratio::from_id ("185"));
- film->set_name (film_name);
-
- shared_ptr<FFmpegContent> content (new FFmpegContent("test/data/staircase.wav"));
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto content = make_shared<FFmpegContent>("test/data/staircase.wav");
+ shared_ptr<Film> film = new_test_film2 (
+ film_name, { content }
+ );
+
content->audio->set_delay (delay_in_ms);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_CPL_METADATA });
boost::filesystem::path path = "build/test";
path /= film_name;
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);
/* Sample index in the DCP */
}
}
+
/* Test audio delay when specified in a piece of audio content */
BOOST_AUTO_TEST_CASE (audio_delay_test)
{
content->subtitle->set_use (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_dcp", film->dir (film->dcp_name ()));
}
film->set_name ("frobozz");
film->examine_and_add_content (content_factory(film, "test/data/flat_black.png").front());
BOOST_REQUIRE (!wait_for_jobs());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
Config::instance()->set_log_types (Config::instance()->log_types() | LogEntry::TYPE_DEBUG_ENCODE);
auto film2 = new_test_film ("burnt_subtitle_test_onto_dcp2");
sub->subtitle->set_outline (true);
film2->examine_and_add_content (sub);
BOOST_REQUIRE (!wait_for_jobs());
- film2->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film2);
BOOST_CHECK (background_dcp->position() == DCPTime());
BOOST_CHECK (sub->position() == DCPTime());
{
Cleanup cl;
- auto film = new_test_film2 ("closed_caption_test1", &cl);
auto content = make_shared<StringTextFileContent>("test/data/subrip.srt");
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs ());
+ auto film = new_test_film2 ("closed_caption_test1", { content }, &cl);
content->only_text()->set_type (TextType::CLOSED_CAPTION);
BOOST_AUTO_TEST_CASE (closed_caption_test2)
{
Cleanup cl;
-
- auto film = new_test_film2 ("closed_caption_test2", &cl);
auto content1 = make_shared<StringTextFileContent>("test/data/subrip.srt");
- film->examine_and_add_content (content1);
auto content2 = make_shared<StringTextFileContent>("test/data/subrip2.srt");
- film->examine_and_add_content (content2);
auto content3 = make_shared<StringTextFileContent>("test/data/subrip3.srt");
- film->examine_and_add_content (content3);
- BOOST_REQUIRE (!wait_for_jobs ());
+ auto film = new_test_film2 ("closed_caption_test2", { content1, content2, content3 }, &cl);
content1->only_text()->set_type (TextType::CLOSED_CAPTION);
content1->only_text()->set_dcp_track (DCPTextTrack("First track", "fr-FR"));
content3->only_text()->set_type (TextType::CLOSED_CAPTION);
content3->only_text()->set_dcp_track (DCPTextTrack("Third track", "it-IT"));
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION,
+ dcp::VerificationNote::Code::INVALID_CLOSED_CAPTION_LINE_LENGTH,
+ dcp::VerificationNote::Code::MISSING_CPL_METADATA
+ }
+ );
dcp::DCP check (film->dir(film->dcp_name()));
check.read ();
/*
- 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.
*/
+
/** @file test/content_test.cc
* @brief Tests which expose problems with certain pieces of content.
* @ingroup completedcp
*/
+
#include "lib/audio_content.h"
#include "lib/film.h"
#include "lib/dcp_content_type.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
+
using std::shared_ptr;
using namespace dcpomatic;
+
/** There has been garbled audio with this piece of content */
BOOST_AUTO_TEST_CASE (content_test1)
{
- shared_ptr<Film> film = new_test_film ("content_test1");
+ auto film = new_test_film ("content_test1");
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
film->set_name ("content_test1");
film->set_container (Ratio::from_id ("185"));
- shared_ptr<Content> content = content_factory(TestPaths::private_data() / "demo_sound_bug.mkv").front ();
+ auto content = content_factory(TestPaths::private_data() / "demo_sound_bug.mkv").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,
+ { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE }
+ );
boost::filesystem::path check;
- for (
- boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator("build/test/content_test1/" + film->dcp_name());
- i != boost::filesystem::directory_iterator();
- ++i) {
-
- if (i->path().leaf().string().substr(0, 4) == "pcm_") {
- check = *i;
+ for (auto i: boost::filesystem::directory_iterator("build/test/content_test1/" + film->dcp_name())) {
+ if (i.path().leaf().string().substr(0, 4) == "pcm_") {
+ check = i;
}
}
check_mxf_audio_file (TestPaths::private_data() / "content_test1.mxf", check);
}
+
/** Taking some 23.976fps content and trimming 0.5s (in content time) from the start
* has failed in the past; ensure that this is fixed.
*/
BOOST_AUTO_TEST_CASE (content_test2)
{
- shared_ptr<Film> film = new_test_film2 ("content_test2");
-
- shared_ptr<Content> content = content_factory("test/data/red_23976.mp4").front();
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs ());
+ auto content = content_factory("test/data/red_23976.mp4").front();
+ auto film = new_test_film2 ("content_test2", {content});
content->set_trim_start(ContentTime::from_seconds(0.5));
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film);
}
+
/** Check that position and start trim of video content is forced to a frame boundary */
BOOST_AUTO_TEST_CASE (content_test3)
{
- shared_ptr<Film> film = new_test_film2 ("content_test3");
+ auto content = content_factory("test/data/red_24.mp4").front();
+ auto film = new_test_film2 ("content_test3", {content});
film->set_sequence (false);
- shared_ptr<Content> content = content_factory("test/data/red_24.mp4").front();
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs ());
-
/* Trim */
/* 12 frames */
/** Content containing video will have its length rounded to the nearest video frame */
BOOST_AUTO_TEST_CASE (content_test4)
{
- shared_ptr<Film> film = new_test_film2 ("content_test4");
+ auto film = new_test_film2 ("content_test4");
- shared_ptr<Content> video = content_factory("test/data/count300bd24.m2ts").front();
+ auto video = content_factory("test/data/count300bd24.m2ts").front();
film->examine_and_add_content (video);
BOOST_REQUIRE (!wait_for_jobs());
/** Content containing no video will not have its length rounded to the nearest video frame */
BOOST_AUTO_TEST_CASE (content_test5)
{
- shared_ptr<Film> film = new_test_film2 ("content_test5");
-
- shared_ptr<Content> audio = content_factory("test/data/sine_16_48_220_10.wav").front();
- film->examine_and_add_content (audio);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto audio = content_factory("test/data/sine_16_48_220_10.wav").front();
+ auto film = new_test_film2 ("content_test5", {audio});
audio->set_trim_end (dcpomatic::ContentTime(3000));
+
BOOST_CHECK (audio->length_after_trim(film) == DCPTime(957000));
}
{
Cleanup cl;
- auto film = new_test_film2 ("content_test6", &cl);
- film->examine_and_add_content (content_factory(TestPaths::private_data() / "fha.mkv").front());
- BOOST_REQUIRE (!wait_for_jobs());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ auto film = new_test_film2 (
+ "content_test6",
+ { content_factory(TestPaths::private_data() / "fha.mkv").front() },
+ &cl
+ );
+
+ make_and_verify_dcp (film);
check_dcp (TestPaths::private_data() / "fha", film);
cl.run ();
/** Reel length error when making the test for #1833 */
BOOST_AUTO_TEST_CASE (content_test7)
{
- shared_ptr<Film> film = new_test_film2 ("content_test7");
- shared_ptr<Content> content = content_factory(TestPaths::private_data() / "clapperboard.mp4").front();
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto content = content_factory(TestPaths::private_data() / "clapperboard.mp4").front();
+ auto film = new_test_film2 ("content_test7", {content});
content->audio->set_delay (-1000);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_RATE_FOR_2K });
}
/*
- Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2020-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/cpl_hash_test.cc
* @brief Make sure that <Hash> tags are always written to CPLs where required.
* @ingroup feature
#include <boost/test/unit_test.hpp>
-using std::string;
+using std::make_shared;
using std::shared_ptr;
+using std::string;
BOOST_AUTO_TEST_CASE (hash_added_to_imported_dcp_test)
using namespace boost::filesystem;
string const ov_name = "hash_added_to_imported_dcp_test_ov";
- shared_ptr<Film> ov = new_test_film2 (ov_name);
- 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());
+ shared_ptr<Film> ov = new_test_film2 (
+ ov_name,
+ { content_factory("test/data/flat_red.png").front() }
+ );
+ make_and_verify_dcp (ov);
/* Remove <Hash> tags from the CPL */
- for (directory_iterator i = directory_iterator(String::compose("build/test/%1/%2", ov_name, ov->dcp_name())); i != directory_iterator(); ++i) {
- if (boost::algorithm::starts_with(i->path().filename().string(), "cpl_")) {
- FILE* in = fopen_boost(i->path(), "r");
+ for (auto i: directory_iterator(String::compose("build/test/%1/%2", ov_name, ov->dcp_name()))) {
+ if (boost::algorithm::starts_with(i.path().filename().string(), "cpl_")) {
+ auto in = fopen_boost(i.path(), "r");
BOOST_REQUIRE (in);
- FILE* out = fopen_boost(i->path().string() + ".tmp", "w");
+ auto out = fopen_boost(i.path().string() + ".tmp", "w");
BOOST_REQUIRE (out);
char buffer[256];
- while (fgets (buffer, sizeof(buffer), in)) {
+ while (fgets(buffer, sizeof(buffer), in)) {
if (string(buffer).find("Hash") == string::npos) {
fputs (buffer, out);
}
}
fclose (in);
fclose (out);
- rename (i->path().string() + ".tmp", i->path());
+ rename (i.path().string() + ".tmp", i.path());
}
}
string const vf_name = "hash_added_to_imported_dcp_test_vf";
- shared_ptr<Film> vf = new_test_film2 (vf_name);
- shared_ptr<DCPContent> ov_content(new DCPContent(String::compose("build/test/%1/%2", ov_name, ov->dcp_name())));
- vf->examine_and_add_content (ov_content);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto ov_content = make_shared<DCPContent>(String::compose("build/test/%1/%2", ov_name, ov->dcp_name()));
+ auto vf = new_test_film2 (
+ vf_name, { ov_content }
+ );
ov_content->set_reference_video (true);
- vf->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
/* Check for Hash tags in the VF DCP */
int hashes = 0;
- for (directory_iterator i = directory_iterator(String::compose("build/test/%1/%2", vf_name, vf->dcp_name())); i != directory_iterator(); ++i) {
- if (boost::algorithm::starts_with(i->path().filename().string(), "cpl_")) {
- FILE* in = fopen_boost(i->path(), "r");
+ for (auto i: directory_iterator(String::compose("build/test/%1/%2", vf_name, vf->dcp_name()))) {
+ if (boost::algorithm::starts_with(i.path().filename().string(), "cpl_")) {
+ auto in = fopen_boost(i.path(), "r");
BOOST_REQUIRE (in);
char buffer[256];
while (fgets (buffer, sizeof(buffer), in)) {
-Subproject commit 21f386365bef1ee6f8073c088679357fbbb13f9d
+Subproject commit 3eb05f5989dcb601bde60c4badc95b66cf46a0cb
/*
- 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/dcp_subtitle_test.cc
* @brief Test DCP subtitle content in various ways.
* @ingroup feature
*/
+
#include <boost/test/unit_test.hpp>
#include "lib/film.h"
#include "lib/dcp_subtitle_content.h"
#include "test.h"
#include <iostream>
+
using std::cout;
using std::list;
+using std::make_shared;
using std::shared_ptr;
using std::vector;
using boost::optional;
#endif
using namespace dcpomatic;
+
optional<ContentStringText> stored;
+
static void
store (ContentStringText sub)
{
}
}
+
/** Test pass-through of a very simple DCP subtitle file */
BOOST_AUTO_TEST_CASE (dcp_subtitle_test)
{
- shared_ptr<Film> film = new_test_film ("dcp_subtitle_test");
+ auto film = new_test_film ("dcp_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_interop (false);
- shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent ("test/data/dcp_sub.xml"));
+ auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub.xml");
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 ());
-
- check_dcp ("test/data/dcp_subtitle_test", film->dir (film->dcp_name ()));
+ 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
+ });
+
+ check_dcp ("test/data/dcp_subtitle_test", film->dir(film->dcp_name()));
}
+
/** Test parsing of a subtitle within an existing DCP */
BOOST_AUTO_TEST_CASE (dcp_subtitle_within_dcp_test)
{
- shared_ptr<Film> film = new_test_film ("dcp_subtitle_within_dcp_test");
+ auto film = new_test_film ("dcp_subtitle_within_dcp_test");
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<DCPContent> content (new DCPContent(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV"));
+ auto content = make_shared<DCPContent>(TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV");
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
/** Test subtitles whose text includes things like <b> */
BOOST_AUTO_TEST_CASE (dcp_subtitle_test2)
{
- shared_ptr<Film> film = new_test_film ("dcp_subtitle_test2");
+ auto film = new_test_film ("dcp_subtitle_test2");
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TLR"));
film->set_name ("frobozz");
- shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent("test/data/dcp_sub2.xml"));
+ auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub2.xml");
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder(film, content));
+ auto decoder = make_shared<DCPSubtitleDecoder>(film, content);
decoder->only_text()->PlainStart.connect (bind (store, _1));
stored = optional<ContentStringText> ();
}
}
+
/** Test a failure case */
BOOST_AUTO_TEST_CASE (dcp_subtitle_test3)
{
- shared_ptr<Film> film = new_test_film ("dcp_subtitle_test3");
+ auto film = new_test_film ("dcp_subtitle_test3");
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);
- shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent ("test/data/dcp_sub3.xml"));
+ auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub3.xml");
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::INVALID_STANDARD });
- shared_ptr<DCPSubtitleDecoder> decoder (new DCPSubtitleDecoder (film, content));
+ auto decoder = make_shared<DCPSubtitleDecoder>(film, content);
stored = optional<ContentStringText> ();
while (!decoder->pass ()) {
decoder->only_text()->PlainStart.connect (bind (store, _1));
if (stored && stored->from() == ContentTime::from_seconds(0.08)) {
- list<dcp::SubtitleString> s = stored->subs;
- list<dcp::SubtitleString>::const_iterator i = s.begin ();
+ auto s = stored->subs;
+ auto i = s.begin ();
BOOST_CHECK_EQUAL (i->text(), "This");
++i;
BOOST_REQUIRE (i != s.end ());
}
}
+
/** Check that Interop DCPs aren't made with more than one <LoadFont> (#1273) */
BOOST_AUTO_TEST_CASE (dcp_subtitle_test4)
{
- shared_ptr<Film> film = new_test_film2 ("dcp_subtitle_test4");
+ auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub3.xml");
+ auto content2 = make_shared<DCPSubtitleContent>("test/data/dcp_sub3.xml");
+ auto film = new_test_film2 ("dcp_subtitle_test4", {content, content2});
film->set_interop (true);
- shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent ("test/data/dcp_sub3.xml"));
- film->examine_and_add_content (content);
- shared_ptr<DCPSubtitleContent> content2 (new DCPSubtitleContent ("test/data/dcp_sub3.xml"));
- film->examine_and_add_content (content2);
- BOOST_REQUIRE (!wait_for_jobs ());
-
content->only_text()->add_font (shared_ptr<Font> (new Font ("font1")));
content2->only_text()->add_font (shared_ptr<Font> (new Font ("font2")));
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_STANDARD });
cxml::Document doc ("DCSubtitle");
doc.read_file (subtitle_file (film));
BOOST_REQUIRE_EQUAL (doc.node_children("LoadFont").size(), 1U);
}
+
static
void
check_font_tags (vector<cxml::NodePtr> nodes)
}
}
+
/** Check that imported <LoadFont> tags with empty IDs (or corresponding Font tags with empty IDs)
* are not passed through into the DCP.
*/
BOOST_AUTO_TEST_CASE (dcp_subtitle_test5)
{
- shared_ptr<Film> film = new_test_film2 ("dcp_subtitle_test5");
+ auto content = make_shared<DCPSubtitleContent>("test/data/dcp_sub6.xml");
+ auto film = new_test_film2 ("dcp_subtitle_test5", {content});
film->set_interop (true);
- shared_ptr<DCPSubtitleContent> content (new DCPSubtitleContent("test/data/dcp_sub6.xml"));
- 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::INVALID_STANDARD });
cxml::Document doc ("DCSubtitle");
doc.read_file (subtitle_file(film));
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/ffmpeg_dcp_test.cc
* @brief Test creation of a very simple DCP from some FFmpegContent (data/test.mp4).
* @ingroup feature
* Also a quick test of Film::have_dcp ().
*/
+
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include "lib/video_content.h"
#include "test.h"
+
+using std::make_shared;
using std::shared_ptr;
+
BOOST_AUTO_TEST_CASE (ffmpeg_dcp_test)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_dcp_test");
+ auto film = new_test_film ("ffmpeg_dcp_test");
film->set_name ("test_film2");
- 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());
film->set_container (Ratio::from_id ("185"));
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
- film->make_dcp ();
- film->write_metadata ();
+ make_and_verify_dcp (film);
BOOST_REQUIRE (!wait_for_jobs());
}
-/** Briefly test Film::cpls(). Requires the output from ffmpeg_dcp_test above */
+
+/** Briefly test Film::cpls() */
BOOST_AUTO_TEST_CASE (ffmpeg_have_dcp_test, * boost::unit_test::depends_on("ffmpeg_dcp_test"))
{
- boost::filesystem::path p = test_film_dir ("ffmpeg_dcp_test");
- shared_ptr<Film> film (new Film (p));
+ auto p = test_film_dir ("ffmpeg_dcp_test");
+ auto film = make_shared<Film>(p);
film->read_metadata ();
BOOST_CHECK (!film->cpls().empty());
p /= film->dcp_name();
- boost::filesystem::directory_iterator i = boost::filesystem::directory_iterator (p);
+ auto i = boost::filesystem::directory_iterator (p);
while (i != boost::filesystem::directory_iterator() && !boost::algorithm::starts_with (i->path().leaf().string(), "j2c")) {
++i;
}
name = String::compose("%1_test%2", name, number);
- shared_ptr<Film> film = new_test_film2 (name, &cl);
- film->set_name (name);
auto c = make_shared<FFmpegContent>(content);
+ shared_ptr<Film> film = new_test_film2 (name, {c}, &cl);
+ film->set_name (name);
film->set_audio_channels (6);
- film->examine_and_add_content (c);
- BOOST_REQUIRE (!wait_for_jobs ());
-
film->write_metadata ();
auto job = make_shared<TranscodeJob>(film);
auto file = boost::filesystem::path("build") / "test" / String::compose("%1.%2", name, extension);
/*
- 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.
*/
-#include "test.h"
-#include "lib/film.h"
-#include "lib/content_factory.h"
+
#include "lib/content.h"
+#include "lib/content_factory.h"
+#include "lib/film.h"
#include "lib/video_content.h"
+#include "test.h"
#include <boost/test/unit_test.hpp>
+
using std::string;
using std::list;
using std::shared_ptr;
+
BOOST_AUTO_TEST_CASE (image_content_fade_test)
{
- shared_ptr<Film> film = new_test_film2 ("image_content_fade_test");
- shared_ptr<Content> content = content_factory("test/data/flat_red.png").front();
+ auto film = new_test_film2 ("image_content_fade_test");
+ auto content = content_factory("test/data/flat_red.png").front();
film->examine_and_add_content (content);
BOOST_REQUIRE (!wait_for_jobs());
content->video->set_fade_in (1);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
check_dcp ("test/data/image_content_fade_test", film->dir(film->dcp_name()));
}
Cleanup cl;
/* Make a DCP with some markers */
- auto film = new_test_film2 ("import_dcp_markers_test", &cl);
auto content = content_factory("test/data/flat_red.png").front();
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto film = new_test_film2 ("import_dcp_markers_test", {content}, &cl);
content->video->set_length (24 * 60 * 10);
BOOST_REQUIRE (!wait_for_jobs());
/* Import the DCP to a new film and check the markers */
- auto film2 = new_test_film2 ("import_dcp_markers_test2", &cl);
auto imported = make_shared<DCPContent>(film->dir(film->dcp_name()));
- film2->examine_and_add_content (imported);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto film2 = new_test_film2 ("import_dcp_markers_test2", {imported}, &cl);
film2->write_metadata ();
/* When import_dcp_markers_test was made a LFOC marker will automatically
auto film3 = make_shared<Film>(boost::filesystem::path("build/test/import_dcp_markers_test2"));
film3->read_metadata ();
BOOST_REQUIRE_EQUAL (film3->content().size(), 1U);
- shared_ptr<DCPContent> reloaded = dynamic_pointer_cast<DCPContent>(film3->content().front());
+ auto reloaded = dynamic_pointer_cast<DCPContent>(film3->content().front());
BOOST_REQUIRE (reloaded);
BOOST_CHECK_EQUAL (reloaded->markers().size(), 4U);
film->examine_and_add_content (content_factory("test/data/flat_black.png").front());
BOOST_REQUIRE (!wait_for_jobs());
film->set_encrypted (true);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
- film->write_metadata ();
- vector<CPLSummary> cpls = film->cpls ();
+ make_and_verify_dcp (film);
+ auto cpls = film->cpls ();
BOOST_REQUIRE(cpls.size() == 1);
dcp::LocalTime from (cert.not_before());
string const from_string = from.date() + " " + from.time_of_day(true, false);
string const until_string = until.date() + " " + until.time_of_day(true, false);
- boost::filesystem::path cpl = cpls.front().cpl_file;
- KDMWithMetadataPtr kdm = kdm_for_screen (
+ auto cpl = cpls.front().cpl_file;
+ auto kdm = kdm_for_screen (
film,
cpls.front().cpl_file,
cinema_a_screen_1,
optional<int>()
);
- list<KDMWithMetadataPtr> kdms;
- kdms.push_back (kdm);
-
write_files (
- kdms,
+ { kdm },
boost::filesystem::path("build/test/single_kdm_naming_test"),
dcp::NameFormat("KDM %c - %s - %f - %b - %e"),
&confirm_overwrite
/* Film */
boost::filesystem::remove_all ("build/test/directory_kdm_naming_test");
- shared_ptr<Film> film = new_test_film2 ("directory_kdm_naming_test");
+ auto film = new_test_film2 (
+ "directory_kdm_naming_test",
+ { content_factory("test/data/flat_black.png").front() }
+ );
+
film->set_name ("my_great_film");
- film->examine_and_add_content (content_factory("test/data/flat_black.png").front());
- BOOST_REQUIRE (!wait_for_jobs());
film->set_encrypted (true);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
- film->write_metadata ();
- vector<CPLSummary> cpls = film->cpls ();
+ make_and_verify_dcp (film);
+ auto cpls = film->cpls ();
BOOST_REQUIRE(cpls.size() == 1);
dcp::LocalTime from (cert.not_before());
string const from_string = from.date() + " " + from.time_of_day(true, false);
string const until_string = until.date() + " " + until.time_of_day(true, false);
- list<shared_ptr<dcpomatic::Screen> > screens;
- screens.push_back (cinema_a_screen_2);
- screens.push_back (cinema_b_screen_x);
- screens.push_back (cinema_a_screen_1);
- screens.push_back (cinema_b_screen_z);
+ list<shared_ptr<dcpomatic::Screen>> screens = {
+ cinema_a_screen_2, cinema_b_screen_x, cinema_a_screen_1, (cinema_b_screen_z)
+ };
- path const cpl = cpls.front().cpl_file;
- string const cpl_id = cpls.front().cpl_id;
+ auto const cpl = cpls.front().cpl_file;
+ auto const cpl_id = cpls.front().cpl_id;
list<KDMWithMetadataPtr> kdms;
for (auto i: screens) {
- KDMWithMetadataPtr kdm = kdm_for_screen (
+ auto kdm = kdm_for_screen (
film,
cpls.front().cpl_file,
i,
&confirm_overwrite
);
- string from_time = from.time_of_day (true, false);
+ auto from_time = from.time_of_day (true, false);
boost::algorithm::replace_all (from_time, ":", "-");
- string until_time = until.time_of_day (true, false);
+ auto until_time = until.time_of_day (true, false);
boost::algorithm::replace_all (until_time, ":", "-");
path const base = "build/test/directory_kdm_naming_test";
B->set_position (film, dcpomatic::DCPTime());
A->video->set_use (false);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
check_dcp ("test/data/no_use_video_test1", film);
}
B->set_position (film, dcpomatic::DCPTime());
A->video->set_use (false);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
check_dcp (TestPaths::private_data() / "no_use_video_test2", film);
}
ov_a->examine_and_add_content (ov_a_pic);
ov_a->examine_and_add_content (ov_a_snd);
BOOST_REQUIRE (!wait_for_jobs());
- ov_a->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (ov_a);
auto ov_b = new_test_film2("no_use_video_test3_ov_b");
auto ov_b_pic = content_factory("test/data/flat_green.png").front();
ov_b->examine_and_add_content (ov_b_pic);
ov_b->examine_and_add_content (ov_b_snd);
BOOST_REQUIRE (!wait_for_jobs());
- ov_b->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (ov_b);
auto vf = new_test_film2 ("no_use_video_test3_vf");
auto A = make_shared<DCPContent>(ov_a->dir(ov_a->dcp_name()));
A->set_reference_audio (true);
B->set_reference_video (true);
- vf->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
dcp::DCP ov_a_check (ov_a->dir(ov_a->dcp_name()));
ov_a_check.read ();
/*
- Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/recover_test.cc
* @brief Test recovery of a DCP transcode after a crash.
* @ingroup feature
*/
+
#include "test.h"
#include "lib/film.h"
#include "lib/dcp_content_type.h"
#include <boost/test/unit_test.hpp>
#include <iostream>
+
using std::cout;
using std::make_shared;
using std::shared_ptr;
using namespace boost::placeholders;
#endif
+
static void
note (dcp::NoteType t, string n)
{
}
}
+
BOOST_AUTO_TEST_CASE (recover_test_2d)
{
shared_ptr<Film> film = new_test_film ("recover_test_2d");
boost::filesystem::resize_file (video, 2 * 1024 * 1024);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
shared_ptr<dcp::MonoPictureAsset> A (new dcp::MonoPictureAsset ("build/test/recover_test_2d/original.mxf"));
shared_ptr<dcp::MonoPictureAsset> B (new dcp::MonoPictureAsset (video));
BOOST_CHECK (A->equals (B, eq, boost::bind (¬e, _1, _2)));
}
+
BOOST_AUTO_TEST_CASE (recover_test_3d, * boost::unit_test::depends_on("recover_test_2d"))
{
auto film = new_test_film ("recover_test_3d");
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_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
boost::filesystem::path const video = "build/test/recover_test_3d/video/185_2K_70e6661af92ae94458784c16a21a9748_24_100000000_P_S_3D_0_96000.mxf";
boost::filesystem::resize_file (video, 2 * 1024 * 1024);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
auto A = make_shared<dcp::StereoPictureAsset>("build/test/recover_test_3d/original.mxf");
auto B = make_shared<dcp::StereoPictureAsset>(video);
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_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
boost::filesystem::path const video =
"build/test/recover_test_2d_encrypted/video/185_2K_02543352c540f4b083bff3f1e309d4a9_24_100000000_Eeafcb91c9f5472edf01f3a2404c57258_S_0_1200000.mxf";
boost::filesystem::resize_file (video, 2 * 1024 * 1024);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
auto A = make_shared<dcp::MonoPictureAsset>("build/test/recover_test_2d_encrypted/original.mxf");
A->set_key (film->key ());
auto audio = content_factory("test/data/white.wav").front();
film->examine_and_add_content (audio);
BOOST_REQUIRE (!wait_for_jobs());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
/* Find main picture and sound asset IDs */
dcp::DCP dcp1 (film->dir(film->dcp_name()));
/* Change the audio and re-make */
audio->audio->set_gain (-3);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
/* Video ID should be the same, sound different */
dcp::DCP dcp2 (film->dir(film->dcp_name()));
/* Crop video and re-make */
video->video->set_left_crop (5);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
/* Video and sound IDs should be different */
dcp::DCP dcp3 (film->dir(film->dcp_name()));
/*
- Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @file test/reels_test.cc
* @brief Check manipulation of reels in various ways.
* @ingroup feature
*/
+
#include "lib/film.h"
#include "lib/ratio.h"
#include "lib/ffmpeg_content.h"
#include <boost/test/unit_test.hpp>
#include <iostream>
+
using std::list;
using std::cout;
using std::vector;
using boost::function;
using namespace dcpomatic;
+
/** Test Film::reels() */
BOOST_AUTO_TEST_CASE (reels_test1)
{
BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_frames(144, 24).get());
}
+
/** Make a short DCP with multi reels split by video content, then import
* this into a new project and make a new DCP referencing it.
*/
BOOST_CHECK_EQUAL (film->reels().size(), 3U);
BOOST_REQUIRE (!wait_for_jobs());
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
check_dcp ("test/data/reels_test2", film->dir (film->dcp_name()));
- shared_ptr<Film> film2 = new_test_film ("reels_test2b");
- film2->set_name ("reels_test2b");
- film2->set_container (Ratio::from_id ("185"));
- film2->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
- film2->set_reel_type (ReelType::BY_VIDEO_CONTENT);
-
auto c = make_shared<DCPContent>(film->dir(film->dcp_name()));
- film2->examine_and_add_content (c);
- BOOST_REQUIRE (!wait_for_jobs ());
+ auto film2 = new_test_film2 ("reels_test2b", {c});
+ film2->set_reel_type (ReelType::BY_VIDEO_CONTENT);
auto r = film2->reels ();
BOOST_CHECK_EQUAL (r.size(), 3U);
c->set_reference_video (true);
c->set_reference_audio (true);
- film2->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film2, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
}
+
/** Check that ReelType::BY_VIDEO_CONTENT adds an extra reel, if necessary, at the end
* of all the video content to mop up anything afterward.
*/
BOOST_AUTO_TEST_CASE (reels_test3)
{
- auto film = new_test_film ("reels_test3");
- film->set_name ("reels_test3");
- film->set_container (Ratio::from_id ("185"));
- film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
- film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
-
auto dcp = make_shared<DCPContent>("test/data/reels_test2");
- film->examine_and_add_content (dcp);
auto sub = make_shared<StringTextFileContent>("test/data/subrip.srt");
- film->examine_and_add_content (sub);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto film = new_test_film2 ("reels_test3", {dcp, sub});
+ film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
auto reels = film->reels();
BOOST_REQUIRE_EQUAL (reels.size(), 4U);
BOOST_CHECK_EQUAL (i->to.get(), sub->full_length(film).ceil(film->video_frame_rate()).get());
}
+
/** Check creation of a multi-reel DCP with a single .srt subtitle file;
* make sure that the reel subtitle timing is done right.
*/
BOOST_AUTO_TEST_CASE (reels_test4)
{
- auto film = new_test_film ("reels_test4");
- film->set_name ("reels_test4");
- film->set_container (Ratio::from_id ("185"));
- film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
+ auto film = new_test_film2 ("reels_test4");
film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
film->set_interop (false);
content[i]->video->set_length (24);
}
- shared_ptr<StringTextFileContent> subs (new StringTextFileContent("test/data/subrip3.srt"));
+ auto subs = make_shared<StringTextFileContent>("test/data/subrip3.srt");
film->examine_and_add_content (subs);
BOOST_REQUIRE (!wait_for_jobs());
BOOST_CHECK_EQUAL (i->from.get(), 96000 * 3);
BOOST_CHECK_EQUAL (i->to.get(), 96000 * 4);
- 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_DURATION
+ });
check_dcp ("test/data/reels_test4", film->dir (film->dcp_name()));
}
+
BOOST_AUTO_TEST_CASE (reels_test5)
{
- auto film = new_test_film ("reels_test5");
+ auto dcp = make_shared<DCPContent>("test/data/reels_test4");
+ auto film = new_test_film2 ("reels_test5", {dcp});
film->set_sequence (false);
- shared_ptr<DCPContent> dcp (new DCPContent("test/data/reels_test4"));
- film->examine_and_add_content (dcp);
- BOOST_REQUIRE (!wait_for_jobs ());
/* Set to 2123 but it will be rounded up to the next frame (4000) */
dcp->set_position(film, DCPTime(2123));
}
}
+
/** Check reel split with a muxed video/audio source */
BOOST_AUTO_TEST_CASE (reels_test6)
{
- auto film = new_test_film ("reels_test6");
- film->set_name ("reels_test6");
- film->set_container (Ratio::from_id ("185"));
- film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
- shared_ptr<FFmpegContent> A (new FFmpegContent("test/data/test2.mp4"));
- film->examine_and_add_content (A);
- BOOST_REQUIRE (!wait_for_jobs ());
+ auto A = make_shared<FFmpegContent>("test/data/test2.mp4");
+ auto film = new_test_film2 ("reels_test6", {A});
film->set_j2k_bandwidth (100000000);
film->set_reel_type (ReelType::BY_LENGTH);
/* This is just over 2.5s at 100Mbit/s; should correspond to 60 frames */
film->set_reel_length (31253154);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (
+ film,
+ {
+ dcp::VerificationNote::Code::INVALID_INTRINSIC_DURATION,
+ dcp::VerificationNote::Code::INVALID_DURATION,
+ });
}
+
/** Check the case where the last bit of audio hangs over the end of the video
* and we are using ReelType::BY_VIDEO_CONTENT.
*/
BOOST_AUTO_TEST_CASE (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"));
auto A = content_factory("test/data/flat_red.png").front();
- film->examine_and_add_content (A);
- 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 ());
+ auto film = new_test_film2 ("reels_test7", { A, B });
film->set_video_frame_rate (24);
A->video->set_length (2 * 24);
BOOST_CHECK (film->reels().front() == DCPTimePeriod(DCPTime(0), DCPTime::from_frames(2 * 24, 24)));
BOOST_CHECK (film->reels().back() == DCPTimePeriod(DCPTime::from_frames(2 * 24, 24), DCPTime::from_frames(3 * 24 + 1, 24)));
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film);
}
+
/** Check a reels-related error; make_dcp() would raise a ProgrammingError */
BOOST_AUTO_TEST_CASE (reels_test8)
{
- shared_ptr<Film> film = new_test_film ("reels_test8");
- film->set_name ("reels_test8");
- film->set_container (Ratio::from_id ("185"));
- film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
auto A = make_shared<FFmpegContent>("test/data/test2.mp4");
- film->examine_and_add_content (A);
- BOOST_REQUIRE (!wait_for_jobs ());
+ auto film = new_test_film2 ("reels_test8", {A});
A->set_trim_end (ContentTime::from_seconds (1));
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs ());
+ make_and_verify_dcp (film);
}
+
/** Check another reels-related error; make_dcp() would raise a ProgrammingError */
BOOST_AUTO_TEST_CASE (reels_test9)
{
- shared_ptr<Film> film = new_test_film2("reels_test9a");
- shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
- film->examine_and_add_content(A);
- BOOST_REQUIRE(!wait_for_jobs());
+ auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+ auto film = new_test_film2("reels_test9a", {A});
A->video->set_length(5 * 24);
film->set_video_frame_rate(24);
- film->make_dcp();
- BOOST_REQUIRE(!wait_for_jobs());
+ make_and_verify_dcp (film);
- shared_ptr<Film> film2 = new_test_film2("reels_test9b");
- shared_ptr<DCPContent> B(new DCPContent(film->dir(film->dcp_name())));
- film2->examine_and_add_content(B);
- film2->examine_and_add_content(content_factory("test/data/dcp_sub4.xml").front());
+ auto B = make_shared<DCPContent>(film->dir(film->dcp_name()));
+ auto film2 = new_test_film2("reels_test9b", {B, content_factory("test/data/dcp_sub4.xml").front()});
B->set_reference_video(true);
B->set_reference_audio(true);
- BOOST_REQUIRE(!wait_for_jobs());
film2->set_reel_type(ReelType::BY_VIDEO_CONTENT);
film2->write_metadata();
- film2->make_dcp();
- BOOST_REQUIRE(!wait_for_jobs());
+ make_and_verify_dcp (
+ film2,
+ {
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME
+ });
}
+
/** Another reels-related error; make_dcp() would raise a ProgrammingError
* in AudioBuffers::allocate due to an attempt to allocate a negatively-sized buffer.
* This was triggered by a VF where there are referenced audio reels followed by
BOOST_AUTO_TEST_CASE (reels_test10)
{
/* Make the OV */
- shared_ptr<Film> ov = new_test_film2("reels_test10_ov");
- shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
- ov->examine_and_add_content (A);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+ auto B = make_shared<FFmpegContent>("test/data/flat_red.png");
+ auto ov = new_test_film2("reels_test10_ov", {A, B});
A->video->set_length (5 * 24);
-
- shared_ptr<FFmpegContent> B(new FFmpegContent("test/data/flat_red.png"));
- ov->examine_and_add_content (B);
- BOOST_REQUIRE (!wait_for_jobs());
B->video->set_length (5 * 24);
ov->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- ov->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (ov);
ov->write_metadata ();
/* Now try to make the VF; this used to fail */
- shared_ptr<Film> vf = new_test_film2("reels_test10_vf");
- shared_ptr<DCPContent> ov_dcp(new DCPContent(ov->dir(ov->dcp_name())));
- vf->examine_and_add_content (ov_dcp);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
+ auto vf = new_test_film2("reels_test10_vf", {ov_dcp, content_factory("test/data/15s.srt").front()});
vf->set_reel_type (ReelType::BY_VIDEO_CONTENT);
ov_dcp->set_reference_video (true);
ov_dcp->set_reference_audio (true);
- vf->examine_and_add_content (content_factory("test/data/15s.srt").front());
- 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
+ });
}
+
/** Another reels error; ReelType::BY_VIDEO_CONTENT when the first content is not
* at time 0.
*/
BOOST_AUTO_TEST_CASE (reels_test11)
{
- shared_ptr<Film> film = new_test_film2 ("reels_test11");
+ auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+ auto film = new_test_film2 ("reels_test11", {A});
film->set_video_frame_rate (24);
- shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
- film->examine_and_add_content (A);
- BOOST_REQUIRE (!wait_for_jobs());
A->video->set_length (240);
A->set_video_frame_rate (24);
A->set_position (film, DCPTime::from_seconds(1));
film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
BOOST_CHECK_EQUAL (A->position().get(), DCPTime::from_seconds(1).get());
BOOST_CHECK_EQUAL (A->end(film).get(), DCPTime::from_seconds(1 + 10).get());
- list<DCPTimePeriod> r = film->reels ();
+ auto r = film->reels ();
BOOST_CHECK_EQUAL (r.size(), 2U);
BOOST_CHECK_EQUAL (r.front().from.get(), 0);
BOOST_CHECK_EQUAL (r.front().to.get(), DCPTime::from_seconds(1).get());
BOOST_CHECK_EQUAL (r.back().to.get(), DCPTime::from_seconds(1 + 10).get());
}
+
/** For VFs to work right we have to make separate reels for empty bits between
* video content.
*/
BOOST_AUTO_TEST_CASE (reels_test12)
{
- shared_ptr<Film> film = new_test_film2 ("reels_test12");
+ auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+ auto B = make_shared<FFmpegContent>("test/data/flat_red.png");
+ auto film = new_test_film2 ("reels_test12", {A, B});
film->set_video_frame_rate (24);
film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
film->set_sequence (false);
- shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
- film->examine_and_add_content (A);
- BOOST_REQUIRE (!wait_for_jobs());
A->video->set_length (240);
A->set_video_frame_rate (24);
A->set_position (film, DCPTime::from_seconds(1));
- shared_ptr<FFmpegContent> B(new FFmpegContent("test/data/flat_red.png"));
- film->examine_and_add_content (B);
- BOOST_REQUIRE (!wait_for_jobs());
B->video->set_length (120);
B->set_video_frame_rate (24);
B->set_position (film, DCPTime::from_seconds(14));
- list<DCPTimePeriod> r = film->reels ();
+ auto r = film->reels ();
BOOST_REQUIRE_EQUAL (r.size(), 4U);
- list<DCPTimePeriod>::const_iterator i = r.begin ();
+ auto i = r.begin ();
BOOST_CHECK_EQUAL (i->from.get(), 0);
BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_seconds(1).get());
BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_seconds(19).get());
}
+
static void
no_op ()
{
*/
BOOST_AUTO_TEST_CASE (reels_should_not_be_short1)
{
- shared_ptr<Film> film = new_test_film2 ("reels_should_not_be_short1");
+ auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+ auto B = make_shared<FFmpegContent>("test/data/flat_red.png");
+ auto film = new_test_film2 ("reels_should_not_be_short1", {A, B});
film->set_video_frame_rate (24);
- shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
- film->examine_and_add_content (A);
- BOOST_REQUIRE (!wait_for_jobs());
A->video->set_length (23);
- shared_ptr<FFmpegContent> B(new FFmpegContent("test/data/flat_red.png"));
- film->examine_and_add_content (B);
- BOOST_REQUIRE (!wait_for_jobs());
B->video->set_length (23);
B->set_position (film, DCPTime::from_frames(23, 24));
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
- vector<boost::filesystem::path> dirs;
- dirs.push_back (film->dir(film->dcp_name(false)));
+ vector<boost::filesystem::path> dirs = { film->dir(film->dcp_name(false)) };
auto notes = dcp::verify(dirs, boost::bind(&no_op), boost::bind(&no_op), TestPaths::xsd());
dump_notes (notes);
BOOST_REQUIRE (notes.empty());
}
+
/** Leaving less than 1 second's gap between two pieces of content with
* ReelType::BY_VIDEO_CONTENT should not make a <1s reel.
*/
BOOST_AUTO_TEST_CASE (reels_should_not_be_short2)
{
- shared_ptr<Film> film = new_test_film2 ("reels_should_not_be_short2");
+ auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+ auto B = make_shared<FFmpegContent>("test/data/flat_red.png");
+ auto film = new_test_film2 ("reels_should_not_be_short2", {A, B});
film->set_video_frame_rate (24);
film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
- film->examine_and_add_content (A);
- BOOST_REQUIRE (!wait_for_jobs());
A->video->set_length (240);
- shared_ptr<FFmpegContent> B(new FFmpegContent("test/data/flat_red.png"));
- film->examine_and_add_content (B);
- BOOST_REQUIRE (!wait_for_jobs());
B->video->set_length (240);
B->set_position (film, DCPTime::from_seconds(10.2));
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
- vector<boost::filesystem::path> dirs;
- dirs.push_back (film->dir(film->dcp_name(false)));
+ vector<boost::filesystem::path> dirs = { film->dir(film->dcp_name(false)) };
auto const notes = dcp::verify(dirs, boost::bind(&no_op), boost::bind(&no_op), TestPaths::xsd());
dump_notes (notes);
BOOST_REQUIRE (notes.empty());
}
+
/** Setting ReelType::BY_LENGTH and using a small length value should not make
* <1s reels.
*/
BOOST_AUTO_TEST_CASE (reels_should_not_be_short3)
{
- shared_ptr<Film> film = new_test_film2 ("reels_should_not_be_short3");
+ auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+ auto film = new_test_film2 ("reels_should_not_be_short3", {A});
film->set_video_frame_rate (24);
film->set_reel_type (ReelType::BY_LENGTH);
film->set_reel_length (1024 * 1024 * 10);
- shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
- film->examine_and_add_content (A);
- BOOST_REQUIRE (!wait_for_jobs());
A->video->set_length (240);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
- vector<boost::filesystem::path> dirs;
- auto const notes = dcp::verify(dirs, boost::bind(&no_op), boost::bind(&no_op), TestPaths::xsd());
+ auto const notes = dcp::verify({}, boost::bind(&no_op), boost::bind(&no_op), TestPaths::xsd());
dump_notes (notes);
BOOST_REQUIRE (notes.empty());
}
+
/** Having one piece of content less than 1s long in ReelType::BY_VIDEO_CONTENT
* should not make a reel less than 1s long.
*/
BOOST_AUTO_TEST_CASE (reels_should_not_be_short4)
{
- shared_ptr<Film> film = new_test_film2 ("reels_should_not_be_short4");
+ auto A = make_shared<FFmpegContent>("test/data/flat_red.png");
+ auto B = make_shared<FFmpegContent>("test/data/flat_red.png");
+ auto film = new_test_film2 ("reels_should_not_be_short4", {A, B});
film->set_video_frame_rate (24);
film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
- shared_ptr<FFmpegContent> A(new FFmpegContent("test/data/flat_red.png"));
- film->examine_and_add_content (A);
- BOOST_REQUIRE (!wait_for_jobs());
A->video->set_length (240);
- shared_ptr<FFmpegContent> B(new FFmpegContent("test/data/flat_red.png"));
- film->examine_and_add_content (B);
- BOOST_REQUIRE (!wait_for_jobs());
B->video->set_length (23);
B->set_position (film, DCPTime::from_frames(240, 24));
+ BOOST_CHECK_EQUAL (film->reels().size(), 1U);
+ BOOST_CHECK (film->reels().front() == dcpomatic::DCPTimePeriod(dcpomatic::DCPTime(), dcpomatic::DCPTime::from_frames(263, 24)));
+
+ film->write_metadata ();
film->make_dcp ();
BOOST_REQUIRE (!wait_for_jobs());
- vector<boost::filesystem::path> dirs;
- dirs.push_back (film->dir(film->dcp_name(false)));
+ vector<boost::filesystem::path> dirs = { film->dir(film->dcp_name(false)) };
auto const notes = dcp::verify(dirs, boost::bind(&no_op), boost::bind(&no_op), TestPaths::xsd());
dump_notes (notes);
BOOST_REQUIRE (notes.empty());
/*
- 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/repeat_frame_test.cc
* @brief Test the repeat of frames by the player when putting a 24fps
* source into a 48fps DCP.
* @see test/skip_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::make_shared;
using std::shared_ptr;
+
BOOST_AUTO_TEST_CASE (repeat_frame_test)
{
- shared_ptr<Film> film = new_test_film ("repeat_frame_test");
- film->set_name ("repeat_frame_test");
- film->set_container (Ratio::from_id ("185"));
- film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
+ auto c = make_shared<FFmpegContent>("test/data/red_24.mp4");
+ auto film = new_test_film2 ("repeat_frame_test", {c});
film->set_interop (false);
- shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/red_24.mp4"));
- film->examine_and_add_content (c);
- BOOST_REQUIRE (!wait_for_jobs());
c->video->set_custom_ratio (1.85);
film->set_video_frame_rate (48);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
/* Should be 32 frames of red followed by 16 frames of black to fill the DCP up to 1 second */
check_dcp ("test/data/repeat_frame_test", film->dir (film->dcp_name ()));
test_silence_padding (int channels)
{
string const film_name = "silence_padding_test_" + lexical_cast<string> (channels);
- auto film = new_test_film (film_name);
- film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
- film->set_container (Ratio::from_id ("185"));
- film->set_name (film_name);
-
- auto content = make_shared<FFmpegContent>("test/data/staircase.wav");
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto film = new_test_film2 (
+ film_name,
+ {
+ make_shared<FFmpegContent>("test/data/flat_red.png"),
+ make_shared<FFmpegContent>("test/data/staircase.wav")
+ });
film->set_audio_channels (channels);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
boost::filesystem::path path = "build/test";
path /= film_name;
{
Cleanup cl;
- auto film = new_test_film2 ("silence_padding_test2", &cl);
auto content = make_shared<FFmpegContent>(TestPaths::private_data() / "cars.mov");
- film->examine_and_add_content (content);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto film = new_test_film2 ("silence_padding_test2", { content }, &cl);
film->set_video_frame_rate (24);
content->set_trim_start (dcpomatic::ContentTime(4003));
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
cl.run ();
}
{
Cleanup cl;
- shared_ptr<Film> film = new_test_film2 ("srt_subtitle_test3", &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);
- film->set_container (Ratio::from_id ("185"));
film->set_name ("frobozz");
film->set_interop (true);
film->set_audio_channels (6);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent(TestPaths::private_data() / "Ankoemmling_short.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::INVALID_STANDARD});
check_subtitle_file (film, TestPaths::private_data() / "Ankoemmling_short.xml");
/*
- 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/ssa_subtitle_test.cc
* @brief Test use of SSA subtitle files.
* @ingroup feature
*/
+
#include "lib/film.h"
#include "lib/string_text_file_content.h"
#include "lib/dcp_content_type.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
#include <boost/algorithm/string.hpp>
-#include <list>
+
using std::string;
using std::list;
using std::shared_ptr;
+using std::make_shared;
+
/** Make a DCP with subs from a .ssa file */
BOOST_AUTO_TEST_CASE (ssa_subtitle_test1)
{
Cleanup cl;
- shared_ptr<Film> film = new_test_film2 ("ssa_subtitle_test1", &cl);
+ auto film = new_test_film2 ("ssa_subtitle_test1", {}, &cl);
film->set_container (Ratio::from_id ("185"));
film->set_name ("frobozz");
film->set_interop (true);
- shared_ptr<StringTextFileContent> content (new StringTextFileContent(TestPaths::private_data() / "DKH_UT_EN20160601def.ssa"));
+ auto content = make_shared<StringTextFileContent>(TestPaths::private_data() / "DKH_UT_EN20160601def.ssa");
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::INVALID_STANDARD });
/* Find the subtitle file and check it */
- list<string> ignore;
- ignore.push_back ("SubtitleID");
- check_xml (subtitle_file(film), TestPaths::private_data() / "DKH_UT_EN20160601def.xml", ignore);
+ check_xml (subtitle_file(film), TestPaths::private_data() / "DKH_UT_EN20160601def.xml", {"SubtitleID"});
cl.run ();
}
BOOST_AUTO_TEST_CASE (subtitle_language_interop_test)
{
string const name = "subtitle_language_interop_test";
- shared_ptr<Film> film = new_test_film2 (name);
- film->examine_and_add_content (content_factory("test/data/frames.srt").front());
- BOOST_REQUIRE (!wait_for_jobs());
+ auto film = new_test_film2 (name, { content_factory("test/data/frames.srt").front() });
- vector<dcp::LanguageTag> langs;
- langs.push_back(dcp::LanguageTag("fr-FR"));
- langs.push_back(dcp::LanguageTag("de-DE"));
+ vector<dcp::LanguageTag> langs = {
+ dcp::LanguageTag("fr-FR"), dcp::LanguageTag("de-DE")
+ };
film->set_subtitle_languages(langs);
film->set_interop (true);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film, {dcp::VerificationNote::Code::INVALID_STANDARD});
check_dcp (String::compose("test/data/%1", name), String::compose("build/test/%1/%2", name, film->dcp_name()));
}
BOOST_AUTO_TEST_CASE (subtitle_language_smpte_test)
{
string const name = "subtitle_language_smpte_test";
- shared_ptr<Film> film = new_test_film2 (name);
- film->examine_and_add_content (content_factory("test/data/frames.srt").front());
- BOOST_REQUIRE (!wait_for_jobs());
+ auto film = new_test_film2 (name, { content_factory("test/data/frames.srt").front() });
- vector<dcp::LanguageTag> langs;
- langs.push_back(dcp::LanguageTag("fr-FR"));
- langs.push_back(dcp::LanguageTag("de-DE"));
- film->set_subtitle_languages(langs);
+ vector<dcp::LanguageTag> langs = {
+ dcp::LanguageTag("fr-FR"), dcp::LanguageTag("de-DE")
+ };
+ film->set_subtitle_languages (langs);
film->set_interop (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::INVALID_SUBTITLE_DURATION,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING,
+ dcp::VerificationNote::Code::MISSING_CPL_METADATA
+ });
check_dcp (String::compose("test/data/%1", name), String::compose("build/test/%1/%2", name, film->dcp_name()));
}
}
shared_ptr<Film>
-new_test_film2 (string name, Cleanup* cleanup)
+new_test_film2 (string name, vector<shared_ptr<Content>> content, Cleanup* cleanup)
{
auto p = test_film_dir (name);
if (boost::filesystem::exists (p)) {
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
film->set_container (Ratio::from_id ("185"));
film->write_metadata ();
+
+ for (auto i: content) {
+ film->examine_and_add_content (i);
+ BOOST_REQUIRE (!wait_for_jobs());
+ }
+
return film;
}
boost::filesystem::remove_all (i, ec);
}
}
+
+
+void stage (string, boost::optional<boost::filesystem::path>) {}
+void progress (float) {}
+
+
+void
+make_and_verify_dcp (shared_ptr<Film> film, vector<dcp::VerificationNote::Code> ignore)
+{
+ film->write_metadata ();
+ film->make_dcp ();
+ BOOST_REQUIRE (!wait_for_jobs());
+ auto notes = dcp::verify ({film->dir(film->dcp_name())}, &stage, &progress, TestPaths::xsd());
+ bool ok = true;
+ for (auto i: notes) {
+ if (find(ignore.begin(), ignore.end(), i.code()) == ignore.end()) {
+ std::cout << "\t" << dcp::note_to_string(i) << "\n";
+ ok = false;
+ }
+ }
+ BOOST_CHECK(ok);
+}
+
#include "lib/warnings.h"
#include "lib/types.h"
+#include <dcp/verify.h>
#include <boost/filesystem.hpp>
+#include <vector>
class Film;
extern bool wait_for_jobs ();
extern void setup_test_config ();
extern std::shared_ptr<Film> new_test_film (std::string);
-extern std::shared_ptr<Film> new_test_film2 (std::string, Cleanup* cleanup = nullptr);
+extern std::shared_ptr<Film> new_test_film2 (std::string, std::vector<std::shared_ptr<Content>> content = {}, Cleanup* cleanup = nullptr);
extern void check_dcp (boost::filesystem::path, boost::filesystem::path);
extern void check_dcp (boost::filesystem::path, std::shared_ptr<const Film>);
extern void check_file (boost::filesystem::path ref, boost::filesystem::path check);
void check_one_frame (boost::filesystem::path dcp, int64_t index, boost::filesystem::path ref);
extern boost::filesystem::path subtitle_file (std::shared_ptr<Film> film);
extern void make_random_file (boost::filesystem::path path, size_t size);
+extern void make_and_verify_dcp (std::shared_ptr<Film> film, std::vector<dcp::VerificationNote::Code> ignore = {});
class LogSwitcher
/** Test start/end trim and positioning of some audio content */
BOOST_AUTO_TEST_CASE (torture_test1)
{
- shared_ptr<Film> film = new_test_film ("torture_test1");
- film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
- film->set_name ("torture_test1");
- film->set_container (Ratio::from_id ("185"));
+ auto film = new_test_film2 ("torture_test1");
film->set_sequence (false);
/* Staircase at an offset of 2000 samples, trimmed both start and end, with a gain of exactly 2 (linear) */
- shared_ptr<Content> staircase = content_factory("test/data/staircase.wav").front ();
+ auto staircase = content_factory("test/data/staircase.wav").front();
film->examine_and_add_content (staircase);
BOOST_REQUIRE (!wait_for_jobs());
- staircase->set_position (film, DCPTime::from_frames (2000, film->audio_frame_rate()));
- staircase->set_trim_start (ContentTime::from_frames (12, 48000));
+ staircase->set_position (film, DCPTime::from_frames(2000, film->audio_frame_rate()));
+ staircase->set_trim_start (ContentTime::from_frames(12, 48000));
staircase->set_trim_end (ContentTime::from_frames (35, 48000));
staircase->audio->set_gain (20 * log10(2));
film->examine_and_add_content (staircase);
BOOST_REQUIRE (!wait_for_jobs());
staircase->set_position (film, DCPTime::from_frames(50000, film->audio_frame_rate()));
- staircase->set_trim_start (ContentTime::from_frames (12, 48000));
- staircase->set_trim_end (ContentTime::from_frames (35, 48000));
+ staircase->set_trim_start (ContentTime::from_frames(12, 48000));
+ staircase->set_trim_end (ContentTime::from_frames(35, 48000));
staircase->audio->set_gain (20 * log10(2));
/* 1s of red at 5s in */
- shared_ptr<Content> red = content_factory("test/data/flat_red.png").front ();
+ auto red = content_factory("test/data/flat_red.png").front();
film->examine_and_add_content (red);
BOOST_REQUIRE (!wait_for_jobs());
red->set_position (film, DCPTime::from_seconds(5));
red->video->set_length (24);
film->set_video_frame_rate (24);
- film->write_metadata ();
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
dcp::DCP dcp ("build/test/torture_test1/" + film->dcp_name(false));
dcp.read ();
BOOST_REQUIRE (sound);
BOOST_CHECK_EQUAL (sound->intrinsic_duration(), 144);
- shared_ptr<dcp::SoundAssetReader> sound_reader = sound->start_read ();
+ auto sound_reader = sound->start_read ();
/* First frame silent */
auto fr = sound_reader->get_frame (0);
/* Check picture */
- shared_ptr<dcp::ReelPictureAsset> reel_picture = reels.front()->main_picture();
+ auto reel_picture = reels.front()->main_picture();
BOOST_REQUIRE (reel_picture);
- shared_ptr<dcp::MonoPictureAsset> picture = dynamic_pointer_cast<dcp::MonoPictureAsset> (reel_picture->asset());
+ auto picture = dynamic_pointer_cast<dcp::MonoPictureAsset> (reel_picture->asset());
BOOST_REQUIRE (picture);
BOOST_CHECK_EQUAL (picture->intrinsic_duration(), 144);
- shared_ptr<dcp::MonoPictureAssetReader> picture_reader = picture->start_read ();
+ auto picture_reader = picture->start_read ();
/* First 5 * 24 = 120 frames should be black, possibly with a little noise to raise the bitrate */
shared_ptr<dcp::OpenJPEGImage> ref;
for (int i = 0; i < 120; ++i) {
- shared_ptr<const dcp::MonoPictureFrame> fr = picture_reader->get_frame (i);
- shared_ptr<dcp::OpenJPEGImage> image = fr->xyz_image ();
- dcp::Size const size = image->size ();
+ auto fr = picture_reader->get_frame (i);
+ auto image = fr->xyz_image ();
+ auto const size = image->size ();
if (i == 0) {
/* Check the first frame pixel by pixel... */
for (int c = 0; c < 3; ++c) {
/* Then 24 red, perhaps also with some noise */
for (int i = 120; i < 144; ++i) {
- shared_ptr<const dcp::MonoPictureFrame> fr = picture_reader->get_frame (i);
- shared_ptr<dcp::OpenJPEGImage> image = fr->xyz_image ();
- dcp::Size const size = image->size ();
+ auto fr = picture_reader->get_frame (i);
+ auto image = fr->xyz_image ();
+ auto const size = image->size ();
if (i == 120) {
for (int y = 0; y < size.height; ++y) {
for (int x = 0; x < size.width; ++x) {
pair<int, int>
dcp_range (shared_ptr<Film> film)
{
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
return pixel_range (film->dir(film->dcp_name()));
}
/*
- 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/video_mxf_content_test.cc
* @brief Test use of Video MXF content.
* @ingroup feature
*/
+
+
#include "lib/film.h"
#include "lib/video_mxf_content.h"
#include "lib/content_factory.h"
#include <dcp/mono_picture_asset.h>
#include <boost/test/unit_test.hpp>
+
+using std::make_shared;
using std::shared_ptr;
using std::dynamic_pointer_cast;
+
static boost::filesystem::path ref_mxf = "test/data/scaling_test_185_185/j2c_74b946f4-1c33-4209-b639-b834de675eac.mxf";
+
static void note (dcp::NoteType, std::string)
{
}
+
/** Basic test of using video MXF content */
BOOST_AUTO_TEST_CASE (video_mxf_content_test)
{
- shared_ptr<Film> film = new_test_film ("video_mxf_content_test");
+ auto film = new_test_film ("video_mxf_content_test");
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("FTR"));
film->set_container (Ratio::from_id ("185"));
film->set_name ("video_mxf_content_test");
- shared_ptr<Content> content = content_factory(ref_mxf).front();
- shared_ptr<VideoMXFContent> check = dynamic_pointer_cast<VideoMXFContent> (content);
+ auto content = content_factory(ref_mxf).front();
+ auto check = dynamic_pointer_cast<VideoMXFContent> (content);
BOOST_REQUIRE (check);
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_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
- shared_ptr<dcp::MonoPictureAsset> ref (new dcp::MonoPictureAsset (ref_mxf));
+ auto ref = make_shared<dcp::MonoPictureAsset>(ref_mxf);
boost::filesystem::directory_iterator i ("build/test/video_mxf_content_test/video");
- shared_ptr<dcp::MonoPictureAsset> comp (new dcp::MonoPictureAsset (*i));
+ auto comp = make_shared<dcp::MonoPictureAsset>(*i);
dcp::EqualityOptions op;
BOOST_CHECK (ref->equals (comp, op, note));
}