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