- string name;
- optional<string> template_name;
- DCPContentType const * dcp_content_type = DCPContentType::from_isdcf_name ("TST");
- optional<int> dcp_frame_rate;
- Ratio const * container_ratio = 0;
- Ratio const * content_ratio = 0;
- int still_length = 10;
- dcp::Standard standard = dcp::SMPTE;
- optional<boost::filesystem::path> output;
- bool sign = true;
- bool use_isdcf_name = true;
- optional<boost::filesystem::path> config;
-
- 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'},
- { "template", required_argument, 0, 't'},
- { "dcp-content-type", required_argument, 0, 'c'},
- { "dcp-frame-rate", required_argument, 0, 'f'},
- { "container-ratio", required_argument, 0, 'A'},
- { "content-ratio", required_argument, 0, 'B'},
- { "still-length", required_argument, 0, 's'},
- { "standard", required_argument, 0, 'C'},
- { "no-use-isdcf-name", no_argument, 0, 'D'},
- { "no-sign", no_argument, 0, 'E'},
- { "output", required_argument, 0, 'o'},
- { "config", required_argument, 0, 'F'},
- { 0, 0, 0, 0}
- };
-
- int c = getopt_long (argc, argv, "vhn:f:c:f:A:B:C:s:o:DEF:", long_options, &option_index);
- if (c == -1) {
- break;
- }
-
- switch (c) {
- case 'v':
- cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n";
- exit (EXIT_SUCCESS);
- case 'h':
- help (argv[0]);
- exit (EXIT_SUCCESS);
- case 'n':
- name = optarg;
- break;
- case 't':
- template_name = optarg;
- break;
- case 'c':
- dcp_content_type = DCPContentType::from_isdcf_name (optarg);
- if (dcp_content_type == 0) {
- cerr << "Bad DCP content type.\n";
- syntax (argv[0]);
- exit (EXIT_FAILURE);
- }
- break;
- case 'f':
- dcp_frame_rate = atoi (optarg);
- break;
- case 'A':
- container_ratio = Ratio::from_id (optarg);
- if (container_ratio == 0) {
- cerr << "Bad container ratio.\n";
- syntax (argv[0]);
- exit (EXIT_FAILURE);
- }
- break;
- case 'B':
- content_ratio = Ratio::from_id (optarg);
- if (content_ratio == 0) {
- cerr << "Bad content ratio " << optarg << ".\n";
- syntax (argv[0]);
- exit (EXIT_FAILURE);
- }
- break;
- case 'C':
- if (strcmp (optarg, "interop") == 0) {
- standard = dcp::INTEROP;
- } else if (strcmp (optarg, "SMPTE") != 0) {
- cerr << "Bad standard " << optarg << ".\n";
- syntax (argv[0]);
- exit (EXIT_FAILURE);
- }
- break;
- case 'D':
- use_isdcf_name = false;
- break;
- case 'E':
- sign = false;
- break;
- case 'F':
- config = optarg;
- break;
- case 's':
- still_length = atoi (optarg);
- break;
- case 'o':
- output = optarg;
- break;
- case '?':
- syntax (argv[0]);
- exit (EXIT_FAILURE);
- }
- }
-
- if (optind > argc) {
- help (argv[0]);
- exit (EXIT_FAILURE);
- }
-
- if (config) {
- Config::override_path = *config;
- }
-
- if (!content_ratio) {
- cerr << argv[0] << ": missing required option --content-ratio.\n";
- exit (EXIT_FAILURE);