Mercurial > mplayer.hg
annotate stream/tvi_def.h @ 24104:b0a47d3bf2f3
Fix blue color for yv12 and i420 image formats in "automute" screen
author | voroshil |
---|---|
date | Thu, 23 Aug 2007 14:20:31 +0000 |
parents | d7bd74869672 |
children | 9e71e0345c35 |
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 | |
24017
d7bd74869672
Define teletext_control() in tvi_v4l.c and tvi_v4l2.c.
cehoyos
parents:
23423
diff
changeset
|
13 int teletext_control(void* p, int cmd, void *arg); |
d7bd74869672
Define teletext_control() in tvi_v4l.c and tvi_v4l2.c.
cehoyos
parents:
23423
diff
changeset
|
14 |
2790 | 15 static tvi_functions_t functions = |
16 { | |
17 init, | |
2802 | 18 uninit, |
2790 | 19 control, |
2802 | 20 start, |
2790 | 21 grab_video_frame, |
22 get_video_framesize, | |
23 grab_audio_frame, | |
24 get_audio_framesize | |
25 }; | |
26 | |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
8123
diff
changeset
|
27 static tvi_handle_t *new_handle(void) |
2790 | 28 { |
2819
2e58962dc9fe
cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents:
2802
diff
changeset
|
29 tvi_handle_t *h = (tvi_handle_t *)malloc(sizeof(tvi_handle_t)); |
2790 | 30 |
31 if (!h) | |
32 return(NULL); | |
2802 | 33 h->priv = (priv_t *)malloc(sizeof(priv_t)); |
2790 | 34 if (!h->priv) |
35 { | |
36 free(h); | |
37 return(NULL); | |
38 } | |
39 memset(h->priv, 0, sizeof(priv_t)); | |
40 h->functions = &functions; | |
2802 | 41 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
|
42 h->chanlist = -1; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2819
diff
changeset
|
43 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
|
44 h->norm = -1; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2819
diff
changeset
|
45 h->channel = -1; |
2790 | 46 return(h); |
47 } | |
48 | |
49 static void free_handle(tvi_handle_t *h) | |
50 { | |
3611 | 51 if (h) { |
52 if (h->priv) | |
53 free(h->priv); | |
2790 | 54 free(h); |
3611 | 55 } |
2790 | 56 } |
23422 | 57 |
58 /** | |
59 Fills video frame in given buffer with blue color for yv12,i420,uyvy,yuy2. | |
60 Other formats will be filled with 0xC0 | |
61 */ | |
62 static inline void fill_blank_frame(char* buffer,int len,int fmt){ | |
63 int i; | |
24104
b0a47d3bf2f3
Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents:
24017
diff
changeset
|
64 // RGB(0,0,255) <-> YVU(41,110,240) |
23422 | 65 |
66 switch(fmt){ | |
67 case IMGFMT_YV12: | |
24104
b0a47d3bf2f3
Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents:
24017
diff
changeset
|
68 memset(buffer, 41,4*len/6); //Y |
b0a47d3bf2f3
Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents:
24017
diff
changeset
|
69 memset(buffer+4*len/6, 110,len/6);//V |
b0a47d3bf2f3
Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents:
24017
diff
changeset
|
70 memset(buffer+5*len/6, 240,len/6);//U |
23422 | 71 break; |
72 case IMGFMT_I420: | |
24104
b0a47d3bf2f3
Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents:
24017
diff
changeset
|
73 memset(buffer, 41,4*len/6); //Y |
b0a47d3bf2f3
Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents:
24017
diff
changeset
|
74 memset(buffer+4*len/6, 240,len/6);//U |
b0a47d3bf2f3
Fix blue color for yv12 and i420 image formats in "automute" screen
voroshil
parents:
24017
diff
changeset
|
75 memset(buffer+5*len/6, 110,len/6);//V |
23422 | 76 break; |
77 case IMGFMT_UYVY: | |
78 for(i=0;i<len;i+=4){ | |
79 buffer[i]=0xFF; | |
80 buffer[i+1]=0; | |
81 buffer[i+2]=0; | |
82 buffer[i+3]=0; | |
83 } | |
84 break; | |
85 case IMGFMT_YUY2: | |
86 for(i=0;i<len;i+=4){ | |
87 buffer[i]=0; | |
88 buffer[i+1]=0xFF; | |
89 buffer[i+2]=0; | |
90 buffer[i+3]=0; | |
91 } | |
92 break; | |
23423 | 93 case IMGFMT_MJPEG: |
94 /* | |
95 This is compressed format. I don't know yet how to fill such frame with blue color. | |
96 Keeping frame unchanged. | |
97 */ | |
98 break; | |
23422 | 99 default: |
100 memset(buffer,0xC0,len); | |
101 } | |
102 } |