+
+ // Rec. 709 would be the sane thing to do, but it seems many players
+ // just default to BT.601 coefficients no matter what. We _do_ set
+ // the right flags, so that a player that works properly doesn't have
+ // to guess, but it's frequently ignored. See discussions
+ // in e.g. https://trac.ffmpeg.org/ticket/4978; the situation with
+ // browsers is complicated and depends on things like hardware acceleration
+ // (https://bugs.chromium.org/p/chromium/issues/detail?id=333619 for
+ // extensive discussion). VLC generally fixed this as part of 3.0.0
+ // (see e.g. https://github.com/videolan/vlc/commit/bc71288b2e38c07d6921472824b92eef1aa85f7e
+ // and https://github.com/videolan/vlc/commit/c3fc2683a9cde1d42674ebf9935dced05733a215),
+ // but earlier versions were pretty random.
+ //
+ // On the other hand, HDMI/SDI output typically requires Rec. 709 for
+ // HD resolutions (with no way of signaling anything else), which is
+ // a conflicting demand. In this case, we typically let the HDMI/SDI
+ // output win if it is active, but the user can override this.
+ if (output_ycbcr_coefficients == "auto") {
+ // Essentially: BT.709 if HDMI/SDI output is on, otherwise BT.601.
+ global_flags.ycbcr_rec709_coefficients = false;
+ global_flags.ycbcr_auto_coefficients = true;
+ } else if (output_ycbcr_coefficients == "rec709") {
+ global_flags.ycbcr_rec709_coefficients = true;
+ global_flags.ycbcr_auto_coefficients = false;
+ } else if (output_ycbcr_coefficients == "rec601") {
+ global_flags.ycbcr_rec709_coefficients = false;
+ global_flags.ycbcr_auto_coefficients = false;
+ } else {
+ fprintf(stderr, "ERROR: --output-ycbcr-coefficients must be “rec601”, “rec709” or “auto”\n");
+ exit(1);
+ }
+
+ if (global_flags.output_buffer_frames < 0.0f) {
+ // Actually, even zero probably won't make sense; there is some internal
+ // delay to the card.
+ fprintf(stderr, "ERROR: --output-buffer-frames can't be negative.\n");
+ exit(1);
+ }
+ if (global_flags.output_slop_frames < 0.0f) {
+ fprintf(stderr, "ERROR: --output-slop-frames can't be negative.\n");
+ exit(1);
+ }
+ if (global_flags.max_input_queue_frames < 1) {
+ fprintf(stderr, "ERROR: --max-input-queue-frames must be at least 1.\n");
+ exit(1);
+ }
+ if (global_flags.max_input_queue_frames > 10) {
+ fprintf(stderr, "WARNING: --max-input-queue-frames has little effect over 10.\n");
+ }