]> git.sesse.net Git - nageru/blob - flags.cpp
Add support for opening VA-API via DRM instead of X11.
[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                 { 0, 0, 0, 0 }
15         };
16         for ( ;; ) {
17                 int option_index = 0;
18                 int c = getopt_long(argc, argv, "c:", long_options, &option_index);
19
20                 if (c == -1) {
21                         break;
22                 }
23                 switch (c) {
24                 case 'c':
25                         global_flags.num_cards = atoi(optarg);
26                         break;
27                 case 1000:
28                         global_flags.va_display = optarg;
29                         break;
30                 default:
31                         fprintf(stderr, "Unknown option '%s'\n", argv[option_index]);
32                         exit(1);
33                 }
34         }
35 }