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