-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
44 lines (35 loc) · 918 Bytes
/
main.c
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
#include <stdio.h>
#include "rtsp_control.h"
#define USAGE_STR "usage: %s <rtsp link>\n"
int main(int argc, unsigned char* argv[]) {
if(argc != 2) {
printf(USAGE_STR, argv[0]);
return 1;
}
while(1) {
sleep(15);
RtspControlConnection con;
int resv;
resv = rtsp_control_init_struct_data(&con);
if(resv < 0) {
continue;
}
resv = rtsp_control_connect(&con, argv[1]);
if(resv < 0) {
continue;
}
resv = rtsp_control_init_media(&con);
if(resv < 0) {
continue;
}
unsigned char recv_buf[RTSP_CONTROL_BUF_SIZE];
while(1) {
resv = rtsp_control_run_command(&con, "GET_PARAMETER", recv_buf, RTSP_CONTROL_BUF_SIZE);
if(resv < 0) {
break;
}
sleep(60);
}
}
return 0;
}