X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=flags.cpp;h=ffba26961e082c29ee2b8d293dbca5007c6cac13;hb=50d4cda64803f775343563bf9bf39300c3ac2f5d;hp=21e71e99208765ee1122e6900fa3464f98b3839a;hpb=736515f6ad2ba242579bad96476fcff1af1408cf;p=nageru diff --git a/flags.cpp b/flags.cpp index 21e71e9..ffba269 100644 --- a/flags.cpp +++ b/flags.cpp @@ -6,16 +6,37 @@ 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, " --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 }, + { "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,11 +45,28 @@ 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 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); } }