Mercurial > mplayer.hg
annotate libvo/vo_aa.c @ 17960:ec93436dc52d
Fix a/v desync for real some files
author | rtognimp |
---|---|
date | Sun, 26 Mar 2006 14:10:52 +0000 |
parents | f580a7755ac5 |
children | 8579acff875e |
rev | line source |
---|---|
1538
f3f4fc77fd88
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new. fixed wrong char
folke
parents:
1537
diff
changeset
|
1 /* |
1511 | 2 * MPlayer |
3 * | |
1553
12551899e83f
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking +header change
folke
parents:
1551
diff
changeset
|
4 * Video driver for AAlib - 1.0 |
1511 | 5 * |
6 * by Folke Ashberg <folke@ashberg.de> | |
7 * | |
8 * Code started: Sun Aug 12 2001 | |
1553
12551899e83f
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking +header change
folke
parents:
1551
diff
changeset
|
9 * Version 1.0 : Thu Aug 16 2001 |
1511 | 10 * |
11 */ | |
12 | |
13 #include <stdio.h> | |
14 #include <stdlib.h> | |
15 | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
16 #include <sys/stat.h> |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
17 #include <unistd.h> |
1511 | 18 |
19 #include <limits.h> | |
20 #include <math.h> | |
21 #include <stdarg.h> | |
22 #include <time.h> | |
23 #include <string.h> | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4674
diff
changeset
|
24 #include <errno.h> |
1511 | 25 |
26 #include "config.h" | |
27 #include "video_out.h" | |
28 #include "video_out_internal.h" | |
5870 | 29 #include "aspect.h" |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
10595
diff
changeset
|
30 #include "postproc/swscale.h" |
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
10595
diff
changeset
|
31 #include "libmpcodecs/vf_scale.h" |
5295 | 32 #include "font_load.h" |
1511 | 33 #include "sub.h" |
34 | |
9380 | 35 #include "osdep/keycodes.h" |
1511 | 36 #include <aalib.h> |
14935
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
37 #include "subopt-helper.h" |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
38 #include "help_mp.h" |
5870 | 39 #include "mp_msg.h" |
1511 | 40 |
41 | |
42 #define MESSAGE_DURATION 3 | |
43 #define MESSAGE_SIZE 512 | |
44 #define MESSAGE_DEKO " +++ %s +++ " | |
45 | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7625
diff
changeset
|
46 static vo_info_t info = { |
1511 | 47 "AAlib", |
48 "aa", | |
5870 | 49 "Alban Bedel <albeu@free.fr> and Folke Ashberg <folke@ashberg.de>", |
1511 | 50 "" |
51 }; | |
52 | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7625
diff
changeset
|
53 LIBVO_EXTERN(aa) |
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7625
diff
changeset
|
54 |
1511 | 55 /* aa's main context we use */ |
56 aa_context *c; | |
57 aa_renderparams *p; | |
58 static int fast =0; | |
5870 | 59 /* used for the sws */ |
60 static uint8_t * image[3]; | |
61 static int image_stride[3]; | |
1511 | 62 |
63 /* image infos */ | |
5870 | 64 static int image_format; |
1511 | 65 static int image_width; |
66 static int image_height; | |
5870 | 67 static int image_x, image_y; |
68 static int screen_x, screen_y; | |
69 static int screen_w, screen_h; | |
70 static int src_width; | |
71 static int src_height; | |
1511 | 72 |
73 /* osd stuff */ | |
74 time_t stoposd = 0; | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
75 static int showosdmessage = 0; |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
76 char osdmessagetext[MESSAGE_SIZE]; |
1511 | 77 char posbar[MESSAGE_SIZE]; |
78 static int osdx, osdy; | |
5870 | 79 static int osd_text_length = 0; |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
80 int aaconfigmode=1; |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
81 #ifdef USE_OSD |
5870 | 82 font_desc_t* vo_font_save = NULL; |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
83 #endif |
9496 | 84 static struct SwsContext *sws=NULL; |
1511 | 85 |
86 /* our version of the playmodes :) */ | |
87 | |
88 extern void mplayer_put_key(int code); | |
89 | |
1518 | 90 /* to disable stdout outputs when curses/linux mode */ |
91 extern int quiet; | |
92 | |
1537
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
93 /* configuration */ |
1518 | 94 int aaopt_osdcolor = AA_SPECIAL; |
1537
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
95 int aaopt_subcolor = AA_SPECIAL; |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
96 |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
97 extern struct aa_hardware_params aa_defparams; |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
98 extern struct aa_renderparams aa_defrenderparams; |
1511 | 99 |
100 void | |
101 resize(void){ | |
102 /* | |
103 * this function is called by aa lib if windows resizes | |
104 * further during init, because here we have to calculate | |
105 * a little bit | |
106 */ | |
107 | |
108 aa_resize(c); | |
109 | |
5870 | 110 aspect_save_screenres(aa_imgwidth(c),aa_imgheight(c)); |
111 image_height = aa_imgheight(c); //src_height; | |
112 image_width = aa_imgwidth(c); //src_width; | |
113 | |
114 aspect(&image_width,&image_height,A_ZOOM); | |
115 | |
116 image_x = (aa_imgwidth(c) - image_width) / 2; | |
117 image_y = (aa_imgheight(c) - image_height) / 2; | |
118 screen_w = image_width * aa_scrwidth(c) / aa_imgwidth(c); | |
119 screen_h = image_height * aa_scrheight(c) / aa_imgheight(c); | |
120 screen_x = (aa_scrwidth(c) - screen_w) / 2; | |
121 screen_y = (aa_scrheight(c) - screen_h) / 2; | |
122 | |
9496 | 123 if(sws) sws_freeContext(sws); |
124 sws = sws_getContextFromCmdLine(src_width,src_height,image_format, | |
6522 | 125 image_width,image_height,IMGFMT_Y8); |
5870 | 126 |
6809
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
127 image[0] = aa_image(c) + image_y * aa_imgwidth(c) + image_x; |
5870 | 128 image[1] = NULL; |
6522 | 129 image[2] = NULL; |
5870 | 130 |
6809
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
131 image_stride[0] = aa_imgwidth(c); |
5870 | 132 image_stride[1] = 0; |
6522 | 133 image_stride[2] = 0; |
5870 | 134 |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
135 showosdmessage=0; |
1511 | 136 |
137 } | |
138 | |
139 void | |
140 osdmessage(int duration, int deko, char *fmt, ...) | |
141 { | |
142 /* | |
143 * for outputting a centered string at the bottom | |
144 * of our window for a while | |
145 */ | |
146 va_list ar; | |
147 char m[MESSAGE_SIZE]; | |
5870 | 148 unsigned int old_len = strlen(osdmessagetext); |
149 | |
1511 | 150 va_start(ar, fmt); |
151 vsprintf(m, fmt, ar); | |
152 va_end(ar); | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
153 if (deko==1) sprintf(osdmessagetext, MESSAGE_DEKO , m); |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
154 else strcpy(osdmessagetext, m); |
5870 | 155 |
156 if(old_len > strlen(osdmessagetext)) { | |
157 memset(c->textbuffer + osdy * aa_scrwidth(c) + osdx,' ',old_len); | |
158 memset(c->attrbuffer + osdy * aa_scrwidth(c) + osdx,0,old_len); | |
159 } | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
160 showosdmessage=1; |
1511 | 161 stoposd = time(NULL) + duration; |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
162 osdx=(aa_scrwidth(c) / 2) - (strlen(osdmessagetext) / 2 ) ; |
1511 | 163 posbar[0]='\0'; |
164 } | |
165 | |
166 void | |
167 osdpercent(int duration, int deko, int min, int max, int val, char * desc, char * unit) | |
168 { | |
169 /* | |
170 * prints a bar for setting values | |
171 */ | |
172 float step; | |
173 int where; | |
174 int i; | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
175 |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
176 |
1511 | 177 step=(float)aa_scrwidth(c) /(float)(max-min); |
178 where=(val-min)*step; | |
5870 | 179 osdmessage(duration,deko,"%s: %i%s",desc, val, unit); |
1511 | 180 posbar[0]='|'; |
181 posbar[aa_scrwidth(c)-1]='|'; | |
182 for (i=0;i<aa_scrwidth(c);i++){ | |
183 if (i==where) posbar[i]='#'; | |
184 else posbar[i]='-'; | |
185 } | |
186 if (where!=0) posbar[0]='|'; | |
187 if (where!=(aa_scrwidth(c)-1) ) posbar[aa_scrwidth(c)-1]='|'; | |
5870 | 188 |
1511 | 189 posbar[aa_scrwidth(c)]='\0'; |
5870 | 190 |
1511 | 191 } |
192 | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
193 void |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
16171
diff
changeset
|
194 printosdtext(void) |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
195 { |
5870 | 196 if(osd_text_length > 0 && !vo_osd_text) { |
197 memset(c->textbuffer,' ',osd_text_length); | |
198 memset(c->attrbuffer,0,osd_text_length); | |
199 osd_text_length = 0; | |
200 } | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
201 /* |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
202 * places the mplayer status osd |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
203 */ |
6757
f72fc85934e5
10L bugs founds by Jindrich Makovicka <makovicki at KMLinux dot fjfi dot cvuti dot cz>
albeu
parents:
6522
diff
changeset
|
204 if (vo_osd_text && vo_osd_text[0] != 0) { |
5870 | 205 int len; |
206 if(vo_osd_text[0] < 32) { | |
207 len = strlen(__sub_osd_names_short[vo_osd_text[0]]) + strlen(vo_osd_text+1) + 2; | |
208 aa_printf(c, 0, 0 , aaopt_osdcolor, "%s %s ", __sub_osd_names_short[vo_osd_text[0]], vo_osd_text+1); | |
209 } else { | |
210 len = strlen(vo_osd_text) + 1; | |
211 aa_printf(c, 0, 0 , aaopt_osdcolor, "%s ",vo_osd_text); | |
212 } | |
213 | |
214 if(len < osd_text_length) { | |
215 memset(c->textbuffer + len,' ',osd_text_length - len); | |
216 memset(c->attrbuffer + len,0,osd_text_length - len); | |
217 } | |
218 osd_text_length = len; | |
219 | |
220 } | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
221 } |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
222 |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
223 void |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
16171
diff
changeset
|
224 printosdprogbar(void){ |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
225 /* print mplayer osd-progbar */ |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
226 if (vo_osd_progbar_type!=-1){ |
2498 | 227 osdpercent(1,1,0,255,vo_osd_progbar_value, __sub_osd_names[vo_osd_progbar_type], ""); |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
228 } |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
229 } |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
230 static int |
4433 | 231 config(uint32_t width, uint32_t height, uint32_t d_width, |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
14935
diff
changeset
|
232 uint32_t d_height, uint32_t flags, char *title, |
7124
eca7dbad0166
finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents:
6809
diff
changeset
|
233 uint32_t format) { |
1511 | 234 /* |
235 * main init | |
236 * called by mplayer | |
237 */ | |
5870 | 238 |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
239 int i; |
1511 | 240 |
5870 | 241 aspect_save_orig(width,height); |
242 aspect_save_prescale(d_width,d_height); | |
1511 | 243 |
5870 | 244 src_height = height; |
245 src_width = width; | |
1511 | 246 image_format = format; |
247 | |
248 /* nothing will change its size, be we need some values initialized */ | |
249 resize(); | |
250 | |
1554 | 251 #ifdef USE_OSD |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
252 /* now init out own 'font' (to use vo_draw_text_sub without edit them) */ |
5870 | 253 if(!vo_font_save) vo_font_save = vo_font; |
254 if(vo_font == vo_font_save) { | |
255 vo_font=malloc(sizeof(font_desc_t));//if(!desc) return NULL; | |
256 memset(vo_font,0,sizeof(font_desc_t)); | |
257 vo_font->pic_a[0]=malloc(sizeof(raw_file)); | |
9176 | 258 memset(vo_font->pic_a[0],0,sizeof(raw_file)); |
5870 | 259 vo_font->pic_b[0]=malloc(sizeof(raw_file)); |
9176 | 260 memset(vo_font->pic_b[0],0,sizeof(raw_file)); |
1572 | 261 |
7140
b9ce54c7f30f
add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents:
7124
diff
changeset
|
262 #ifdef HAVE_FREETYPE |
b9ce54c7f30f
add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents:
7124
diff
changeset
|
263 vo_font->dynamic = 0; |
b9ce54c7f30f
add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents:
7124
diff
changeset
|
264 #endif |
b9ce54c7f30f
add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents:
7124
diff
changeset
|
265 |
5870 | 266 vo_font->spacewidth=1; |
267 vo_font->charspace=0; | |
268 vo_font->height=1; | |
269 vo_font->pic_a[0]->bmp=malloc(255); | |
9176 | 270 vo_font->pic_a[0]->pal=NULL; |
5870 | 271 vo_font->pic_b[0]->bmp=malloc(255); |
9176 | 272 vo_font->pic_b[0]->pal=NULL; |
5870 | 273 vo_font->pic_a[0]->w=1; |
274 vo_font->pic_a[0]->h=1; | |
275 for (i=0; i<255; i++){ | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
276 vo_font->width[i]=1; |
1572 | 277 vo_font->font[i]=0; |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
278 vo_font->start[i]=i; |
1572 | 279 vo_font->pic_a[0]->bmp[i]=i; |
280 vo_font->pic_b[0]->bmp[i]=i; | |
5870 | 281 } |
282 } | |
1554 | 283 #endif |
1511 | 284 /* say hello */ |
7625 | 285 osdmessage(5, 1, "Welcome to ASCII ART MPlayer"); |
1511 | 286 |
5870 | 287 mp_msg(MSGT_VO,MSGL_V,"VO: [aa] screendriver: %s\n", c->driver->name); |
288 mp_msg(MSGT_VO,MSGL_V,"VO: [aa] keyboarddriver: %s\n", c->kbddriver->name); | |
1511 | 289 |
5870 | 290 mp_msg(MSGT_VO,MSGL_INFO, |
1511 | 291 "\n" |
14935
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
292 "Important suboptions\n" |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
293 "\textended use use all 256 characters\n" |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
294 "\teight use eight bit ascii\n" |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
295 "\tdriver set recommended aalib driver (X11,curses,linux)\n" |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
296 "\thelp to see all options provided by aalib\n" |
1518 | 297 "\n" |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
298 "AA-MPlayer Keys\n" |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
299 "\t1 : contrast -\n" |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
300 "\t2 : contrast +\n" |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
301 "\t3 : brightness -\n" |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
302 "\t4 : brightness +\n" |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
303 "\t5 : fast rendering\n" |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
304 "\t6 : dithering\n" |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
305 "\t7 : invert image\n" |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
306 "\ta : toggles between aa and mplayer control\n" |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
307 |
1511 | 308 "\n" |
1527 | 309 "All other keys are MPlayer defaults.\n" |
1511 | 310 |
311 | |
312 ); | |
313 | |
314 return 0; | |
315 } | |
316 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
317 static int |
1511 | 318 query_format(uint32_t format) { |
319 /* | |
320 * ...are we able to... ? | |
321 * called by mplayer | |
5870 | 322 * All input format supported by the sws |
1511 | 323 */ |
324 switch(format){ | |
325 case IMGFMT_YV12: | |
5870 | 326 case IMGFMT_I420: |
327 case IMGFMT_IYUV: | |
328 case IMGFMT_IYU2: | |
329 case IMGFMT_BGR32: | |
5027 | 330 case IMGFMT_BGR24: |
5870 | 331 case IMGFMT_BGR16: |
332 case IMGFMT_BGR15: | |
333 case IMGFMT_RGB32: | |
334 case IMGFMT_RGB24: | |
335 case IMGFMT_Y8: | |
336 case IMGFMT_Y800: | |
6210 | 337 return VFCAP_CSP_SUPPORTED|VFCAP_SWSCALE |
6205 | 338 #ifdef USE_OSD |
339 | VFCAP_OSD | |
340 #endif | |
341 ; | |
1511 | 342 } |
343 return 0; | |
344 } | |
345 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
346 static int |
1511 | 347 draw_frame(uint8_t *src[]) { |
5870 | 348 int stride[3] = { 0 , 0 , 0 }; |
349 | |
350 switch(image_format) { | |
351 case IMGFMT_BGR15: | |
352 case IMGFMT_BGR16: | |
353 stride[0] = src_width*2; | |
354 break; | |
355 case IMGFMT_IYU2: | |
356 case IMGFMT_BGR24: | |
357 stride[0] = src_width*3; | |
358 break; | |
359 case IMGFMT_BGR32: | |
360 stride[0] = src_width*4; | |
361 break; | |
362 } | |
363 | |
9697 | 364 sws_scale_ordered(sws,src,stride,0,src_height,image,image_stride); |
5870 | 365 |
366 /* Now 'ASCIInate' the image */ | |
367 if (fast) | |
368 aa_fastrender(c, screen_x, screen_y, screen_w + screen_x, screen_h + screen_y ); | |
369 else | |
370 aa_render(c, p,screen_x, screen_y, screen_w + screen_x, screen_h + screen_y ); | |
371 | |
372 return 0; | |
1511 | 373 } |
374 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
375 static int |
1511 | 376 draw_slice(uint8_t *src[], int stride[], |
377 int w, int h, int x, int y) { | |
5870 | 378 |
379 int dx1 = screen_x + (x * screen_w / src_width); | |
380 int dy1 = screen_y + (y * screen_h / src_height); | |
381 int dx2 = screen_x + ((x+w) * screen_w / src_width); | |
382 int dy2 = screen_y + ((y+h) * screen_h / src_height); | |
383 | |
9697 | 384 sws_scale_ordered(sws,src,stride,y,h,image,image_stride); |
1511 | 385 |
5870 | 386 /* Now 'ASCIInate' the image */ |
387 if (fast) | |
388 aa_fastrender(c, dx1, dy1, dx2, dy2 ); | |
389 else | |
390 aa_render(c, p,dx1, dy1, dx2, dy2 ); | |
4674 | 391 |
5870 | 392 |
393 return 0; | |
1511 | 394 } |
395 | |
396 static void | |
397 flip_page(void) { | |
5870 | 398 |
399 /* do we have to put *our* (messages, progbar) osd to aa's txtbuf ? */ | |
400 if (showosdmessage) | |
401 { | |
402 if (time(NULL)>=stoposd ) { | |
403 showosdmessage=0; | |
404 if(osdmessagetext) { | |
405 memset(c->textbuffer + osdy * aa_scrwidth(c) + osdx,' ',strlen(osdmessagetext)); | |
406 memset(c->attrbuffer + osdy * aa_scrwidth(c) + osdx ,0,strlen(osdmessagetext)); | |
407 osdmessagetext[0] = '\0'; | |
408 } | |
409 if(posbar) { | |
410 memset(c->textbuffer + (osdy+1) * aa_scrwidth(c),' ',strlen(posbar)); | |
411 memset(c->attrbuffer + (osdy+1) * aa_scrwidth(c),0,strlen(posbar)); | |
412 } | |
413 } else { | |
414 /* update osd */ | |
415 aa_puts(c, osdx, osdy, AA_SPECIAL, osdmessagetext); | |
416 /* posbar? */ | |
417 if (posbar[0]!='\0') | |
418 aa_puts(c, 0, osdy + 1, AA_SPECIAL, posbar); | |
419 } | |
420 } | |
421 /* OSD time & playmode , subtitles */ | |
422 #ifdef USE_OSD | |
423 printosdtext(); | |
424 #endif | |
425 | |
426 | |
427 /* print out */ | |
428 aa_flush(c); | |
1511 | 429 } |
430 | |
431 static void | |
432 check_events(void) { | |
433 /* | |
434 * any events? | |
435 * called by show_image and mplayer | |
436 */ | |
437 int key; | |
438 while ((key=aa_getevent(c,0))!=AA_NONE ){ | |
439 if (key>255){ | |
440 /* some conversations */ | |
441 switch (key) { | |
442 case AA_UP: | |
443 mplayer_put_key(KEY_UP); | |
444 break; | |
445 case AA_DOWN: | |
446 mplayer_put_key(KEY_DOWN); | |
447 break; | |
448 case AA_LEFT: | |
449 mplayer_put_key(KEY_LEFT); | |
450 break; | |
451 case AA_RIGHT: | |
452 mplayer_put_key(KEY_RIGHT); | |
453 break; | |
454 case AA_ESC: | |
455 mplayer_put_key(KEY_ESC); | |
456 break; | |
457 case 65765: | |
458 mplayer_put_key(KEY_PAGE_UP); | |
459 break; | |
460 case 65766: | |
461 mplayer_put_key(KEY_PAGE_DOWN); | |
462 break; | |
463 default: | |
464 continue; /* aa lib special key */ | |
465 break; | |
466 } | |
467 } | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
468 if (key=='a' || key=='A'){ |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
469 aaconfigmode=!aaconfigmode; |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
470 osdmessage(MESSAGE_DURATION, 1, "aa config mode is now %s", |
5870 | 471 aaconfigmode==1 ? "on. use keys 5-7" : "off"); |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
472 } |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
473 if (aaconfigmode==1) { |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
474 switch (key) { |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
475 /* AA image controls */ |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
476 case '5': |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
477 fast=!fast; |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
478 osdmessage(MESSAGE_DURATION, 1, "Fast mode is now %s", fast==1 ? "on" : "off"); |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
479 break; |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
480 case '6': |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
481 if (p->dither==AA_FLOYD_S){ |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
482 p->dither=AA_NONE; |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
483 osdmessage(MESSAGE_DURATION, 1, "Dithering: Off"); |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
484 }else if (p->dither==AA_NONE){ |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
485 p->dither=AA_ERRORDISTRIB; |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
486 osdmessage(MESSAGE_DURATION, 1, "Dithering: Error Distribution"); |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
487 }else if (p->dither==AA_ERRORDISTRIB){ |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
488 p->dither=AA_FLOYD_S; |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
489 osdmessage(MESSAGE_DURATION, 1, "Dithering: Floyd Steinberg"); |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
490 } |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
491 break; |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
492 case '7': |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
493 p->inversion=!p->inversion; |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
494 osdmessage(MESSAGE_DURATION, 1, "Invert mode is now %s", |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
495 p->inversion==1 ? "on" : "off"); |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
496 break; |
1511 | 497 |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
498 default : |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
499 /* nothing if we're interested in? |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
500 * the mplayer should handle it! |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
501 */ |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
502 mplayer_put_key(key); |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
503 break; |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
504 } |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
505 }// aaconfigmode |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
506 else mplayer_put_key(key); |
1511 | 507 } |
508 } | |
509 | |
510 static void | |
511 uninit(void) { | |
512 /* | |
513 * THE END | |
5870 | 514 */ |
515 | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
516 if (strstr(c->driver->name,"Curses") || strstr(c->driver->name,"Linux")){ |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
517 freopen("/dev/tty", "w", stderr); |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
518 } |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
519 #ifdef USE_OSD |
5870 | 520 if(vo_font_save) { |
521 free(vo_font->pic_a[0]->bmp); | |
522 free(vo_font->pic_a[0]); | |
523 free(vo_font->pic_b[0]->bmp); | |
524 free(vo_font->pic_b[0]); | |
525 free(vo_font); | |
526 vo_font = vo_font_save; | |
527 vo_font_save = NULL; | |
528 } | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
529 #endif |
1511 | 530 aa_close(c); |
531 } | |
532 | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
533 #ifdef USE_OSD |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
534 static void draw_alpha(int x,int y, int w,int h, unsigned char* src, unsigned char *srca, int stride){ |
7140
b9ce54c7f30f
add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents:
7124
diff
changeset
|
535 int i,j; |
b9ce54c7f30f
add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents:
7124
diff
changeset
|
536 for (i = 0; i < h; i++) { |
b9ce54c7f30f
add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents:
7124
diff
changeset
|
537 for (j = 0; j < w; j++) { |
b9ce54c7f30f
add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents:
7124
diff
changeset
|
538 if (src[i*stride+j] > 0) { |
b9ce54c7f30f
add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents:
7124
diff
changeset
|
539 c->textbuffer[x + j + (y+i)*aa_scrwidth(c)] = src[i*stride+j]; |
b9ce54c7f30f
add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents:
7124
diff
changeset
|
540 c->attrbuffer[x + j + (y+i)*aa_scrwidth(c)] = aaopt_subcolor; |
b9ce54c7f30f
add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents:
7124
diff
changeset
|
541 } |
b9ce54c7f30f
add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents:
7124
diff
changeset
|
542 } |
b9ce54c7f30f
add Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz> freetype patch
pontscho
parents:
7124
diff
changeset
|
543 } |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
544 } |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
545 |
5870 | 546 static void clear_alpha(int x0,int y0, int w,int h) { |
547 int l; | |
548 | |
549 for(l = 0 ; l < h ; l++) { | |
550 memset(c->textbuffer + (y0 + l) * aa_scrwidth(c) + x0,' ',w); | |
551 memset(c->attrbuffer + (y0 + l) * aa_scrwidth(c) + x0,0,w); | |
552 } | |
553 } | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
554 |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
555 |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
556 #endif |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
557 |
1511 | 558 static void |
559 draw_osd(void){ | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
560 #ifdef USE_OSD |
1575 | 561 char * vo_osd_text_save; |
562 int vo_osd_progbar_type_save; | |
563 | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
564 printosdprogbar(); |
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
565 /* let vo_draw_text only write subtitle */ |
1575 | 566 vo_osd_text_save=vo_osd_text; /* we have to save the osd_text */ |
567 vo_osd_text=NULL; | |
568 vo_osd_progbar_type_save=vo_osd_progbar_type; | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
569 vo_osd_progbar_type=-1; |
5870 | 570 vo_remove_text(aa_scrwidth(c), aa_scrheight(c),clear_alpha); |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
571 vo_draw_text(aa_scrwidth(c), aa_scrheight(c), draw_alpha); |
1575 | 572 vo_osd_text=vo_osd_text_save; |
573 vo_osd_progbar_type=vo_osd_progbar_type_save; | |
1551
267816fbdab3
vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents:
1538
diff
changeset
|
574 #endif |
1511 | 575 } |
1537
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
576 |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
577 int |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
578 getcolor(char * s){ |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
579 int i; |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
580 char * rest; |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
581 if (s==NULL) return -1; |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
582 i=strtol(s, &rest, 10); |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
583 if ((rest==NULL || strlen(rest)==0) && i>=0 && i<=5) return i; |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
584 if (!strcasecmp(s, "normal")) return AA_NORMAL; |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
585 else if (!strcasecmp(s, "dim")) return AA_DIM; |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
586 else if (!strcasecmp(s, "bold")) return AA_BOLD; |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
587 else if (!strcasecmp(s, "boldfont")) return AA_BOLDFONT; |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
588 else if (!strcasecmp(s, "special")) return AA_SPECIAL; |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
589 else return -1; |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
590 } |
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
591 |
14935
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
592 static int parse_suboptions(const char *arg) { |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
593 char *pseudoargv[4], *osdcolor = NULL, *subcolor = NULL, **strings, |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
594 *helpmsg = NULL; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
595 int pseudoargc, displayhelp = 0, *booleans; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
596 opt_t extra_opts[] = { |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
597 {"osdcolor", OPT_ARG_MSTRZ, &osdcolor, NULL, 0}, |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
598 {"subcolor", OPT_ARG_MSTRZ, &subcolor, NULL, 0}, |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
599 {"help", OPT_ARG_BOOL, &displayhelp, NULL, 0} }; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
600 opt_t *subopts = NULL, *p; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
601 char *strings_list[] = {"-driver", "-kbddriver", "-mousedriver", "-font", |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
602 "-width", "-height", "-minwidth", "-minheight", "-maxwidth", |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
603 "-maxheight", "-recwidth", "-recheight", "-bright", "-contrast", |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
604 "-gamma", "-dimmul", "-boldmul", "-random" }; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
605 char *booleans_list[] = {"-dim", "-bold", "-reverse", "-normal", |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
606 "-boldfont", "-inverse", "-extended", "-eight", "-dither", |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
607 "-floyd_steinberg", "-error_distribution"}; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
608 char *nobooleans_list[] = {"-nodim", "-nobold", "-noreverse", "-nonormal", |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
609 "-noboldfont", "-noinverse", "-noextended", "-noeight", "-nodither", |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
610 "-nofloyd_steinberg", "-noerror_distribution"}; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
611 const int nstrings = sizeof(strings_list) / sizeof(char*); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
612 const int nbooleans = sizeof(booleans_list) / sizeof(int); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
613 const int nextra_opts = sizeof(extra_opts) / sizeof(opt_t); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
614 const int nsubopts = nstrings + nbooleans + nextra_opts; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
615 int i, retval = 0; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
616 |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
617 subopts = calloc(nsubopts + 1, sizeof(opt_t)); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
618 strings = calloc(nstrings, sizeof(char*)); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
619 booleans = calloc(nbooleans, sizeof(int)); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
620 |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
621 p = subopts; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
622 for (i=0; i<nstrings; i++, p++) { |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
623 p->name = strings_list[i] + 1; // skip '-' |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
624 p->type = OPT_ARG_MSTRZ; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
625 p->valp = &strings[i]; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
626 } |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
627 for (i=0; i<nbooleans; i++, p++) { |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
628 p->name = booleans_list[i] + 1; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
629 p->type = OPT_ARG_BOOL; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
630 p->valp = &booleans[i]; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
631 } |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
632 memcpy(p, extra_opts, sizeof(extra_opts)); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
633 |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
634 retval = subopt_parse(arg, subopts); |
1537
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
635 |
14935
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
636 if (retval == 0 && displayhelp) { |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
637 helpmsg = strdup(aa_help); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
638 for (i=0; i<(signed)strlen(helpmsg); i++) |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
639 if (helpmsg[i] == '-') helpmsg[i] = ' '; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
640 mp_msg(MSGT_VO, MSGL_INFO, MSGTR_VO_AA_HelpHeader); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
641 mp_msg(MSGT_VO, MSGL_INFO, "%s\n\n", helpmsg); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
642 mp_msg(MSGT_VO, MSGL_INFO, MSGTR_VO_AA_AdditionalOptions); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
643 retval = -1; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
644 } |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
645 if (retval == 0) { |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
646 pseudoargv[3] = NULL; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
647 for (i=0; i<nstrings; i++) { |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
648 pseudoargc = 3; // inside loop because aalib changes it |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
649 if (strings[i] != NULL) { |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
650 pseudoargv[1] = strings_list[i]; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
651 pseudoargv[2] = strings[i]; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
652 aa_parseoptions(&aa_defparams, &aa_defrenderparams, |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
653 &pseudoargc, pseudoargv) != 1; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
654 } |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
655 } |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
656 pseudoargv[2] = NULL; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
657 for (i=0; i<nbooleans; i++) { |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
658 pseudoargc = 2; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
659 if (booleans[i]) pseudoargv[1] = booleans_list[i]; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
660 else pseudoargv[1] = nobooleans_list[i]; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
661 aa_parseoptions(&aa_defparams, &aa_defrenderparams, |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
662 &pseudoargc, pseudoargv) != 1; |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
663 } |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
664 if (osdcolor) aaopt_osdcolor = getcolor(osdcolor); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
665 if (subcolor) aaopt_subcolor = getcolor(subcolor); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
666 } |
1537
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
667 |
14935
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
668 if (subopts) free(subopts); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
669 if (booleans) free(booleans); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
670 if (strings) { |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
671 for (i=0; i<nstrings; i++) |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
672 if (strings[i]) |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
673 free(strings[i]); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
674 free(strings); |
1537
7bdf6a585b67
All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents:
1527
diff
changeset
|
675 } |
14935
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
676 if (osdcolor) free(osdcolor); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
677 if (subcolor) free(subcolor); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
678 if (helpmsg) free(helpmsg); |
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
679 return retval; |
4258 | 680 } |
681 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
682 static int preinit(const char *arg) |
4352 | 683 { |
5870 | 684 char * hidis = NULL; |
685 struct stat sbuf; | |
686 int fd, vt, major, minor; | |
687 FILE * fp; | |
688 char fname[12]; | |
689 extern aa_linkedlist *aa_displayrecommended; | |
690 | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4674
diff
changeset
|
691 if(arg) |
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4674
diff
changeset
|
692 { |
14935
b3274e6b88ef
Convert vo_aa suboption parser to using the subopt-helper.
ivo
parents:
13787
diff
changeset
|
693 if (parse_suboptions(arg) != 0) |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4674
diff
changeset
|
694 return ENOSYS; |
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4674
diff
changeset
|
695 } |
5870 | 696 |
697 /* initializing of aalib */ | |
698 | |
699 hidis=aa_getfirst(&aa_displayrecommended); | |
700 if ( hidis==NULL ){ | |
701 /* check /dev/vcsa<vt> */ | |
702 /* check only, if no driver is explicit set */ | |
703 fd = dup (fileno (stderr)); | |
704 fstat (fd, &sbuf); | |
705 major = sbuf.st_rdev >> 8; | |
706 vt = minor = sbuf.st_rdev & 0xff; | |
707 close (fd); | |
708 sprintf (fname, "/dev/vcsa%2.2i", vt); | |
709 fp = fopen (fname, "w+"); | |
710 if (fp==NULL){ | |
711 fprintf(stderr,"VO: [aa] cannot open %s for writing," | |
712 "so we'll not use linux driver\n", fname); | |
713 aa_recommendlowdisplay("linux"); | |
714 aa_recommendhidisplay("curses"); | |
715 aa_recommendhidisplay("X11"); | |
716 }else fclose(fp); | |
717 } else aa_recommendhidisplay(hidis); | |
718 c = aa_autoinit(&aa_defparams); | |
719 | |
720 if (c == NULL) { | |
7625 | 721 mp_msg(MSGT_VO,MSGL_ERR,"Cannot initialize aalib\n"); |
5870 | 722 return VO_ERROR; |
723 } | |
724 if (!aa_autoinitkbd(c,0)) { | |
7625 | 725 mp_msg(MSGT_VO,MSGL_ERR,"Cannot initialize keyboard\n"); |
5870 | 726 aa_close(c); |
727 return VO_ERROR; | |
728 } | |
729 | |
730 aa_resizehandler(c, (void *)resize); | |
731 aa_hidecursor(c); | |
732 p = aa_getrenderparams(); | |
733 | |
734 if ((strstr(c->driver->name,"Curses")) || (strstr(c->driver->name,"Linux"))){ | |
735 freopen("/dev/null", "w", stderr); | |
736 /* disable console blanking */ | |
737 printf("\033[9;0]"); | |
738 } | |
739 | |
740 memset(image,0,3*sizeof(uint8_t)); | |
741 osdmessagetext[0] = '\0'; | |
742 osdx = osdy = 0; | |
743 | |
4737
32e1f5042f65
I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents:
4674
diff
changeset
|
744 return 0; |
4352 | 745 } |
746 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
747 static int control(uint32_t request, void *data, ...) |
4352 | 748 { |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
749 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
750 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
751 return query_format(*((uint32_t*)data)); |
6809
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
752 case VOCTRL_SET_EQUALIZER: { |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
753 va_list ap; |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
754 int val; |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
755 |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
756 va_start(ap, data); |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
757 val = va_arg(ap, int); |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
758 va_end(ap); |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
759 |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
760 if(strcmp((char*)data,"contrast") == 0) |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
761 p->contrast = ( val + 100 ) * 64 / 100; |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
762 else if(strcmp((char*)data,"brightness") == 0) |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
763 p->bright = ( val + 100) * 128 / 100; |
5870 | 764 return VO_TRUE; |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
765 } |
6809
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
766 case VOCTRL_GET_EQUALIZER: { |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
767 va_list ap; |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
768 int* val; |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
769 |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
770 va_start(ap, data); |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
771 val = va_arg(ap, int*); |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
772 va_end(ap); |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
773 |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
774 if(strcmp((char*)data,"contrast") == 0) |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
775 *val = (p->contrast - 64) * 100 / 64; |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
776 else if(strcmp((char*)data,"brightness") == 0) |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
777 *val = (p->bright - 128) * 100 / 128; |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
778 |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
779 return VO_TRUE; |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
780 } |
0250f691037e
10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents:
6757
diff
changeset
|
781 } |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
782 return VO_NOTIMPL; |
4352 | 783 } |