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