Mercurial > mplayer.hg
annotate stream/tvi_def.h @ 23883:d65439444b75
Removing global variables from tv://
Step 2: fixing tv subdrivers initialization.
author | voroshil |
---|---|
date | Sun, 29 Jul 2007 10:18:38 +0000 |
parents | 6b18c979dd45 |
children | d7bd74869672 |
rev | line source |
---|---|
3815 | 1 #include <stdlib.h> /* malloc */ |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
5572
diff
changeset
|
2 #include <string.h> /* memset */ |
3815 | 3 |
4 static int init(priv_t *priv); | |
2802 | 5 static int uninit(priv_t *priv); |
2790 | 6 static int control(priv_t *priv, int cmd, void *arg); |
2802 | 7 static int start(priv_t *priv); |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
3815
diff
changeset
|
8 static double grab_video_frame(priv_t *priv, char *buffer, int len); |
2790 | 9 static int get_video_framesize(priv_t *priv); |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
3815
diff
changeset
|
10 static double grab_audio_frame(priv_t *priv, char *buffer, int len); |
2790 | 11 static int get_audio_framesize(priv_t *priv); |
12 | |
13 static tvi_functions_t functions = | |
14 { | |
15 init, | |
2802 | 16 uninit, |
2790 | 17 control, |
2802 | 18 start, |
2790 | 19 grab_video_frame, |
20 get_video_framesize, | |
21 grab_audio_frame, | |
22 get_audio_framesize | |
23 }; | |
24 | |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
8123
diff
changeset
|
25 static tvi_handle_t *new_handle(void) |
2790 | 26 { |
2819
2e58962dc9fe
cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents:
2802
diff
changeset
|
27 tvi_handle_t *h = (tvi_handle_t *)malloc(sizeof(tvi_handle_t)); |
2790 | 28 |
29 if (!h) | |
30 return(NULL); | |
2802 | 31 h->priv = (priv_t *)malloc(sizeof(priv_t)); |
2790 | 32 if (!h->priv) |
33 { | |
34 free(h); | |
35 return(NULL); | |
36 } | |
37 memset(h->priv, 0, sizeof(priv_t)); | |
38 h->functions = &functions; | |
2802 | 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 | 44 return(h); |
45 } | |
46 | |
47 static void free_handle(tvi_handle_t *h) | |
48 { | |
3611 | 49 if (h) { |
50 if (h->priv) | |
51 free(h->priv); | |
2790 | 52 free(h); |
3611 | 53 } |
2790 | 54 } |
23422 | 55 |
56 /** | |
57 Fills video frame in given buffer with blue color for yv12,i420,uyvy,yuy2. | |
58 Other formats will be filled with 0xC0 | |
59 */ | |
60 static inline void fill_blank_frame(char* buffer,int len,int fmt){ | |
61 int i; | |
62 | |
63 switch(fmt){ | |
64 case IMGFMT_YV12: | |
65 memset(buffer, 0xFF,5*len/6); | |
66 memset(buffer+5*len/6, 0xFF,len/6); | |
67 break; | |
68 case IMGFMT_I420: | |
69 memset(buffer, 0xFF,4*len/6); | |
70 memset(buffer+4*len/6, 0xFF,len/6); | |
71 memset(buffer+5*len/6, 0xFF,len/6); | |
72 break; | |
73 case IMGFMT_UYVY: | |
74 for(i=0;i<len;i+=4){ | |
75 buffer[i]=0xFF; | |
76 buffer[i+1]=0; | |
77 buffer[i+2]=0; | |
78 buffer[i+3]=0; | |
79 } | |
80 break; | |
81 case IMGFMT_YUY2: | |
82 for(i=0;i<len;i+=4){ | |
83 buffer[i]=0; | |
84 buffer[i+1]=0xFF; | |
85 buffer[i+2]=0; | |
86 buffer[i+3]=0; | |
87 } | |
88 break; | |
23423 | 89 case IMGFMT_MJPEG: |
90 /* | |
91 This is compressed format. I don't know yet how to fill such frame with blue color. | |
92 Keeping frame unchanged. | |
93 */ | |
94 break; | |
23422 | 95 default: |
96 memset(buffer,0xC0,len); | |
97 } | |
98 } |