forked from sambios/UsbCameraRtspServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
46 lines (37 loc) · 1.01 KB
/
main.cpp
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
41
42
43
44
45
46
#include "CameraDevice.hpp"
#include "UsbCameraOnDemandRTSPServer.h"
#include "getopt.h"
int main(int argc, char *argv[])
{
std::string h264file;
int ch = 0, option_index;
struct option long_options[] =
{
{"h264file", optional_argument, NULL, 0},
{0, 0, 0, 0},
};
while ((ch = getopt_long(argc, argv, "i:", long_options, &option_index)) != -1)
{
switch (ch)
{
case 0:
if (optarg) {
if (option_index == 0) {
h264file = optarg;
}
}
break;
case 'i':
h264file = optarg;
break;
}
}
if (h264file.empty()) {
printf("Usage: -i [filepath] or --h264file=[filepath]\n");
return -1;
}
UsbCameraOnDemandRTSPServer server;
server.SetH264File(h264file);
server.StartServer();
return 0;
}