annotate libvo/vo_aa.c @ 7137:9a44c38d388c

Fixed some breakages of single-buffer rendering of tdfx
author mark
date Thu, 29 Aug 2002 12:04:21 +0000
parents eca7dbad0166
children b9ce54c7f30f
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>
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4674
diff changeset
24 #include <errno.h>
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
25
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
26 #include "config.h"
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
27 #include "video_out.h"
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
28 #include "video_out_internal.h"
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
29 #include "aspect.h"
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
30 #include "../postproc/swscale.h"
5295
302fe25185c4 moved font_laod.h
arpi
parents: 5027
diff changeset
31 #include "font_load.h"
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
32 #include "sub.h"
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
33
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
34 #include "linux/keycodes.h"
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
35 #include <aalib.h>
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
36 #include "cfgparser.h"
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
37 #include "mp_msg.h"
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
38
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
39
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
40 #define MESSAGE_DURATION 3
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
41 #define MESSAGE_SIZE 512
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
42 #define MESSAGE_DEKO " +++ %s +++ "
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
43
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
44 LIBVO_EXTERN(aa)
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
45
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
46 static vo_info_t vo_info = {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
47 "AAlib",
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
48 "aa",
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
49 "Alban Bedel <albeu@free.fr> and Folke Ashberg <folke@ashberg.de>",
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
50 ""
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
51 };
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
52
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
53 /* aa's main context we use */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
54 aa_context *c;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
55 aa_renderparams *p;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
56 static int fast =0;
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
57 /* used for the sws */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
58 static uint8_t * image[3];
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
59 static int image_stride[3];
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
60
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
61 /* image infos */
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
62 static int image_format;
1511
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;
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
65 static int image_x, image_y;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
66 static int screen_x, screen_y;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
67 static int screen_w, screen_h;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
68 static int src_width;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
69 static int src_height;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
70
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
71 /* osd stuff */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
72 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
73 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
74 char osdmessagetext[MESSAGE_SIZE];
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
75 char posbar[MESSAGE_SIZE];
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
76 static int osdx, osdy;
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
77 static int osd_text_length = 0;
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
78 int aaconfigmode=1;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
79 #ifdef USE_OSD
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
80 font_desc_t* vo_font_save = NULL;
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
81 #endif
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
82 static SwsContext *sws=NULL;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
83 extern m_config_t *mconfig;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
84
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
85 /* our version of the playmodes :) */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
86
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
87 extern void mplayer_put_key(int code);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
88
1518
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
89 /* to disable stdout outputs when curses/linux mode */
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
90 extern int quiet;
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
91
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
92 /* configuration */
1518
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
93 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
94 int aaopt_subcolor = AA_SPECIAL;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
95
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
96 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
97 extern struct aa_renderparams aa_defrenderparams;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
98
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
99 void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
100 resize(void){
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
101 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
102 * this function is called by aa lib if windows resizes
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
103 * further during init, because here we have to calculate
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
104 * a little bit
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
105 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
106
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
107 aa_resize(c);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
108
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
109 aspect_save_screenres(aa_imgwidth(c),aa_imgheight(c));
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
110 image_height = aa_imgheight(c); //src_height;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
111 image_width = aa_imgwidth(c); //src_width;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
112
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
113 aspect(&image_width,&image_height,A_ZOOM);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
114
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
115 image_x = (aa_imgwidth(c) - image_width) / 2;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
116 image_y = (aa_imgheight(c) - image_height) / 2;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
117 screen_w = image_width * aa_scrwidth(c) / aa_imgwidth(c);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
118 screen_h = image_height * aa_scrheight(c) / aa_imgheight(c);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
119 screen_x = (aa_scrwidth(c) - screen_w) / 2;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
120 screen_y = (aa_scrheight(c) - screen_h) / 2;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
121
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
122 if(sws) freeSwsContext(sws);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
123 sws = getSwsContextFromCmdLine(src_width,src_height,image_format,
6522
ed8a717a423e Use the new Y8 support in place of YV12.
albeu
parents: 6210
diff changeset
124 image_width,image_height,IMGFMT_Y8);
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
125
6809
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
126 image[0] = aa_image(c) + image_y * aa_imgwidth(c) + image_x;
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
127 image[1] = NULL;
6522
ed8a717a423e Use the new Y8 support in place of YV12.
albeu
parents: 6210
diff changeset
128 image[2] = NULL;
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
129
6809
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
130 image_stride[0] = aa_imgwidth(c);
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
131 image_stride[1] = 0;
6522
ed8a717a423e Use the new Y8 support in place of YV12.
albeu
parents: 6210
diff changeset
132 image_stride[2] = 0;
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
133
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
134 showosdmessage=0;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
135
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
136 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
137
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];
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
147 unsigned int old_len = strlen(osdmessagetext);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
148
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
149 va_start(ar, fmt);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
150 vsprintf(m, fmt, ar);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
151 va_end(ar);
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
152 if (deko==1) sprintf(osdmessagetext, MESSAGE_DEKO , m);
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
153 else strcpy(osdmessagetext, m);
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
154
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
155 if(old_len > strlen(osdmessagetext)) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
156 memset(c->textbuffer + osdy * aa_scrwidth(c) + osdx,' ',old_len);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
157 memset(c->attrbuffer + osdy * aa_scrwidth(c) + osdx,0,old_len);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
158 }
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
159 showosdmessage=1;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
160 stoposd = time(NULL) + duration;
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
161 osdx=(aa_scrwidth(c) / 2) - (strlen(osdmessagetext) / 2 ) ;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
162 posbar[0]='\0';
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
163 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
164
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
165 void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
166 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
167 {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
168 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
169 * prints a bar for setting values
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
170 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
171 float step;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
172 int where;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
173 int i;
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
174
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
175
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
176 step=(float)aa_scrwidth(c) /(float)(max-min);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
177 where=(val-min)*step;
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
178 osdmessage(duration,deko,"%s: %i%s",desc, val, unit);
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
179 posbar[0]='|';
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
180 posbar[aa_scrwidth(c)-1]='|';
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
181 for (i=0;i<aa_scrwidth(c);i++){
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
182 if (i==where) posbar[i]='#';
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
183 else posbar[i]='-';
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
184 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
185 if (where!=0) posbar[0]='|';
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
186 if (where!=(aa_scrwidth(c)-1) ) posbar[aa_scrwidth(c)-1]='|';
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
187
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
188 posbar[aa_scrwidth(c)]='\0';
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
189
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
190 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
191
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
192 void
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
193 printosdtext()
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
194 {
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
195 if(osd_text_length > 0 && !vo_osd_text) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
196 memset(c->textbuffer,' ',osd_text_length);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
197 memset(c->attrbuffer,0,osd_text_length);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
198 osd_text_length = 0;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
199 }
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
200 /*
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
201 * places the mplayer status osd
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
202 */
6757
f72fc85934e5 10L bugs founds by Jindrich Makovicka <makovicki at KMLinux dot fjfi dot cvuti dot cz>
albeu
parents: 6522
diff changeset
203 if (vo_osd_text && vo_osd_text[0] != 0) {
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
204 int len;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
205 if(vo_osd_text[0] < 32) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
206 len = strlen(__sub_osd_names_short[vo_osd_text[0]]) + strlen(vo_osd_text+1) + 2;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
207 aa_printf(c, 0, 0 , aaopt_osdcolor, "%s %s ", __sub_osd_names_short[vo_osd_text[0]], vo_osd_text+1);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
208 } else {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
209 len = strlen(vo_osd_text) + 1;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
210 aa_printf(c, 0, 0 , aaopt_osdcolor, "%s ",vo_osd_text);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
211 }
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
212
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
213 if(len < osd_text_length) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
214 memset(c->textbuffer + len,' ',osd_text_length - len);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
215 memset(c->attrbuffer + len,0,osd_text_length - len);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
216 }
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
217 osd_text_length = len;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
218
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
219 }
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
220 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
221
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
222 void
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
223 printosdprogbar(){
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
224 /* print mplayer osd-progbar */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
225 if (vo_osd_progbar_type!=-1){
2498
38bb41c48d1f never declare variables in *.h files, pls
nick
parents: 1577
diff changeset
226 osdpercent(1,1,0,255,vo_osd_progbar_value, __sub_osd_names[vo_osd_progbar_type], "");
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
227 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
228 }
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
229 static uint32_t
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
230 config(uint32_t width, uint32_t height, uint32_t d_width,
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
231 uint32_t d_height, uint32_t fullscreen, char *title,
7124
eca7dbad0166 finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents: 6809
diff changeset
232 uint32_t format) {
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
233 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
234 * main init
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
235 * called by mplayer
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
236 */
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
237
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
238 int i;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
239
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
240 aspect_save_orig(width,height);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
241 aspect_save_prescale(d_width,d_height);
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
242
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
243 src_height = height;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
244 src_width = width;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
245 image_format = format;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
246
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
247 /* nothing will change its size, be we need some values initialized */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
248 resize();
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
249
1554
db379aa38e51 define USE_OSD / USE_SUB fixes
folke
parents: 1553
diff changeset
250 #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
251 /* now init out own 'font' (to use vo_draw_text_sub without edit them) */
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
252 if(!vo_font_save) vo_font_save = vo_font;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
253 if(vo_font == vo_font_save) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
254 vo_font=malloc(sizeof(font_desc_t));//if(!desc) return NULL;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
255 memset(vo_font,0,sizeof(font_desc_t));
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
256 vo_font->pic_a[0]=malloc(sizeof(raw_file));
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
257 vo_font->pic_b[0]=malloc(sizeof(raw_file));
1572
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
258
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
259 vo_font->spacewidth=1;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
260 vo_font->charspace=0;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
261 vo_font->height=1;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
262 vo_font->pic_a[0]->bmp=malloc(255);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
263 vo_font->pic_b[0]->bmp=malloc(255);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
264 vo_font->pic_a[0]->w=1;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
265 vo_font->pic_a[0]->h=1;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
266 for (i=0; i<255; i++){
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
267 vo_font->width[i]=1;
1572
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
268 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
269 vo_font->start[i]=i;
1572
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
270 vo_font->pic_a[0]->bmp[i]=i;
25c2ee4de8b1 vo_font SEGFAULT fixed
arpi
parents: 1554
diff changeset
271 vo_font->pic_b[0]->bmp[i]=i;
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
272 }
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
273 }
1554
db379aa38e51 define USE_OSD / USE_SUB fixes
folke
parents: 1553
diff changeset
274 #endif
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
275 /* say hello */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
276 osdmessage(5, 1, "Welcome to ASCII ARTS MPlayer");
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
277
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
278 mp_msg(MSGT_VO,MSGL_V,"VO: [aa] screendriver: %s\n", c->driver->name);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
279 mp_msg(MSGT_VO,MSGL_V,"VO: [aa] keyboarddriver: %s\n", c->kbddriver->name);
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
280
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
281 mp_msg(MSGT_VO,MSGL_INFO,
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
282 "\n"
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
283 "Important Options\n"
1518
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
284 "\t-aaextended use use all 256 characters\n"
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
285 "\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
286 "\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
287 "\t-aahelp to see all options provided by aalib\n"
1518
e0ceb814471d vo_aa: configurable now
folke
parents: 1511
diff changeset
288 "\n"
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
289 "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
290 "\t1 : contrast -\n"
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
291 "\t2 : contrast +\n"
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
292 "\t3 : brightness -\n"
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
293 "\t4 : brightness +\n"
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
294 "\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
295 "\t6 : dithering\n"
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
296 "\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
297 "\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
298
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
299 "\n"
1527
187aa4b576a7 Fix OSD, small misspelling.
atmos4
parents: 1520
diff changeset
300 "All other keys are MPlayer defaults.\n"
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
301
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
302
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
303 );
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
304
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
305 return 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
306 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
307
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
308 static uint32_t
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
309 query_format(uint32_t format) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
310 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
311 * ...are we able to... ?
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
312 * called by mplayer
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
313 * All input format supported by the sws
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
314 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
315 switch(format){
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
316 case IMGFMT_YV12:
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
317 case IMGFMT_I420:
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
318 case IMGFMT_IYUV:
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
319 case IMGFMT_IYU2:
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
320 case IMGFMT_BGR32:
5027
0c7a6a9d2243 32bpp support not implemented - do not lie
arpi
parents: 4737
diff changeset
321 case IMGFMT_BGR24:
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
322 case IMGFMT_BGR16:
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
323 case IMGFMT_BGR15:
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
324 case IMGFMT_RGB32:
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
325 case IMGFMT_RGB24:
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
326 case IMGFMT_Y8:
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
327 case IMGFMT_Y800:
6210
548129e201a2 it uses swscaler
alex
parents: 6205
diff changeset
328 return VFCAP_CSP_SUPPORTED|VFCAP_SWSCALE
6205
b93497af9ddc revised query_format
alex
parents: 5870
diff changeset
329 #ifdef USE_OSD
b93497af9ddc revised query_format
alex
parents: 5870
diff changeset
330 | VFCAP_OSD
b93497af9ddc revised query_format
alex
parents: 5870
diff changeset
331 #endif
b93497af9ddc revised query_format
alex
parents: 5870
diff changeset
332 ;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
333 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
334 return 0;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
335 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
336
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
337 static const vo_info_t*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
338 get_info(void) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
339 /* who i am? */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
340 return (&vo_info);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
341 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
342
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
343 static uint32_t
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
344 draw_frame(uint8_t *src[]) {
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
345 int stride[3] = { 0 , 0 , 0 };
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
346
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
347 switch(image_format) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
348 case IMGFMT_BGR15:
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
349 case IMGFMT_BGR16:
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
350 stride[0] = src_width*2;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
351 break;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
352 case IMGFMT_IYU2:
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
353 case IMGFMT_BGR24:
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
354 stride[0] = src_width*3;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
355 break;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
356 case IMGFMT_BGR32:
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
357 stride[0] = src_width*4;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
358 break;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
359 }
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
360
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
361 sws->swScale(sws,src,stride,0,src_height,image,image_stride);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
362
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
363 /* Now 'ASCIInate' the image */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
364 if (fast)
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
365 aa_fastrender(c, screen_x, screen_y, screen_w + screen_x, screen_h + screen_y );
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
366 else
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
367 aa_render(c, p,screen_x, screen_y, screen_w + screen_x, screen_h + screen_y );
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
368
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
369 return 0;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
370 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
371
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
372 static uint32_t
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
373 draw_slice(uint8_t *src[], int stride[],
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
374 int w, int h, int x, int y) {
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
375
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
376 int dx1 = screen_x + (x * screen_w / src_width);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
377 int dy1 = screen_y + (y * screen_h / src_height);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
378 int dx2 = screen_x + ((x+w) * screen_w / src_width);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
379 int dy2 = screen_y + ((y+h) * screen_h / src_height);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
380
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
381 sws->swScale(sws,src,stride,y,h,image,image_stride);
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
382
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
383 /* Now 'ASCIInate' the image */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
384 if (fast)
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
385 aa_fastrender(c, dx1, dy1, dx2, dy2 );
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
386 else
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
387 aa_render(c, p,dx1, dy1, dx2, dy2 );
4674
5a7eb882bb19 rgb/bgr 32bpp and IYUV/I420 support
alex
parents: 4596
diff changeset
388
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
389
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
390 return 0;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
391 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
392
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
393 static void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
394 flip_page(void) {
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
395
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
396 /* do we have to put *our* (messages, progbar) osd to aa's txtbuf ? */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
397 if (showosdmessage)
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
398 {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
399 if (time(NULL)>=stoposd ) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
400 showosdmessage=0;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
401 if(osdmessagetext) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
402 memset(c->textbuffer + osdy * aa_scrwidth(c) + osdx,' ',strlen(osdmessagetext));
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
403 memset(c->attrbuffer + osdy * aa_scrwidth(c) + osdx ,0,strlen(osdmessagetext));
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
404 osdmessagetext[0] = '\0';
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
405 }
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
406 if(posbar) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
407 memset(c->textbuffer + (osdy+1) * aa_scrwidth(c),' ',strlen(posbar));
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
408 memset(c->attrbuffer + (osdy+1) * aa_scrwidth(c),0,strlen(posbar));
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
409 }
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
410 } else {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
411 /* update osd */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
412 aa_puts(c, osdx, osdy, AA_SPECIAL, osdmessagetext);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
413 /* posbar? */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
414 if (posbar[0]!='\0')
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
415 aa_puts(c, 0, osdy + 1, AA_SPECIAL, posbar);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
416 }
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
417 }
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
418 /* OSD time & playmode , subtitles */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
419 #ifdef USE_OSD
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
420 printosdtext();
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
421 #endif
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
422
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
423
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
424 /* print out */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
425 aa_flush(c);
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
426 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
427
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
428 static void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
429 check_events(void) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
430 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
431 * any events?
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
432 * called by show_image and mplayer
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
433 */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
434 int key;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
435 while ((key=aa_getevent(c,0))!=AA_NONE ){
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
436 if (key>255){
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
437 /* some conversations */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
438 switch (key) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
439 case AA_UP:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
440 mplayer_put_key(KEY_UP);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
441 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
442 case AA_DOWN:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
443 mplayer_put_key(KEY_DOWN);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
444 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
445 case AA_LEFT:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
446 mplayer_put_key(KEY_LEFT);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
447 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
448 case AA_RIGHT:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
449 mplayer_put_key(KEY_RIGHT);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
450 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
451 case AA_ESC:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
452 mplayer_put_key(KEY_ESC);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
453 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
454 case 65765:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
455 mplayer_put_key(KEY_PAGE_UP);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
456 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
457 case 65766:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
458 mplayer_put_key(KEY_PAGE_DOWN);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
459 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
460 default:
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
461 continue; /* aa lib special key */
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
462 break;
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
463 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
464 }
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
465 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
466 aaconfigmode=!aaconfigmode;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
467 osdmessage(MESSAGE_DURATION, 1, "aa config mode is now %s",
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
468 aaconfigmode==1 ? "on. use keys 5-7" : "off");
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
469 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
470 if (aaconfigmode==1) {
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
471 switch (key) {
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
472 /* AA image controls */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
473 case '5':
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
474 fast=!fast;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
475 osdmessage(MESSAGE_DURATION, 1, "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
476 break;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
477 case '6':
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
478 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
479 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
480 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
481 }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
482 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
483 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
484 }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
485 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
486 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
487 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
488 break;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
489 case '7':
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
490 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
491 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
492 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
493 break;
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
494
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
495 default :
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
496 /* 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
497 * 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
498 */
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
499 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
500 break;
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
501 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
502 }// aaconfigmode
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
503 else mplayer_put_key(key);
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
504 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
505 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
506
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
507 static void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
508 uninit(void) {
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
509 /*
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
510 * THE END
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
511 */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
512
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
513 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
514 freopen("/dev/tty", "w", stderr);
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
515 m_config_set_flag(mconfig,"quiet",0); /* enable mplayer outputs */
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
516 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
517 #ifdef USE_OSD
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
518 if(vo_font_save) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
519 free(vo_font->pic_a[0]->bmp);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
520 free(vo_font->pic_a[0]);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
521 free(vo_font->pic_b[0]->bmp);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
522 free(vo_font->pic_b[0]);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
523 free(vo_font);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
524 vo_font = vo_font_save;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
525 vo_font_save = NULL;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
526 }
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
527 #endif
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
528 aa_close(c);
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
529 }
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
530
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
531 #ifdef USE_OSD
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
532 static void draw_alpha(int x,int y, int w,int h, unsigned char* src, unsigned char *srca, int stride){
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
533
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
534 c->textbuffer[x + y*aa_scrwidth(c)] = src[0];
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
535 c->attrbuffer[x + y*aa_scrwidth(c)] = aaopt_subcolor;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
536
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
537 }
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
538
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
539 static void clear_alpha(int x0,int y0, int w,int h) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
540 int l;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
541
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
542 for(l = 0 ; l < h ; l++) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
543 memset(c->textbuffer + (y0 + l) * aa_scrwidth(c) + x0,' ',w);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
544 memset(c->attrbuffer + (y0 + l) * aa_scrwidth(c) + x0,0,w);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
545 }
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
546 }
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
547
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
548
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
549 #endif
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
550
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
551 static void
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
552 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
553 #ifdef USE_OSD
1575
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
554 char * vo_osd_text_save;
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
555 int vo_osd_progbar_type_save;
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
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 printosdprogbar();
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
558 /* let vo_draw_text only write subtitle */
1575
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
559 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
560 vo_osd_text=NULL;
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
561 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
562 vo_osd_progbar_type=-1;
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
563 vo_remove_text(aa_scrwidth(c), aa_scrheight(c),clear_alpha);
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
564 vo_draw_text(aa_scrwidth(c), aa_scrheight(c), draw_alpha);
1575
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
565 vo_osd_text=vo_osd_text_save;
2766b0d3863d osd problem with YV12 fixed
folke
parents: 1572
diff changeset
566 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
567 #endif
1511
f29e0c2bb675 Added cool aalib vo driver.
atmos4
parents:
diff changeset
568 }
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
569
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
570 int
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
571 getcolor(char * s){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
572 int i;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
573 char * rest;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
574 if (s==NULL) return -1;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
575 i=strtol(s, &rest, 10);
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
576 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
577 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
578 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
579 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
580 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
581 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
582 else return -1;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
583 }
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
584
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
585 int
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
586 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
587 /* 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
588 char *pseudoargv[4];
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
589 int pseudoargc;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
590 char * x, *help;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
591 int i;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
592 /* do WE need it ? */
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
593 if (!strcasecmp(opt, "aaosdcolor")){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
594 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
595 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
596 aaopt_osdcolor=i;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
597 return 1;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
598 }else if (!strcasecmp(opt, "aasubcolor")){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
599 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
600 aaopt_subcolor=i;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
601 return 1;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
602 }else if (!strcasecmp(opt, "aahelp")){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
603 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
604 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
605 x=strtok(help,"-");
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
606 printf(x);
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
607 while ((x=strtok(NULL, "-"))){
1537
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
608 if (*(x-2)==' ') printf("-aa");
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
609 else printf("-");
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
610 printf("%s", x);
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
611 }
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
612 printf(
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
613 "\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
614 "\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
615 "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
616 " -aaosdcolor set osd color\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
617 " -aasubcolor set subtitle color\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
618 " the color params are:\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
619 " 0 : normal\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
620 " 1 : dark\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
621 " 2 : bold\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
622 " 3 : boldfont\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
623 " 4 : reverse\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
624 " 6 : special\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
625 "\n\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
626 " dT8 8Tb\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
627 " dT 8 8 Tb\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
628 " dT 8 8 Tb\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
629 " <PROJECT><PROJECT>\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
630 " dT 8 8 Tb\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
631 " dT 8 8 Tb\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
632 "\n"
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
633
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
634 );
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
635 exit(0);
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
636
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
637 }else{
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
638 /* parse param to aalib */
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
639 pseudoargv[1]=malloc(strlen(opt));
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
640 pseudoargv[3]=NULL;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
641 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
642 if (param!=NULL){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
643 pseudoargv[2]=param;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
644 pseudoargc=3;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
645 }else{
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
646 pseudoargv[2]=NULL;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
647 pseudoargc=2;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
648 }
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
649 fprintf(stderr,"VO: [aa] ");
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
650 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
651 if (i!=1){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
652 return ERR_MISSING_PARAM;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
653 }
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
654 if (pseudoargv[1]!=NULL){
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
655 /* 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
656 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
657 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
658 }
1551
267816fbdab3 vo_aa: +subtitles, +progressbar, key violation with mplayer keys fixed, +consoleblanking disabled, +/dev/vcsa checking
folke
parents: 1538
diff changeset
659 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
660 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
661
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
662 }
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
663 return ERR_NOT_AN_OPTION;
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
664
7bdf6a585b67 All aalib options can be passed to aalib (-aaXXX), also -aahelp is new
folke
parents: 1527
diff changeset
665 }
4258
31ed0b5d8126 Added reverting support for -aa* options
albeu
parents: 4094
diff changeset
666
31ed0b5d8126 Added reverting support for -aa* options
albeu
parents: 4094
diff changeset
667 void
31ed0b5d8126 Added reverting support for -aa* options
albeu
parents: 4094
diff changeset
668 vo_aa_revertoption(config_t* opt,char* param) {
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
669 if (!strcasecmp(param, "aaosdcolor"))
4258
31ed0b5d8126 Added reverting support for -aa* options
albeu
parents: 4094
diff changeset
670 aaopt_osdcolor= AA_SPECIAL;
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
671 else if (!strcasecmp(param, "aasubcolor"))
4258
31ed0b5d8126 Added reverting support for -aa* options
albeu
parents: 4094
diff changeset
672 aaopt_subcolor= AA_SPECIAL;
31ed0b5d8126 Added reverting support for -aa* options
albeu
parents: 4094
diff changeset
673 }
31ed0b5d8126 Added reverting support for -aa* options
albeu
parents: 4094
diff changeset
674
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4258
diff changeset
675 static uint32_t preinit(const char *arg)
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4258
diff changeset
676 {
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
677 char * hidis = NULL;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
678 struct stat sbuf;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
679 int fd, vt, major, minor;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
680 FILE * fp;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
681 char fname[12];
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
682 extern aa_linkedlist *aa_displayrecommended;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
683
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4674
diff changeset
684 if(arg)
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4674
diff changeset
685 {
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
686 mp_msg(MSGT_VO,MSGL_ERR,"vo_aa: Unknown subdevice: %s\n",arg);
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4674
diff changeset
687 return ENOSYS;
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4674
diff changeset
688 }
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
689
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
690 /* initializing of aalib */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
691
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
692 hidis=aa_getfirst(&aa_displayrecommended);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
693 if ( hidis==NULL ){
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
694 /* check /dev/vcsa<vt> */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
695 /* check only, if no driver is explicit set */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
696 fd = dup (fileno (stderr));
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
697 fstat (fd, &sbuf);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
698 major = sbuf.st_rdev >> 8;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
699 vt = minor = sbuf.st_rdev & 0xff;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
700 close (fd);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
701 sprintf (fname, "/dev/vcsa%2.2i", vt);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
702 fp = fopen (fname, "w+");
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
703 if (fp==NULL){
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
704 fprintf(stderr,"VO: [aa] cannot open %s for writing,"
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
705 "so we'll not use linux driver\n", fname);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
706 aa_recommendlowdisplay("linux");
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
707 aa_recommendhidisplay("curses");
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
708 aa_recommendhidisplay("X11");
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
709 }else fclose(fp);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
710 } else aa_recommendhidisplay(hidis);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
711 c = aa_autoinit(&aa_defparams);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
712
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
713 if (c == NULL) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
714 mp_msg(MSGT_VO,MSGL_ERR,"Can not intialize aalib\n");
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
715 return VO_ERROR;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
716 }
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
717 if (!aa_autoinitkbd(c,0)) {
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
718 mp_msg(MSGT_VO,MSGL_ERR,"Can not intialize keyboard\n");
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
719 aa_close(c);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
720 return VO_ERROR;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
721 }
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
722
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
723 aa_resizehandler(c, (void *)resize);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
724 aa_hidecursor(c);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
725 p = aa_getrenderparams();
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
726
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
727 if ((strstr(c->driver->name,"Curses")) || (strstr(c->driver->name,"Linux"))){
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
728 freopen("/dev/null", "w", stderr);
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
729 m_config_set_flag(mconfig,"quiet",0); /* disable mplayer outputs */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
730 /* disable console blanking */
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
731 printf("\033[9;0]");
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
732 }
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
733
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
734 memset(image,0,3*sizeof(uint8_t));
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
735 osdmessagetext[0] = '\0';
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
736 osdx = osdy = 0;
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
737
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4674
diff changeset
738 return 0;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4258
diff changeset
739 }
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4258
diff changeset
740
4596
c35d7ce151b3 10000hl to Holm... control MUST BE static...
arpi
parents: 4592
diff changeset
741 static uint32_t control(uint32_t request, void *data, ...)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4258
diff changeset
742 {
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
743 switch (request) {
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
744 case VOCTRL_QUERY_FORMAT:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
745 return query_format(*((uint32_t*)data));
6809
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
746 case VOCTRL_SET_EQUALIZER: {
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
747 va_list ap;
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
748 int val;
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
749
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
750 va_start(ap, data);
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
751 val = va_arg(ap, int);
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
752 va_end(ap);
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
753
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
754 if(strcmp((char*)data,"contrast") == 0)
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
755 p->contrast = ( val + 100 ) * 64 / 100;
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
756 else if(strcmp((char*)data,"brightness") == 0)
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
757 p->bright = ( val + 100) * 128 / 100;
5870
125d667e9eac A almost complete rewrite.
albeu
parents: 5295
diff changeset
758 return VO_TRUE;
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
759 }
6809
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
760 case VOCTRL_GET_EQUALIZER: {
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
761 va_list ap;
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
762 int* val;
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
763
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
764 va_start(ap, data);
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
765 val = va_arg(ap, int*);
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
766 va_end(ap);
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
767
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
768 if(strcmp((char*)data,"contrast") == 0)
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
769 *val = (p->contrast - 64) * 100 / 64;
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
770 else if(strcmp((char*)data,"brightness") == 0)
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
771 *val = (p->bright - 128) * 100 / 128;
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
772
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
773 return VO_TRUE;
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
774 }
0250f691037e 10L bugs founds by Jindrich Makovicka <makovick at MLinux dot fjfi dot cvut dotcz>
albeu
parents: 6757
diff changeset
775 }
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
776 return VO_NOTIMPL;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4258
diff changeset
777 }