diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-04-26 22:39:12 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-04-26 22:39:12 +0200 |
| commit | 25ac279e5b7ae6593185230a0fe5a4022a6f689d (patch) | |
| tree | 8162b3f10653fcfe06801342917b4e1df123d5a5 | |
| parent | 72d4e2249dc6af0a31f04ff412a7eae84ac3cc4f (diff) | |
Warn if you specify trusted devices with a formulation that won't use them.
| -rw-r--r-- | src/lib/kdm_cli.cc | 5 | ||||
| -rw-r--r-- | test/kdm_cli_test.cc | 26 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/lib/kdm_cli.cc b/src/lib/kdm_cli.cc index b115412a7..1b625e50c 100644 --- a/src/lib/kdm_cli.cc +++ b/src/lib/kdm_cli.cc @@ -718,6 +718,11 @@ try valid_to = valid_from.get() + duration_from_string(*duration_string); } + if (!trusted_devices.empty() && (formulation != dcp::Formulation::MULTIPLE_MODIFIED_TRANSITIONAL_1 && formulation != dcp::Formulation::DCI_SPECIFIC)) { + out("You have given one or more trusted devices but the KDM formulation you specified will not write them to the KDM. " + "Consider using --formulation multiple-modified-transitional-1"); + } + if (verbose) { out(fmt::format("Making KDMs valid from {} to {}", boost::posix_time::to_simple_string(valid_from.get()), boost::posix_time::to_simple_string(valid_to.get()))); } diff --git a/test/kdm_cli_test.cc b/test/kdm_cli_test.cc index 4bc3ddf46..b5088b938 100644 --- a/test/kdm_cli_test.cc +++ b/test/kdm_cli_test.cc @@ -364,3 +364,29 @@ BOOST_AUTO_TEST_CASE(kdm_cli_add_dkdm) BOOST_CHECK_EQUAL(dkdm->dkdm().as_xml(), dcp::file_to_string("test/data/dkdm.xml")); } + +BOOST_AUTO_TEST_CASE(kdm_cli_formulation_warning) +{ + vector<string> args = { + "kdm_cli", + "--valid-from", "now", + "--valid-duration", "2 weeks", + "--trusted-device-chain", "test/data/decryption_chain", + "--projector-certificate", "test/data/cert.pem", + "-S", "my great screen", + "-o", "build/test", + "test/data/dkdm.xml" + }; + + boost::filesystem::path const kdm_filename = "build/test/KDM_Test_FTR-1_F-133_XX-XX_MOS_2K_20220109_SMPTE_OV__my_great_screen.xml"; + boost::system::error_code ec; + boost::filesystem::remove(kdm_filename, ec); + + vector<string> output; + auto error = run(args, output); + BOOST_CHECK(!error); + BOOST_REQUIRE_EQUAL(output.size(), 1U); + BOOST_CHECK(output[0].find("the KDM formulation you specified will not write them to the KDM") != std::string::npos); + + BOOST_CHECK(boost::filesystem::exists(kdm_filename)); +} |
