annotate libvo/vo_aa.c @ 4688:68582b4ce881

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