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