annotate libmpdemux/tvi_def.h @ 4802:9c06b312ced6

Finnaly figured out this little long living bug
author albeu
date Fri, 22 Feb 2002 14:05:41 +0000
parents 622a9ade4517
children 8cd761968f35
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3815
622a9ade4517 updated
alex
parents: 3611
diff changeset
1 #include <stdlib.h> /* malloc */
622a9ade4517 updated
alex
parents: 3611
diff changeset
2
622a9ade4517 updated
alex
parents: 3611
diff changeset
3 static int init(priv_t *priv);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
4 static int uninit(priv_t *priv);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
5 static int control(priv_t *priv, int cmd, void *arg);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
6 static int start(priv_t *priv);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
7 static int grab_video_frame(priv_t *priv, char *buffer, int len);
98769cea155c added tv subsystem
alex
parents:
diff changeset
8 static int get_video_framesize(priv_t *priv);
98769cea155c added tv subsystem
alex
parents:
diff changeset
9 static int grab_audio_frame(priv_t *priv, char *buffer, int len);
98769cea155c added tv subsystem
alex
parents:
diff changeset
10 static int get_audio_framesize(priv_t *priv);
98769cea155c added tv subsystem
alex
parents:
diff changeset
11
98769cea155c added tv subsystem
alex
parents:
diff changeset
12 static tvi_functions_t functions =
98769cea155c added tv subsystem
alex
parents:
diff changeset
13 {
98769cea155c added tv subsystem
alex
parents:
diff changeset
14 init,
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
15 uninit,
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
16 control,
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
17 start,
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
18 grab_video_frame,
98769cea155c added tv subsystem
alex
parents:
diff changeset
19 get_video_framesize,
98769cea155c added tv subsystem
alex
parents:
diff changeset
20 grab_audio_frame,
98769cea155c added tv subsystem
alex
parents:
diff changeset
21 get_audio_framesize
98769cea155c added tv subsystem
alex
parents:
diff changeset
22 };
98769cea155c added tv subsystem
alex
parents:
diff changeset
23
98769cea155c added tv subsystem
alex
parents:
diff changeset
24 static tvi_handle_t *new_handle()
98769cea155c added tv subsystem
alex
parents:
diff changeset
25 {
2819
2e58962dc9fe cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents: 2802
diff changeset
26 tvi_handle_t *h = (tvi_handle_t *)malloc(sizeof(tvi_handle_t));
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
27
98769cea155c added tv subsystem
alex
parents:
diff changeset
28 if (!h)
98769cea155c added tv subsystem
alex
parents:
diff changeset
29 return(NULL);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
30 h->priv = (priv_t *)malloc(sizeof(priv_t));
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
31 if (!h->priv)
98769cea155c added tv subsystem
alex
parents:
diff changeset
32 {
98769cea155c added tv subsystem
alex
parents:
diff changeset
33 free(h);
98769cea155c added tv subsystem
alex
parents:
diff changeset
34 return(NULL);
98769cea155c added tv subsystem
alex
parents:
diff changeset
35 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
36 memset(h->priv, 0, sizeof(priv_t));
98769cea155c added tv subsystem
alex
parents:
diff changeset
37 h->info = &info;
98769cea155c added tv subsystem
alex
parents:
diff changeset
38 h->functions = &functions;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
39 h->seq = 0;
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2819
diff changeset
40 h->chanlist = -1;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2819
diff changeset
41 h->chanlist_s = NULL;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2819
diff changeset
42 h->norm = -1;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2819
diff changeset
43 h->channel = -1;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
44 return(h);
98769cea155c added tv subsystem
alex
parents:
diff changeset
45 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
46
98769cea155c added tv subsystem
alex
parents:
diff changeset
47 static void free_handle(tvi_handle_t *h)
98769cea155c added tv subsystem
alex
parents:
diff changeset
48 {
3611
178c562948ff checkings for malloc results (potential memleaks)
pl
parents: 2941
diff changeset
49 if (h) {
178c562948ff checkings for malloc results (potential memleaks)
pl
parents: 2941
diff changeset
50 if (h->priv)
178c562948ff checkings for malloc results (potential memleaks)
pl
parents: 2941
diff changeset
51 free(h->priv);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
52 free(h);
3611
178c562948ff checkings for malloc results (potential memleaks)
pl
parents: 2941
diff changeset
53 }
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
54 }