- 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;
- boost::filesystem::path output;
-
- int option_index = 0;
- while (1) {
- 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'},
- { "output", required_argument, 0, 'o'},
- { 0, 0, 0, 0}
- };
-
- int c = getopt_long (argc, argv, "vhn:c:A:B:s:o:", 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 'c':
- dcp_content_type = DCPContentType::from_isdcf_name (optarg);
- if (dcp_content_type == 0) {
- cerr << "Bad DCP content type.\n";
- help (argv[0]);
- exit (EXIT_FAILURE);
- }
- break;
- case 'A':
- container_ratio = Ratio::from_id (optarg);
- if (container_ratio == 0) {
- cerr << "Bad container ratio.\n";
- help (argv[0]);
- exit (EXIT_FAILURE);
- }
- break;
- case 'B':
- content_ratio = Ratio::from_id (optarg);
- if (content_ratio == 0) {
- cerr << "Bad content ratio " << optarg << ".\n";
- help (argv[0]);
- exit (EXIT_FAILURE);
- }
- break;
- case 's':
- still_length = atoi (optarg);
- break;
- case 'o':
- output = optarg;
- break;
- }
- }
-
- if (optind > argc) {
- help (argv[0]);
- exit (EXIT_FAILURE);
- }
-
- if (!content_ratio) {
- cerr << argv[0] << ": missing required option --content-ratio.\n";
- exit (EXIT_FAILURE);