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