X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=flags.cpp;h=0fe2236e44b51801808eee8228d7652e7798d6e8;hb=77cc363c7e4db05eb8c1b7fef1a56e2ee308e0d4;hp=e0c638b708469a854cedfd6f869bb7de5e181a1f;hpb=a472dcd2c9faec3e191539fb647237195047bbd4;p=nageru diff --git a/flags.cpp b/flags.cpp index e0c638b..0fe2236 100644 --- a/flags.cpp +++ b/flags.cpp @@ -1,21 +1,44 @@ -#include +#include "flags.h" + #include +#include #include -#include - -#include "flags.h" Flags global_flags; +void usage() +{ + fprintf(stderr, "Usage: nageru [OPTION]...\n"); + fprintf(stderr, "\n"); + fprintf(stderr, " -h, --help print usage information\n"); + fprintf(stderr, " -c, --num-cards set number of input cards (default 2)\n"); + fprintf(stderr, " -t, --theme=FILE choose theme (default theme.lua)\n"); + fprintf(stderr, " -v, --va-display=SPEC VA-API device for H.264 encoding\n"); + fprintf(stderr, " ($DISPLAY spec or /dev/dri/render* path)\n"); + fprintf(stderr, " --http-uncompressed-video send uncompressed NV12 video to HTTP clients\n"); + fprintf(stderr, " --http-mux=NAME mux to use for HTTP streams (default " DEFAULT_STREAM_MUX_NAME ")\n"); + fprintf(stderr, " --flat-audio start with most audio processing turned off\n"); + fprintf(stderr, " --no-flush-pbos do not explicitly signal texture data uploads\n"); + fprintf(stderr, " (will give display corruption, but makes it\n"); + fprintf(stderr, " possible to run with apitrace in real time)\n"); +} + void parse_flags(int argc, char * const argv[]) { static const option long_options[] = { + { "help", no_argument, 0, 'h' }, { "num-cards", required_argument, 0, 'c' }, + { "theme", required_argument, 0, 't' }, + { "va-display", required_argument, 0, 1000 }, + { "http-uncompressed-video", no_argument, 0, 1001 }, + { "http-mux", required_argument, 0, 1004 }, + { "flat-audio", no_argument, 0, 1002 }, + { "no-flush-pbos", no_argument, 0, 1003 }, { 0, 0, 0, 0 } }; for ( ;; ) { int option_index = 0; - int c = getopt_long(argc, argv, "c:", long_options, &option_index); + int c = getopt_long(argc, argv, "c:t:", long_options, &option_index); if (c == -1) { break; @@ -24,8 +47,31 @@ void parse_flags(int argc, char * const argv[]) case 'c': global_flags.num_cards = atoi(optarg); break; + case 't': + global_flags.theme_filename = optarg; + break; + case 1000: + global_flags.va_display = optarg; + break; + case 1001: + global_flags.uncompressed_video_to_http = true; + break; + case 1004: + global_flags.stream_mux_name = optarg; + break; + case 1002: + global_flags.flat_audio = true; + break; + case 1003: + global_flags.flush_pbos = false; + break; + case 'h': + usage(); + exit(0); default: fprintf(stderr, "Unknown option '%s'\n", argv[option_index]); + fprintf(stderr, "\n"); + usage(); exit(1); } }