#include "lib/content_factory.h"
#include "lib/film.h"
#include "lib/map_cli.h"
+#include "lib/text_content.h"
#include "test.h"
#include <dcp/cpl.h>
#include <dcp/dcp.h>
static
void
-test_map_ov_vf_copy()
+test_map_ov_vf_copy(vector<string> extra_args = {})
{
string const name = "map_ov_vf_copy";
string const out = String::compose("build/test/%1_out", name);
auto const vf_dir = vf_film->dir(vf_film->dcp_name());
- vector<string> const args = {
+ vector<string> args = {
"map_cli",
"-o", out,
"-d", ov_dir.string(),
find_cpl(vf_dir).string()
};
+ args.insert(std::end(args), std::begin(extra_args), std::end(extra_args));
+
boost::filesystem::remove_all(out);
vector<string> output_messages;
BOOST_AUTO_TEST_CASE(map_ov_vf_copy)
{
test_map_ov_vf_copy();
+ test_map_ov_vf_copy({"-l"});
}
+
+/** Map an OV and VF into a single DCP, where the VF refers to the OV's assets multiple times */
+BOOST_AUTO_TEST_CASE(map_ov_vf_copy_multiple_reference)
+{
+ string const name = "map_ov_vf_copy_multiple_reference";
+ string const out = String::compose("build/test/%1_out", name);
+
+ auto ov_content = content_factory("test/data/flat_red.png");
+ auto ov_film = new_test_film2(name + "_ov", ov_content);
+ make_and_verify_dcp(ov_film);
+
+ auto const ov_dir = ov_film->dir(ov_film->dcp_name());
+
+ auto vf_ov1 = make_shared<DCPContent>(ov_dir);
+ auto vf_ov2 = make_shared<DCPContent>(ov_dir);
+ auto vf_sound = content_factory("test/data/sine_440.wav").front();
+ auto vf_film = new_test_film2(name + "_vf", { vf_ov1, vf_ov2, vf_sound });
+ vf_film->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+ vf_ov2->set_position(vf_film, vf_ov1->end(vf_film));
+ vf_ov1->set_reference_video(true);
+ vf_ov2->set_reference_video(true);
+ make_and_verify_dcp(vf_film, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+
+ auto const vf_dir = vf_film->dir(vf_film->dcp_name());
+
+ vector<string> const args = {
+ "map_cli",
+ "-o", out,
+ "-d", ov_dir.string(),
+ "-d", vf_dir.string(),
+ "-l",
+ find_cpl(vf_dir).string()
+ };
+
+ boost::filesystem::remove_all(out);
+
+ vector<string> output_messages;
+ auto error = run(args, output_messages);
+ BOOST_CHECK(!error);
+
+ verify_dcp(out, {});
+
+ check_file(find_file(out, "cpl_"), find_file(vf_dir, "cpl_"));
+ check_file(find_file(out, "j2c_"), find_file(ov_dir, "j2c_"));
+}
+
+
/** Map a single DCP into a new DCP using the rename option */
BOOST_AUTO_TEST_CASE(map_simple_dcp_copy_with_rename)
{
BOOST_AUTO_TEST_CASE(map_with_given_config)
{
+ ConfigRestorer cr;
+
string const name = "map_with_given_config";
string const out = String::compose("build/test/%1_out", name);
/* It should be signed by the key in test/data/map_with_given_config, not the one in test/data/signer_key */
BOOST_CHECK(dcp::file_to_string(find_file(out, "cpl_")).find("dnQualifier=\\+uOcNN2lPuxpxgd/5vNkkBER0GE=,CN=CS.dcpomatic.smpte-430-2.LEAF,OU=dcpomatic.com,O=dcpomatic.com") != std::string::npos);
}
+
+
+BOOST_AUTO_TEST_CASE(map_multireel_interop_ov_and_vf_adding_ccaps)
+{
+ string const name = "map_multireel_interop_ov_and_vf_adding_ccaps";
+ string const out = String::compose("build/test/%1_out", name);
+
+ vector<shared_ptr<Content>> video = {
+ content_factory("test/data/flat_red.png")[0],
+ content_factory("test/data/flat_red.png")[0],
+ content_factory("test/data/flat_red.png")[0]
+ };
+
+ auto ov = new_test_film2(name + "_ov", { video[0], video[1], video[2] });
+ ov->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+ ov->set_interop(true);
+ make_and_verify_dcp(ov, { dcp::VerificationNote::Code::INVALID_STANDARD });
+
+ auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
+
+ vector<shared_ptr<Content>> ccap = {
+ content_factory("test/data/short.srt")[0],
+ content_factory("test/data/short.srt")[0],
+ content_factory("test/data/short.srt")[0]
+ };
+
+ auto vf = new_test_film2(name + "_vf", { ov_dcp, ccap[0], ccap[1], ccap[2] });
+ vf->set_interop(true);
+ vf->set_reel_type(ReelType::BY_VIDEO_CONTENT);
+ ov_dcp->set_reference_video(true);
+ ov_dcp->set_reference_audio(true);
+ for (auto i = 0; i < 3; ++i) {
+ ccap[i]->text[0]->set_use(true);
+ ccap[i]->text[0]->set_type(TextType::CLOSED_CAPTION);
+ }
+ make_and_verify_dcp(
+ vf,
+ {
+ dcp::VerificationNote::Code::INVALID_STANDARD,
+ dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+ dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
+ dcp::VerificationNote::Code::EXTERNAL_ASSET
+ });
+
+ vector<string> const args = {
+ "map_cli",
+ "-o", out,
+ "-d", ov->dir(ov->dcp_name()).string(),
+ "-d", vf->dir(vf->dcp_name()).string(),
+ find_cpl(vf->dir(vf->dcp_name())).string()
+ };
+
+ boost::filesystem::remove_all(out);
+
+ vector<string> output_messages;
+ auto error = run(args, output_messages);
+ BOOST_CHECK(!error);
+
+ verify_dcp(out, { dcp::VerificationNote::Code::INVALID_STANDARD });
+}
+
+
+BOOST_AUTO_TEST_CASE(map_uses_config_for_issuer_and_creator)
+{
+ ConfigRestorer cr;
+
+ Config::instance()->set_dcp_issuer("ostrabagalous");
+ Config::instance()->set_dcp_creator("Fred");
+
+ string const name = "map_uses_config_for_issuer_and_creator";
+ string const out = String::compose("build/test/%1_out", name);
+
+ auto content = content_factory("test/data/flat_red.png");
+ auto film = new_test_film2(name + "_in", content);
+ make_and_verify_dcp(film);
+
+ vector<string> const args = {
+ "map_cli",
+ "-o", out,
+ "-d", film->dir(film->dcp_name()).string(),
+ find_cpl(film->dir(film->dcp_name())).string()
+ };
+
+ boost::filesystem::remove_all(out);
+
+ vector<string> output_messages;
+ auto error = run(args, output_messages);
+ BOOST_CHECK(!error);
+
+ cxml::Document assetmap("AssetMap");
+ assetmap.read_file(film->dir(film->dcp_name()) / "ASSETMAP.xml");
+ BOOST_CHECK(assetmap.string_child("Issuer") == "ostrabagalous");
+ BOOST_CHECK(assetmap.string_child("Creator") == "Fred");
+
+ cxml::Document pkl("PackingList");
+ pkl.read_file(find_prefix(out, "pkl_"));
+ BOOST_CHECK(pkl.string_child("Issuer") == "ostrabagalous");
+ BOOST_CHECK(pkl.string_child("Creator") == "Fred");
+}
+