diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-09-30 12:09:00 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-09-30 12:09:00 +0200 |
| commit | 5e34ba58c0c6821756308c09ddcbf08f8a775f3f (patch) | |
| tree | feea07035af7f527f1a0463162dfa39373b9e7cf | |
| parent | dec7ad14997421accfe0ff9f382f9ffcb4e61ec2 (diff) | |
Add --no-encrypt with the same idea as the previous commit.
| -rw-r--r-- | src/lib/create_cli.cc | 15 | ||||
| -rw-r--r-- | src/lib/create_cli.h | 1 | ||||
| -rw-r--r-- | test/create_cli_test.cc | 35 | ||||
| m--------- | test/data | 0 |
4 files changed, 48 insertions, 3 deletions
diff --git a/src/lib/create_cli.cc b/src/lib/create_cli.cc index 495ccddc4..b0f7a843e 100644 --- a/src/lib/create_cli.cc +++ b/src/lib/create_cli.cc @@ -45,6 +45,7 @@ string CreateCLI::_help = " -h, --help show this help\n" " -n, --name <name> film name\n" " -t, --template <name> template name\n" + " --no-encrypt make an unencrypted DCP\n" " -e, --encrypt make an encrypted DCP\n" " -c, --dcp-content-type <type> FTR, SHR, TLR, TST, XSN, RTG, TSR, POL, PSA or ADV\n" " -f, --dcp-frame-rate <rate> set DCP video frame rate (otherwise guessed from content)\n" @@ -153,7 +154,9 @@ CreateCLI::CreateCLI (int argc, char* argv[]) return; } - if (a == "-e" || a == "--encrypt") { + if (a == "--no-encrypt") { + _no_encrypt = claimed = true; + } else if (a == "-e" || a == "--encrypt") { _encrypt = claimed = true; } else if (a == "--no-use-isdcf-name") { _no_use_isdcf_name = claimed = true; @@ -297,6 +300,10 @@ CreateCLI::CreateCLI (int argc, char* argv[]) error = String::compose("%1: specify one of --twod or --threed, not both", argv[0]); } + if (_no_encrypt && _encrypt) { + error = String::compose("%1: specify one of --no-encrypt or --encrypt, not both", argv[0]); + } + if (content.empty()) { error = String::compose("%1: no content specified", argv[0]); return; @@ -330,7 +337,11 @@ CreateCLI::make_film() const film->set_dcp_content_type(_dcp_content_type); film->set_interop(_standard == dcp::Standard::INTEROP); film->set_use_isdcf_name(!_no_use_isdcf_name); - film->set_encrypted(_encrypt); + if (_no_encrypt) { + film->set_encrypted(false); + } else if (_encrypt) { + film->set_encrypted(true); + } if (_twod) { film->set_three_d(false); } else if (_threed) { diff --git a/src/lib/create_cli.h b/src/lib/create_cli.h index dfc922b07..ee15fb0b8 100644 --- a/src/lib/create_cli.h +++ b/src/lib/create_cli.h @@ -63,6 +63,7 @@ private: boost::optional<std::string> _template_name; std::string _name; Ratio const* _container_ratio = nullptr; + bool _no_encrypt = false; bool _encrypt = false; bool _twod = false; bool _threed = false; diff --git a/test/create_cli_test.cc b/test/create_cli_test.cc index 8da07d5d5..3ebdcb81b 100644 --- a/test/create_cli_test.cc +++ b/test/create_cli_test.cc @@ -111,6 +111,15 @@ BOOST_AUTO_TEST_CASE (create_cli_test) cc = run ("dcpomatic2_create x --standard SMPTEX"); BOOST_CHECK (cc.error); + cc = run("dcpomatic2_create x --no-encrypt"); + BOOST_CHECK(cc._no_encrypt); + + cc = run("dcpomatic2_create x --encrypt"); + BOOST_CHECK(cc._encrypt); + + cc = run("dcpomatic2_create x --no-encrypt --encrypt"); + BOOST_CHECK(cc.error); + cc = run("dcpomatic2_create x --twod"); BOOST_CHECK(cc._twod); @@ -217,10 +226,14 @@ BOOST_AUTO_TEST_CASE(create_cli_template_test) Config::override_path = "test/data"; - auto cc = run("dcpomatic2_create test/data/flat_red.png --template 2d"); + auto cc = run("dcpomatic2_create test/data/flat_red.png"); auto film = cc.make_film(); BOOST_CHECK(!film->three_d()); + cc = run("dcpomatic2_create test/data/flat_red.png --template 2d"); + film = cc.make_film(); + BOOST_CHECK(!film->three_d()); + cc = run("dcpomatic2_create test/data/flat_red.png --template 2d --threed"); film = cc.make_film(); BOOST_CHECK(film->three_d()); @@ -232,5 +245,25 @@ BOOST_AUTO_TEST_CASE(create_cli_template_test) cc = run("dcpomatic2_create test/data/flat_red.png --template 3d --twod"); film = cc.make_film(); BOOST_CHECK(!film->three_d()); + + cc = run("dcpomatic2_create test/data/flat_red.png"); + film = cc.make_film(); + BOOST_CHECK(!film->encrypted()); + + cc = run("dcpomatic2_create test/data/flat_red.png --template unencrypted"); + film = cc.make_film(); + BOOST_CHECK(!film->encrypted()); + + cc = run("dcpomatic2_create test/data/flat_red.png --template unencrypted --encrypt"); + film = cc.make_film(); + BOOST_CHECK(film->encrypted()); + + cc = run("dcpomatic2_create test/data/flat_red.png --template encrypted"); + film = cc.make_film(); + BOOST_CHECK(film->encrypted()); + + cc = run("dcpomatic2_create test/data/flat_red.png --template encrypted --no-encrypt"); + film = cc.make_film(); + BOOST_CHECK(!film->encrypted()); } diff --git a/test/data b/test/data -Subproject ab92d786fe2069ef94d79c53945939265e18d7b +Subproject 31f3a1e8d0217e065b9a2e6efbebe194f4dbae7 |
