diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-01-16 20:50:23 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-01-16 20:50:23 +0100 |
| commit | 504367ecc42018d6c2c2542172900701e34090bf (patch) | |
| tree | fbbd1a1b75f56032f2d17c4bfa0574f0f3ab72df | |
| parent | 81a9a5b520ae6d1b89e6a2eb052f023ba329bcc4 (diff) | |
Add --twok option to dcpomatic2_create.
| -rw-r--r-- | src/lib/create_cli.cc | 7 | ||||
| -rw-r--r-- | src/lib/create_cli.h | 1 | ||||
| -rw-r--r-- | src/tools/dcpomatic_create.cc | 3 | ||||
| -rw-r--r-- | test/create_cli_test.cc | 6 |
4 files changed, 16 insertions, 1 deletions
diff --git a/src/lib/create_cli.cc b/src/lib/create_cli.cc index 9453cc167..26f3dbcae 100644 --- a/src/lib/create_cli.cc +++ b/src/lib/create_cli.cc @@ -49,7 +49,8 @@ string CreateCLI::_help = " --no-use-isdcf-name do not use an ISDCF name; use the specified name unmodified\n" " --no-sign do not sign the DCP\n" " --config <dir> directory containing config.xml and cinemas.xml\n" - " --fourk make a 4K DCP rather than a 2K one\n" + " --twok make a 2K DCP instead of choosing a resolution based on the content\n" + " --fourk make a 4K DCP instead of choosing a resolution based on the content\n" " -o, --output <dir> output directory\n" " --threed make a 3D DCP\n" " --j2k-bandwidth <Mbit/s> J2K bandwidth in Mbit/s\n" @@ -124,6 +125,7 @@ CreateCLI::CreateCLI (int argc, char* argv[]) , still_length (10) , standard (dcp::Standard::SMPTE) , no_use_isdcf_name (false) + , twok (false) , fourk (false) { string dcp_content_type_string = "TST"; @@ -163,6 +165,9 @@ CreateCLI::CreateCLI (int argc, char* argv[]) } else if (a == "--right-eye") { next_frame_type = VideoFrameType::THREE_D_RIGHT; claimed = true; + } else if (a == "--twok") { + twok = true; + claimed = true; } else if (a == "--fourk") { fourk = true; claimed = true; diff --git a/src/lib/create_cli.h b/src/lib/create_cli.h index ed42e669c..177d56f7b 100644 --- a/src/lib/create_cli.h +++ b/src/lib/create_cli.h @@ -57,6 +57,7 @@ public: boost::optional<boost::filesystem::path> output_dir; boost::optional<std::string> error; std::vector<Content> content; + bool twok; bool fourk; boost::optional<int> j2k_bandwidth; diff --git a/src/tools/dcpomatic_create.cc b/src/tools/dcpomatic_create.cc index 3a240ec85..1999083dc 100644 --- a/src/tools/dcpomatic_create.cc +++ b/src/tools/dcpomatic_create.cc @@ -105,6 +105,9 @@ main (int argc, char* argv[]) film->set_use_isdcf_name (!cc.no_use_isdcf_name); film->set_encrypted (cc.encrypt); film->set_three_d (cc.threed); + if (cc.twok) { + film->set_resolution (Resolution::TWO_K); + } if (cc.fourk) { film->set_resolution (Resolution::FOUR_K); } diff --git a/test/create_cli_test.cc b/test/create_cli_test.cc index aae243d99..b067c9b16 100644 --- a/test/create_cli_test.cc +++ b/test/create_cli_test.cc @@ -142,6 +142,12 @@ BOOST_AUTO_TEST_CASE (create_cli_test) BOOST_CHECK_EQUAL (cc.content[1].frame_type, VideoFrameType::THREE_D_RIGHT); BOOST_CHECK_EQUAL (cc.fourk, false); + cc = run ("dcpomatic2_create --twok foo.mp4"); + BOOST_REQUIRE_EQUAL (cc.content.size(), 1U); + BOOST_CHECK_EQUAL (cc.content[0].path, "foo.mp4"); + BOOST_CHECK_EQUAL (cc.twok, true); + BOOST_CHECK (!cc.error); + cc = run ("dcpomatic2_create --fourk foo.mp4"); BOOST_REQUIRE_EQUAL (cc.content.size(), 1U); BOOST_CHECK_EQUAL (cc.content[0].path, "foo.mp4"); |
