diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-09-30 11:42:26 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-09-30 11:42:26 +0200 |
| commit | 4fd32ca36487a1130a58769daee9fae22057ffcb (patch) | |
| tree | b70c550af30f723f9f486a4b32cf4b0ecb7e7bc0 | |
| parent | 9eced47f9801c8f4387d7d54355e52021eb11b18 (diff) | |
Cleanup: add some _ prefixes.
| -rw-r--r-- | src/lib/create_cli.cc | 60 | ||||
| -rw-r--r-- | src/lib/create_cli.h | 22 | ||||
| -rw-r--r-- | test/create_cli_test.cc | 24 |
3 files changed, 53 insertions, 53 deletions
diff --git a/src/lib/create_cli.cc b/src/lib/create_cli.cc index 0ad728faf..95654286b 100644 --- a/src/lib/create_cli.cc +++ b/src/lib/create_cli.cc @@ -153,11 +153,11 @@ CreateCLI::CreateCLI (int argc, char* argv[]) } if (a == "-e" || a == "--encrypt") { - encrypt = claimed = true; + _encrypt = claimed = true; } else if (a == "--no-use-isdcf-name") { - no_use_isdcf_name = claimed = true; + _no_use_isdcf_name = claimed = true; } else if (a == "--threed") { - threed = claimed = true; + _threed = claimed = true; } else if (a == "--left-eye") { next_frame_type = VideoFrameType::THREE_D_LEFT; claimed = true; @@ -165,10 +165,10 @@ CreateCLI::CreateCLI (int argc, char* argv[]) next_frame_type = VideoFrameType::THREE_D_RIGHT; claimed = true; } else if (a == "--twok") { - twok = true; + _twok = true; claimed = true; } else if (a == "--fourk") { - fourk = true; + _fourk = true; claimed = true; } @@ -188,7 +188,7 @@ CreateCLI::CreateCLI (int argc, char* argv[]) return boost::optional<int>(value); }; - argument_option(i, argc, argv, "-n", "--name", &claimed, &error, &name); + argument_option(i, argc, argv, "-n", "--name", &claimed, &error, &_name); argument_option(i, argc, argv, "-t", "--template", &claimed, &error, &template_name_string); argument_option(i, argc, argv, "-c", "--dcp-content-type", &claimed, &error, &dcp_content_type_string); argument_option(i, argc, argv, "-f", "--dcp-frame-rate", &claimed, &error, &dcp_frame_rate_int); @@ -256,7 +256,7 @@ CreateCLI::CreateCLI (int argc, char* argv[]) } if (!template_name_string.empty()) { - template_name = template_name_string; + _template_name = template_name_string; } if (dcp_frame_rate_int) { @@ -264,18 +264,18 @@ CreateCLI::CreateCLI (int argc, char* argv[]) } if (j2k_bandwidth_int) { - j2k_bandwidth = j2k_bandwidth_int * 1000000; + _j2k_bandwidth = j2k_bandwidth_int * 1000000; } - dcp_content_type = DCPContentType::from_isdcf_name(dcp_content_type_string); - if (!dcp_content_type) { + _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()) { - container_ratio = Ratio::from_id (container_ratio_string); - if (!container_ratio) { + _container_ratio = Ratio::from_id (container_ratio_string); + if (!_container_ratio) { error = String::compose("%1: unrecognised container ratio %2", argv[0], container_ratio_string); return; } @@ -287,7 +287,7 @@ CreateCLI::CreateCLI (int argc, char* argv[]) } if (standard_string == "interop") { - standard = dcp::Standard::INTEROP; + _standard = dcp::Standard::INTEROP; } if (content.empty()) { @@ -295,11 +295,11 @@ CreateCLI::CreateCLI (int argc, char* argv[]) return; } - if (name.empty()) { - name = content[0].path.leaf().string(); + if (_name.empty()) { + _name = content[0].path.leaf().string(); } - if (j2k_bandwidth && (*j2k_bandwidth < 10000000 || *j2k_bandwidth > Config::instance()->maximum_j2k_bandwidth())) { + if (_j2k_bandwidth && (*_j2k_bandwidth < 10000000 || *_j2k_bandwidth > Config::instance()->maximum_j2k_bandwidth())) { error = String::compose("%1: j2k-bandwidth must be between 10 and %2 Mbit/s", argv[0], (Config::instance()->maximum_j2k_bandwidth() / 1000000)); return; } @@ -312,27 +312,27 @@ CreateCLI::make_film() const auto film = std::make_shared<Film>(output_dir); dcpomatic_log = film->log(); dcpomatic_log->set_types(Config::instance()->log_types()); - if (template_name) { - film->use_template(template_name.get()); + if (_template_name) { + film->use_template(_template_name.get()); } - film->set_name(name); + film->set_name(_name); - if (container_ratio) { - film->set_container(container_ratio); + if (_container_ratio) { + film->set_container(_container_ratio); } - 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); - film->set_three_d(threed); - if (twok) { + 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); + film->set_three_d(_threed); + if (_twok) { film->set_resolution(Resolution::TWO_K); } - if (fourk) { + if (_fourk) { film->set_resolution(Resolution::FOUR_K); } - if (j2k_bandwidth) { - film->set_j2k_bandwidth(*j2k_bandwidth); + if (_j2k_bandwidth) { + film->set_j2k_bandwidth(*_j2k_bandwidth); } int channels = 6; diff --git a/src/lib/create_cli.h b/src/lib/create_cli.h index f88cdb8e4..1133d21c5 100644 --- a/src/lib/create_cli.h +++ b/src/lib/create_cli.h @@ -60,17 +60,17 @@ public: private: friend struct ::create_cli_test; - boost::optional<std::string> template_name; - std::string name; - Ratio const * container_ratio = nullptr; - bool encrypt = false; - bool threed = false; - DCPContentType const * dcp_content_type = nullptr; - dcp::Standard standard = dcp::Standard::SMPTE; - bool no_use_isdcf_name = false; - bool twok = false; - bool fourk = false; - boost::optional<int> j2k_bandwidth; + boost::optional<std::string> _template_name; + std::string _name; + Ratio const* _container_ratio = nullptr; + bool _encrypt = false; + bool _threed = false; + DCPContentType const* _dcp_content_type = nullptr; + dcp::Standard _standard = dcp::Standard::SMPTE; + bool _no_use_isdcf_name = false; + bool _twok = false; + bool _fourk = false; + boost::optional<int> _j2k_bandwidth; static std::string _help; }; diff --git a/test/create_cli_test.cc b/test/create_cli_test.cc index 3bc819604..253f3cadd 100644 --- a/test/create_cli_test.cc +++ b/test/create_cli_test.cc @@ -71,13 +71,13 @@ BOOST_AUTO_TEST_CASE (create_cli_test) cc = run ("dcpomatic2_create x --name frobozz --template bar"); BOOST_CHECK (!cc.error); - BOOST_CHECK_EQUAL (cc.name, "frobozz"); - BOOST_REQUIRE (cc.template_name); - BOOST_CHECK_EQUAL (*cc.template_name, "bar"); + BOOST_CHECK_EQUAL(cc._name, "frobozz"); + BOOST_REQUIRE(cc._template_name); + BOOST_CHECK_EQUAL(*cc._template_name, "bar"); cc = run ("dcpomatic2_create x --dcp-content-type FTR"); BOOST_CHECK (!cc.error); - BOOST_CHECK_EQUAL (cc.dcp_content_type, DCPContentType::from_isdcf_name("FTR")); + BOOST_CHECK_EQUAL(cc._dcp_content_type, DCPContentType::from_isdcf_name("FTR")); cc = run ("dcpomatic2_create x --dcp-frame-rate 30"); BOOST_CHECK (!cc.error); @@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE (create_cli_test) cc = run ("dcpomatic2_create x --container-ratio 185"); BOOST_CHECK (!cc.error); - BOOST_CHECK_EQUAL (cc.container_ratio, Ratio::from_id("185")); + BOOST_CHECK_EQUAL(cc._container_ratio, Ratio::from_id("185")); cc = run ("dcpomatic2_create x --container-ratio XXX"); BOOST_CHECK (cc.error); @@ -97,11 +97,11 @@ BOOST_AUTO_TEST_CASE (create_cli_test) cc = run ("dcpomatic2_create x --standard SMPTE"); BOOST_CHECK (!cc.error); - BOOST_CHECK_EQUAL (cc.standard, dcp::Standard::SMPTE); + BOOST_CHECK_EQUAL(cc._standard, dcp::Standard::SMPTE); cc = run ("dcpomatic2_create x --standard interop"); BOOST_CHECK (!cc.error); - BOOST_CHECK_EQUAL (cc.standard, dcp::Standard::INTEROP); + BOOST_CHECK_EQUAL(cc._standard, dcp::Standard::INTEROP); cc = run ("dcpomatic2_create x --standard SMPTEX"); BOOST_CHECK (cc.error); @@ -140,25 +140,25 @@ BOOST_AUTO_TEST_CASE (create_cli_test) BOOST_CHECK_EQUAL (cc.content[0].frame_type, VideoFrameType::THREE_D_LEFT); BOOST_CHECK_EQUAL (cc.content[1].path, "right.mp4"); BOOST_CHECK_EQUAL (cc.content[1].frame_type, VideoFrameType::THREE_D_RIGHT); - BOOST_CHECK_EQUAL (cc.fourk, false); + 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_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"); - BOOST_CHECK_EQUAL (cc.fourk, true); + BOOST_CHECK_EQUAL(cc._fourk, true); BOOST_CHECK (!cc.error); cc = run ("dcpomatic2_create --j2k-bandwidth 120 foo.mp4"); BOOST_REQUIRE_EQUAL (cc.content.size(), 1U); BOOST_CHECK_EQUAL (cc.content[0].path, "foo.mp4"); - BOOST_REQUIRE (cc.j2k_bandwidth); - BOOST_CHECK_EQUAL (*cc.j2k_bandwidth, 120000000); + BOOST_REQUIRE(cc._j2k_bandwidth); + BOOST_CHECK_EQUAL(*cc._j2k_bandwidth, 120000000); BOOST_CHECK (!cc.error); cc = run ("dcpomatic2_create --channel L fred.wav --channel R jim.wav sheila.wav"); |
