diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-09-30 12:32:42 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-09-30 12:32:42 +0200 |
| commit | cbb6ee07e5e28a8d7f99425fff326d6f6edeabb2 (patch) | |
| tree | a7a6bd5483bf3f7670bc22ae3ddb56ff4c9adc58 | |
| parent | 8a112904ee3cbdcd8e6c88e0a46c67e8d387ba9e (diff) | |
Allow DCP content type from template to work.
| -rw-r--r-- | src/lib/create_cli.cc | 17 | ||||
| -rw-r--r-- | test/create_cli_test.cc | 4 |
2 files changed, 15 insertions, 6 deletions
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<string> dcp_content_type_string; string container_ratio_string; optional<string> 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"); } |
