Add --fourk to dcpomatic_create.
authorCarl Hetherington <cth@carlh.net>
Tue, 30 Apr 2019 09:05:13 +0000 (10:05 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 30 Apr 2019 09:05:13 +0000 (10:05 +0100)
src/lib/create_cli.cc
src/lib/create_cli.h
src/tools/dcpomatic_create.cc
test/create_cli_test.cc

index 94e984fcf81ef1ee6347e5e01fc732188eef0725..e1c5f1233cc45790fa12e918c23109cdd0cf6fca 100644 (file)
@@ -47,6 +47,7 @@ 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"
        "      --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"
        "  -o, --output <dir>            output directory\n"
        "      --threed                  make a 3D DCP\n"
        "      --left-eye                next piece of content is for the left eye\n"
        "  -o, --output <dir>            output directory\n"
        "      --threed                  make a 3D DCP\n"
        "      --left-eye                next piece of content is for the left eye\n"
@@ -82,6 +83,7 @@ CreateCLI::CreateCLI (int argc, char* argv[])
        , standard (dcp::SMPTE)
        , no_use_isdcf_name (false)
        , no_sign (false)
        , standard (dcp::SMPTE)
        , no_use_isdcf_name (false)
        , no_sign (false)
+       , fourk (false)
 {
        string dcp_content_type_string = "TST";
        string content_ratio_string;
 {
        string dcp_content_type_string = "TST";
        string content_ratio_string;
@@ -122,6 +124,9 @@ CreateCLI::CreateCLI (int argc, char* argv[])
                } else if (a == "--right-eye") {
                        next_frame_type = VIDEO_FRAME_TYPE_3D_RIGHT;
                        claimed = true;
                } else if (a == "--right-eye") {
                        next_frame_type = VIDEO_FRAME_TYPE_3D_RIGHT;
                        claimed = true;
+               } else if (a == "--fourk") {
+                       fourk = true;
+                       claimed = true;
                }
 
                argument_option(i, argc, argv, "-n", "--name",             &claimed, &error, &name);
                }
 
                argument_option(i, argc, argv, "-n", "--name",             &claimed, &error, &name);
index 1f1cb3cc4da5948e019cc876a368b0344801e899..d0c81590cc87e9d97f2a500db2c4ea7ffda91208 100644 (file)
@@ -54,6 +54,7 @@ public:
        boost::optional<boost::filesystem::path> output_dir;
        boost::optional<std::string> error;
        std::vector<Content> content;
        boost::optional<boost::filesystem::path> output_dir;
        boost::optional<std::string> error;
        std::vector<Content> content;
+       bool fourk;
 
 private:
        static std::string _help;
 
 private:
        static std::string _help;
index 1dfabd296a30390598532cd9163da76fa4b7128a..6d36735e1e271baa81058f613fba391ec1ba9676 100644 (file)
@@ -100,6 +100,7 @@ main (int argc, char* argv[])
                film->set_signed (!cc.no_sign);
                film->set_encrypted (cc.encrypt);
                film->set_three_d (cc.threed);
                film->set_signed (!cc.no_sign);
                film->set_encrypted (cc.encrypt);
                film->set_three_d (cc.threed);
+               film->set_resolution (cc.fourk ? RESOLUTION_4K : RESOLUTION_2K);
 
                BOOST_FOREACH (CreateCLI::Content i, cc.content) {
                        boost::filesystem::path const can = boost::filesystem::canonical (i.path);
 
                BOOST_FOREACH (CreateCLI::Content i, cc.content) {
                        boost::filesystem::path const can = boost::filesystem::canonical (i.path);
index 15fe62523e23787106ad449a3a29bf02f19cd9ae..7bb21546e5799a46da15935b86305018c8433e46 100644 (file)
@@ -144,4 +144,11 @@ BOOST_AUTO_TEST_CASE (create_cli_test)
        BOOST_CHECK_EQUAL (cc.content[0].frame_type, VIDEO_FRAME_TYPE_3D_LEFT);
        BOOST_CHECK_EQUAL (cc.content[1].path, "right.mp4");
        BOOST_CHECK_EQUAL (cc.content[1].frame_type, VIDEO_FRAME_TYPE_3D_RIGHT);
        BOOST_CHECK_EQUAL (cc.content[0].frame_type, VIDEO_FRAME_TYPE_3D_LEFT);
        BOOST_CHECK_EQUAL (cc.content[1].path, "right.mp4");
        BOOST_CHECK_EQUAL (cc.content[1].frame_type, VIDEO_FRAME_TYPE_3D_RIGHT);
+       BOOST_CHECK_EQUAL (cc.fourk, false);
+
+       cc = run ("dcpomatic2_create --fourk --content-ratio 185 foo.mp4");
+       BOOST_REQUIRE_EQUAL (cc.content.size(), 1);
+       BOOST_CHECK_EQUAL (cc.content[0].path, "foo.mp4");
+       BOOST_CHECK_EQUAL (cc.fourk, true);
+       BOOST_CHECK (!cc.error);
 }
 }