From: Carl Hetherington Date: Sat, 30 Sep 2023 10:32:42 +0000 (+0200) Subject: Allow DCP content type from template to work. X-Git-Tag: v2.16.66~21 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=cbb6ee07e5e28a8d7f99425fff326d6f6edeabb2;p=dcpomatic.git Allow DCP content type from template to work. --- diff --git a/src/lib/create_cli.cc b/src/lib/create_cli.cc index 41dd44d1a..ed62abefb 100644 --- a/src/lib/create_cli.cc +++ b/src/lib/create_cli.cc @@ -127,7 +127,7 @@ argument_option ( CreateCLI::CreateCLI (int argc, char* argv[]) : version (false) { - string dcp_content_type_string = "TST"; + optional dcp_content_type_string; string container_ratio_string; optional standard_string; int dcp_frame_rate_int = 0; @@ -273,10 +273,12 @@ CreateCLI::CreateCLI (int argc, char* argv[]) _j2k_bandwidth = j2k_bandwidth_int * 1000000; } - _dcp_content_type = DCPContentType::from_isdcf_name(dcp_content_type_string); - if (!_dcp_content_type) { - error = String::compose("%1: unrecognised DCP content type '%2'", argv[0], dcp_content_type_string); - return; + if (dcp_content_type_string) { + _dcp_content_type = DCPContentType::from_isdcf_name(*dcp_content_type_string); + if (!_dcp_content_type) { + error = String::compose("%1: unrecognised DCP content type '%2'", argv[0], *dcp_content_type_string); + return; + } } if (!container_ratio_string.empty()) { @@ -337,13 +339,16 @@ CreateCLI::make_film() const * or not. */ film->set_interop(false); + film->set_dcp_content_type(DCPContentType::from_isdcf_name("TST")); } film->set_name(_name); if (_container_ratio) { film->set_container(_container_ratio); } - film->set_dcp_content_type(_dcp_content_type); + if (_dcp_content_type) { + film->set_dcp_content_type(_dcp_content_type); + } if (_standard) { film->set_interop(*_standard == dcp::Standard::INTEROP); } diff --git a/test/create_cli_test.cc b/test/create_cli_test.cc index 0359b2f35..aae5fb6de 100644 --- a/test/create_cli_test.cc +++ b/test/create_cli_test.cc @@ -304,5 +304,9 @@ BOOST_AUTO_TEST_CASE(create_cli_defaults_test) auto film = cc.make_film(); BOOST_CHECK(!film->interop()); + Config::instance()->set_default_dcp_content_type(DCPContentType::from_isdcf_name("FT")); + cc = run("dcpomatic2_create test/data/flat_red.png"); + film = cc.make_film(); + BOOST_CHECK_EQUAL(film->dcp_content_type()->isdcf_name(), "TST"); }