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