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