]> git.sesse.net Git - nageru/blobdiff - flags.cpp
Support switching Y'CbCr coefficients midway, which will allow doing the Right Thing...
[nageru] / flags.cpp
index b926d14c6070348ba5edaa94d0f59e44e4d073d9..88a2c458221bbd26a14797bb31542f1035f56ba8 100644 (file)
--- a/flags.cpp
+++ b/flags.cpp
@@ -51,6 +51,9 @@ enum LongOption {
        OPTION_OUTPUT_YCBCR_COEFFICIENTS,
        OPTION_OUTPUT_BUFFER_FRAMES,
        OPTION_OUTPUT_SLOP_FRAMES,
+       OPTION_TIMECODE_STREAM,
+       OPTION_TIMECODE_STDOUT,
+       OPTION_10_BIT_INPUT,
 };
 
 void usage()
@@ -111,14 +114,17 @@ void usage()
        fprintf(stderr, "      --audio-queue-length-ms=MS  length of audio resampling queue (default 100.0)\n");
        fprintf(stderr, "      --output-ycbcr-coefficients={rec601,rec709,auto}\n");
        fprintf(stderr, "                                  Y'CbCr coefficient standard of output (default auto)\n");
-       fprintf(stderr, "                                    auto is rec709 if and only if --output-card is used\n");
-       fprintf(stderr, "                                    and a HD resolution is set\n");
+       fprintf(stderr, "                                    auto is rec601, unless --output-card is used\n");
+       fprintf(stderr, "                                    and a Rec. 709 mode (typically HD modes) is in use\n");
        fprintf(stderr, "      --output-buffer-frames=NUM  number of frames in output buffer for --output-card,\n");
        fprintf(stderr, "                                    can be fractional (default 6.0); note also\n");
        fprintf(stderr, "                                    the audio queue can't be much longer than this\n");
        fprintf(stderr, "      --output-slop-frames=NUM    if more less than this number of frames behind for\n");
        fprintf(stderr, "                                    --output-card, try to submit anyway instead of\n");
        fprintf(stderr, "                                    dropping the frame (default 0.5)\n");
+       fprintf(stderr, "      --timecode-stream           show timestamp and timecode in stream\n");
+       fprintf(stderr, "      --timecode-stdout           show timestamp and timecode on standard output\n");
+       fprintf(stderr, "      --10-bit-input              use 10-bit video input (requires compute shaders)\n");
 }
 
 void parse_flags(int argc, char * const argv[])
@@ -171,6 +177,9 @@ void parse_flags(int argc, char * const argv[])
                { "output-ycbcr-coefficients", required_argument, 0, OPTION_OUTPUT_YCBCR_COEFFICIENTS },
                { "output-buffer-frames", required_argument, 0, OPTION_OUTPUT_BUFFER_FRAMES },
                { "output-slop-frames", required_argument, 0, OPTION_OUTPUT_SLOP_FRAMES },
+               { "timecode-stream", no_argument, 0, OPTION_TIMECODE_STREAM },
+               { "timecode-stdout", no_argument, 0, OPTION_TIMECODE_STDOUT },
+               { "10-bit-input", no_argument, 0, OPTION_10_BIT_INPUT },
                { 0, 0, 0, 0 }
        };
        vector<string> theme_dirs;
@@ -342,6 +351,15 @@ void parse_flags(int argc, char * const argv[])
                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_HELP:
                        usage();
                        exit(0);
@@ -412,17 +430,17 @@ void parse_flags(int argc, char * const argv[])
        // 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, but the user can override this.
+       // output win if it is active, but the user can override this.
        if (output_ycbcr_coefficients == "auto") {
-               if (global_flags.output_card >= 0 && global_flags.width >= 1280) {
-                       global_flags.ycbcr_rec709_coefficients = true;
-               } else {
-                       global_flags.ycbcr_rec709_coefficients = false;
-               }
+               // 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);