annotate libvo/vo_aa.c @ 1551:267816fbdab3

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