forked from swedishborgie/kinect2pipe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (36 loc) · 1.18 KB
/
Copy pathmain.cpp
File metadata and controls
40 lines (36 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "kinect2pipe_IR.h"
#include <vector>
#include <cstring>
/**
* Main is the entry point for the application. It takes a required argument which is the path to the v4l2loopback
* device to write to, and an optional second argument which is the path to a backup V4L2 capture device used when
* the Kinect 2 is unavailable.
* @param argc Number of command line arguments.
* @param argv Command line arguments.
* @return Exit status
*/
int main(int argc, char** argv) {
bool hwaccel = false;
std::vector<char*> positional;
for (int i = 1; i < argc; ++i) {
if (strcmp(argv[i], "--hwaccel") == 0) {
hwaccel = true;
} else {
positional.push_back(argv[i]);
}
}
if (positional.size() < 1 || positional.size() > 2) {
printf(
"usage: kinect2pipe_IR [--hwaccel] [path to v4l2loopback device] "
"[optional: path to backup v4l2 capture device]\n");
exit(-1);
}
auto* pipe = new kinect2pipe_IR();
pipe->setHwAccel(hwaccel);
pipe->openLoopback(positional[0]);
if (positional.size() == 2) {
pipe->setBackupDevice(positional[1]);
}
pipe->run();
return 0;
}