]> git.sesse.net Git - nageru/blobdiff - flags.cpp
Support 10-bit capture, both on bmusb and on DeckLink drivers.
[nageru] / flags.cpp
index 709cfb601ce82d70fb15015573ed0b7201ed4659..025b6d9b07708504e83b2325b4f406d2233c5238 100644 (file)
--- a/flags.cpp
+++ b/flags.cpp
@@ -46,10 +46,14 @@ enum LongOption {
        OPTION_DISABLE_ALSA_OUTPUT,
        OPTION_NO_FLUSH_PBOS,
        OPTION_PRINT_VIDEO_LATENCY,
+       OPTION_MAX_INPUT_QUEUE_FRAMES,
        OPTION_AUDIO_QUEUE_LENGTH_MS,
        OPTION_OUTPUT_YCBCR_COEFFICIENTS,
-       OUTPUT_BUFFER_FRAMES,
-       OUTPUT_SLOP_FRAMES,
+       OPTION_OUTPUT_BUFFER_FRAMES,
+       OPTION_OUTPUT_SLOP_FRAMES,
+       OPTION_TIMECODE_STREAM,
+       OPTION_TIMECODE_STDOUT,
+       OPTION_10_BIT_INPUT,
 };
 
 void usage()
@@ -105,6 +109,8 @@ void usage()
        fprintf(stderr, "                                    (will give display corruption, but makes it\n");
        fprintf(stderr, "                                    possible to run with apitrace in real time)\n");
        fprintf(stderr, "      --print-video-latency       print out measurements of video latency on stdout\n");
+       fprintf(stderr, "      --max-input-queue-frames=FRAMES  never keep more than FRAMES frames for each card\n");
+       fprintf(stderr, "                                    (default 6, minimum 1)\n");
        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");
@@ -116,6 +122,9 @@ void usage()
        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[])
@@ -163,10 +172,14 @@ void parse_flags(int argc, char * const argv[])
                { "disable-alsa-output", no_argument, 0, OPTION_DISABLE_ALSA_OUTPUT },
                { "no-flush-pbos", no_argument, 0, OPTION_NO_FLUSH_PBOS },
                { "print-video-latency", no_argument, 0, OPTION_PRINT_VIDEO_LATENCY },
+               { "max-input-queue-frames", required_argument, 0, OPTION_MAX_INPUT_QUEUE_FRAMES },
                { "audio-queue-length-ms", required_argument, 0, OPTION_AUDIO_QUEUE_LENGTH_MS },
                { "output-ycbcr-coefficients", required_argument, 0, OPTION_OUTPUT_YCBCR_COEFFICIENTS },
-               { "output-buffer-frames", required_argument, 0, OUTPUT_BUFFER_FRAMES },
-               { "output-slop-frames", required_argument, 0, OUTPUT_SLOP_FRAMES },
+               { "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;
@@ -323,18 +336,30 @@ void parse_flags(int argc, char * const argv[])
                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 OUTPUT_BUFFER_FRAMES:
+               case OPTION_OUTPUT_BUFFER_FRAMES:
                        global_flags.output_buffer_frames = atof(optarg);
                        break;
-               case OUTPUT_SLOP_FRAMES:
+               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);
@@ -431,4 +456,11 @@ void parse_flags(int argc, char * const argv[])
                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");
+       }
 }