]> git.sesse.net Git - nageru/blob - flags.cpp
Add an option --flat-audio to start with almost all the audio processing turned off.
[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                 { "theme", required_argument, 0, 't' },
14                 { "va-display", required_argument, 0, 1000 },
15                 { "http-uncompressed-video", no_argument, 0, 1001 },
16                 { "flat-audio", no_argument, 0, 1002 },
17                 { 0, 0, 0, 0 }
18         };
19         for ( ;; ) {
20                 int option_index = 0;
21                 int c = getopt_long(argc, argv, "c:t:", long_options, &option_index);
22
23                 if (c == -1) {
24                         break;
25                 }
26                 switch (c) {
27                 case 'c':
28                         global_flags.num_cards = atoi(optarg);
29                         break;
30                 case 't':
31                         global_flags.theme_filename = optarg;
32                         break;
33                 case 1000:
34                         global_flags.va_display = optarg;
35                         break;
36                 case 1001:
37                         global_flags.uncompressed_video_to_http = true;
38                         break;
39                 case 1002:
40                         global_flags.flat_audio = true;
41                         break;
42                 default:
43                         fprintf(stderr, "Unknown option '%s'\n", argv[option_index]);
44                         exit(1);
45                 }
46         }
47 }