string
help()
{
+ string colour_conversions = "";
+ for (auto const& conversion: PresetColourConversion::all()) {
+ colour_conversions += conversion.id + ", ";
+ }
+ DCPOMATIC_ASSERT(colour_conversions.length() > 2);
+ colour_conversions = colour_conversions.substr(0, colour_conversions.length() - 2);
+
return string("\nSyntax: %1 [OPTION] <CONTENT> [OPTION] [<CONTENT> ...]\n") +
variant::insert_dcpomatic(" -v, --version show %1 version\n") +
" -h, --help show this help\n"
" --left-eye next piece of content is for the left eye\n"
" --right-eye next piece of content is for the right eye\n"
" --auto-crop next piece of content should be auto-cropped\n"
+ " --colourspace next piece of content is in the given colourspace: " + colour_conversions + "\n"
+ " --colorspace same as --colourspace\n"
" --channel <channel> next piece of content should be mapped to audio channel L, R, C, Lfe, Ls, Rs, BsL, BsR, HI, VI\n"
" --gain next piece of content should have the given audio gain (in dB)\n"
" --cpl <id> CPL ID to use from the next piece of content (which is a DCP)\n"
string template_name_string;
int64_t video_bit_rate_int = 0;
optional<int> audio_channels;
+ optional<string> next_colour_conversion;
auto next_frame_type = VideoFrameType::TWO_D;
auto next_auto_crop = false;
optional<dcp::Channel> channel;
argument_option(i, argc, argv, "", "--video-bit-rate", &claimed, &error, &video_bit_rate_int);
/* Similar to below, not using string_to_int here causes on add compile error on Ubuntu 1{6,8}.04 */
argument_option(i, argc, argv, "-a", "--audio-channels", &claimed, &error, &audio_channels, string_to_int);
+ argument_option(i, argc, argv, "" , "--colourspace", &claimed, &error, &next_colour_conversion, string_to_string);
+ argument_option(i, argc, argv, "" , "--colorspace", &claimed, &error, &next_colour_conversion, string_to_string);
std::function<optional<dcp::Channel> (string)> convert_channel = [](string channel) -> optional<dcp::Channel>{
if (channel == "L") {
error = String::compose("%1: unrecognised option '%2'", argv[0], a) + String::compose(help(), argv[0]);
return;
} else {
+ if (next_colour_conversion) {
+ auto colour_conversions = PresetColourConversion::all();
+ if (!std::any_of(
+ colour_conversions.begin(),
+ colour_conversions.end(),
+ [next_colour_conversion](PresetColourConversion const& conversion) {
+ return conversion.id == *next_colour_conversion;
+ })) {
+ error = fmt::format("{}: {} is not a recognised colourspace", argv[0], *next_colour_conversion);
+ return;
+ }
+ }
+
Content c;
c.path = a;
c.frame_type = next_frame_type;
c.auto_crop = next_auto_crop;
+ c.colour_conversion = next_colour_conversion;
c.channel = channel;
c.gain = gain;
c.kdm = kdm;
content.push_back(c);
next_frame_type = VideoFrameType::TWO_D;
next_auto_crop = false;
+ next_colour_conversion = {};
channel = {};
gain = {};
}
film_content->video->set_crop(crop);
}
+ if (cli_content.colour_conversion) {
+ film_content->video->set_colour_conversion(PresetColourConversion::from_id(*cli_content.colour_conversion).conversion);
+ }
}
if (film_content->audio && cli_content.channel) {
for (auto stream: film_content->audio->streams()) {
BOOST_CHECK_EQUAL (cc.content[1].frame_type, VideoFrameType::THREE_D_RIGHT);
BOOST_CHECK_EQUAL(cc._fourk, false);
+ cc = run ("dcpomatic2_create --colourspace rec1886 test/data/flat_red.png");
+ BOOST_REQUIRE_EQUAL(cc.content.size(), 1U);
+ BOOST_CHECK_EQUAL(cc.content[0].colour_conversion.get_value_or(""), "rec1886");
+ BOOST_CHECK(!cc.error);
+ auto film = cc.make_film(error);
+ BOOST_REQUIRE_EQUAL(film->content().size(), 1U);
+ BOOST_REQUIRE(static_cast<bool>(film->content()[0]->video->colour_conversion()));
+ BOOST_REQUIRE(film->content()[0]->video->colour_conversion() == PresetColourConversion::from_id("rec1886").conversion);
+
+ cc = run ("dcpomatic2_create --colourspace ostrobogulous foo.mp4");
+ BOOST_CHECK_EQUAL(cc.error.get_value_or(""), "dcpomatic2_create: ostrobogulous is not a recognised colourspace");
+
cc = run ("dcpomatic2_create --twok foo.mp4");
BOOST_REQUIRE_EQUAL (cc.content.size(), 1U);
BOOST_CHECK_EQUAL (cc.content[0].path, "foo.mp4");
auto pillarbox = TestPaths::private_data() / "pillarbox.png";
cc = run("dcpomatic2_create --auto-crop " + pillarbox.string());
- auto film = cc.make_film(error);
+ film = cc.make_film(error);
BOOST_CHECK_EQUAL(film->content().size(), 1U);
BOOST_CHECK(film->content()[0]->video->actual_crop() == Crop(113, 262, 0, 0));
BOOST_CHECK_EQUAL(collected_error, fmt::format("Cropped {} to 113 left, 262 right, 0 top and 0 bottom", pillarbox.string()));