- string name;
- DCPContentType const * dcp_content_type = DCPContentType::from_isdcf_name ("TST");
- Ratio const * container_ratio = 0;
- Ratio const * content_ratio = 0;
- int still_length = 10;
- dcp::Standard standard = dcp::SMPTE;
- boost::filesystem::path output;
-
- int option_index = 0;
- while (true) {
- static struct option long_options[] = {
- { "version", no_argument, 0, 'v'},
- { "help", no_argument, 0, 'h'},
- { "name", required_argument, 0, 'n'},
- { "dcp-content-type", required_argument, 0, 'c'},
- { "container-ratio", required_argument, 0, 'A'},
- { "content-ratio", required_argument, 0, 'B'},
- { "still-length", required_argument, 0, 's'},
- { "standard", required_argument, 0, 'C'},
- { "output", required_argument, 0, 'o'},
- { 0, 0, 0, 0}
- };
-
- int c = getopt_long (argc, argv, "vhn:c:A:B:C:s:o:", long_options, &option_index);
- if (c == -1) {
- break;
+ CreateCLI cc (argc, argv);
+ if (cc.error) {
+ cerr << *cc.error << "\n";
+ exit (1);
+ }
+
+ if (cc.version) {
+ cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n";
+ exit (EXIT_SUCCESS);
+ }
+
+ if (cc.config_dir) {
+ State::override_path = *cc.config_dir;
+ }
+
+ signal_manager = new SimpleSignalManager ();
+ auto jm = JobManager::instance ();
+
+ try {
+ auto film = std::make_shared<Film>(cc.output_dir);
+ dcpomatic_log = film->log ();
+ dcpomatic_log->set_types (Config::instance()->log_types());
+ if (cc.template_name) {
+ film->use_template (cc.template_name.get());
+ }
+ film->set_name (cc.name);
+
+ if (cc.container_ratio) {
+ film->set_container (cc.container_ratio);
+ }
+ film->set_dcp_content_type (cc.dcp_content_type);
+ film->set_interop (cc.standard == dcp::Standard::INTEROP);
+ 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);
+ }
+ if (cc.j2k_bandwidth) {
+ film->set_j2k_bandwidth (*cc.j2k_bandwidth);