-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathcli.cpp
More file actions
53 lines (39 loc) · 824 Bytes
/
cli.cpp
File metadata and controls
53 lines (39 loc) · 824 Bytes
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
47
48
49
50
51
52
53
#include "config.h"
#include "HLSLive.h"
#include "LiveFile.h"
#include "LiveCamera.h"
#include "wingetopt.h"
#include <signal.h>
volatile bool g_terminate = false;
void userinterrupt(int)
{
fprintf(stderr, "user interrupt, exit...\n");
g_terminate = true;
}
void check_config()
{
///< todo: check flags in the config file
}
int main(int argc, char ** argv)
{
ILive * live = NULL;
const void * arg = NULL;
check_config();
#if LIVE_CAMERA
live = new LiveCamera();
arg = (void *)LIVE_CAMERA_IDC;
#else
live = new LiveFile;
arg = LIVE_FILE_NAME;
#endif // LIVE_CAMERA
if (!live->start(arg))
{
return -1;
}
::signal(SIGINT, &userinterrupt);
while (!g_terminate) Sleep(1);
live->stop();
delete live;
system("pause");
return 0;
}