forked from Kofera/mms_radio
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
executable file
·61 lines (44 loc) · 1.03 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "common.h"
#include "access.h"
#include "mms.h"
#include <signal.h>
void sig_handle(int sig_no);
access_t *p_access;
int main(int argc, char* argv[])
{
#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2, 2 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
return 1;
}
if ( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 ) {
WSACleanup( );
return 1;
}
#else
#endif
p_access = (access_t*)malloc(sizeof(access_t));
p_access->psz_access = "mmst";
p_access->psz_path = "mms://alive.rbc.cn/cfm1075";
signal(SIGINT, sig_handle);
signal(SIGTERM, sig_handle);
if(MOpen(p_access) == VLC_SUCCESS)
p_access->pf_block(p_access);
MClose(p_access);
return 0;
}
void sig_handle(int sig_no)
{
switch (sig_no)
{
case SIGINT:
case SIGTERM:
MClose(p_access);
}
exit(0);
}