+
+
+shared_ptr<Film>
+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());
+ } else {
+ /* No template: apply our own CLI tool defaults to override the ones in Config.
+ * Maybe one day there will be no defaults in Config any more (as they'll be in
+ * a default template) and we can decide whether to use the default template
+ * or not.
+ */
+ film->set_interop(false);
+ film->set_dcp_content_type(DCPContentType::from_isdcf_name("TST"));
+ }
+ film->set_name(_name);
+
+ if (_container_ratio) {
+ film->set_container(_container_ratio);
+ }
+ if (_dcp_content_type) {
+ film->set_dcp_content_type(_dcp_content_type);
+ }
+ if (_standard) {
+ film->set_interop(*_standard == dcp::Standard::INTEROP);
+ }
+ film->set_use_isdcf_name(!_no_use_isdcf_name);
+ if (_no_encrypt) {
+ film->set_encrypted(false);
+ } else if (_encrypt) {
+ film->set_encrypted(true);
+ }
+ if (_twod) {
+ film->set_three_d(false);
+ } else if (_threed) {
+ film->set_three_d(true);
+ }
+ if (_twok) {
+ film->set_resolution(Resolution::TWO_K);
+ }
+ if (_fourk) {
+ film->set_resolution(Resolution::FOUR_K);
+ }
+ if (_j2k_bandwidth) {
+ film->set_j2k_bandwidth(*_j2k_bandwidth);
+ }
+
+ int channels = 6;
+ for (auto cli_content: content) {
+ if (cli_content.channel) {
+ channels = std::max(channels, static_cast<int>(*cli_content.channel) + 1);
+ }
+ }
+ if (channels % 2) {
+ ++channels;
+ }
+
+ film->set_audio_channels(channels);
+
+ return film;
+}
+