Fix:
[mplayer/glamo.git] / libmpdemux / tvi_def.h
blob27b797c603c7049ffbd30176691163e2ec79524a
1 #include <stdlib.h> /* malloc */
2 #include <string.h> /* memset */
4 static int init(priv_t *priv);
5 static int uninit(priv_t *priv);
6 static int control(priv_t *priv, int cmd, void *arg);
7 static int start(priv_t *priv);
8 static double grab_video_frame(priv_t *priv, char *buffer, int len);
9 #ifdef HAVE_TV_BSDBT848
10 static double grabimmediate_video_frame(priv_t *priv, char *buffer, int len);
11 #endif
12 static int get_video_framesize(priv_t *priv);
13 static double grab_audio_frame(priv_t *priv, char *buffer, int len);
14 static int get_audio_framesize(priv_t *priv);
16 static tvi_functions_t functions =
18 init,
19 uninit,
20 control,
21 start,
22 grab_video_frame,
23 #ifdef HAVE_TV_BSDBT848
24 grabimmediate_video_frame,
25 #endif
26 get_video_framesize,
27 grab_audio_frame,
28 get_audio_framesize
31 static tvi_handle_t *new_handle(void)
33 tvi_handle_t *h = (tvi_handle_t *)malloc(sizeof(tvi_handle_t));
35 if (!h)
36 return(NULL);
37 h->priv = (priv_t *)malloc(sizeof(priv_t));
38 if (!h->priv)
40 free(h);
41 return(NULL);
43 memset(h->priv, 0, sizeof(priv_t));
44 h->info = &info;
45 h->functions = &functions;
46 h->seq = 0;
47 h->chanlist = -1;
48 h->chanlist_s = NULL;
49 h->norm = -1;
50 h->channel = -1;
51 return(h);
54 static void free_handle(tvi_handle_t *h)
56 if (h) {
57 if (h->priv)
58 free(h->priv);
59 free(h);