]> git.sesse.net Git - nageru/blob - flags.cpp
Add support for uncompressed video instead of H.264 (while still storing H.264 to...
[nageru] / flags.cpp
1 #include "flags.h"
2
3 #include <getopt.h>
4 #include <stdio.h>
5 #include <stdlib.h>
6
7 Flags global_flags;
8
9 void parse_flags(int argc, char * const argv[])
10 {
11         static const option long_options[] = {
12                 { "num-cards", required_argument, 0, 'c' },
13                 { "va-display", required_argument, 0, 1000 },
14                 { "http-uncompressed-video", no_argument, 0, 1001 },
15                 { 0, 0, 0, 0 }
16         };
17         for ( ;; ) {
18                 int option_index = 0;
19                 int c = getopt_long(argc, argv, "c:", long_options, &option_index);
20
21                 if (c == -1) {
22                         break;
23                 }
24                 switch (c) {
25                 case 'c':
26                         global_flags.num_cards = atoi(optarg);
27                         break;
28                 case 1000:
29                         global_flags.va_display = optarg;
30                         break;
31                 case 1001:
32                         global_flags.uncompressed_video_to_http = true;
33                         break;
34                 default:
35                         fprintf(stderr, "Unknown option '%s'\n", argv[option_index]);
36                         exit(1);
37                 }
38         }
39 }