Mercurial > mplayer.hg
annotate libvo/vo_directfb2.c @ 31018:6ffd2e644c04
Remove unnecessary kd.h #include.
author | diego |
---|---|
date | Sat, 24 Apr 2010 10:47:53 +0000 |
parents | 37bb4d020f50 |
children | d50e094bfd13 |
rev | line source |
---|---|
6952 | 1 /* |
27582
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
2 * MPlayer video driver for DirectFramebuffer device |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
3 * |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
4 * copyright (C) 2002 Jiri Svoboda <Jiri.Svoboda@seznam.cz> |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
5 * |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
6 * based on vo_directfb2.c |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
7 * |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
8 * This file is part of MPlayer. |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
9 * |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
10 * MPlayer is free software; you can redistribute it and/or |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
11 * modify it under the terms of the GNU Lesser General Public |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
12 * License as published by the Free Software Foundation; either |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
13 * version 2.1 of the License, or (at your option) any later version. |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
14 * |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
15 * MPlayer is distributed in the hope that it will be useful, |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
18 * Lesser General Public License for more details. |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
19 * |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
20 * You should have received a copy of the GNU Lesser General Public License |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
21 * along with MPlayer; if not, write to the Free Software Foundation, Inc., |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
34d3e0c8487a
Upgrade license of LGPL 2 or later files to LGPL 2.1 or later.
diego
parents:
26755
diff
changeset
|
23 */ |
6952 | 24 |
25 // directfb includes | |
26 | |
27 #include <directfb.h> | |
28 | |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
29 #define DFB_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c)) |
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
30 |
6952 | 31 // other things |
32 | |
33 #include <stdio.h> | |
34 #include <stdlib.h> | |
35 #include <string.h> | |
31018 | 36 //#include <sys/kd.h> |
6952 | 37 |
38 #include "config.h" | |
39 #include "video_out.h" | |
40 #include "video_out_internal.h" | |
41 #include "fastmemcpy.h" | |
42 #include "sub.h" | |
9937 | 43 #include "mp_msg.h" |
6952 | 44 #include "aspect.h" |
15750 | 45 #include "subopt-helper.h" |
22823
98eaf29b5dee
Code cleanup: don't include a .c file in mplayer.c and fix a few
rathann
parents:
20112
diff
changeset
|
46 #include "mp_fifo.h" |
6952 | 47 |
48 #ifndef min | |
49 #define min(x,y) (((x)<(y))?(x):(y)) | |
50 #endif | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
51 |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
52 #if DIRECTFBVERSION > DFB_VERSION(0,9,17) |
9937 | 53 // triple buffering |
54 #define TRIPLE 1 | |
55 #endif | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
56 |
25216 | 57 static const vo_info_t info = { |
6952 | 58 "Direct Framebuffer Device", |
59 "directfb", | |
60 "Jiri Svoboda Jiri.Svoboda@seznam.cz", | |
8137
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
61 "v 2.0 (for DirectFB version >=0.9.13)" |
6952 | 62 }; |
63 | |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25216
diff
changeset
|
64 const LIBVO_EXTERN(directfb) |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
8137
diff
changeset
|
65 |
6952 | 66 /****************************** |
67 * vo_directfb globals * | |
68 ******************************/ | |
69 | |
70 #define DFBCHECK(x...) \ | |
71 { \ | |
72 DFBResult err = x; \ | |
73 \ | |
74 if (err != DFB_OK) \ | |
75 { \ | |
76 fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \ | |
77 DirectFBErrorFatal( #x, err ); \ | |
78 } \ | |
79 } | |
80 | |
81 /* | |
82 * filled by preinit | |
83 */ | |
84 | |
85 // main DirectFB handle | |
86 static IDirectFB *dfb = NULL; | |
87 // keyboard handle | |
88 static IDirectFBInputDevice *keyboard = NULL; | |
89 // A buffer for input events. | |
90 static IDirectFBEventBuffer *buffer = NULL; | |
91 | |
92 /* | |
93 * filled during config | |
94 */ | |
95 | |
96 // handle of used layer | |
97 static IDirectFBDisplayLayer *layer = NULL; | |
98 // surface of used layer | |
99 static IDirectFBSurface *primary = NULL; | |
100 static int primarylocked = 0; | |
101 // handle of temporary surface (if used) | |
102 static IDirectFBSurface *frame = NULL; | |
103 static int framelocked = 0; | |
104 // flipping mode flag (layer/surface) | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
105 static int flipping = 0; |
6952 | 106 // scaling flag |
107 static int stretch = 0; | |
24950 | 108 // picture position |
6952 | 109 static int xoffset=0,yoffset=0; |
110 // picture size | |
111 static int out_width=0,out_height=0; | |
112 // frame/primary size | |
113 static int width=0,height=0; | |
114 // frame primary format | |
115 DFBSurfacePixelFormat pixel_format; | |
116 /* | |
117 static void (*draw_alpha_p)(int w, int h, unsigned char *src, | |
118 unsigned char *srca, int stride, unsigned char *dst, | |
119 int dstride); | |
120 */ | |
121 | |
122 /****************************** | |
123 * cmd line parameteres * | |
124 ******************************/ | |
125 | |
126 /* command line/config file options */ | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
127 static int layer_id = -1; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
128 static int buffer_mode = 1; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
129 static int use_input = 1; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
130 static int field_parity = -1; |
6952 | 131 |
132 /****************************** | |
133 * implementation * | |
134 ******************************/ | |
135 | |
30556
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
30250
diff
changeset
|
136 static void unlock(void) |
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
30250
diff
changeset
|
137 { |
6952 | 138 if (frame && framelocked) frame->Unlock(frame); |
139 if (primary && primarylocked) primary->Unlock(primary); | |
140 } | |
141 | |
15750 | 142 static int get_parity(strarg_t *arg) { |
143 if (strargcmp(arg, "top") == 0) | |
144 return 0; | |
145 if (strargcmp(arg, "bottom") == 0) | |
146 return 1; | |
147 return -1; | |
148 } | |
149 | |
150 static int check_parity(void *arg) { | |
151 return get_parity(arg) != -1; | |
152 } | |
153 | |
154 static int get_mode(strarg_t *arg) { | |
155 if (strargcmp(arg, "single") == 0) | |
156 return 1; | |
157 if (strargcmp(arg, "double") == 0) | |
158 return 2; | |
159 if (strargcmp(arg, "triple") == 0) | |
160 return 3; | |
161 return 0; | |
162 } | |
163 | |
164 static int check_mode(void *arg) { | |
165 return get_mode(arg) != 0; | |
166 } | |
6952 | 167 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15750
diff
changeset
|
168 static int preinit(const char *arg) |
6952 | 169 { |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
170 DFBResult ret; |
15750 | 171 strarg_t mode_str = {0, NULL}; |
172 strarg_t par_str = {0, NULL}; | |
173 strarg_t dfb_params = {0, NULL}; | |
28828
56eee6ffba9b
Make data related to suboption parsing const in libvo
reimar
parents:
27582
diff
changeset
|
174 const opt_t subopts[] = { |
15750 | 175 {"input", OPT_ARG_BOOL, &use_input, NULL}, |
176 {"buffermode", OPT_ARG_STR, &mode_str, check_mode}, | |
177 {"fieldparity", OPT_ARG_STR, &par_str, check_parity}, | |
178 {"layer", OPT_ARG_INT, &layer_id, NULL}, | |
179 {"dfbopts", OPT_ARG_STR, &dfb_params, NULL}, | |
180 {NULL} | |
181 }; | |
6952 | 182 |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
183 //mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Preinit entered\n"); |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
184 |
24950 | 185 if (dfb) return 0; // we are already initialized! |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
186 |
15750 | 187 // set defaults |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
188 buffer_mode = 1 + vo_doublebuffering; // honor -double switch |
15750 | 189 layer_id = -1; |
190 use_input = 1; | |
191 field_parity = -1; | |
192 if (subopt_parse(arg, subopts) != 0) { | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
193 mp_msg( MSGT_VO, MSGL_ERR, |
11982 | 194 "\n-vo directfb command line help:\n" |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
195 "Example: mplayer -vo directfb:layer=1:buffermode=single\n" |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
196 "\nOptions (use 'no' prefix to disable):\n" |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
197 " input Use DirectFB for keyboard input\n" |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
198 "\nOther options:\n" |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
199 " layer=n\n" |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
200 " n=0..xx Use layer with id n for output (0=primary)\n" |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
201 " buffermode=(single|double|triple)\n" |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
202 " single Use single buffering\n" |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
203 " double Use double buffering\n" |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
204 " triple Use triple buffering\n" |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
205 " fieldparity=(top|bottom)\n" |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
206 " top Top field first\n" |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
207 " bottom Bottom field first\n" |
15750 | 208 " dfbopts=<str>\n" |
209 " Specify a parameter list for DirectFB\n" | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
210 "\n" ); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
211 return -1; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
212 } |
15750 | 213 if (mode_str.len) |
214 buffer_mode = get_mode(&mode_str); | |
215 if (par_str.len) | |
216 field_parity = get_parity(&par_str); | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
217 |
8137
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
218 |
15750 | 219 if (dfb_params.len > 0) |
8137
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
220 { |
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
221 int argc = 2; |
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
222 char arg0[10] = "mplayer"; |
18878 | 223 char *arg1 = malloc(dfb_params.len + 7); |
8137
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
224 char* argv[3]; |
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
225 char ** a; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
226 |
8137
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
227 a = &argv[0]; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
228 |
15750 | 229 strcpy(arg1, "--dfb:"); |
230 strncat(arg1, dfb_params.str, dfb_params.len); | |
8137
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
231 |
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
232 argv[0]=arg0; |
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
233 argv[1]=arg1; |
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
234 argv[2]=NULL; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
235 |
8137
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
236 DFBCHECK (DirectFBInit (&argc,&a)); |
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
237 |
15750 | 238 free(arg1); |
8137
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
239 } else { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
240 |
6952 | 241 DFBCHECK (DirectFBInit (NULL,NULL)); |
8137
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
242 } |
6952 | 243 |
244 if (((directfb_major_version <= 0) && | |
245 (directfb_minor_version <= 9) && | |
246 (directfb_micro_version < 13))) | |
247 { | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
248 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: Unsupported DirectFB version\n"); |
6952 | 249 return 1; |
250 } | |
251 | |
252 /* | |
253 * (set options) | |
254 */ | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
255 |
24950 | 256 // uncomment this if you do not wish to create a new VT for DirectFB |
6952 | 257 // DFBCHECK (DirectFBSetOption ("no-vt-switch","")); |
258 | |
24950 | 259 // uncomment this if you want to allow VT switching |
6952 | 260 // DFBCHECK (DirectFBSetOption ("vt-switching","")); |
261 | |
262 // uncomment this if you want to hide gfx cursor (req dfb >=0.9.9) | |
11972
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
263 DFBCHECK (DirectFBSetOption ("no-cursor","")); |
6952 | 264 |
265 // bg color fix | |
266 DFBCHECK (DirectFBSetOption ("bg-color","00000000")); | |
267 | |
268 /* | |
269 * (Initialize) | |
270 */ | |
271 | |
272 DFBCHECK (DirectFBCreate (&dfb)); | |
273 | |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
274 #if DIRECTFBVERSION < DFB_VERSION(0,9,17) |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
275 if (DFB_OK != dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)) { |
24951 | 276 mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - cannot switch to fullscreen mode"); |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
277 }; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
278 #endif |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
279 |
6952 | 280 /* |
281 * (Get keyboard) | |
282 */ | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
283 |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
284 if (use_input) { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
285 ret = dfb->GetInputDevice (dfb, DIDID_KEYBOARD, &keyboard); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
286 if (ret==DFB_OK) { |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
287 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Keyboard init OK\n"); |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
288 } else { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
289 keyboard = NULL; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
290 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: Keyboard init FAILED\n"); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
291 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
292 } |
6952 | 293 |
294 | |
295 /* | |
296 * Create an input buffer for the keyboard. | |
297 */ | |
298 if (keyboard) DFBCHECK (keyboard->CreateEventBuffer (keyboard, &buffer)); | |
299 | |
24950 | 300 // just to start clean ... |
6952 | 301 if (buffer) buffer->Reset(buffer); |
302 | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
303 //mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Preinit OK\n"); |
6952 | 304 |
305 return 0; | |
306 | |
307 } | |
308 | |
30556
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
30250
diff
changeset
|
309 static DFBSurfacePixelFormat convformat(uint32_t format) |
6952 | 310 { |
311 // add more formats !!! | |
312 switch (format) { | |
313 case IMGFMT_RGB32: return DSPF_RGB32; break; | |
314 case IMGFMT_BGR32: return DSPF_RGB32; break; | |
315 case IMGFMT_RGB24: return DSPF_RGB24; break; | |
316 case IMGFMT_BGR24: return DSPF_RGB24; break; | |
317 case IMGFMT_RGB16: return DSPF_RGB16; break; | |
318 case IMGFMT_BGR16: return DSPF_RGB16; break; | |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
319 #if DIRECTFBVERSION > DFB_VERSION(0,9,15) |
8640 | 320 case IMGFMT_RGB15: return DSPF_ARGB1555; break; |
321 case IMGFMT_BGR15: return DSPF_ARGB1555; break; | |
322 #else | |
6952 | 323 case IMGFMT_RGB15: return DSPF_RGB15; break; |
324 case IMGFMT_BGR15: return DSPF_RGB15; break; | |
8640 | 325 #endif |
6952 | 326 case IMGFMT_YUY2: return DSPF_YUY2; break; |
327 case IMGFMT_UYVY: return DSPF_UYVY; break; | |
328 case IMGFMT_YV12: return DSPF_YV12; break; | |
329 case IMGFMT_I420: return DSPF_I420; break; | |
330 // case IMGFMT_IYUV: return DSPF_IYUV; break; | |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
331 case IMGFMT_RGB8: return DSPF_RGB332; break; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
332 case IMGFMT_BGR8: return DSPF_RGB332; break; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
333 |
6952 | 334 default: return 0; |
335 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
336 return 0; |
6952 | 337 } |
338 | |
339 typedef struct enum1_s { | |
340 uint32_t format; | |
341 int scale; | |
342 int result; | |
343 unsigned int id; | |
344 unsigned int width; | |
345 unsigned int height; | |
346 int setsize; | |
347 } enum1_t; | |
348 | |
30556
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
30250
diff
changeset
|
349 static DFBEnumerationResult test_format_callback(unsigned int id, |
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
30250
diff
changeset
|
350 DFBDisplayLayerDescription desc, |
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
30250
diff
changeset
|
351 void *data) |
6952 | 352 { |
353 enum1_t *params =(enum1_t *)data; | |
354 IDirectFBDisplayLayer *layer; | |
355 DFBResult ret; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
356 |
8137
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
357 if ((layer_id == -1 )||(layer_id == id)) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
358 |
6952 | 359 ret = dfb->GetDisplayLayer( dfb, id, &layer); |
360 if (ret) { | |
361 DirectFBError( "dfb->GetDisplayLayer failed", ret ); | |
362 return DFENUM_OK; | |
363 } else { | |
364 DFBDisplayLayerConfig dlc; | |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
365 |
6952 | 366 if (params->setsize) { |
367 dlc.flags = DLCONF_WIDTH |DLCONF_HEIGHT; | |
368 dlc.width = params->width; | |
369 dlc.height = params->height; | |
370 layer->SetConfiguration(layer,&dlc); | |
371 } | |
372 | |
373 | |
374 dlc.flags = DLCONF_PIXELFORMAT; | |
375 dlc.pixelformat = convformat(params->format); | |
9515 | 376 |
377 layer->SetOpacity(layer,0); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
378 |
6952 | 379 ret = layer->TestConfiguration(layer,&dlc,NULL); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
380 |
6952 | 381 layer->Release(layer); |
382 | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
383 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Test format - layer %i scale/pos %i\n",id,(desc.caps & DLCAPS_SCREEN_LOCATION)); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
384 |
9515 | 385 if (ret==DFB_OK) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
386 // printf("Test OK\n"); |
6952 | 387 if (params->result) { |
388 if ((!params->scale) && (desc.caps & DLCAPS_SCREEN_LOCATION)) { | |
389 params->scale=1; | |
390 params->id=id; | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
391 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Test format - added layer %i scale/pos %i\n",id,(desc.caps & DLCAPS_SCREEN_LOCATION)); |
6952 | 392 } |
393 } else { | |
394 params->result=1; | |
395 params->id=id; | |
396 if (desc.caps & DLCAPS_SCREEN_LOCATION) params->scale=1; | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
397 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Test format - added layer %i scale/pos %i\n",id,(desc.caps & DLCAPS_SCREEN_LOCATION)); |
6952 | 398 }; |
399 }; | |
400 }; | |
401 | |
8137
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
402 }; |
9515 | 403 |
6952 | 404 return DFENUM_OK; |
405 } | |
406 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15750
diff
changeset
|
407 static int query_format(uint32_t format) |
6952 | 408 { |
24950 | 409 int ret = VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_OSD; // osd should be removed the in future -> will be handled outside... |
6952 | 410 enum1_t params; |
411 | |
412 | |
413 if (!convformat(format)) return 0; | |
24950 | 414 // temporarily disable YV12 |
6952 | 415 // if (format == IMGFMT_YV12) return 0; |
416 // if (format == IMGFMT_I420) return 0; | |
417 if (format == IMGFMT_IYUV) return 0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
418 |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
419 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Format query: %s\n",vo_format_name(format)); |
6952 | 420 |
421 params.format=format; | |
422 params.scale=0; | |
423 params.result=0; | |
424 params.setsize=0; | |
425 | |
426 DFBCHECK (dfb->EnumDisplayLayers(dfb,test_format_callback,¶ms)); | |
427 | |
428 if (params.result) { | |
429 if (params.scale) ret |=VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN; | |
430 return ret; | |
431 } | |
432 | |
433 return 0; | |
434 } | |
435 | |
436 typedef struct videomode_s { | |
437 int width; | |
438 int height; | |
439 int out_width; | |
440 int out_height; | |
441 int overx; | |
442 int overy; | |
443 int bpp; | |
444 } videomode_t; | |
445 | |
446 | |
30556
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
30250
diff
changeset
|
447 static DFBEnumerationResult video_modes_callback(int width, int height, |
358ac046eccc
libvo: Mark functions not used outside of their files as static.
diego
parents:
30250
diff
changeset
|
448 int bpp, void *data) |
6952 | 449 { |
450 videomode_t *params =(videomode_t *)data; | |
451 | |
452 int overx=0,overy=0,closer=0,over=0; | |
453 int we_are_under=0; | |
454 | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
455 //mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Validator entered %i %i %i\n",width,height,bpp); |
6952 | 456 |
457 overx=width-params->out_width; | |
458 overy=height-params->out_height; | |
459 | |
460 if (!params->width) { | |
461 params->width=width; | |
462 params->height=height; | |
463 params->overx=overx; | |
464 params->overy=overy; | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
465 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Mode added %i %i %i\n",width,height,bpp); |
6952 | 466 } |
467 | |
468 if ((params->overy<0)||(params->overx<0)) we_are_under=1; // stored mode is smaller than req mode | |
469 if (abs(overx*overy)<abs(params->overx * params->overy)) closer=1; // current mode is closer to desired res | |
470 if ((overx>=0)&&(overy>=0)) over=1; // current mode is bigger or equaul to desired res | |
471 if ((closer && (over || we_are_under)) || (we_are_under && over)) { | |
472 params->width=width; | |
473 params->height=height; | |
474 params->overx=overx; | |
475 params->overy=overy; | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
476 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Better mode added %i %i %i\n",width,height,bpp); |
6952 | 477 }; |
478 | |
479 return DFENUM_OK; | |
480 } | |
481 | |
482 #define CONFIG_ERROR -1 | |
483 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15750
diff
changeset
|
484 static int config(uint32_t s_width, uint32_t s_height, uint32_t d_width, |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
13787
diff
changeset
|
485 uint32_t d_height, uint32_t flags, char *title, |
7272 | 486 uint32_t format) |
6952 | 487 { |
488 /* | |
489 * (Locals) | |
490 */ | |
491 | |
492 // decode flags | |
493 | |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
13787
diff
changeset
|
494 int fs = flags & VOFLAG_FULLSCREEN; |
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
13787
diff
changeset
|
495 int vm = flags & VOFLAG_MODESWITCHING; |
6952 | 496 |
497 DFBSurfaceDescription dsc; | |
498 DFBResult ret; | |
499 DFBDisplayLayerConfig dlc; | |
500 DFBSurfaceCapabilities caps; | |
501 | |
502 enum1_t params; | |
503 | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
504 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Config entered [%ix%i]\n",s_width,s_height); |
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
505 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: With requested format: %s\n",vo_format_name(format)); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
506 |
24950 | 507 // initial cleanup |
6952 | 508 if (frame) { |
509 frame->Release(frame); | |
510 frame=NULL; | |
511 } | |
512 | |
513 if (primary) { | |
514 primary->Release(primary); | |
515 primary=NULL; | |
516 } | |
517 | |
518 if (layer) { | |
519 layer->Release(layer); | |
520 layer=NULL; | |
521 } | |
522 | |
523 | |
524 // vm things | |
525 | |
526 if (vm) { | |
527 videomode_t params; | |
528 params.out_width=d_width; | |
529 params.out_height=d_height; | |
530 params.width=0; | |
531 params.height=0; | |
532 switch (format) { | |
9515 | 533 case IMGFMT_RGB32: |
534 case IMGFMT_BGR32: | |
6952 | 535 params.bpp=32; |
536 break; | |
9515 | 537 case IMGFMT_RGB24: |
538 case IMGFMT_BGR24: | |
6952 | 539 params.bpp=24; |
540 break; | |
541 case IMGFMT_RGB16: | |
542 case IMGFMT_BGR16: | |
543 case IMGFMT_RGB15: | |
544 case IMGFMT_BGR15: | |
545 params.bpp=16; | |
546 break; | |
9515 | 547 default: params.bpp=0; |
548 | |
549 } | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
550 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Config - trying to change videomode\n"); |
6952 | 551 DFBCHECK (dfb->EnumVideoModes(dfb,video_modes_callback,¶ms)); |
552 ret=dfb->SetVideoMode(dfb,params.width,params.height,params.bpp); | |
553 if (ret) { | |
554 ret=dfb->SetVideoMode(dfb,params.width,params.height,24); | |
555 if (ret) { | |
556 ret=dfb->SetVideoMode(dfb,params.width,params.height,32); | |
557 if (ret) { | |
558 ret=dfb->SetVideoMode(dfb,params.width,params.height,16); | |
559 if (ret) { | |
560 ret=dfb->SetVideoMode(dfb,params.width,params.height,8); | |
561 } | |
562 } | |
563 } | |
564 } | |
565 } // vm end | |
566 | |
24950 | 567 // just to be sure clear primary layer |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
568 #if DIRECTFBVERSION > DFB_VERSION(0,9,13) |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
569 ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer); |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
570 if (ret==DFB_OK) { |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
571 ret = layer->GetSurface(layer,&primary); |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
572 if (ret==DFB_OK) { |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
573 primary->Clear(primary,0,0,0,0xff); |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
574 ret = primary->Flip(primary,NULL,0); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
575 if (ret==DFB_OK) { |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
576 primary->Clear(primary,0,0,0,0xff); |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
577 } |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
578 primary->Release(primary); |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
579 } |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
580 primary=NULL; |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
581 layer->Release(layer); |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
582 } |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
583 layer=NULL; |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
584 #endif |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
585 |
6952 | 586 // find best layer |
587 | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
588 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Config - looking for suitable layer\n"); |
6952 | 589 params.format=format; |
590 params.scale=0; | |
591 params.result=0; | |
592 params.width=s_width; | |
593 params.height=s_height; | |
594 params.setsize=1; | |
595 | |
596 DFBCHECK (dfb->EnumDisplayLayers(dfb,test_format_callback,¶ms)); | |
597 | |
598 if (!params.result) { | |
9937 | 599 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: ConfigError - no suitable layer found\n"); |
6952 | 600 params.id = DLID_PRIMARY; |
9515 | 601 } |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
602 |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
603 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Config - layer %i\n",params.id); |
6952 | 604 |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
605 // setup layer |
6952 | 606 |
607 DFBCHECK (dfb->GetDisplayLayer( dfb, params.id, &layer)); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
608 |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
609 #if DIRECTFBVERSION > DFB_VERSION(0,9,16) |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
610 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Config - switching layer to exclusive mode\n"); |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
611 ret = layer->SetCooperativeLevel (layer, DLSCL_EXCLUSIVE); |
6952 | 612 |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
613 if (DFB_OK != ret) { |
24951 | 614 mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - cannot switch layer to exclusive mode. This could cause\nproblems. You may need to select correct pixel format manually!\n"); |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
615 DirectFBError("MPlayer - Switch layer to exlusive mode.",ret); |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
616 }; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
617 #endif |
6952 | 618 if (params.scale) { |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
619 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Config - changing layer configuration (size)\n"); |
6952 | 620 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT; |
621 dlc.width = s_width; | |
622 dlc.height = s_height; | |
9515 | 623 |
6952 | 624 ret = layer->SetConfiguration(layer,&dlc); |
9515 | 625 |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
626 if (ret) { |
9937 | 627 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: ConfigError in layer configuration (size)\n"); |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
628 DirectFBError("MPlayer - Layer size change.",ret); |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
629 }; |
6952 | 630 } |
631 | |
24950 | 632 // look if we need to change the pixel format of the layer |
633 // and just to be sure also fetch all layer properties | |
9515 | 634 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_OPTIONS | DLCONF_BUFFERMODE; |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
635 |
9515 | 636 ret = layer->GetConfiguration(layer,&dlc); |
637 | |
638 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_WIDTH | DLCONF_HEIGHT; | |
639 | |
640 if (ret) { | |
9937 | 641 mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - could not get layer properties!\n"); |
642 } else { | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
643 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Layer reports format:%x\n",dlc.pixelformat); |
9515 | 644 } |
6952 | 645 |
9515 | 646 if ((dlc.pixelformat != convformat(params.format)) || (ret != DFB_OK)) { |
647 | |
648 dlc.flags = DLCONF_PIXELFORMAT; | |
649 dlc.pixelformat = convformat(params.format); | |
650 | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
651 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Desired pixelformat: %x\n",dlc.pixelformat); |
9515 | 652 |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
653 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Config - changing layer configuration (format)\n"); |
9515 | 654 ret = layer->SetConfiguration(layer,&dlc); |
655 | |
656 if (ret) { | |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
657 unsigned int bpp; |
9937 | 658 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: ConfigError in layer configuration (format, flags=%x)\n",dlc.flags); |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
659 DirectFBError("MPlayer - layer pixelformat change",ret); |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
660 |
24950 | 661 // ugly fbdev workaround - try to switch pixelformat via videomode change |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
662 switch (dlc.pixelformat) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
663 case DSPF_ARGB: |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
664 case DSPF_RGB32: bpp=32;break; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
665 case DSPF_RGB24: bpp=24;break; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
666 case DSPF_RGB16: bpp=16;break; |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
667 #if DIRECTFBVERSION > DFB_VERSION(0,9,15) |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
668 case DSPF_ARGB1555: bpp=15;break; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
669 #else |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
670 case DSPF_RGB15: bpp=15;break; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
671 #endif |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
672 case DSPF_RGB332 : bpp=8;break; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
673 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
674 |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
675 switch (dlc.pixelformat) { |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
676 case DSPF_ARGB: |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
677 case DSPF_RGB32: |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
678 case DSPF_RGB24: |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
679 case DSPF_RGB16: |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
680 #if DIRECTFBVERSION > DFB_VERSION(0,9,15) |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
681 case DSPF_ARGB1555: |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
682 #else |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
683 case DSPF_RGB15: |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
684 #endif |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
685 case DSPF_RGB332: |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
686 mp_msg(MSGT_VO, MSGL_V,"DirectFB: Trying to recover via videomode change (VM).\n"); |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
687 // get size |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
688 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
689 if (DFB_OK==layer->GetConfiguration(layer,&dlc)) { |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
690 // try to set videomode |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
691 mp_msg(MSGT_VO, MSGL_V,"DirectFB: Videomode %ix%i BPP %i\n",dlc.width,dlc.height,bpp); |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
692 ret = dfb->SetVideoMode(dfb,dlc.width,dlc.height,bpp); |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
693 if (ret) DirectFBError("MPlayer - VM - pixelformat change",ret); |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
694 |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
695 }; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
696 |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
697 //get current pixel format |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
698 dlc.flags = DLCONF_PIXELFORMAT; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
699 ret = layer->GetConfiguration(layer,&dlc); |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
700 if (ret) { |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
701 DirectFBError("MPlayer - VM - Layer->GetConfiguration",ret); |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
702 } else { |
24951 | 703 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Layer now has pixelformat [%x]\n",dlc.pixelformat); |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
704 }; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
705 |
24950 | 706 // check if we were succesful |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
707 if ((dlc.pixelformat != convformat(params.format)) || (ret != DFB_OK)) { |
9937 | 708 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Recovery failed!.\n"); |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
709 return CONFIG_ERROR; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
710 } |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
711 |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
712 break; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
713 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
714 default: return CONFIG_ERROR; |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
715 |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
716 }; |
9515 | 717 }; |
6952 | 718 }; |
719 | |
720 // flipping of layer | |
24950 | 721 // try triple, double... buffering |
6952 | 722 |
723 dlc.flags = DLCONF_BUFFERMODE; | |
9937 | 724 #ifdef TRIPLE |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
725 if (buffer_mode > 2) { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
726 dlc.buffermode = DLBM_TRIPLE; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
727 ret = layer->SetConfiguration( layer, &dlc ); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
728 } else { |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
729 ret=!DFB_OK; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
730 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
731 |
9937 | 732 if (ret!=DFB_OK) { |
733 #endif | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
734 if (buffer_mode > 1) { |
9937 | 735 dlc.buffermode = DLBM_BACKVIDEO; |
736 ret = layer->SetConfiguration( layer, &dlc ); | |
737 if (ret!=DFB_OK) { | |
738 dlc.buffermode = DLBM_BACKSYSTEM; | |
739 ret = layer->SetConfiguration( layer, &dlc ); | |
6952 | 740 } |
9937 | 741 } |
742 if (ret == DFB_OK) { | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
743 mp_msg(MSGT_VO, MSGL_V,"DirectFB: Double buffering is active\n"); |
9937 | 744 } |
745 #ifdef TRIPLE | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
746 } else { |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
747 mp_msg(MSGT_VO, MSGL_V,"DirectFB: Triple buffering is active\n"); |
9937 | 748 } |
749 #endif | |
6952 | 750 |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
751 #if DIRECTFBVERSION > DFB_VERSION(0,9,16) |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
752 if (field_parity != -1) { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
753 dlc.flags = DLCONF_OPTIONS; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
754 ret = layer->GetConfiguration( layer, &dlc ); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
755 if (ret==DFB_OK) { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
756 dlc.options |= DLOP_FIELD_PARITY; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
757 ret = layer->SetConfiguration( layer, &dlc ); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
758 if (ret==DFB_OK) { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
759 layer->SetFieldParity( layer, field_parity ); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
760 } |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
761 } |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
762 } |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
763 mp_msg( MSGT_VO, MSGL_DBG2, "DirectFB: Requested field parity: "); |
11972
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
764 switch (field_parity) { |
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
765 case -1: |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
766 mp_msg( MSGT_VO, MSGL_DBG2, "Don't care\n"); |
11972
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
767 break; |
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
768 case 0: |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
769 mp_msg( MSGT_VO, MSGL_DBG2, "Top field first\n"); |
11972
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
770 break; |
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
771 case 1: |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
772 mp_msg( MSGT_VO, MSGL_DBG2, "Bottom field first\n"); |
11972
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
773 break; |
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
774 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
775 |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
776 #endif |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
777 |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
778 |
6952 | 779 // get layer surface |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
780 |
6952 | 781 ret = layer->GetSurface(layer,&primary); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
782 |
6952 | 783 if (ret) { |
9937 | 784 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: ConfigError - could not get surface\n"); |
24950 | 785 return CONFIG_ERROR; // what shall we report on failure? |
6952 | 786 } |
787 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
788 // test surface for flipping |
6952 | 789 DFBCHECK(primary->GetCapabilities(primary,&caps)); |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
790 #if DIRECTFBVERSION > DFB_VERSION(0,9,13) |
9937 | 791 primary->Clear(primary,0,0,0,0xff); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
792 #endif |
6952 | 793 flipping = 0; |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
794 if (caps & (DSCAPS_FLIPPING |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
795 #ifdef TRIPLE |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
796 | DSCAPS_TRIPLE |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
797 #endif |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
798 )) { |
6952 | 799 ret = primary->Flip(primary,NULL,0); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
800 if (ret==DFB_OK) { |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
801 flipping = 1; |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
802 #if DIRECTFBVERSION > DFB_VERSION(0,9,13) |
9937 | 803 primary->Clear(primary,0,0,0,0xff); |
804 #ifdef TRIPLE | |
805 // if we have 3 buffers clean once more | |
806 if (caps & DSCAPS_TRIPLE) { | |
807 primary->Flip(primary,NULL,0); | |
808 primary->Clear(primary,0,0,0,0xff); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
809 flipping = 2; |
9937 | 810 } |
811 #endif | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
812 #endif |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
813 } |
6952 | 814 }; |
815 | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
816 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Config - flipping = %i\n",flipping); |
6952 | 817 |
818 // is scale needed ? Aspect ratio and layer pos/size | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
819 |
6952 | 820 |
821 // get surface size | |
822 DFBCHECK(primary->GetSize(primary,&width,&height)); | |
823 | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
824 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Config - surface size = %ix%i\n",width,height); |
6952 | 825 |
826 aspect_save_orig(s_width,s_height); | |
827 aspect_save_prescale(d_width,d_height); | |
828 if (params.scale) { | |
829 aspect_save_screenres(10000,10000); | |
830 aspect(&out_width,&out_height,A_ZOOM); | |
831 | |
832 ret = layer->SetScreenLocation(layer,(1-(float)out_width/10000)/2,(1-(float)out_height/10000)/2,((float)out_width/10000),((float)out_height/10000)); | |
833 | |
9937 | 834 if (ret) mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: ConfigError in layer configuration (position)\n"); |
6952 | 835 |
836 xoffset = 0; | |
837 yoffset = 0; | |
838 | |
839 } else { | |
840 | |
841 aspect_save_screenres(width,height); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
842 |
6952 | 843 if(fs) /* -fs */ |
844 aspect(&out_width,&out_height,A_ZOOM); | |
845 else | |
846 aspect(&out_width,&out_height,A_NOZOOM); | |
847 | |
848 | |
849 xoffset = (width - out_width) / 2; | |
850 yoffset = (height - out_height) / 2; | |
851 } | |
852 | |
853 if (((s_width==out_width)&&(s_height==out_height)) || (params.scale)) { | |
854 stretch = 0; | |
855 } else { | |
856 stretch = 1; | |
857 } | |
858 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
859 |
6952 | 860 // temporary buffer in case of not flipping or scaling |
861 if ((!flipping) || stretch) { | |
862 | |
863 DFBCHECK (primary->GetPixelFormat (primary, &dsc.pixelformat)); | |
864 | |
865 dsc.flags = DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH; | |
866 | |
867 dsc.width = s_width; | |
868 dsc.height = s_height; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
869 |
6952 | 870 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &frame)); |
871 DFBCHECK(frame->GetSize(frame,&width,&height)); | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
872 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Frame is active.\n"); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
873 } |
6952 | 874 |
875 // get format for draw_alpha - should be removed soon - osd will be rendered outside vo driver | |
876 if (frame) { | |
877 DFBCHECK (frame->GetPixelFormat(frame,&pixel_format)); | |
878 } else { | |
879 DFBCHECK (primary->GetPixelFormat(primary,&pixel_format)); | |
880 }; | |
881 | |
882 // finally turn on layer | |
883 layer->SetOpacity(layer,255); | |
884 | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
885 //mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config finished [%ix%i] - [%ix%i]\n",out_width,out_height,width,height); |
6952 | 886 |
887 return 0; | |
888 } | |
889 | |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
11982
diff
changeset
|
890 #include "osdep/keycodes.h" |
6952 | 891 |
892 static void check_events(void) | |
893 { | |
894 | |
895 if (buffer) { | |
896 | |
897 DFBInputEvent event; | |
898 | |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
899 //if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf ("DirectFB: Check events entered\n"); |
6952 | 900 if (buffer->GetEvent(buffer, DFB_EVENT (&event)) == DFB_OK) { |
901 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
902 if (event.type == DIET_KEYPRESS) { |
6952 | 903 switch (event.key_symbol) { |
904 case DIKS_ESCAPE: | |
16892
3470c810527b
libvo input cleanup: remove the dependency on libinput,
albeu
parents:
16171
diff
changeset
|
905 mplayer_put_key(KEY_ESC); |
6952 | 906 break; |
907 case DIKS_PAGE_UP: mplayer_put_key(KEY_PAGE_UP);break; | |
908 case DIKS_PAGE_DOWN: mplayer_put_key(KEY_PAGE_DOWN);break; | |
909 case DIKS_CURSOR_UP: mplayer_put_key(KEY_UP);break; | |
910 case DIKS_CURSOR_DOWN: mplayer_put_key(KEY_DOWN);break; | |
911 case DIKS_CURSOR_LEFT: mplayer_put_key(KEY_LEFT);break; | |
912 case DIKS_CURSOR_RIGHT: mplayer_put_key(KEY_RIGHT);break; | |
913 case DIKS_INSERT: mplayer_put_key(KEY_INSERT);break; | |
914 case DIKS_DELETE: mplayer_put_key(KEY_DELETE);break; | |
915 case DIKS_HOME: mplayer_put_key(KEY_HOME);break; | |
916 case DIKS_END: mplayer_put_key(KEY_END);break; | |
917 | |
918 default:mplayer_put_key(event.key_symbol); | |
919 }; | |
920 }; | |
921 }; | |
922 // empty buffer, because of repeating (keyboard repeat is faster than key handling | |
923 // and this causes problems during seek) | |
24950 | 924 // temporary workaround should be solved in the future |
6952 | 925 buffer->Reset(buffer); |
926 | |
927 } | |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
928 //if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf ("DirectFB: Check events finished\n"); |
6952 | 929 } |
930 | |
931 static void flip_page(void) | |
932 { | |
933 DFBSurfaceBlittingFlags flags=DSBLIT_NOFX; | |
934 | |
935 unlock(); // unlock frame & primary | |
936 | |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
937 // if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: Flip page entered"); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
938 |
6952 | 939 DFBCHECK (primary->SetBlittingFlags(primary,flags)); |
940 | |
941 if (frame) { | |
942 if (stretch) { | |
943 DFBRectangle rect; | |
944 rect.x=xoffset; | |
945 rect.y=yoffset; | |
946 rect.w=out_width; | |
947 rect.h=out_height; | |
948 | |
949 DFBCHECK (primary->StretchBlit(primary,frame,NULL,&rect)); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
950 |
6952 | 951 } else { |
952 | |
953 DFBCHECK (primary->Blit(primary,frame,NULL,xoffset,yoffset)); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
954 |
6952 | 955 }; |
956 }; | |
957 | |
958 | |
11972
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
959 #ifdef TRIPLE |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
960 switch (flipping) { |
11972
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
961 case 1: DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAIT)); |
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
962 break; |
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
963 case 2: DFBCHECK (primary->Flip (primary, NULL, DSFLIP_ONSYNC)); |
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
964 break; |
24950 | 965 default:; // should never be reached |
11972
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
966 } |
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
967 #else |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
968 if (flipping) { |
6952 | 969 DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC)); |
970 } | |
11972
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
971 #endif |
6952 | 972 |
973 } | |
974 | |
975 | |
976 | |
977 static void uninit(void) | |
978 { | |
979 | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
980 //mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Uninit entered\n"); |
6952 | 981 |
982 unlock(); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
983 |
6952 | 984 /* |
985 * (Release) | |
986 */ | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
987 /* |
9937 | 988 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing buffer\n"); |
6952 | 989 if (buffer) buffer->Release (buffer); |
9937 | 990 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing keyboard\n"); |
6952 | 991 if (keyboard) keyboard->Release (keyboard); |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
992 */ |
6952 | 993 if (frame) { |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
994 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Releasing frame\n"); |
6952 | 995 frame->Release (frame); |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
996 frame = NULL; |
6952 | 997 }; |
998 | |
999 // switch off BES | |
1000 // if (layer) layer->SetOpacity(layer,0); | |
1001 | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1002 if (layer) { |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
1003 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Releasing layer\n"); |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1004 layer->Release(layer); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1005 layer = NULL; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1006 } |
6952 | 1007 |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1008 if (primary) { |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
1009 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: Releasing primary\n"); |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1010 primary->Release (primary); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1011 primary = NULL; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1012 } |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1013 |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1014 |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1015 /* mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing DirectFB library\n"); |
6952 | 1016 |
1017 dfb->Release (dfb); | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1018 */ |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
1019 //mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Uninit done.\n"); |
6952 | 1020 } |
1021 | |
1022 | |
1023 static uint32_t directfb_set_video_eq(char *data, int value) //data==name | |
1024 { | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1025 |
6952 | 1026 DFBColorAdjustment ca; |
1027 float factor = (float)0xffff / 200.0; | |
1028 | |
1029 DFBDisplayLayerDescription desc; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1030 |
6952 | 1031 unlock(); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1032 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1033 if (layer) { |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1034 |
6952 | 1035 layer->GetDescription(layer,&desc); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1036 |
6952 | 1037 ca.flags=DCAF_NONE; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1038 |
6952 | 1039 if (! strcmp( data,"brightness" )) { |
1040 if (desc.caps & DLCAPS_BRIGHTNESS) { | |
1041 ca.brightness = value * factor +0x8000; | |
1042 ca.flags |= DCAF_BRIGHTNESS; | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
1043 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: SetVEq Brightness 0x%X %i\n",ca.brightness,value); |
6952 | 1044 } else return VO_FALSE; |
1045 } | |
1046 | |
1047 if (! strcmp( data,"contrast" )) { | |
1048 if ((desc.caps & DLCAPS_CONTRAST)) { | |
1049 ca.contrast = value * factor + 0x8000; | |
1050 ca.flags |= DCAF_CONTRAST; | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
1051 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: SetVEq Contrast 0x%X %i\n",ca.contrast,value); |
6952 | 1052 } else return VO_FALSE; |
1053 } | |
1054 | |
1055 if (! strcmp( data,"hue" )) { | |
1056 if ((desc.caps & DLCAPS_HUE)) { | |
1057 ca.hue = value * factor + 0x8000; | |
1058 ca.flags |= DCAF_HUE; | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
1059 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: SetVEq Hue 0x%X %i\n",ca.hue,value); |
6952 | 1060 } else return VO_FALSE; |
1061 } | |
1062 | |
1063 if (! strcmp( data,"saturation" )) { | |
1064 if ((desc.caps & DLCAPS_SATURATION)) { | |
1065 ca.saturation = value * factor + 0x8000; | |
1066 ca.flags |= DCAF_SATURATION; | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
1067 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: SetVEq Saturation 0x%X %i\n",ca.saturation,value); |
6952 | 1068 } else return VO_FALSE; |
1069 } | |
1070 | |
1071 if (ca.flags != DCAF_NONE) { | |
1072 layer->SetColorAdjustment(layer,&ca); | |
1073 return VO_TRUE; | |
1074 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1075 } |
6952 | 1076 |
1077 return VO_FALSE; | |
1078 | |
1079 } | |
1080 | |
1081 static uint32_t directfb_get_video_eq(char *data, int *value) // data==name | |
1082 { | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1083 |
6952 | 1084 DFBColorAdjustment ca; |
1085 float factor = 200.0 / (float)0xffff; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1086 |
6952 | 1087 DFBDisplayLayerDescription desc; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1088 |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1089 if (layer) { |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1090 |
6952 | 1091 unlock(); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1092 |
6952 | 1093 layer->GetDescription(layer,&desc); |
1094 | |
1095 layer->GetColorAdjustment(layer,&ca); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1096 |
6952 | 1097 if (! strcmp( data,"brightness" )) { |
1098 if (desc.caps & DLCAPS_BRIGHTNESS) { | |
1099 *value = (int) ((ca.brightness-0x8000) * factor); | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
1100 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: GetVEq Brightness 0x%X %i\n",ca.brightness,*value); |
6952 | 1101 return VO_TRUE; |
1102 } else return VO_FALSE; | |
1103 } | |
1104 | |
1105 if (! strcmp( data,"contrast" )) { | |
1106 if ((desc.caps & DLCAPS_CONTRAST)) { | |
1107 *value = (int) ((ca.contrast-0x8000) * factor); | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
1108 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: GetVEq Contrast 0x%X %i\n",ca.contrast,*value); |
6952 | 1109 return VO_TRUE; |
1110 } else return VO_FALSE; | |
1111 } | |
1112 | |
1113 if (! strcmp( data,"hue" )) { | |
1114 if ((desc.caps & DLCAPS_HUE)) { | |
1115 *value = (int) ((ca.hue-0x8000) * factor); | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
1116 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: GetVEq Hue 0x%X %i\n",ca.hue,*value); |
6952 | 1117 return VO_TRUE; |
1118 } else return VO_FALSE; | |
1119 } | |
1120 | |
1121 if (! strcmp( data,"saturation" )) { | |
1122 if ((desc.caps & DLCAPS_SATURATION)) { | |
1123 *value = (int) ((ca.saturation-0x8000) * factor); | |
24949
11d4bcd96bc3
Reduce excessive verbosity: Move debug messages to the appropriate MSGL
diego
parents:
24939
diff
changeset
|
1124 mp_msg(MSGT_VO, MSGL_DBG2,"DirectFB: GetVEq Saturation 0x%X %i\n",ca.saturation,*value); |
6952 | 1125 return VO_TRUE; |
1126 } else return VO_FALSE; | |
1127 } | |
1128 } | |
1129 return VO_FALSE; | |
1130 } | |
1131 | |
1132 static uint32_t get_image(mp_image_t *mpi) | |
1133 { | |
1134 | |
1135 int err; | |
25763 | 1136 uint8_t *dst; |
6952 | 1137 int pitch; |
1138 | |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
1139 // if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: get_image() called\n"); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1140 if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram |
6952 | 1141 if(mpi->type==MP_IMGTYPE_STATIC) return VO_FALSE; // it is not static |
1142 | |
1143 // printf("width=%d vs. pitch=%d, flags=0x%X \n",mpi->width,pitch,mpi->flags); | |
1144 | |
30250
8ddf6f92553a
Remove a check that simply can not have worked since it relied on a completely
reimar
parents:
29263
diff
changeset
|
1145 if(mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH)){ |
6952 | 1146 // we're lucky or codec accepts stride => ok, let's go! |
1147 | |
1148 if (frame) { | |
25763 | 1149 err = frame->Lock(frame,DSLF_WRITE|DSLF_READ,(void *)&dst,&pitch); |
6952 | 1150 framelocked=1; |
1151 } else { | |
25763 | 1152 err = primary->Lock(primary,DSLF_WRITE,(void *)&dst,&pitch); |
6952 | 1153 primarylocked=1; |
1154 } | |
1155 | |
1156 if (err) { | |
9937 | 1157 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: DR lock failed!"); |
6952 | 1158 return VO_FALSE; |
1159 }; | |
1160 | |
1161 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
1162 //YV12 format | |
1163 mpi->planes[0]=dst; | |
1164 if(mpi->flags&MP_IMGFLAG_SWAPPED){ | |
1165 mpi->planes[1]=dst + pitch*height; | |
1166 mpi->planes[2]=mpi->planes[1] + pitch*height/4; | |
1167 } else { | |
1168 mpi->planes[2]=dst + pitch*height; | |
1169 mpi->planes[1]=mpi->planes[2] + pitch*height/4; | |
1170 } | |
6985
6074119e09a0
Put/get_image fixed. Deleted forgotten development comments
zdar
parents:
6952
diff
changeset
|
1171 mpi->width=width; |
6074119e09a0
Put/get_image fixed. Deleted forgotten development comments
zdar
parents:
6952
diff
changeset
|
1172 mpi->stride[0]=pitch; |
6952 | 1173 mpi->stride[1]=mpi->stride[2]=pitch/2; |
1174 } else { | |
1175 //YUY2 and RGB formats | |
1176 mpi->planes[0]=dst; | |
1177 mpi->width=width; | |
1178 mpi->stride[0]=pitch; | |
1179 } | |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1180 |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1181 // center image |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1182 |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1183 if (!frame) { |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1184 if(mpi->flags&MP_IMGFLAG_PLANAR){ |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1185 mpi->planes[0]= dst + yoffset * pitch + xoffset; |
24939 | 1186 mpi->planes[1]+= ((yoffset * pitch) >> 2) + (xoffset >> 1); |
1187 mpi->planes[2]+= ((yoffset * pitch) >> 2) + (xoffset >> 1); | |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1188 } else { |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1189 mpi->planes[0]=dst + yoffset * pitch + xoffset * (mpi->bpp >> 3); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1190 } |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1191 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1192 |
6952 | 1193 mpi->flags|=MP_IMGFLAG_DIRECT; |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
1194 // if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: get_image() SUCCESS -> Direct Rendering ENABLED\n"); |
6952 | 1195 return VO_TRUE; |
1196 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1197 } |
6952 | 1198 return VO_FALSE; |
1199 } | |
1200 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15750
diff
changeset
|
1201 static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y) |
6952 | 1202 { |
1203 int i; | |
1204 unsigned int pitch; | |
25763 | 1205 uint8_t *dst; |
1206 uint8_t *dst2; | |
1207 uint8_t *srcp; | |
6952 | 1208 unsigned int p; |
1209 | |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
1210 // if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: draw_slice entered\n"); |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1211 |
6952 | 1212 unlock(); |
1213 | |
1214 if (frame) { | |
25763 | 1215 DFBCHECK (frame->Lock(frame,DSLF_WRITE|DSLF_READ,(void *)&dst,&pitch)); |
6952 | 1216 framelocked = 1; |
1217 } else { | |
25763 | 1218 DFBCHECK (primary->Lock(primary,DSLF_WRITE,(void *)&dst,&pitch)); |
6952 | 1219 primarylocked = 1; |
1220 }; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1221 |
6952 | 1222 p=min(w,pitch); |
1223 | |
1224 dst += y*pitch + x; | |
1225 dst2 = dst + pitch*height - y*pitch + y*pitch/4 - x/2; | |
1226 srcp = src[0]; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1227 |
6952 | 1228 for (i=0;i<h;i++) { |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22886
diff
changeset
|
1229 fast_memcpy(dst,srcp,p); |
6952 | 1230 dst += pitch; |
1231 srcp += stride[0]; | |
1232 } | |
1233 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1234 if (pixel_format == DSPF_YV12) { |
6952 | 1235 |
1236 dst = dst2; | |
1237 srcp = src[2]; | |
1238 p = p/2; | |
1239 | |
1240 for (i=0;i<h/2;i++) { | |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22886
diff
changeset
|
1241 fast_memcpy(dst,srcp,p); |
6952 | 1242 dst += pitch/2; |
1243 srcp += stride[2]; | |
1244 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1245 |
6952 | 1246 dst = dst2 + pitch*height/4; |
1247 srcp = src[1]; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1248 |
6952 | 1249 for (i=0;i<h/2;i++) { |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22886
diff
changeset
|
1250 fast_memcpy(dst,srcp,p); |
6952 | 1251 dst += pitch/2; |
1252 srcp += stride[1]; | |
1253 } | |
1254 | |
1255 } else { | |
1256 | |
1257 dst = dst2; | |
1258 srcp = src[1]; | |
1259 p = p/2; | |
1260 | |
1261 for (i=0;i<h/2;i++) { | |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22886
diff
changeset
|
1262 fast_memcpy(dst,srcp,p); |
6952 | 1263 dst += pitch/2; |
1264 srcp += stride[1]; | |
1265 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1266 |
6952 | 1267 dst = dst2 + pitch*height/4; |
1268 srcp = src[2]; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1269 |
6952 | 1270 for (i=0;i<h/2;i++) { |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22886
diff
changeset
|
1271 fast_memcpy(dst,srcp,p); |
6952 | 1272 dst += pitch/2; |
1273 srcp += stride[2]; | |
1274 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1275 |
6952 | 1276 } |
1277 | |
1278 unlock(); | |
1279 | |
1280 return 0; | |
1281 } | |
1282 | |
1283 | |
1284 static uint32_t put_image(mp_image_t *mpi){ | |
1285 | |
1286 | |
24166 | 1287 // static IDirectFBSurface *tmp = NULL; |
1288 // DFBSurfaceDescription dsc; | |
1289 // DFBRectangle rect; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1290 |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
1291 // if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: Put_image entered %i %i %i %i %i %i\n",mpi->x,mpi->y,mpi->w,mpi->h,mpi->width,mpi->height); |
6952 | 1292 |
1293 unlock(); | |
1294 | |
1295 // already out? | |
6985
6074119e09a0
Put/get_image fixed. Deleted forgotten development comments
zdar
parents:
6952
diff
changeset
|
1296 if((mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))) { |
24951 | 1297 // if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: Put_image - nothing to do\n"); |
6952 | 1298 return VO_TRUE; |
1299 } | |
1300 | |
1301 if (mpi->flags&MP_IMGFLAG_PLANAR) { | |
1302 // memcpy all planes - sad but necessary | |
1303 int i; | |
1304 unsigned int pitch; | |
25763 | 1305 uint8_t *dst; |
1306 uint8_t *src; | |
6952 | 1307 unsigned int p; |
1308 | |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
1309 // if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: Put_image - planar branch\n"); |
6952 | 1310 if (frame) { |
25763 | 1311 DFBCHECK (frame->Lock(frame,DSLF_WRITE|DSLF_READ,(void *)&dst,&pitch)); |
6952 | 1312 framelocked = 1; |
1313 } else { | |
25763 | 1314 DFBCHECK (primary->Lock(primary,DSLF_WRITE,(void *)&dst,&pitch)); |
6952 | 1315 primarylocked = 1; |
1316 }; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1317 |
6952 | 1318 p=min(mpi->w,pitch); |
1319 | |
1320 src = mpi->planes[0]+mpi->y*mpi->stride[0]+mpi->x; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1321 |
6952 | 1322 for (i=0;i<mpi->h;i++) { |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22886
diff
changeset
|
1323 fast_memcpy(dst+i*pitch,src+i*mpi->stride[0],p); |
6952 | 1324 } |
1325 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1326 |
6952 | 1327 if (pixel_format == DSPF_YV12) { |
1328 | |
1329 dst += pitch*height; | |
1330 p = p/2; | |
1331 src = mpi->planes[2]+mpi->y*mpi->stride[2]+mpi->x/2; | |
1332 | |
1333 for (i=0;i<mpi->h/2;i++) { | |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22886
diff
changeset
|
1334 fast_memcpy(dst+i*pitch/2,src+i*mpi->stride[2],p); |
6952 | 1335 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1336 |
6952 | 1337 dst += pitch*height/4; |
1338 src = mpi->planes[1]+mpi->y*mpi->stride[1]+mpi->x/2; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1339 |
6952 | 1340 for (i=0;i<mpi->h/2;i++) { |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22886
diff
changeset
|
1341 fast_memcpy(dst+i*pitch/2,src+i*mpi->stride[1],p); |
6952 | 1342 } |
1343 | |
1344 } else { | |
1345 | |
1346 dst += pitch*height; | |
1347 p = p/2; | |
1348 src = mpi->planes[1]+mpi->y*mpi->stride[1]+mpi->x/2; | |
1349 | |
1350 for (i=0;i<mpi->h/2;i++) { | |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22886
diff
changeset
|
1351 fast_memcpy(dst+i*pitch/2,src+i*mpi->stride[1],p); |
6952 | 1352 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1353 |
6952 | 1354 dst += pitch*height/4; |
1355 src = mpi->planes[2]+mpi->y*mpi->stride[2]+mpi->x/2; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1356 |
6952 | 1357 for (i=0;i<mpi->h/2;i++) { |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22886
diff
changeset
|
1358 fast_memcpy(dst+i*pitch/2,src+i*mpi->stride[2],p); |
6952 | 1359 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1360 |
6952 | 1361 } |
1362 unlock(); | |
1363 | |
1364 } else { | |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1365 // I had to disable native directfb blit because it wasn't working under some conditions :-( |
6952 | 1366 |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1367 /* |
6952 | 1368 dsc.flags = DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH | DSDESC_PREALLOCATED; |
1369 dsc.preallocated[0].data = mpi->planes[0]; | |
1370 dsc.preallocated[0].pitch = mpi->stride[0]; | |
1371 dsc.width = mpi->width; | |
1372 dsc.height = mpi->height; | |
1373 dsc.pixelformat = convformat(mpi->imgfmt); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1374 |
6952 | 1375 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &tmp)); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1376 |
6952 | 1377 rect.x=mpi->x; |
1378 rect.y=mpi->y; | |
1379 rect.w=mpi->w; | |
1380 rect.h=mpi->h; | |
1381 | |
1382 if (frame) { | |
1383 DFBCHECK (tmp->Blit(tmp,frame,&rect,0,0)); | |
1384 } else { | |
1385 DFBCHECK (tmp->Blit(tmp,primary,&rect,xoffset,yoffset)); | |
1386 }; | |
1387 tmp->Release(tmp); | |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1388 */ |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1389 |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1390 unsigned int pitch; |
25763 | 1391 uint8_t *dst; |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1392 |
24951 | 1393 // if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: Put_image - non-planar branch\n"); |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1394 if (frame) { |
25763 | 1395 DFBCHECK (frame->Lock(frame,DSLF_WRITE,(void *)&dst,&pitch)); |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1396 framelocked = 1; |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1397 mem2agpcpy_pic(dst,mpi->planes[0] + mpi->y * mpi->stride[0] + mpi->x * (mpi->bpp >> 3) ,mpi->w * (mpi->bpp >> 3),mpi->h,pitch,mpi->stride[0]); |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1398 } else { |
25763 | 1399 DFBCHECK (primary->Lock(primary,DSLF_WRITE,(void *)&dst,&pitch)); |
10840
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1400 primarylocked = 1; |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1401 mem2agpcpy_pic(dst + yoffset * pitch + xoffset * (mpi->bpp >> 3),mpi->planes[0] + mpi->y * mpi->stride[0] + mpi->x * (mpi->bpp >> 3) ,mpi->w * (mpi->bpp >> 3),mpi->h,pitch,mpi->stride[0]); |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1402 }; |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1403 unlock(); |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1404 |
6952 | 1405 } |
1406 return VO_TRUE; | |
1407 } | |
1408 | |
1409 | |
1410 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15750
diff
changeset
|
1411 static int control(uint32_t request, void *data, ...) |
6952 | 1412 { |
1413 switch (request) { | |
1414 case VOCTRL_QUERY_FORMAT: | |
1415 return query_format(*((uint32_t*)data)); | |
1416 case VOCTRL_GET_IMAGE: | |
1417 return get_image(data); | |
1418 case VOCTRL_DRAW_IMAGE: | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1419 return put_image(data); |
6952 | 1420 case VOCTRL_SET_EQUALIZER: |
1421 { | |
1422 va_list ap; | |
1423 int value; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1424 |
6952 | 1425 va_start(ap, data); |
1426 value = va_arg(ap, int); | |
1427 va_end(ap); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1428 |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
25764
diff
changeset
|
1429 return directfb_set_video_eq(data, value); |
6952 | 1430 } |
1431 case VOCTRL_GET_EQUALIZER: | |
1432 { | |
1433 va_list ap; | |
1434 int *value; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1435 |
6952 | 1436 va_start(ap, data); |
1437 value = va_arg(ap, int*); | |
1438 va_end(ap); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1439 |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
25764
diff
changeset
|
1440 return directfb_get_video_eq(data, value); |
6952 | 1441 } |
1442 }; | |
1443 return VO_NOTIMPL; | |
1444 } | |
1445 | |
1446 // unused function | |
1447 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15750
diff
changeset
|
1448 static int draw_frame(uint8_t *src[]) |
6952 | 1449 { |
1450 return -1; | |
1451 } | |
1452 | |
1453 // hopefully will be removed soon | |
1454 | |
1455 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, | |
1456 unsigned char *srca, int stride) | |
1457 { | |
1458 void *dst; | |
1459 int pitch; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1460 |
11000 | 1461 unlock(); // isn't it silly I have to unlock surface and then lock it again :-) |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1462 |
6952 | 1463 if (frame) { |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1464 DFBCHECK (frame->Lock(frame,DSLF_WRITE|DSLF_READ,&dst,&pitch)); |
6952 | 1465 framelocked = 1; |
1466 } else { | |
1467 DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch)); | |
1468 primarylocked = 1; | |
1469 }; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28828
diff
changeset
|
1470 |
6952 | 1471 switch(pixel_format) { |
1472 case DSPF_RGB32: | |
1473 case DSPF_ARGB: | |
1474 vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 4*x0,pitch); | |
1475 break; | |
1476 | |
1477 case DSPF_RGB24: | |
1478 vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 3*x0,pitch); | |
1479 break; | |
1480 | |
1481 case DSPF_RGB16: | |
1482 vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch); | |
1483 break; | |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
1484 #if DIRECTFBVERSION > DFB_VERSION(0,9,15) |
8640 | 1485 case DSPF_ARGB1555: |
1486 #else | |
6952 | 1487 case DSPF_RGB15: |
8640 | 1488 #endif |
6952 | 1489 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch); |
1490 break; | |
1491 | |
1492 case DSPF_YUY2: | |
1493 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0,pitch); | |
1494 break; | |
1495 | |
1496 case DSPF_UYVY: | |
1497 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0 + 1,pitch); | |
1498 break; | |
1499 | |
1500 case DSPF_I420: | |
1501 case DSPF_YV12: | |
1502 vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 1*x0,pitch); | |
1503 break; | |
1504 } | |
1505 | |
1506 unlock(); | |
1507 } | |
1508 | |
1509 static void draw_osd(void) | |
1510 { | |
1511 vo_draw_text(width,height,draw_alpha); | |
1512 } |