2790
|
1 static int init(priv_t *priv);
|
|
2 static int exit(priv_t *priv);
|
|
3 static int control(priv_t *priv, int cmd, void *arg);
|
|
4 static int grab_video_frame(priv_t *priv, char *buffer, int len);
|
|
5 static int get_video_framesize(priv_t *priv);
|
|
6 static int grab_audio_frame(priv_t *priv, char *buffer, int len);
|
|
7 static int get_audio_framesize(priv_t *priv);
|
|
8
|
|
9 static tvi_functions_t functions =
|
|
10 {
|
|
11 init,
|
|
12 exit,
|
|
13 control,
|
|
14 grab_video_frame,
|
|
15 get_video_framesize,
|
|
16 grab_audio_frame,
|
|
17 get_audio_framesize
|
|
18 };
|
|
19
|
|
20 static tvi_handle_t *new_handle()
|
|
21 {
|
|
22 tvi_handle_t *h = malloc(sizeof(tvi_handle_t));
|
|
23
|
|
24 if (!h)
|
|
25 return(NULL);
|
|
26 h->priv = malloc(sizeof(priv_t));
|
|
27 if (!h->priv)
|
|
28 {
|
|
29 free(h);
|
|
30 return(NULL);
|
|
31 }
|
|
32 memset(h->priv, 0, sizeof(priv_t));
|
|
33 h->info = &info;
|
|
34 h->functions = &functions;
|
|
35 return(h);
|
|
36 }
|
|
37
|
|
38 static void free_handle(tvi_handle_t *h)
|
|
39 {
|
|
40 if (h->priv)
|
|
41 free(h->priv);
|
|
42 if (h)
|
|
43 free(h);
|
|
44 }
|