X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic_create.cc;h=345c0182bc8215765c9b57de17469f114a51f9e8;hp=944ec32846e90637e41ca9935e2aa5ed253540c9;hb=0792f10d395c90532e8c778eab22145e746257e6;hpb=1523e5d756b2e00db6910e616514e1860c806e17 diff --git a/src/tools/dcpomatic_create.cc b/src/tools/dcpomatic_create.cc index 944ec3284..345c0182b 100644 --- a/src/tools/dcpomatic_create.cc +++ b/src/tools/dcpomatic_create.cc @@ -45,6 +45,7 @@ #include #include + using std::cerr; using std::cout; using std::dynamic_pointer_cast; @@ -53,15 +54,17 @@ using std::list; using std::make_shared; using std::shared_ptr; using std::string; +using std::vector; using boost::optional; + class SimpleSignalManager : public SignalManager { public: /* Do nothing in this method so that UI events happen in our thread when we call SignalManager::ui_idle(). */ - void wake_ui () {} + void wake_ui () override {} }; int @@ -105,6 +108,9 @@ main (int argc, char* argv[]) film->set_use_isdcf_name (!cc.no_use_isdcf_name); film->set_encrypted (cc.encrypt); film->set_three_d (cc.threed); + if (cc.twok) { + film->set_resolution (Resolution::TWO_K); + } if (cc.fourk) { film->set_resolution (Resolution::FOUR_K); } @@ -112,19 +118,23 @@ main (int argc, char* argv[]) film->set_j2k_bandwidth (*cc.j2k_bandwidth); } - for (auto i: cc.content) { - boost::filesystem::path const can = boost::filesystem::canonical (i.path); - list > content; + for (auto cli_content: cc.content) { + auto const can = boost::filesystem::canonical (cli_content.path); + vector> film_content_list; if (boost::filesystem::exists (can / "ASSETMAP") || (boost::filesystem::exists (can / "ASSETMAP.xml"))) { - content.push_back (make_shared(can)); + auto dcp = make_shared(can); + film_content_list.push_back (dcp); + if (cli_content.kdm) { + dcp->add_kdm (dcp::EncryptedKDM(dcp::file_to_string(*cli_content.kdm))); + } } else { /* I guess it's not a DCP */ - content = content_factory (can); + film_content_list = content_factory (can); } - for (auto j: content) { - film->examine_and_add_content (j); + for (auto film_content: film_content_list) { + film->examine_and_add_content (film_content); } while (jm->work_to_do ()) { @@ -133,9 +143,21 @@ main (int argc, char* argv[]) while (signal_manager->ui_idle() > 0) {} - for (auto j: content) { - if (j->video) { - j->video->set_frame_type (i.frame_type); + for (auto film_content: film_content_list) { + if (film_content->video) { + film_content->video->set_frame_type (cli_content.frame_type); + } + if (film_content->audio && cli_content.channel) { + for (auto stream: film_content->audio->streams()) { + AudioMapping mapping(stream->channels(), film->audio_channels()); + for (int channel = 0; channel < stream->channels(); ++channel) { + mapping.set(channel, *cli_content.channel, 1.0f); + } + stream->set_mapping (mapping); + } + } + if (film_content->audio && cli_content.gain) { + film_content->audio->set_gain (*cli_content.gain); } } } @@ -154,8 +176,10 @@ main (int argc, char* argv[]) if (jm->errors ()) { for (auto i: jm->get()) { if (i->finished_in_error()) { - cerr << i->error_summary() << "\n" - << i->error_details() << "\n"; + cerr << i->error_summary() << "\n"; + if (!i->error_details().empty()) { + cout << i->error_details() << "\n"; + } } } exit (EXIT_FAILURE);