+ case OPTION_PRINT_VIDEO_LATENCY:
+ global_flags.print_video_latency = true;
+ break;
+ case OPTION_MAX_INPUT_QUEUE_FRAMES:
+ global_flags.max_input_queue_frames = atoi(optarg);
+ break;
+ case OPTION_AUDIO_QUEUE_LENGTH_MS:
+ global_flags.audio_queue_length_ms = atof(optarg);
+ break;
+ case OPTION_OUTPUT_YCBCR_COEFFICIENTS:
+ output_ycbcr_coefficients = optarg;
+ break;
+ case OPTION_OUTPUT_BUFFER_FRAMES:
+ global_flags.output_buffer_frames = atof(optarg);
+ break;
+ case OPTION_OUTPUT_SLOP_FRAMES:
+ global_flags.output_slop_frames = atof(optarg);
+ break;
+ case OPTION_TIMECODE_STREAM:
+ global_flags.display_timecode_in_stream = true;
+ break;
+ case OPTION_TIMECODE_STDOUT:
+ global_flags.display_timecode_on_stdout = true;
+ break;
+ case OPTION_10_BIT_INPUT:
+ global_flags.ten_bit_input = true;
+ break;
+ case OPTION_10_BIT_OUTPUT:
+ global_flags.ten_bit_output = true;
+ global_flags.x264_video_to_disk = true;
+ global_flags.x264_video_to_http = true;
+ global_flags.x264_bit_depth = 10;
+ break;
+ case OPTION_INPUT_YCBCR_INTERPRETATION: {
+ char *ptr = strchr(optarg, ',');
+ if (ptr == nullptr) {
+ fprintf(stderr, "ERROR: Invalid argument '%s' to --input-ycbcr-interpretation (needs a card and an interpretation, separated by comma)\n", optarg);
+ exit(1);
+ }
+ *ptr = '\0';
+ const int card_num = atoi(optarg);
+ if (card_num < 0 || card_num >= MAX_VIDEO_CARDS) {
+ fprintf(stderr, "ERROR: Invalid card number %d\n", card_num);
+ exit(1);
+ }
+
+ YCbCrInterpretation interpretation;
+ char *interpretation_str = ptr + 1;
+ ptr = strchr(interpretation_str, ',');
+ if (ptr != nullptr) {
+ *ptr = '\0';
+ const char *range = ptr + 1;
+ if (strcmp(range, "full") == 0) {
+ interpretation.full_range = true;
+ } else if (strcmp(range, "limited") == 0) {
+ interpretation.full_range = false;
+ } else {
+ fprintf(stderr, "ERROR: Invalid Y'CbCr range '%s' (must be “full” or “limited”)\n", range);
+ exit(1);
+ }
+ }
+
+ if (strcmp(interpretation_str, "rec601") == 0) {
+ interpretation.ycbcr_coefficients_auto = false;
+ interpretation.ycbcr_coefficients = movit::YCBCR_REC_601;
+ } else if (strcmp(interpretation_str, "rec709") == 0) {
+ interpretation.ycbcr_coefficients_auto = false;
+ interpretation.ycbcr_coefficients = movit::YCBCR_REC_709;
+ } else if (strcmp(interpretation_str, "auto") == 0) {
+ interpretation.ycbcr_coefficients_auto = true;
+ if (interpretation.full_range) {
+ fprintf(stderr, "ERROR: Cannot use “auto” Y'CbCr coefficients with full range\n");
+ exit(1);
+ }
+ } else {
+ fprintf(stderr, "ERROR: Invalid Y'CbCr coefficients '%s' (must be “rec601”, “rec709” or “auto”)\n", interpretation_str);
+ exit(1);
+ }
+ global_flags.ycbcr_interpretation[card_num] = interpretation;
+ break;
+ }
+ case OPTION_HELP: