annotate libvo/vo_aa.c @ 3499:93351eec9f1f

Add subtitle loader for gui
author pontscho
date Sat, 15 Dec 2001 15:36:07 +0000
parents ae79207a3055
children f2abd12e9231
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1538
f3f4fc77fd88 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new. fixed wrong char
folke
parents: 1537
diff changeset
1 /*
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
2 * MPlayer
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
3 *
1553
12551899e83f vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking +header change
folke
parents: 1551
diff changeset
4 * Video driver for AAlib - 1.0
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
5 *
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
6 * by Folke Ashberg <folke@ashberg.de>
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
7 *
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
8 * Code started: Sun Aug 12 2001
1553
12551899e83f vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking +header change
folke
parents: 1551
diff changeset
9 * Version 1.0 : Thu Aug 16 2001
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
10 *
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
11 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
12
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
13 #include <stdio.h>
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
14 #include <stdlib.h>
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
15
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
16 #include <sys/stat.h>
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
17 #include <unistd.h>
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
18
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
19 #include <limits.h>
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
20 #include <math.h>
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
21 #include <stdarg.h>
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
22 #include <time.h>
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
23 #include <string.h>
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
24
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
25 #include "config.h"
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
26 #include "video_out.h"
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
27 #include "video_out_internal.h"
2732
ae79207a3055 Move yuv2rgb to postprocess
nick
parents: 2498
diff changeset
28 #include "../postproc/rgb2rgb.h"
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
29 #include "sub.h"
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
30
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
31 #include "linux/keycodes.h"
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
32 #include <aalib.h>
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
33 #include "cfgparser.h"
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
34
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
35 #define RGB 0
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
36 #define BGR 1
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
37
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
38 #define DO_INC(val,max,step) if (val + step <=max) val+=step; else val=max;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
39 #define DO_DEC(val,min,step) if (val - step >=min) val-=step; else val=min;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
40
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
41 #define MESSAGE_DURATION 3
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
42 #define MESSAGE_SIZE 512
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
43 #define MESSAGE_DEKO " +++ %s +++ "
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
44
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
45 LIBVO_EXTERN(aa)
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
46
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
47 static vo_info_t vo_info = {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
48 "AAlib",
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
49 "aa",
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
50 "Folke Ashberg <folke@ashberg.de>",
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
51 ""
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
52 };
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
53
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
54 /* aa's main context we use */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
55 aa_context *c;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
56 aa_renderparams *p;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
57 static int fast =0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
58 /* used for YV12 streams for the converted RGB image */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
59 uint8_t * convertbuf=NULL;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
60
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
61 /* image infos */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
62 static int image_format, bpp=24;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
63 static int image_width;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
64 static int image_height;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
65 static int bppmul;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
66
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
67 /* osd stuff */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
68 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
69 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
70 char osdmessagetext[MESSAGE_SIZE];
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
71 char posbar[MESSAGE_SIZE];
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
72 static int osdx, osdy;
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
73 int aaconfigmode=1;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
74 /* for resizing/scaling */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
75 static int *stx;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
76 static int *sty;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
77 double accum;
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
78 #ifdef USE_OSD
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
79 char * osdbuffer=NULL;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
80 #endif
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
81
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
82 /* our version of the playmodes :) */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
83
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
84 extern void mplayer_put_key(int code);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
85
1518
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
86 /* to disable stdout outputs when curses/linux mode */
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
87 extern int quiet;
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
88
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
89 /* configuration */
1518
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
90 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
91 int aaopt_subcolor = AA_SPECIAL;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
92
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
93 extern struct aa_hardware_params aa_defparams;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
94 extern struct aa_renderparams aa_defrenderparams;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
95
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
96 void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
97 resize(void){
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
98 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
99 * this function is called by aa lib if windows resizes
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
100 * further during init, because here we have to calculate
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
101 * a little bit
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
102 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
103
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
104 int i;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
105 aa_resize(c);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
106
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
107 showosdmessage=0;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
108 osdy=aa_scrheight(c) - ( aa_scrheight(c)/10 );
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
109
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
110 /* now calculating the needed values for resizing */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
111
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
112 /* We only need to use floating point to determine the correct
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
113 stretch vector for one line's worth. */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
114 stx = (int *) malloc(sizeof(int) * image_width);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
115 sty = (int *) malloc(sizeof(int) * image_height);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
116 accum = 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
117 for (i=0; (i < image_width); i++) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
118 int got;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
119 accum += (double)aa_imgwidth(c)/(double)image_width;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
120 got = (int) floor(accum);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
121 stx[i] = got;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
122 accum -= got;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
123 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
124 accum = 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
125 for (i=0; (i < image_height); i++) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
126 int got;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
127 accum += (double)aa_imgheight(c)/(double)image_height;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
128 got = (int) floor(accum);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
129 sty[i] = got;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
130 accum -= got;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
131 }
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
132 #ifdef USE_OSD
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
133 if (osdbuffer!=NULL) free(osdbuffer);
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
134 osdbuffer=malloc(aa_scrwidth(c) * aa_scrheight(c));
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
135 #endif
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
136 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
137
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
138 void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
139 osdmessage(int duration, int deko, char *fmt, ...)
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
140 {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
141 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
142 * for outputting a centered string at the bottom
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
143 * of our window for a while
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
144 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
145 va_list ar;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
146 char m[MESSAGE_SIZE];
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
147 va_start(ar, fmt);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
148 vsprintf(m, fmt, ar);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
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);
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
152 showosdmessage=1;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
153 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
154 osdx=(aa_scrwidth(c) / 2) - (strlen(osdmessagetext) / 2 ) ;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
155 posbar[0]='\0';
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
156 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
157
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
158 void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
159 osdpercent(int duration, int deko, int min, int max, int val, char * desc, char * unit)
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
160 {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
161 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
162 * prints a bar for setting values
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
163 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
164 float step;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
165 int where;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
166 char m[MESSAGE_SIZE];
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
167 int i;
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
168
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
169
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
170 step=(float)aa_scrwidth(c) /(float)(max-min);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
171 where=(val-min)*step;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
172 sprintf(m,"%s: %i%s",desc, val, unit);
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
173 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
174 else strcpy(osdmessagetext, m);
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
175 posbar[0]='|';
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
176 posbar[aa_scrwidth(c)-1]='|';
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
177 for (i=0;i<aa_scrwidth(c);i++){
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
178 if (i==where) posbar[i]='#';
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
179 else posbar[i]='-';
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
180 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
181 if (where!=0) posbar[0]='|';
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
182 if (where!=(aa_scrwidth(c)-1) ) posbar[aa_scrwidth(c)-1]='|';
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
183 /* snipp */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
184 posbar[aa_scrwidth(c)]='\0';
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
185 showosdmessage=1;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
186 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
187 osdx=(aa_scrwidth(c) / 2) - (strlen(osdmessagetext) / 2 ) ;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
188 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
189
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
190 void
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
191 printosdtext()
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
192 {
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
193 /*
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
194 * 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
195 */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
196 if (vo_osd_text)
2498
38bb41c48d1f never declare variables in *.h files, pls
nick
parents: 1577
diff changeset
197 aa_printf(c, 0, 0 , aaopt_osdcolor, "%s %s ", __sub_osd_names_short[vo_osd_text[0]], vo_osd_text+1);
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
198 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
199
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
200 void
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
201 printosdprogbar(){
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
202 /* 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
203 if (vo_osd_progbar_type!=-1){
2498
38bb41c48d1f never declare variables in *.h files, pls
nick
parents: 1577
diff changeset
204 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
205 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
206 }
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
207 static uint32_t
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
208 init(uint32_t width, uint32_t height, uint32_t d_width,
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
209 uint32_t d_height, uint32_t fullscreen, char *title,
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
210 uint32_t format) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
211 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
212 * main init
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
213 * called by mplayer
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
214 */
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
215 FILE * fp;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
216 char fname[12];
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
217 int fd, vt, major, minor;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
218 struct stat sbuf;
1576
2dff06ebfbb4 now linux/curses detection works
folke
parents: 1575
diff changeset
219 char * hidis = NULL;
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
220 int i;
1577
440782e33c81 aalib 1.4.X incombatibility fixed
folke
parents: 1576
diff changeset
221 extern aa_linkedlist *aa_displayrecommended;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
222
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
223 switch(format) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
224 case IMGFMT_BGR24:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
225 bpp = 24;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
226 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
227 case IMGFMT_RGB24:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
228 bpp = 24;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
229 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
230 case IMGFMT_YV12:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
231 bpp = 24;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
232 /* YUV ? then initialize what we will need */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
233 convertbuf=malloc(width*height*3);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
234 yuv2rgb_init(24,MODE_BGR);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
235 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
236 default:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
237 return 1;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
238 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
239 bppmul=bpp/8;
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
240
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
241
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
242 /* initializing of aalib */
1518
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
243
1577
440782e33c81 aalib 1.4.X incombatibility fixed
folke
parents: 1576
diff changeset
244 hidis=aa_getfirst(&aa_displayrecommended);
1575
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
245 if ( hidis==NULL ){
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
246 /* check /dev/vcsa<vt> */
1575
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
247 /* check only, if no driver is explicit set */
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
248 fd = dup (fileno (stderr));
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
249 fstat (fd, &sbuf);
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
250 major = sbuf.st_rdev >> 8;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
251 vt = minor = sbuf.st_rdev & 0xff;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
252 close (fd);
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
253 sprintf (fname, "/dev/vcsa%i", vt);
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
254 fp = fopen (fname, "w+");
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
255 if (fp==NULL){
1576
2dff06ebfbb4 now linux/curses detection works
folke
parents: 1575
diff changeset
256 fprintf(stderr,"VO: [aa] cannot open %s for writing,"
2dff06ebfbb4 now linux/curses detection works
folke
parents: 1575
diff changeset
257 "so we'll not use linux driver\n", fname);
1575
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
258 aa_recommendlowdisplay("linux");
1576
2dff06ebfbb4 now linux/curses detection works
folke
parents: 1575
diff changeset
259 aa_recommendhidisplay("curses");
2dff06ebfbb4 now linux/curses detection works
folke
parents: 1575
diff changeset
260 aa_recommendhidisplay("X11");
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
261 }else fclose(fp);
1577
440782e33c81 aalib 1.4.X incombatibility fixed
folke
parents: 1576
diff changeset
262 } else aa_recommendhidisplay(hidis);
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
263 c = aa_autoinit(&aa_defparams);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
264 aa_resizehandler(c, (void *)resize);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
265
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
266 if (c == NULL) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
267 printf("Can not intialize aalib\n");
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
268 return 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
269 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
270 if (!aa_autoinitkbd(c,0)) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
271 printf("Can not intialize keyboard\n");
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
272 aa_close(c);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
273 return 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
274 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
275 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
276 if (!aa_autoinitmouse(c,0)) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
277 printf("Can not intialize mouse\n");
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
278 aa_close(c);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
279 return 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
280 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
281 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
282 aa_hidecursor(c);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
283 p = aa_getrenderparams();
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
284
1520
c156984e545e write fault error fixed
folke
parents: 1518
diff changeset
285 if ((strstr(c->driver->name,"Curses")) || (strstr(c->driver->name,"Linux"))){
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
286 freopen("/dev/null", "w", stderr);
1518
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
287 quiet=1; /* disable mplayer outputs */
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
288 /* disable console blanking */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
289 printf("\033[9;0]");
1518
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
290 }
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
291
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
292 image_height = height;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
293 image_width = width;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
294 image_format = format;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
295
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
296 /* needed by prepare_image */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
297 stx = (int *) malloc(sizeof(int) * image_width);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
298 sty = (int *) malloc(sizeof(int) * image_height);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
299
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
300 /* nothing will change its size, be we need some values initialized */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
301 resize();
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
302
1554
db379aa38e51 define USE_OSD / USE_SUB fixes
folke
parents: 1553
diff changeset
303 #ifdef USE_OSD
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
304 /* now init out own 'font' (to use vo_draw_text_sub without edit them) */
1572
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
305 vo_font=malloc(sizeof(font_desc_t));//if(!desc) return NULL;
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
306 memset(vo_font,0,sizeof(font_desc_t));
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
307 vo_font->pic_a[0]=malloc(sizeof(raw_file));
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
308 vo_font->pic_b[0]=malloc(sizeof(raw_file));
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
309
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
310 vo_font->spacewidth=1;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
311 vo_font->charspace=0;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
312 vo_font->height=1;
1572
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
313 vo_font->pic_a[0]->bmp=malloc(255);
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
314 vo_font->pic_b[0]->bmp=malloc(255);
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
315 vo_font->pic_a[0]->w=1;
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
316 vo_font->pic_a[0]->h=1;
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
317 for (i=1; i<256; i++){
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
318 vo_font->width[i]=1;
1572
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
319 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
320 vo_font->start[i]=i;
1572
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
321 vo_font->pic_a[0]->bmp[i]=i;
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
322 vo_font->pic_b[0]->bmp[i]=i;
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
323 };
1554
db379aa38e51 define USE_OSD / USE_SUB fixes
folke
parents: 1553
diff changeset
324 #endif
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
325 /* say hello */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
326 osdmessage(5, 1, "Welcome to ASCII ARTS MPlayer");
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
327
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
328 printf("VO: [aa] screendriver: %s\n", c->driver->name);
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
329 printf("VO: [aa] keyboarddriver: %s\n", c->kbddriver->name);
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
330 //printf("VO: mousedriver: %s\n", c->mousedriver->name);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
331
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
332 printf(
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
333 "\n"
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
334 "Important Options\n"
1518
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
335 "\t-aaextended use use all 256 characters\n"
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
336 "\t-aaeight use eight bit ascii\n"
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
337 "\t-aadriver set recommended aalib driver (X11,curses,linux)\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
338 "\t-aahelp to see all options provided by aalib\n"
1518
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
339 "\n"
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
340 "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
341 "\t1 : contrast -\n"
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
342 "\t2 : contrast +\n"
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
343 "\t3 : brightness -\n"
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
344 "\t4 : brightness +\n"
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
345 "\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
346 "\t6 : dithering\n"
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
347 "\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
348 "\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
349
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
350 "\n"
1527
187aa4b576a7 Fix OSD, small misspelling.
atmos4
parents: 1520
diff changeset
351 "All other keys are MPlayer defaults.\n"
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
352
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
353
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
354 );
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
355
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
356 return 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
357 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
358
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
359 static uint32_t
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
360 query_format(uint32_t format) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
361 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
362 * ...are we able to... ?
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
363 * called by mplayer
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
364 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
365 switch(format){
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
366 case IMGFMT_YV12:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
367 case IMGFMT_RGB|24:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
368 case IMGFMT_BGR|24:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
369 return 1;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
370 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
371 return 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
372 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
373
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
374 static const vo_info_t*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
375 get_info(void) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
376 /* who i am? */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
377 return (&vo_info);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
378 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
379
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
380 int
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
381 prepare_image(uint8_t *data, int inx, int iny, int outx, int outy){
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
382 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
383 * copies an RGB-Image to the aalib imagebuffer
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
384 * also scaling an grayscaling is done here
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
385 * show_image calls us
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
386 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
387
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
388 int value;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
389 int x, y;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
390 int tox, toy;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
391 int ydest;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
392 int i;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
393 int pos;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
394
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
395 toy = 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
396 for (y=0; (y < (0 + iny)); y++) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
397 for (ydest=0; (ydest < sty[y-0]); ydest++) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
398 tox = 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
399 for (x=0; (x < (0 + inx)); x++) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
400 if (!stx[x - 0]) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
401 continue;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
402 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
403 pos=3*(inx*y)+(3*x);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
404 value=(data[pos]+data[pos+1]+data[pos+2])/3;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
405 for (i=0; (i < stx[x - 0]); i++) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
406 //printf("ToX: %i, ToY %i, i=%i, stx=%i, x=%i\n", tox, toy, i, stx[x], x);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
407 c->imagebuffer[(toy*outx) +tox]=value;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
408 tox++;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
409 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
410 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
411 toy++;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
412 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
413 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
414 return 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
415 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
416
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
417 void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
418 show_image(uint8_t * src){
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
419 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
420 * every frame (flip_page/draw_frame) we will be called
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
421 */
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
422 #ifdef USE_OSD
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
423 int i;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
424 #endif
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
425
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
426 /* events? */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
427 check_events();
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
428
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
429 /* RGB->gray , scaling/resizing, stores data in aalib imgbuf */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
430 prepare_image( src, image_width, image_height,
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
431 aa_imgwidth(c), aa_imgheight(c) );
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
432
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
433 /* Now 'ASCIInate' the image */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
434 if (fast)
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
435 aa_fastrender(c, 0, 0, aa_scrwidth(c), aa_scrheight(c) );
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
436 else
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
437 aa_render(c, p, 0, 0, aa_scrwidth(c), aa_scrheight(c));
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
438
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
439 /* do we have to put *our* (messages, progbar) osd to aa's txtbuf ? */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
440 if (showosdmessage)
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
441 {
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
442 if (time(NULL)>=stoposd ) showosdmessage=0;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
443 /* update osd */
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
444 aa_puts(c, osdx, osdy, AA_SPECIAL, osdmessagetext);
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
445 /* posbar? */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
446 if (posbar[0]!='\0')
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
447 aa_puts(c, 0, osdy + 1, AA_SPECIAL, posbar);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
448 }
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
449 /* OSD time & playmode , subtitles */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
450 #ifdef USE_OSD
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
451 printosdtext();
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
452 /* now write the subtitle osd buffer */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
453 for (i=0;i<aa_scrwidth(c)*aa_scrheight(c);i++){
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
454 if (osdbuffer[i]){
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
455 c->textbuffer[i]=osdbuffer[i];
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
456 c->attrbuffer[i]=aaopt_subcolor;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
457 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
458 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
459 #endif
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
460
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
461 /* print out */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
462 aa_flush(c);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
463 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
464
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
465 static uint32_t
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
466 draw_frame(uint8_t *src[]) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
467 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
468 * RGB-Video's Only
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
469 * src[0] is handled by prepare_image
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
470 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
471 show_image(src[0]);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
472 return 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
473 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
474
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
475 static uint32_t
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
476 draw_slice(uint8_t *src[], int stride[],
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
477 int w, int h, int x, int y) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
478 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
479 * for MPGEGS YV12
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
480 * draw a rectangle converted to RGB to a
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
481 * temporary RGB Buffer
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
482 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
483 uint8_t *dst;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
484
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
485 dst = convertbuf+(image_width * y + x) * 3;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
486 yuv2rgb(dst,src[0],src[1],src[2],w,h,image_width*3,stride[0],stride[1]);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
487
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
488 return 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
489 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
490
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
491 static void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
492 flip_page(void) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
493 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
494 * wow! another ready Image, so draw it !
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
495 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
496 if(image_format == IMGFMT_YV12)
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
497 show_image(convertbuf);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
498 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
499
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
500 static void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
501 check_events(void) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
502 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
503 * any events?
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
504 * called by show_image and mplayer
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
505 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
506 int key;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
507 while ((key=aa_getevent(c,0))!=AA_NONE ){
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
508 if (key>255){
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
509 /* some conversations */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
510 switch (key) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
511 case AA_UP:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
512 mplayer_put_key(KEY_UP);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
513 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
514 case AA_DOWN:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
515 mplayer_put_key(KEY_DOWN);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
516 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
517 case AA_LEFT:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
518 mplayer_put_key(KEY_LEFT);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
519 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
520 case AA_RIGHT:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
521 mplayer_put_key(KEY_RIGHT);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
522 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
523 case AA_ESC:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
524 mplayer_put_key(KEY_ESC);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
525 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
526 case 65765:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
527 mplayer_put_key(KEY_PAGE_UP);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
528 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
529 case 65766:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
530 mplayer_put_key(KEY_PAGE_DOWN);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
531 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
532 default:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
533 continue; /* aa lib special key */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
534 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
535 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
536 }
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
537 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
538 aaconfigmode=!aaconfigmode;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
539 osdmessage(MESSAGE_DURATION, 1, "aa config 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
540 aaconfigmode==1 ? "on. use keys 1-7" : "off");
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 if (aaconfigmode==1) {
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
543 switch (key) {
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
544 /* AA image controls */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
545 case '1': /* contrast */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
546 DO_DEC(p->contrast,0,1);
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
547 osdpercent(MESSAGE_DURATION, 1, 0, 255, p->contrast, "AA-Contrast", "");
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
548 break;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
549 case '2': /* contrast */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
550 DO_INC(p->contrast,255,1);
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
551 osdpercent(MESSAGE_DURATION, 1, 0, 255, p->contrast, "AA-Contrast", "");
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
552 break;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
553 case '3': /* brightness */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
554 DO_DEC(p->bright,0,1);
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
555 osdpercent(MESSAGE_DURATION, 1, 0, 255, p->bright, "AA-Brightnes", "");
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
556 break;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
557 case '4': /* brightness */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
558 DO_INC(p->bright,255,1);
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
559 osdpercent(MESSAGE_DURATION, 1, 0, 255, p->bright, "AA-Brightnes", "");
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
560 break;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
561 case '5':
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
562 fast=!fast;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
563 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
564 break;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
565 case '6':
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
566 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
567 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
568 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
569 }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
570 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
571 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
572 }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
573 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
574 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
575 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
576 break;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
577 case '7':
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
578 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
579 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
580 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
581 break;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
582
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
583 default :
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
584 /* 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
585 * 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
586 */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
587 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
588 break;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
589 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
590 }// aaconfigmode
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
591 else mplayer_put_key(key);
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
592 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
593 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
594
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
595 static void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
596 uninit(void) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
597 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
598 * THE END
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
599 */
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
600 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
601 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
602 quiet=0; /* enable mplayer outputs */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
603 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
604 #ifdef USE_OSD
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
605 if (osdbuffer!=NULL) free(osdbuffer);
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
606 #endif
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
607 aa_close(c);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
608 free(stx);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
609 free(sty);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
610 if (convertbuf!=NULL) free(convertbuf);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
611 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
612
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
613 #ifdef USE_OSD
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
614 static void draw_alpha(int x,int y, int w,int h, unsigned char* src, unsigned char *srca, int stride){
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
615 /* alpha, hm, grr, only the char into our osdbuffer */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
616 int pos;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
617 pos=(x)+(y)*(aa_scrwidth(c));
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
618 osdbuffer[pos]=src[0];
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
619 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
620
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
621
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
622
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
623 #endif
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
624
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
625 static void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
626 draw_osd(void){
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
627 #ifdef USE_OSD
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
628 /*
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
629 * the subtiles are written into a own osdbuffer
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
630 * because draw_osd is called after show_image/flip_page
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
631 * the osdbuffer is written the next show_image/flip_page
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
632 * into aatextbuf
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
633 */
1575
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
634 char * vo_osd_text_save;
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
635 int vo_osd_progbar_type_save;
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
636
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
637 memset(osdbuffer,0,aa_scrwidth(c)*aa_scrheight(c));
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
638 printosdprogbar();
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
639 /* let vo_draw_text only write subtitle */
1575
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
640 vo_osd_text_save=vo_osd_text; /* we have to save the osd_text */
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
641 vo_osd_text=NULL;
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
642 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
643 vo_osd_progbar_type=-1;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
644 vo_draw_text(aa_scrwidth(c), aa_scrheight(c), draw_alpha);
1575
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
645 vo_osd_text=vo_osd_text_save;
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
646 vo_osd_progbar_type=vo_osd_progbar_type_save;
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
647 #endif
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
648 }
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
649
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
650 int
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
651 getcolor(char * s){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
652 int i;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
653 char * rest;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
654 if (s==NULL) return -1;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
655 i=strtol(s, &rest, 10);
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
656 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
657 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
658 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
659 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
660 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
661 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
662 else return -1;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
663 }
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
664
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
665 int
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
666 vo_aa_parseoption(struct config * conf, char *opt, char *param){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
667 /* got an option starting with aa */
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
668 char *pseudoargv[3];
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
669 int pseudoargc;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
670 char * x, *help;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
671 int i;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
672 /* do WE need it ? */
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
673 if (!strcasecmp(opt, "aaosdcolor")){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
674 if (param==NULL) return ERR_MISSING_PARAM;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
675 if ((i=getcolor(param))==-1) return ERR_OUT_OF_RANGE;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
676 aaopt_osdcolor=i;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
677 return 1;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
678 }else if (!strcasecmp(opt, "aasubcolor")){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
679 if ((i=getcolor(param))==-1) return ERR_OUT_OF_RANGE;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
680 aaopt_subcolor=i;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
681 return 1;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
682 }else if (!strcasecmp(opt, "aahelp")){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
683 printf("Here are the aalib options:\n");
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
684 help=strdup(aa_help); /* aa_help is const :( */
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
685 x=strtok(help,"-");
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
686 printf(x);
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
687 while ((x=strtok(NULL, "-"))){
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
688 if (*(x-2)==' ') printf("-aa");
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
689 else printf("-");
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
690 printf("%s", x);
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
691 }
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
692 printf(
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
693 "\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
694 "\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
695 "Additional options vo_aa provides:\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
696 " -aaosdcolor set osd color\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
697 " -aasubcolor set subtitle color\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
698 " the color params are:\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
699 " 0 : normal\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
700 " 1 : dark\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
701 " 2 : bold\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
702 " 3 : boldfont\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
703 " 4 : reverse\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
704 " 6 : special\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
705 "\n\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
706 " dT8 8Tb\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
707 " dT 8 8 Tb\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
708 " dT 8 8 Tb\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
709 " <PROJECT><PROJECT>\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
710 " dT 8 8 Tb\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
711 " dT 8 8 Tb\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
712 "\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
713
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
714 );
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
715 exit(0);
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
716
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
717 }else{
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
718 /* parse param to aalib */
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
719 pseudoargv[1]=malloc(strlen(opt));
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
720 pseudoargv[3]=NULL;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
721 sprintf(pseudoargv[1], "-%s", opt+2);
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
722 if (param!=NULL){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
723 pseudoargv[2]=param;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
724 pseudoargc=3;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
725 }else{
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
726 pseudoargv[2]=NULL;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
727 pseudoargc=2;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
728 }
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
729 fprintf(stderr,"VO: [aa] ");
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
730 i=aa_parseoptions(&aa_defparams, &aa_defrenderparams, &pseudoargc, pseudoargv);
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
731 if (i!=1){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
732 return ERR_MISSING_PARAM;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
733 }
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
734 if (pseudoargv[1]!=NULL){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
735 /* aalib has given param back */
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
736 fprintf(stderr," Parameter -%s accepted\n", opt);
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
737 return 0; /* param could be the filename */
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
738 }
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
739 fprintf(stderr," Parameter -%s %s accepted\n", opt, ((param==NULL) ? "" : param) );
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
740 return 1; /* all opt & params accepted */
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
741
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
742 }
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
743 return ERR_NOT_AN_OPTION;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
744
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
745 }