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