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