Mercurial > mplayer.hg
annotate libvo/vo_directfb2.c @ 24410:606006d9f2f1
Do not replace _ by - if x86_64 is given in --target.
Patch by Andrew Calkin (andrew calkin gmail com)
author | reimar |
---|---|
date | Wed, 12 Sep 2007 06:59:36 +0000 |
parents | 57a3895ba1cc |
children | 1889da7f76f3 |
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 |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
8137
diff
changeset
|
61 static 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 | |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
8137
diff
changeset
|
68 LIBVO_EXTERN(directfb) |
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; | |
112 // pictrure position | |
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 |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
186 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Preinit entered\n"); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
187 |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
188 if (dfb) return 0; // we are already inited! |
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 | |
259 // uncomment this if you do not wish to create a new vt for DirectFB | |
260 // DFBCHECK (DirectFBSetOption ("no-vt-switch","")); | |
261 | |
262 // uncomment this if you want to allow vt switching | |
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)) { |
9937 | 279 mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - cannot swith 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) { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
290 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Keyboard init OK\n"); |
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 | |
303 // just to start with clean ... | |
304 if (buffer) buffer->Reset(buffer); | |
305 | |
9937 | 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 | |
9937 | 386 mp_msg(MSGT_VO, MSGL_INFO,"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; | |
9937 | 394 mp_msg(MSGT_VO, MSGL_INFO,"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; | |
9937 | 400 mp_msg(MSGT_VO, MSGL_INFO,"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 { |
412 int ret = VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_OSD; // osd should be removed in future -> will be handled outside... | |
413 enum1_t params; | |
414 | |
415 | |
416 if (!convformat(format)) return 0; | |
417 // temporary disable YV12 | |
418 // if (format == IMGFMT_YV12) return 0; | |
419 // if (format == IMGFMT_I420) return 0; | |
420 if (format == IMGFMT_IYUV) return 0; | |
421 | |
9937 | 422 mp_msg(MSGT_VO, MSGL_INFO,"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 | |
450 DFBEnumerationResult video_modes_callback( unsigned int width,unsigned int height,unsigned int bpp, void *data) | |
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 | |
9937 | 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; | |
9937 | 467 mp_msg(MSGT_VO, MSGL_INFO,"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; | |
9937 | 478 mp_msg(MSGT_VO, MSGL_INFO,"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; |
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
13787
diff
changeset
|
498 int zoom = flags & VOFLAG_SWSCALE; |
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
13787
diff
changeset
|
499 int flip = flags & VOFLAG_FLIPPING; |
6952 | 500 |
501 DFBSurfaceDescription dsc; | |
502 DFBResult ret; | |
503 DFBDisplayLayerConfig dlc; | |
504 DFBSurfaceCapabilities caps; | |
505 | |
506 enum1_t params; | |
507 | |
9937 | 508 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config entered [%ix%i]\n",s_width,s_height); |
509 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: With requested format: %s\n",vo_format_name(format)); | |
510 | |
6952 | 511 // initial clean-up |
512 if (frame) { | |
513 frame->Release(frame); | |
514 frame=NULL; | |
515 } | |
516 | |
517 if (primary) { | |
518 primary->Release(primary); | |
519 primary=NULL; | |
520 } | |
521 | |
522 if (layer) { | |
523 layer->Release(layer); | |
524 layer=NULL; | |
525 } | |
526 | |
527 | |
528 // vm things | |
529 | |
530 if (vm) { | |
531 videomode_t params; | |
532 params.out_width=d_width; | |
533 params.out_height=d_height; | |
534 params.width=0; | |
535 params.height=0; | |
536 switch (format) { | |
9515 | 537 case IMGFMT_RGB32: |
538 case IMGFMT_BGR32: | |
6952 | 539 params.bpp=32; |
540 break; | |
9515 | 541 case IMGFMT_RGB24: |
542 case IMGFMT_BGR24: | |
6952 | 543 params.bpp=24; |
544 break; | |
545 case IMGFMT_RGB16: | |
546 case IMGFMT_BGR16: | |
547 case IMGFMT_RGB15: | |
548 case IMGFMT_BGR15: | |
549 params.bpp=16; | |
550 break; | |
9515 | 551 default: params.bpp=0; |
552 | |
553 } | |
9937 | 554 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - trying to change videomode\n"); |
6952 | 555 DFBCHECK (dfb->EnumVideoModes(dfb,video_modes_callback,¶ms)); |
556 ret=dfb->SetVideoMode(dfb,params.width,params.height,params.bpp); | |
557 if (ret) { | |
558 ret=dfb->SetVideoMode(dfb,params.width,params.height,24); | |
559 if (ret) { | |
560 ret=dfb->SetVideoMode(dfb,params.width,params.height,32); | |
561 if (ret) { | |
562 ret=dfb->SetVideoMode(dfb,params.width,params.height,16); | |
563 if (ret) { | |
564 ret=dfb->SetVideoMode(dfb,params.width,params.height,8); | |
565 } | |
566 } | |
567 } | |
568 } | |
569 } // vm end | |
570 | |
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 // just for sure clear primary layer |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
572 #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
|
573 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
|
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 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
|
576 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
|
577 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
|
578 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
|
579 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
|
580 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
|
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->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
|
583 } |
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 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
|
585 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
|
586 } |
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 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
|
588 #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
|
589 |
6952 | 590 // find best layer |
591 | |
9937 | 592 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - looking for suitable layer\n"); |
6952 | 593 params.format=format; |
594 params.scale=0; | |
595 params.result=0; | |
596 params.width=s_width; | |
597 params.height=s_height; | |
598 params.setsize=1; | |
599 | |
600 DFBCHECK (dfb->EnumDisplayLayers(dfb,test_format_callback,¶ms)); | |
601 | |
602 if (!params.result) { | |
9937 | 603 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: ConfigError - no suitable layer found\n"); |
6952 | 604 params.id = DLID_PRIMARY; |
9515 | 605 } |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
606 |
9937 | 607 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - layer %i\n",params.id); |
6952 | 608 |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
609 // setup layer |
6952 | 610 |
611 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
|
612 |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
613 #if DIRECTFBVERSION > DFB_VERSION(0,9,16) |
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
|
614 mp_msg(MSGT_VO, MSGL_INFO,"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
|
615 ret = layer->SetCooperativeLevel (layer, DLSCL_EXCLUSIVE); |
6952 | 616 |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
617 if (DFB_OK != ret) { |
9937 | 618 mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - cannot swith 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
|
619 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
|
620 }; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
621 #endif |
6952 | 622 if (params.scale) { |
9937 | 623 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - changing layer configuration (size)\n"); |
6952 | 624 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT; |
625 dlc.width = s_width; | |
626 dlc.height = s_height; | |
9515 | 627 |
6952 | 628 ret = layer->SetConfiguration(layer,&dlc); |
9515 | 629 |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
630 if (ret) { |
9937 | 631 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
|
632 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
|
633 }; |
6952 | 634 } |
635 | |
9515 | 636 // look if we need to change pixel fromat of layer |
637 // and just for sure fetch also all layer propreties | |
638 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
|
639 |
9515 | 640 ret = layer->GetConfiguration(layer,&dlc); |
641 | |
642 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_WIDTH | DLCONF_HEIGHT; | |
643 | |
644 if (ret) { | |
9937 | 645 mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - could not get layer properties!\n"); |
646 } else { | |
647 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Layer reports format:%x\n",dlc.pixelformat); | |
9515 | 648 } |
6952 | 649 |
9515 | 650 if ((dlc.pixelformat != convformat(params.format)) || (ret != DFB_OK)) { |
651 | |
652 dlc.flags = DLCONF_PIXELFORMAT; | |
653 dlc.pixelformat = convformat(params.format); | |
654 | |
9937 | 655 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Desired pixelformat: %x\n",dlc.pixelformat); |
9515 | 656 |
9937 | 657 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - changing layer configuration (format)\n"); |
9515 | 658 ret = layer->SetConfiguration(layer,&dlc); |
659 | |
660 if (ret) { | |
9538
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
661 unsigned int bpp; |
9937 | 662 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
|
663 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
|
664 |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
665 // ugly fbdev workabout - try to switch pixelformat via videomode change |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
666 switch (dlc.pixelformat) { |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
667 case DSPF_ARGB: |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
668 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
|
669 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
|
670 case DSPF_RGB16: bpp=16;break; |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
671 #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
|
672 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
|
673 #else |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
674 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
|
675 #endif |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
676 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
|
677 } |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
678 |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
679 switch (dlc.pixelformat) { |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
680 case DSPF_ARGB: |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
681 case DSPF_RGB32: |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
682 case DSPF_RGB24: |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
683 case DSPF_RGB16: |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
684 #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
|
685 case DSPF_ARGB1555: |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
686 #else |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
687 case DSPF_RGB15: |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
688 #endif |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
689 case DSPF_RGB332: |
9937 | 690 mp_msg(MSGT_VO, MSGL_INFO,"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
|
691 // get size |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
692 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
|
693 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
|
694 // try to set videomode |
9937 | 695 mp_msg(MSGT_VO, MSGL_INFO,"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
|
696 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
|
697 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
|
698 |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
699 }; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
700 |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
701 //get current pixel format |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
702 dlc.flags = DLCONF_PIXELFORMAT; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
703 ret = layer->GetConfiguration(layer,&dlc); |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
704 if (ret) { |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
705 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
|
706 } else { |
9937 | 707 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Layer has now 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
|
708 }; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
709 |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
710 // check if we were succesfull |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
711 if ((dlc.pixelformat != convformat(params.format)) || (ret != DFB_OK)) { |
9937 | 712 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
|
713 return CONFIG_ERROR; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
714 } |
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 break; |
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 default: return CONFIG_ERROR; |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
719 |
7b1907aa1422
Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents:
9515
diff
changeset
|
720 }; |
9515 | 721 }; |
6952 | 722 }; |
723 | |
724 // flipping of layer | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
725 // try triple, \double... buffering |
6952 | 726 |
727 dlc.flags = DLCONF_BUFFERMODE; | |
9937 | 728 #ifdef TRIPLE |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
729 if (buffer_mode > 2) { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
730 dlc.buffermode = DLBM_TRIPLE; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
731 ret = layer->SetConfiguration( layer, &dlc ); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
732 } else { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
733 ret=!DFB_OK; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
734 } |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
735 |
9937 | 736 if (ret!=DFB_OK) { |
737 #endif | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
738 if (buffer_mode > 1) { |
9937 | 739 dlc.buffermode = DLBM_BACKVIDEO; |
740 ret = layer->SetConfiguration( layer, &dlc ); | |
741 if (ret!=DFB_OK) { | |
742 dlc.buffermode = DLBM_BACKSYSTEM; | |
743 ret = layer->SetConfiguration( layer, &dlc ); | |
6952 | 744 } |
9937 | 745 } |
746 if (ret == DFB_OK) { | |
747 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Double buffering is active\n"); | |
748 } | |
749 #ifdef TRIPLE | |
750 } else { | |
751 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Triple buffering is active\n"); | |
752 } | |
753 #endif | |
6952 | 754 |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
755 #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
|
756 if (field_parity != -1) { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
757 dlc.flags = DLCONF_OPTIONS; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
758 ret = layer->GetConfiguration( layer, &dlc ); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
759 if (ret==DFB_OK) { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
760 dlc.options |= DLOP_FIELD_PARITY; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
761 ret = layer->SetConfiguration( layer, &dlc ); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
762 if (ret==DFB_OK) { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
763 layer->SetFieldParity( layer, field_parity ); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
764 } |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
765 } |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
766 } |
11972
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
767 mp_msg( MSGT_VO, MSGL_INFO, "DirectFB: Requested 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
|
768 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
|
769 case -1: |
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 mp_msg( MSGT_VO, MSGL_INFO, "Don't care\n"); |
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
771 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
|
772 case 0: |
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 mp_msg( MSGT_VO, MSGL_INFO, "Top field first\n"); |
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
774 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
|
775 case 1: |
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 mp_msg( MSGT_VO, MSGL_INFO, "Bottom field first\n"); |
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 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
|
778 } |
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
|
779 |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
780 #endif |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
781 |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
782 |
6952 | 783 // get layer surface |
784 | |
785 ret = layer->GetSurface(layer,&primary); | |
786 | |
787 if (ret) { | |
9937 | 788 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: ConfigError - could not get surface\n"); |
6952 | 789 return CONFIG_ERROR; // what shall we report on fail? |
790 } | |
791 | |
792 // test surface for flipping | |
793 DFBCHECK(primary->GetCapabilities(primary,&caps)); | |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
794 #if DIRECTFBVERSION > DFB_VERSION(0,9,13) |
9937 | 795 primary->Clear(primary,0,0,0,0xff); |
8137
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
796 #endif |
6952 | 797 flipping = 0; |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
798 if (caps & (DSCAPS_FLIPPING |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
799 #ifdef TRIPLE |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
800 | DSCAPS_TRIPLE |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
801 #endif |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
802 )) { |
6952 | 803 ret = primary->Flip(primary,NULL,0); |
804 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
|
805 flipping = 1; |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
806 #if DIRECTFBVERSION > DFB_VERSION(0,9,13) |
9937 | 807 primary->Clear(primary,0,0,0,0xff); |
808 #ifdef TRIPLE | |
809 // if we have 3 buffers clean once more | |
810 if (caps & DSCAPS_TRIPLE) { | |
811 primary->Flip(primary,NULL,0); | |
812 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
|
813 flipping = 2; |
9937 | 814 } |
815 #endif | |
8137
530d1c5f0c78
Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents:
7272
diff
changeset
|
816 #endif |
6952 | 817 } |
818 }; | |
819 | |
9937 | 820 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - flipping = %i\n",flipping); |
6952 | 821 |
822 // is scale needed ? Aspect ratio and layer pos/size | |
823 | |
824 | |
825 // get surface size | |
826 DFBCHECK(primary->GetSize(primary,&width,&height)); | |
827 | |
9937 | 828 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - surface size = %ix%i\n",width,height); |
6952 | 829 |
830 aspect_save_orig(s_width,s_height); | |
831 aspect_save_prescale(d_width,d_height); | |
832 if (params.scale) { | |
833 aspect_save_screenres(10000,10000); | |
834 aspect(&out_width,&out_height,A_ZOOM); | |
835 | |
836 ret = layer->SetScreenLocation(layer,(1-(float)out_width/10000)/2,(1-(float)out_height/10000)/2,((float)out_width/10000),((float)out_height/10000)); | |
837 | |
9937 | 838 if (ret) mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: ConfigError in layer configuration (position)\n"); |
6952 | 839 |
840 xoffset = 0; | |
841 yoffset = 0; | |
842 | |
843 } else { | |
844 | |
845 aspect_save_screenres(width,height); | |
846 | |
847 if(fs) /* -fs */ | |
848 aspect(&out_width,&out_height,A_ZOOM); | |
849 else | |
850 aspect(&out_width,&out_height,A_NOZOOM); | |
851 | |
852 | |
853 xoffset = (width - out_width) / 2; | |
854 yoffset = (height - out_height) / 2; | |
855 } | |
856 | |
857 if (((s_width==out_width)&&(s_height==out_height)) || (params.scale)) { | |
858 stretch = 0; | |
859 } else { | |
860 stretch = 1; | |
861 } | |
862 | |
863 | |
864 // temporary buffer in case of not flipping or scaling | |
865 if ((!flipping) || stretch) { | |
866 | |
867 DFBCHECK (primary->GetPixelFormat (primary, &dsc.pixelformat)); | |
868 | |
869 dsc.flags = DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH; | |
870 | |
871 dsc.width = s_width; | |
872 dsc.height = s_height; | |
873 | |
874 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &frame)); | |
875 DFBCHECK(frame->GetSize(frame,&width,&height)); | |
9937 | 876 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Frame is active.\n"); |
6952 | 877 } |
878 | |
879 // get format for draw_alpha - should be removed soon - osd will be rendered outside vo driver | |
880 if (frame) { | |
881 DFBCHECK (frame->GetPixelFormat(frame,&pixel_format)); | |
882 } else { | |
883 DFBCHECK (primary->GetPixelFormat(primary,&pixel_format)); | |
884 }; | |
885 | |
886 // finally turn on layer | |
887 layer->SetOpacity(layer,255); | |
888 | |
9937 | 889 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config finished [%ix%i] - [%ix%i]\n",out_width,out_height,width,height); |
6952 | 890 |
891 return 0; | |
892 } | |
893 | |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
11982
diff
changeset
|
894 #include "osdep/keycodes.h" |
6952 | 895 |
896 static void check_events(void) | |
897 { | |
898 | |
899 if (buffer) { | |
900 | |
901 DFBInputEvent event; | |
902 | |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
903 //if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf ("DirectFB: Check events entered\n"); |
6952 | 904 if (buffer->GetEvent(buffer, DFB_EVENT (&event)) == DFB_OK) { |
905 | |
906 if (event.type == DIET_KEYPRESS) { | |
907 switch (event.key_symbol) { | |
908 case DIKS_ESCAPE: | |
16892
3470c810527b
libvo input cleanup: remove the dependency on libinput,
albeu
parents:
16171
diff
changeset
|
909 mplayer_put_key(KEY_ESC); |
6952 | 910 break; |
911 case DIKS_PAGE_UP: mplayer_put_key(KEY_PAGE_UP);break; | |
912 case DIKS_PAGE_DOWN: mplayer_put_key(KEY_PAGE_DOWN);break; | |
913 case DIKS_CURSOR_UP: mplayer_put_key(KEY_UP);break; | |
914 case DIKS_CURSOR_DOWN: mplayer_put_key(KEY_DOWN);break; | |
915 case DIKS_CURSOR_LEFT: mplayer_put_key(KEY_LEFT);break; | |
916 case DIKS_CURSOR_RIGHT: mplayer_put_key(KEY_RIGHT);break; | |
917 case DIKS_INSERT: mplayer_put_key(KEY_INSERT);break; | |
918 case DIKS_DELETE: mplayer_put_key(KEY_DELETE);break; | |
919 case DIKS_HOME: mplayer_put_key(KEY_HOME);break; | |
920 case DIKS_END: mplayer_put_key(KEY_END);break; | |
921 | |
922 default:mplayer_put_key(event.key_symbol); | |
923 }; | |
924 }; | |
925 }; | |
926 // empty buffer, because of repeating (keyboard repeat is faster than key handling | |
927 // and this causes problems during seek) | |
928 // temporary workabout should be solved in the future | |
929 buffer->Reset(buffer); | |
930 | |
931 } | |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
932 //if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf ("DirectFB: Check events finished\n"); |
6952 | 933 } |
934 | |
935 static void flip_page(void) | |
936 { | |
937 DFBSurfaceBlittingFlags flags=DSBLIT_NOFX; | |
938 | |
939 unlock(); // unlock frame & primary | |
940 | |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
941 // if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: Flip page entered"); |
6952 | 942 |
943 DFBCHECK (primary->SetBlittingFlags(primary,flags)); | |
944 | |
945 if (frame) { | |
946 if (stretch) { | |
947 DFBRectangle rect; | |
948 rect.x=xoffset; | |
949 rect.y=yoffset; | |
950 rect.w=out_width; | |
951 rect.h=out_height; | |
952 | |
953 DFBCHECK (primary->StretchBlit(primary,frame,NULL,&rect)); | |
954 | |
955 } else { | |
956 | |
957 DFBCHECK (primary->Blit(primary,frame,NULL,xoffset,yoffset)); | |
958 | |
959 }; | |
960 }; | |
961 | |
962 | |
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
|
963 #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
|
964 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
|
965 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
|
966 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
|
967 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
|
968 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
|
969 default:; // should never reach here |
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
|
970 } |
cda09732375e
removed usage of fb_dev_name, imported field parity reporting from dfbmga, fixed vsync handling in triple buffering mode
zdar
parents:
11000
diff
changeset
|
971 #else |
6952 | 972 if (flipping) { |
973 DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC)); | |
974 } | |
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
|
975 #endif |
6952 | 976 |
977 } | |
978 | |
979 | |
980 | |
981 static void uninit(void) | |
982 { | |
983 | |
9937 | 984 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Uninit entered\n"); |
6952 | 985 |
986 unlock(); | |
987 | |
988 /* | |
989 * (Release) | |
990 */ | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
991 /* |
9937 | 992 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing buffer\n"); |
6952 | 993 if (buffer) buffer->Release (buffer); |
9937 | 994 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing keyboard\n"); |
6952 | 995 if (keyboard) keyboard->Release (keyboard); |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
996 */ |
6952 | 997 if (frame) { |
9937 | 998 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing frame\n"); |
6952 | 999 frame->Release (frame); |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1000 frame = NULL; |
6952 | 1001 }; |
1002 | |
1003 // switch off BES | |
1004 // if (layer) layer->SetOpacity(layer,0); | |
1005 | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1006 if (layer) { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1007 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing layer\n"); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1008 layer->Release(layer); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1009 layer = NULL; |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1010 } |
6952 | 1011 |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1012 if (primary) { |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1013 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing primary\n"); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1014 primary->Release (primary); |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1015 primary = NULL; |
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 |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1018 |
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1019 /* mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing DirectFB library\n"); |
6952 | 1020 |
1021 dfb->Release (dfb); | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1022 */ |
9937 | 1023 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Uninit done.\n"); |
6952 | 1024 } |
1025 | |
1026 | |
1027 static uint32_t directfb_set_video_eq(char *data, int value) //data==name | |
1028 { | |
1029 | |
1030 DFBColorAdjustment ca; | |
1031 float factor = (float)0xffff / 200.0; | |
1032 | |
1033 DFBDisplayLayerDescription desc; | |
1034 | |
1035 unlock(); | |
1036 | |
1037 if (layer) { | |
1038 | |
1039 layer->GetDescription(layer,&desc); | |
1040 | |
1041 ca.flags=DCAF_NONE; | |
1042 | |
1043 if (! strcmp( data,"brightness" )) { | |
1044 if (desc.caps & DLCAPS_BRIGHTNESS) { | |
1045 ca.brightness = value * factor +0x8000; | |
1046 ca.flags |= DCAF_BRIGHTNESS; | |
9937 | 1047 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: SetVEq Brightness 0x%X %i\n",ca.brightness,value); |
6952 | 1048 } else return VO_FALSE; |
1049 } | |
1050 | |
1051 if (! strcmp( data,"contrast" )) { | |
1052 if ((desc.caps & DLCAPS_CONTRAST)) { | |
1053 ca.contrast = value * factor + 0x8000; | |
1054 ca.flags |= DCAF_CONTRAST; | |
9937 | 1055 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: SetVEq Contrast 0x%X %i\n",ca.contrast,value); |
6952 | 1056 } else return VO_FALSE; |
1057 } | |
1058 | |
1059 if (! strcmp( data,"hue" )) { | |
1060 if ((desc.caps & DLCAPS_HUE)) { | |
1061 ca.hue = value * factor + 0x8000; | |
1062 ca.flags |= DCAF_HUE; | |
9937 | 1063 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: SetVEq Hue 0x%X %i\n",ca.hue,value); |
6952 | 1064 } else return VO_FALSE; |
1065 } | |
1066 | |
1067 if (! strcmp( data,"saturation" )) { | |
1068 if ((desc.caps & DLCAPS_SATURATION)) { | |
1069 ca.saturation = value * factor + 0x8000; | |
1070 ca.flags |= DCAF_SATURATION; | |
9937 | 1071 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: SetVEq Saturation 0x%X %i\n",ca.saturation,value); |
6952 | 1072 } else return VO_FALSE; |
1073 } | |
1074 | |
1075 if (ca.flags != DCAF_NONE) { | |
1076 layer->SetColorAdjustment(layer,&ca); | |
1077 return VO_TRUE; | |
1078 } | |
1079 } | |
1080 | |
1081 return VO_FALSE; | |
1082 | |
1083 } | |
1084 | |
1085 static uint32_t directfb_get_video_eq(char *data, int *value) // data==name | |
1086 { | |
1087 | |
1088 DFBColorAdjustment ca; | |
1089 float factor = 200.0 / (float)0xffff; | |
1090 | |
1091 DFBDisplayLayerDescription desc; | |
1092 | |
1093 if (layer) { | |
1094 | |
1095 unlock(); | |
1096 | |
1097 layer->GetDescription(layer,&desc); | |
1098 | |
1099 layer->GetColorAdjustment(layer,&ca); | |
1100 | |
1101 if (! strcmp( data,"brightness" )) { | |
1102 if (desc.caps & DLCAPS_BRIGHTNESS) { | |
1103 *value = (int) ((ca.brightness-0x8000) * factor); | |
9937 | 1104 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: GetVEq Brightness 0x%X %i\n",ca.brightness,*value); |
6952 | 1105 return VO_TRUE; |
1106 } else return VO_FALSE; | |
1107 } | |
1108 | |
1109 if (! strcmp( data,"contrast" )) { | |
1110 if ((desc.caps & DLCAPS_CONTRAST)) { | |
1111 *value = (int) ((ca.contrast-0x8000) * factor); | |
9937 | 1112 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: GetVEq Contrast 0x%X %i\n",ca.contrast,*value); |
6952 | 1113 return VO_TRUE; |
1114 } else return VO_FALSE; | |
1115 } | |
1116 | |
1117 if (! strcmp( data,"hue" )) { | |
1118 if ((desc.caps & DLCAPS_HUE)) { | |
1119 *value = (int) ((ca.hue-0x8000) * factor); | |
9937 | 1120 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: GetVEq Hue 0x%X %i\n",ca.hue,*value); |
6952 | 1121 return VO_TRUE; |
1122 } else return VO_FALSE; | |
1123 } | |
1124 | |
1125 if (! strcmp( data,"saturation" )) { | |
1126 if ((desc.caps & DLCAPS_SATURATION)) { | |
1127 *value = (int) ((ca.saturation-0x8000) * factor); | |
9937 | 1128 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: GetVEq Saturation 0x%X %i\n",ca.saturation,*value); |
6952 | 1129 return VO_TRUE; |
1130 } else return VO_FALSE; | |
1131 } | |
1132 } | |
1133 return VO_FALSE; | |
1134 } | |
1135 | |
1136 static uint32_t get_image(mp_image_t *mpi) | |
1137 { | |
1138 | |
1139 int err; | |
1140 void *dst; | |
1141 int pitch; | |
1142 | |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
1143 // if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: get_image() called\n"); |
9937 | 1144 if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram |
6952 | 1145 if(mpi->type==MP_IMGTYPE_STATIC) return VO_FALSE; // it is not static |
1146 | |
1147 // printf("width=%d vs. pitch=%d, flags=0x%X \n",mpi->width,pitch,mpi->flags); | |
1148 | |
6985
6074119e09a0
Put/get_image fixed. Deleted forgotten development comments
zdar
parents:
6952
diff
changeset
|
1149 if((mpi->width==pitch) || |
6952 | 1150 (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))){ |
1151 // we're lucky or codec accepts stride => ok, let's go! | |
1152 | |
1153 if (frame) { | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1154 err = frame->Lock(frame,DSLF_WRITE|DSLF_READ,&dst,&pitch); |
6952 | 1155 framelocked=1; |
1156 } else { | |
1157 err = primary->Lock(primary,DSLF_WRITE,&dst,&pitch); | |
1158 primarylocked=1; | |
1159 } | |
1160 | |
1161 if (err) { | |
9937 | 1162 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: DR lock failed!"); |
6952 | 1163 return VO_FALSE; |
1164 }; | |
1165 | |
1166 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
1167 //YV12 format | |
1168 mpi->planes[0]=dst; | |
1169 if(mpi->flags&MP_IMGFLAG_SWAPPED){ | |
1170 mpi->planes[1]=dst + pitch*height; | |
1171 mpi->planes[2]=mpi->planes[1] + pitch*height/4; | |
1172 } else { | |
1173 mpi->planes[2]=dst + pitch*height; | |
1174 mpi->planes[1]=mpi->planes[2] + pitch*height/4; | |
1175 } | |
6985
6074119e09a0
Put/get_image fixed. Deleted forgotten development comments
zdar
parents:
6952
diff
changeset
|
1176 mpi->width=width; |
6074119e09a0
Put/get_image fixed. Deleted forgotten development comments
zdar
parents:
6952
diff
changeset
|
1177 mpi->stride[0]=pitch; |
6952 | 1178 mpi->stride[1]=mpi->stride[2]=pitch/2; |
1179 } else { | |
1180 //YUY2 and RGB formats | |
1181 mpi->planes[0]=dst; | |
1182 mpi->width=width; | |
1183 mpi->stride[0]=pitch; | |
1184 } | |
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
|
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 // 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
|
1187 |
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 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
|
1189 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
|
1190 mpi->planes[0]= dst + yoffset * pitch + xoffset; |
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 mpi->planes[1]+= (yoffset * pitch) >> 2 + xoffset >> 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
|
1192 mpi->planes[2]+= (yoffset * pitch) >> 2 + xoffset >> 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
|
1193 } 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
|
1194 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
|
1195 } |
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
|
1196 } |
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
|
1197 |
6952 | 1198 mpi->flags|=MP_IMGFLAG_DIRECT; |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
1199 // if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: get_image() SUCCESS -> Direct Rendering ENABLED\n"); |
6952 | 1200 return VO_TRUE; |
1201 | |
1202 } | |
1203 return VO_FALSE; | |
1204 } | |
1205 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15750
diff
changeset
|
1206 static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y) |
6952 | 1207 { |
1208 int i; | |
1209 unsigned int pitch; | |
1210 void *dst; | |
1211 void *dst2; | |
1212 void *srcp; | |
1213 unsigned int p; | |
1214 | |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
1215 // 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
|
1216 |
6952 | 1217 unlock(); |
1218 | |
1219 if (frame) { | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1220 DFBCHECK (frame->Lock(frame,DSLF_WRITE|DSLF_READ,&dst,&pitch)); |
6952 | 1221 framelocked = 1; |
1222 } else { | |
1223 DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch)); | |
1224 primarylocked = 1; | |
1225 }; | |
1226 | |
1227 p=min(w,pitch); | |
1228 | |
1229 dst += y*pitch + x; | |
1230 dst2 = dst + pitch*height - y*pitch + y*pitch/4 - x/2; | |
1231 srcp = src[0]; | |
1232 | |
1233 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
|
1234 fast_memcpy(dst,srcp,p); |
6952 | 1235 dst += pitch; |
1236 srcp += stride[0]; | |
1237 } | |
1238 | |
1239 if (pixel_format == DSPF_YV12) { | |
1240 | |
1241 dst = dst2; | |
1242 srcp = src[2]; | |
1243 p = p/2; | |
1244 | |
1245 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
|
1246 fast_memcpy(dst,srcp,p); |
6952 | 1247 dst += pitch/2; |
1248 srcp += stride[2]; | |
1249 } | |
1250 | |
1251 dst = dst2 + pitch*height/4; | |
1252 srcp = src[1]; | |
1253 | |
1254 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
|
1255 fast_memcpy(dst,srcp,p); |
6952 | 1256 dst += pitch/2; |
1257 srcp += stride[1]; | |
1258 } | |
1259 | |
1260 } else { | |
1261 | |
1262 dst = dst2; | |
1263 srcp = src[1]; | |
1264 p = p/2; | |
1265 | |
1266 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
|
1267 fast_memcpy(dst,srcp,p); |
6952 | 1268 dst += pitch/2; |
1269 srcp += stride[1]; | |
1270 } | |
1271 | |
1272 dst = dst2 + pitch*height/4; | |
1273 srcp = src[2]; | |
1274 | |
1275 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
|
1276 fast_memcpy(dst,srcp,p); |
6952 | 1277 dst += pitch/2; |
1278 srcp += stride[2]; | |
1279 } | |
1280 | |
1281 } | |
1282 | |
1283 unlock(); | |
1284 | |
1285 return 0; | |
1286 } | |
1287 | |
1288 | |
1289 static uint32_t put_image(mp_image_t *mpi){ | |
1290 | |
1291 | |
24166 | 1292 // static IDirectFBSurface *tmp = NULL; |
1293 // DFBSurfaceDescription dsc; | |
1294 // DFBRectangle rect; | |
6952 | 1295 |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
1296 // 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 | 1297 |
1298 unlock(); | |
1299 | |
1300 // already out? | |
6985
6074119e09a0
Put/get_image fixed. Deleted forgotten development comments
zdar
parents:
6952
diff
changeset
|
1301 if((mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))) { |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
1302 // if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: Put_image - nothing todo\n"); |
6952 | 1303 return VO_TRUE; |
1304 } | |
1305 | |
1306 if (mpi->flags&MP_IMGFLAG_PLANAR) { | |
1307 // memcpy all planes - sad but necessary | |
1308 int i; | |
1309 unsigned int pitch; | |
1310 void *dst; | |
1311 void *src; | |
1312 unsigned int p; | |
1313 | |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
1314 // if ( mp_msg_test(MSGT_VO,MSGL_V) ) printf("DirectFB: Put_image - planar branch\n"); |
6952 | 1315 if (frame) { |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1316 DFBCHECK (frame->Lock(frame,DSLF_WRITE|DSLF_READ,&dst,&pitch)); |
6952 | 1317 framelocked = 1; |
1318 } else { | |
1319 DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch)); | |
1320 primarylocked = 1; | |
1321 }; | |
1322 | |
1323 p=min(mpi->w,pitch); | |
1324 | |
1325 src = mpi->planes[0]+mpi->y*mpi->stride[0]+mpi->x; | |
1326 | |
1327 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
|
1328 fast_memcpy(dst+i*pitch,src+i*mpi->stride[0],p); |
6952 | 1329 } |
1330 | |
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
|
1331 |
6952 | 1332 if (pixel_format == DSPF_YV12) { |
1333 | |
1334 dst += pitch*height; | |
1335 p = p/2; | |
1336 src = mpi->planes[2]+mpi->y*mpi->stride[2]+mpi->x/2; | |
1337 | |
1338 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
|
1339 fast_memcpy(dst+i*pitch/2,src+i*mpi->stride[2],p); |
6952 | 1340 } |
1341 | |
1342 dst += pitch*height/4; | |
1343 src = mpi->planes[1]+mpi->y*mpi->stride[1]+mpi->x/2; | |
1344 | |
1345 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
|
1346 fast_memcpy(dst+i*pitch/2,src+i*mpi->stride[1],p); |
6952 | 1347 } |
1348 | |
1349 } else { | |
1350 | |
1351 dst += pitch*height; | |
1352 p = p/2; | |
1353 src = mpi->planes[1]+mpi->y*mpi->stride[1]+mpi->x/2; | |
1354 | |
1355 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
|
1356 fast_memcpy(dst+i*pitch/2,src+i*mpi->stride[1],p); |
6952 | 1357 } |
1358 | |
1359 dst += pitch*height/4; | |
1360 src = mpi->planes[2]+mpi->y*mpi->stride[2]+mpi->x/2; | |
1361 | |
1362 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
|
1363 fast_memcpy(dst+i*pitch/2,src+i*mpi->stride[2],p); |
6952 | 1364 } |
1365 | |
1366 } | |
1367 unlock(); | |
1368 | |
1369 } 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
|
1370 // I had to disable native directfb blit because it wasn't working under some conditions :-( |
6952 | 1371 |
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
|
1372 /* |
6952 | 1373 dsc.flags = DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH | DSDESC_PREALLOCATED; |
1374 dsc.preallocated[0].data = mpi->planes[0]; | |
1375 dsc.preallocated[0].pitch = mpi->stride[0]; | |
1376 dsc.width = mpi->width; | |
1377 dsc.height = mpi->height; | |
1378 dsc.pixelformat = convformat(mpi->imgfmt); | |
1379 | |
1380 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &tmp)); | |
1381 | |
1382 rect.x=mpi->x; | |
1383 rect.y=mpi->y; | |
1384 rect.w=mpi->w; | |
1385 rect.h=mpi->h; | |
1386 | |
1387 if (frame) { | |
1388 DFBCHECK (tmp->Blit(tmp,frame,&rect,0,0)); | |
1389 } else { | |
1390 DFBCHECK (tmp->Blit(tmp,primary,&rect,xoffset,yoffset)); | |
1391 }; | |
1392 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
|
1393 */ |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1394 |
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 unsigned int pitch; |
10f45897d653
Config fixed, changed put_image to use memcpy instead of native blits (for compatibility reasons), always clear primary layer (to have always black background) and try to center image.
zdar
parents:
10618
diff
changeset
|
1396 void *dst; |
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 |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
16892
diff
changeset
|
1398 // 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
|
1399 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
|
1400 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch)); |
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 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
|
1402 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
|
1403 } 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
|
1404 DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch)); |
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 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
|
1406 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
|
1407 }; |
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
|
1408 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
|
1409 |
6952 | 1410 } |
1411 return VO_TRUE; | |
1412 } | |
1413 | |
1414 | |
1415 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15750
diff
changeset
|
1416 static int control(uint32_t request, void *data, ...) |
6952 | 1417 { |
1418 switch (request) { | |
1419 case VOCTRL_QUERY_FORMAT: | |
1420 return query_format(*((uint32_t*)data)); | |
1421 case VOCTRL_GET_IMAGE: | |
1422 return get_image(data); | |
1423 case VOCTRL_DRAW_IMAGE: | |
1424 return put_image(data); | |
1425 case VOCTRL_SET_EQUALIZER: | |
1426 { | |
1427 va_list ap; | |
1428 int value; | |
1429 | |
1430 va_start(ap, data); | |
1431 value = va_arg(ap, int); | |
1432 va_end(ap); | |
1433 | |
1434 return(directfb_set_video_eq(data, value)); | |
1435 } | |
1436 case VOCTRL_GET_EQUALIZER: | |
1437 { | |
1438 va_list ap; | |
1439 int *value; | |
1440 | |
1441 va_start(ap, data); | |
1442 value = va_arg(ap, int*); | |
1443 va_end(ap); | |
1444 | |
1445 return(directfb_get_video_eq(data, value)); | |
1446 } | |
1447 }; | |
1448 return VO_NOTIMPL; | |
1449 } | |
1450 | |
1451 // unused function | |
1452 | |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15750
diff
changeset
|
1453 static int draw_frame(uint8_t *src[]) |
6952 | 1454 { |
1455 return -1; | |
1456 } | |
1457 | |
1458 // hopefully will be removed soon | |
1459 | |
1460 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, | |
1461 unsigned char *srca, int stride) | |
1462 { | |
1463 void *dst; | |
1464 int pitch; | |
1465 | |
11000 | 1466 unlock(); // isn't it silly I have to unlock surface and then lock it again :-) |
6952 | 1467 |
1468 if (frame) { | |
10004
c889e7f9391a
triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents:
9937
diff
changeset
|
1469 DFBCHECK (frame->Lock(frame,DSLF_WRITE|DSLF_READ,&dst,&pitch)); |
6952 | 1470 framelocked = 1; |
1471 } else { | |
1472 DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch)); | |
1473 primarylocked = 1; | |
1474 }; | |
1475 | |
1476 switch(pixel_format) { | |
1477 case DSPF_RGB32: | |
1478 case DSPF_ARGB: | |
1479 vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 4*x0,pitch); | |
1480 break; | |
1481 | |
1482 case DSPF_RGB24: | |
1483 vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 3*x0,pitch); | |
1484 break; | |
1485 | |
1486 case DSPF_RGB16: | |
1487 vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch); | |
1488 break; | |
20112
5deee6e61057
Fix DirectFB version check. The old code simply concatenated the
syrjala
parents:
19614
diff
changeset
|
1489 #if DIRECTFBVERSION > DFB_VERSION(0,9,15) |
8640 | 1490 case DSPF_ARGB1555: |
1491 #else | |
6952 | 1492 case DSPF_RGB15: |
8640 | 1493 #endif |
6952 | 1494 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch); |
1495 break; | |
1496 | |
1497 case DSPF_YUY2: | |
1498 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0,pitch); | |
1499 break; | |
1500 | |
1501 case DSPF_UYVY: | |
1502 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0 + 1,pitch); | |
1503 break; | |
1504 | |
1505 case DSPF_I420: | |
1506 case DSPF_YV12: | |
1507 vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 1*x0,pitch); | |
1508 break; | |
1509 } | |
1510 | |
1511 unlock(); | |
1512 } | |
1513 | |
1514 static void draw_osd(void) | |
1515 { | |
1516 vo_draw_text(width,height,draw_alpha); | |
1517 } |