diff options
author | Martin Jansa <martin.jansa@gmail.com> | 2011-11-04 09:38:56 +0000 |
---|---|---|
committer | Koen Kooi <koen@dominion.thruhere.net> | 2011-11-04 17:11:04 +0100 |
commit | 54458a43c8988826f7d7b738a6f942a2aef52e74 (patch) | |
tree | 7a9dceed0bcf4da12e48203bb1b2afcd8689bead /meta-oe | |
parent | 4fafe9bf33d015defd2fd3324a53ff2d17876c33 (diff) | |
download | meta-openembedded-54458a43c8988826f7d7b738a6f942a2aef52e74.tar.gz |
mplayer2: import from OE-classic
* taken from 1a91fc4b705b0c4f45eb088a2f7aea01ebc9c98e
* dropped V4L1, largefile, xvmc
* added libass
* added LIC_FILES_CHKSUM
* upgraded to latest SRCREV
* moved glamo patch to meta-openmoko layer
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
[ Koen - commented out mplayer-common for the time being ]
Diffstat (limited to 'meta-oe')
3 files changed, 1678 insertions, 0 deletions
diff --git a/meta-oe/recipes-multimedia/mplayer/mplayer2/0001-video-out-for-omapfb-support.patch b/meta-oe/recipes-multimedia/mplayer/mplayer2/0001-video-out-for-omapfb-support.patch new file mode 100644 index 0000000000..0354ccf79b --- /dev/null +++ b/meta-oe/recipes-multimedia/mplayer/mplayer2/0001-video-out-for-omapfb-support.patch | |||
@@ -0,0 +1,1487 @@ | |||
1 | From 23eb4c4051c7acb2babd4b224ef85cc8ee8fa511 Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
3 | Date: Thu, 25 Nov 2010 16:49:53 +0100 | ||
4 | Subject: [PATCH] video out for omapfb support | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
8 | --- | ||
9 | Makefile | 2 +- | ||
10 | libvo/video_out.c | 2 + | ||
11 | libvo/video_out.c.orig | 654 ++++++++++++++++++++++++++++++++++++++++++++++++ | ||
12 | libvo/vo_omapfb.c | 591 +++++++++++++++++++++++++++++++++++++++++++ | ||
13 | libvo/yuv.S | 170 +++++++++++++ | ||
14 | 5 files changed, 1418 insertions(+), 1 deletions(-) | ||
15 | create mode 100644 libvo/video_out.c.orig | ||
16 | create mode 100644 libvo/vo_omapfb.c | ||
17 | create mode 100644 libvo/yuv.S | ||
18 | |||
19 | diff --git a/Makefile b/Makefile | ||
20 | index 28c6383..b023136 100644 | ||
21 | --- a/Makefile | ||
22 | +++ b/Makefile | ||
23 | @@ -451,7 +451,7 @@ SRCS_MPLAYER-$(DIRECTFB) += libvo/vo_directfb2.c libvo/vo_dfbmga.c | ||
24 | SRCS_MPLAYER-$(DIRECTX) += libao2/ao_dsound.c libvo/vo_directx.c | ||
25 | SRCS_MPLAYER-$(DXR3) += libvo/vo_dxr3.c | ||
26 | SRCS_MPLAYER-$(ESD) += libao2/ao_esd.c | ||
27 | -SRCS_MPLAYER-$(FBDEV) += libvo/vo_fbdev.c libvo/vo_fbdev2.c | ||
28 | +SRCS_MPLAYER-$(FBDEV) += libvo/vo_fbdev.c libvo/vo_fbdev2.c libvo/vo_omapfb.c libvo/yuv.S | ||
29 | SRCS_MPLAYER-$(FFMPEG) += libvo/vo_png.c | ||
30 | SRCS_MPLAYER-$(GGI) += libvo/vo_ggi.c | ||
31 | SRCS_MPLAYER-$(GIF) += libvo/vo_gif89a.c | ||
32 | diff --git a/libvo/video_out.c b/libvo/video_out.c | ||
33 | index 2ed0c86..fc9a1cd 100644 | ||
34 | --- a/libvo/video_out.c | ||
35 | +++ b/libvo/video_out.c | ||
36 | @@ -95,6 +95,7 @@ extern struct vo_driver video_out_null; | ||
37 | extern struct vo_driver video_out_bl; | ||
38 | extern struct vo_driver video_out_fbdev; | ||
39 | extern struct vo_driver video_out_fbdev2; | ||
40 | +extern struct vo_driver video_out_omapfb; | ||
41 | extern struct vo_driver video_out_svga; | ||
42 | extern struct vo_driver video_out_png; | ||
43 | extern struct vo_driver video_out_ggi; | ||
44 | @@ -194,6 +195,7 @@ const struct vo_driver *video_out_drivers[] = | ||
45 | #ifdef CONFIG_FBDEV | ||
46 | &video_out_fbdev, | ||
47 | &video_out_fbdev2, | ||
48 | + &video_out_omapfb, | ||
49 | #endif | ||
50 | #ifdef CONFIG_SVGALIB | ||
51 | &video_out_svga, | ||
52 | diff --git a/libvo/video_out.c.orig b/libvo/video_out.c.orig | ||
53 | new file mode 100644 | ||
54 | index 0000000..2ed0c86 | ||
55 | --- /dev/null | ||
56 | +++ b/libvo/video_out.c.orig | ||
57 | @@ -0,0 +1,654 @@ | ||
58 | +/* | ||
59 | + * libvo common functions, variables used by many/all drivers. | ||
60 | + * | ||
61 | + * This file is part of MPlayer. | ||
62 | + * | ||
63 | + * MPlayer is free software; you can redistribute it and/or modify | ||
64 | + * it under the terms of the GNU General Public License as published by | ||
65 | + * the Free Software Foundation; either version 2 of the License, or | ||
66 | + * (at your option) any later version. | ||
67 | + * | ||
68 | + * MPlayer is distributed in the hope that it will be useful, | ||
69 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
70 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
71 | + * GNU General Public License for more details. | ||
72 | + * | ||
73 | + * You should have received a copy of the GNU General Public License along | ||
74 | + * with MPlayer; if not, write to the Free Software Foundation, Inc., | ||
75 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
76 | + */ | ||
77 | + | ||
78 | +#include <stdio.h> | ||
79 | +#include <stdlib.h> | ||
80 | +#include <string.h> | ||
81 | +#include <assert.h> | ||
82 | +#include <stdbool.h> | ||
83 | + | ||
84 | +#include <unistd.h> | ||
85 | +//#include <sys/mman.h> | ||
86 | + | ||
87 | +#include "config.h" | ||
88 | +#include "options.h" | ||
89 | +#include "talloc.h" | ||
90 | +#include "video_out.h" | ||
91 | +#include "aspect.h" | ||
92 | +#include "geometry.h" | ||
93 | +#include "old_vo_wrapper.h" | ||
94 | +#include "input/input.h" | ||
95 | +#include "mp_fifo.h" | ||
96 | + | ||
97 | + | ||
98 | +#include "mp_msg.h" | ||
99 | + | ||
100 | +#include "osdep/shmem.h" | ||
101 | +#ifdef CONFIG_X11 | ||
102 | +#include "x11_common.h" | ||
103 | +#endif | ||
104 | + | ||
105 | +int xinerama_screen = -1; | ||
106 | +int xinerama_x; | ||
107 | +int xinerama_y; | ||
108 | + | ||
109 | +int vo_nomouse_input = 0; | ||
110 | +int vo_grabpointer = 1; | ||
111 | +int vo_doublebuffering = 1; | ||
112 | +int vo_vsync = 0; | ||
113 | +int vo_fs = 0; | ||
114 | +int vo_fsmode = 0; | ||
115 | +float vo_panscan = 0.0f; | ||
116 | +int vo_adapter_num=0; | ||
117 | +int vo_refresh_rate=0; | ||
118 | +int vo_keepaspect=1; | ||
119 | +int vo_rootwin=0; | ||
120 | +int vo_border=1; | ||
121 | +int64_t WinID = -1; | ||
122 | + | ||
123 | +int vo_pts=0; // for hw decoding | ||
124 | +float vo_fps=0; | ||
125 | + | ||
126 | +char *vo_subdevice = NULL; | ||
127 | +int vo_directrendering=0; | ||
128 | + | ||
129 | +int vo_colorkey = 0x0000ff00; // default colorkey is green | ||
130 | + // (0xff000000 means that colorkey has been disabled) | ||
131 | + | ||
132 | + | ||
133 | +// | ||
134 | +// Externally visible list of all vo drivers | ||
135 | +// | ||
136 | +extern struct vo_driver video_out_mga; | ||
137 | +extern struct vo_driver video_out_xmga; | ||
138 | +extern struct vo_driver video_out_x11; | ||
139 | +extern struct vo_driver video_out_xover; | ||
140 | +extern struct vo_driver video_out_vdpau; | ||
141 | +extern struct vo_driver video_out_xv; | ||
142 | +extern struct vo_driver video_out_gl_nosw; | ||
143 | +extern struct vo_driver video_out_gl; | ||
144 | +extern struct vo_driver video_out_gl_sdl; | ||
145 | +extern struct vo_driver video_out_dga; | ||
146 | +extern struct vo_driver video_out_sdl; | ||
147 | +extern struct vo_driver video_out_3dfx; | ||
148 | +extern struct vo_driver video_out_tdfxfb; | ||
149 | +extern struct vo_driver video_out_s3fb; | ||
150 | +extern struct vo_driver video_out_wii; | ||
151 | +extern struct vo_driver video_out_null; | ||
152 | +extern struct vo_driver video_out_bl; | ||
153 | +extern struct vo_driver video_out_fbdev; | ||
154 | +extern struct vo_driver video_out_fbdev2; | ||
155 | +extern struct vo_driver video_out_svga; | ||
156 | +extern struct vo_driver video_out_png; | ||
157 | +extern struct vo_driver video_out_ggi; | ||
158 | +extern struct vo_driver video_out_aa; | ||
159 | +extern struct vo_driver video_out_caca; | ||
160 | +extern struct vo_driver video_out_mpegpes; | ||
161 | +extern struct vo_driver video_out_yuv4mpeg; | ||
162 | +extern struct vo_driver video_out_direct3d; | ||
163 | +extern struct vo_driver video_out_directx; | ||
164 | +extern struct vo_driver video_out_kva; | ||
165 | +extern struct vo_driver video_out_dxr3; | ||
166 | +extern struct vo_driver video_out_ivtv; | ||
167 | +extern struct vo_driver video_out_v4l2; | ||
168 | +extern struct vo_driver video_out_jpeg; | ||
169 | +extern struct vo_driver video_out_gif89a; | ||
170 | +extern struct vo_driver video_out_vesa; | ||
171 | +extern struct vo_driver video_out_directfb; | ||
172 | +extern struct vo_driver video_out_dfbmga; | ||
173 | +extern struct vo_driver video_out_tdfx_vid; | ||
174 | +extern struct vo_driver video_out_xvr100; | ||
175 | +extern struct vo_driver video_out_tga; | ||
176 | +extern struct vo_driver video_out_corevideo; | ||
177 | +extern struct vo_driver video_out_quartz; | ||
178 | +extern struct vo_driver video_out_pnm; | ||
179 | +extern struct vo_driver video_out_md5sum; | ||
180 | +extern struct vo_driver video_out_glamo; | ||
181 | + | ||
182 | +const struct vo_driver *video_out_drivers[] = | ||
183 | +{ | ||
184 | +#ifdef CONFIG_XVR100 | ||
185 | + &video_out_xvr100, | ||
186 | +#endif | ||
187 | +#ifdef CONFIG_TDFX_VID | ||
188 | + &video_out_tdfx_vid, | ||
189 | +#endif | ||
190 | +#ifdef CONFIG_DIRECTX | ||
191 | + &video_out_directx, | ||
192 | +#endif | ||
193 | +#ifdef CONFIG_DIRECT3D | ||
194 | + &video_out_direct3d, | ||
195 | +#endif | ||
196 | +#ifdef CONFIG_KVA | ||
197 | + &video_out_kva, | ||
198 | +#endif | ||
199 | +#ifdef CONFIG_COREVIDEO | ||
200 | + &video_out_corevideo, | ||
201 | +#endif | ||
202 | +#ifdef CONFIG_QUARTZ | ||
203 | + &video_out_quartz, | ||
204 | +#endif | ||
205 | +#ifdef CONFIG_XMGA | ||
206 | + &video_out_xmga, | ||
207 | +#endif | ||
208 | +#ifdef CONFIG_MGA | ||
209 | + &video_out_mga, | ||
210 | +#endif | ||
211 | +#ifdef CONFIG_TDFXFB | ||
212 | + &video_out_tdfxfb, | ||
213 | +#endif | ||
214 | +#ifdef CONFIG_S3FB | ||
215 | + &video_out_s3fb, | ||
216 | +#endif | ||
217 | +#ifdef CONFIG_WII | ||
218 | + &video_out_wii, | ||
219 | +#endif | ||
220 | +#ifdef CONFIG_3DFX | ||
221 | + &video_out_3dfx, | ||
222 | +#endif | ||
223 | +#if CONFIG_VDPAU | ||
224 | + &video_out_vdpau, | ||
225 | +#endif | ||
226 | +#ifdef CONFIG_XV | ||
227 | + &video_out_xv, | ||
228 | +#endif | ||
229 | +#ifdef CONFIG_X11 | ||
230 | +#ifdef CONFIG_GL | ||
231 | + &video_out_gl_nosw, | ||
232 | +#endif | ||
233 | + &video_out_x11, | ||
234 | + &video_out_xover, | ||
235 | +#endif | ||
236 | +#ifdef CONFIG_SDL | ||
237 | + &video_out_sdl, | ||
238 | +#endif | ||
239 | +#ifdef CONFIG_GL | ||
240 | + &video_out_gl, | ||
241 | +#endif | ||
242 | +#ifdef CONFIG_GL_SDL | ||
243 | + &video_out_gl_sdl, | ||
244 | +#endif | ||
245 | +#ifdef CONFIG_DGA | ||
246 | + &video_out_dga, | ||
247 | +#endif | ||
248 | +#ifdef CONFIG_GGI | ||
249 | + &video_out_ggi, | ||
250 | +#endif | ||
251 | +#ifdef CONFIG_FBDEV | ||
252 | + &video_out_fbdev, | ||
253 | + &video_out_fbdev2, | ||
254 | +#endif | ||
255 | +#ifdef CONFIG_SVGALIB | ||
256 | + &video_out_svga, | ||
257 | +#endif | ||
258 | +#ifdef CONFIG_AA | ||
259 | + &video_out_aa, | ||
260 | +#endif | ||
261 | +#ifdef CONFIG_CACA | ||
262 | + &video_out_caca, | ||
263 | +#endif | ||
264 | +#ifdef CONFIG_DXR3 | ||
265 | + &video_out_dxr3, | ||
266 | +#endif | ||
267 | +#ifdef CONFIG_IVTV | ||
268 | + &video_out_ivtv, | ||
269 | +#endif | ||
270 | +#ifdef CONFIG_V4L2_DECODER | ||
271 | + &video_out_v4l2, | ||
272 | +#endif | ||
273 | +#ifdef CONFIG_BL | ||
274 | + &video_out_bl, | ||
275 | +#endif | ||
276 | +#ifdef CONFIG_VESA | ||
277 | + &video_out_vesa, | ||
278 | +#endif | ||
279 | +#ifdef CONFIG_DIRECTFB | ||
280 | + &video_out_dfbmga, | ||
281 | +#endif | ||
282 | + &video_out_null, | ||
283 | + // should not be auto-selected | ||
284 | +#ifdef CONFIG_DIRECTFB | ||
285 | + // vo directfb can call exit() if initialization fails | ||
286 | + &video_out_directfb, | ||
287 | +#endif | ||
288 | + &video_out_mpegpes, | ||
289 | +#ifdef CONFIG_YUV4MPEG | ||
290 | + &video_out_yuv4mpeg, | ||
291 | +#endif | ||
292 | +#ifdef CONFIG_FFMPEG | ||
293 | + &video_out_png, | ||
294 | +#endif | ||
295 | +#ifdef CONFIG_JPEG | ||
296 | + &video_out_jpeg, | ||
297 | +#endif | ||
298 | +#ifdef CONFIG_GIF | ||
299 | + &video_out_gif89a, | ||
300 | +#endif | ||
301 | +#ifdef CONFIG_TGA | ||
302 | + &video_out_tga, | ||
303 | +#endif | ||
304 | +#ifdef CONFIG_PNM | ||
305 | + &video_out_pnm, | ||
306 | +#endif | ||
307 | +#ifdef CONFIG_MD5SUM | ||
308 | + &video_out_md5sum, | ||
309 | +#endif | ||
310 | +#ifdef CONFIG_GLAMO | ||
311 | + &video_out_glamo, | ||
312 | +#endif | ||
313 | + NULL | ||
314 | +}; | ||
315 | + | ||
316 | + | ||
317 | +static int vo_preinit(struct vo *vo, const char *arg) | ||
318 | +{ | ||
319 | + return vo->driver->preinit(vo, arg); | ||
320 | +} | ||
321 | + | ||
322 | +int vo_control(struct vo *vo, uint32_t request, void *data) | ||
323 | +{ | ||
324 | + return vo->driver->control(vo, request, data); | ||
325 | +} | ||
326 | + | ||
327 | +// Return -1 if driver appears not to support a draw_image interface, | ||
328 | +// 0 otherwise (whether the driver actually drew something or not). | ||
329 | +int vo_draw_image(struct vo *vo, struct mp_image *mpi, double pts) | ||
330 | +{ | ||
331 | + if (!vo->config_ok) | ||
332 | + return 0; | ||
333 | + if (vo->driver->buffer_frames) { | ||
334 | + vo->driver->draw_image(vo, mpi, pts); | ||
335 | + return 0; | ||
336 | + } | ||
337 | + vo->frame_loaded = true; | ||
338 | + vo->next_pts = pts; | ||
339 | + if (vo_control(vo, VOCTRL_DRAW_IMAGE, mpi) == VO_NOTIMPL) | ||
340 | + return -1; | ||
341 | + return 0; | ||
342 | +} | ||
343 | + | ||
344 | +int vo_get_buffered_frame(struct vo *vo, bool eof) | ||
345 | +{ | ||
346 | + if (!vo->config_ok) | ||
347 | + return -1; | ||
348 | + if (vo->frame_loaded) | ||
349 | + return 0; | ||
350 | + if (!vo->driver->buffer_frames) | ||
351 | + return -1; | ||
352 | + vo->driver->get_buffered_frame(vo, eof); | ||
353 | + return vo->frame_loaded ? 0 : -1; | ||
354 | +} | ||
355 | + | ||
356 | +void vo_skip_frame(struct vo *vo) | ||
357 | +{ | ||
358 | + vo->frame_loaded = false; | ||
359 | +} | ||
360 | + | ||
361 | +int vo_draw_frame(struct vo *vo, uint8_t *src[]) | ||
362 | +{ | ||
363 | + assert(!vo->driver->is_new); | ||
364 | + if (!vo->config_ok) | ||
365 | + return 0; | ||
366 | + return old_vo_draw_frame(vo, src); | ||
367 | +} | ||
368 | + | ||
369 | +int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int x, int y) | ||
370 | +{ | ||
371 | + return vo->driver->draw_slice(vo, src, stride, w, h, x, y); | ||
372 | +} | ||
373 | + | ||
374 | +void vo_draw_osd(struct vo *vo, struct osd_state *osd) | ||
375 | +{ | ||
376 | + if (!vo->config_ok) | ||
377 | + return; | ||
378 | + vo->driver->draw_osd(vo, osd); | ||
379 | +} | ||
380 | + | ||
381 | +void vo_flip_page(struct vo *vo, unsigned int pts_us, int duration) | ||
382 | +{ | ||
383 | + if (!vo->config_ok) | ||
384 | + return; | ||
385 | + vo->frame_loaded = false; | ||
386 | + vo->next_pts = MP_NOPTS_VALUE; | ||
387 | + if (vo->driver->flip_page_timed) | ||
388 | + vo->driver->flip_page_timed(vo, pts_us, duration); | ||
389 | + else | ||
390 | + vo->driver->flip_page(vo); | ||
391 | +} | ||
392 | + | ||
393 | +void vo_check_events(struct vo *vo) | ||
394 | +{ | ||
395 | + if (!vo->config_ok) { | ||
396 | + if (vo->registered_fd != -1) | ||
397 | + mp_input_rm_key_fd(vo->input_ctx, vo->registered_fd); | ||
398 | + vo->registered_fd = -1; | ||
399 | + return; | ||
400 | + } | ||
401 | + vo->driver->check_events(vo); | ||
402 | +} | ||
403 | + | ||
404 | +void vo_seek_reset(struct vo *vo) | ||
405 | +{ | ||
406 | + vo_control(vo, VOCTRL_RESET, NULL); | ||
407 | + vo->frame_loaded = false; | ||
408 | +} | ||
409 | + | ||
410 | +void vo_destroy(struct vo *vo) | ||
411 | +{ | ||
412 | + if (vo->registered_fd != -1) | ||
413 | + mp_input_rm_key_fd(vo->input_ctx, vo->registered_fd); | ||
414 | + vo->driver->uninit(vo); | ||
415 | + talloc_free(vo); | ||
416 | +} | ||
417 | + | ||
418 | +void list_video_out(void) | ||
419 | +{ | ||
420 | + int i = 0; | ||
421 | + mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Available video output drivers:\n"); | ||
422 | + mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_OUTPUTS\n"); | ||
423 | + while (video_out_drivers[i]) { | ||
424 | + const vo_info_t *info = video_out_drivers[i++]->info; | ||
425 | + mp_msg(MSGT_GLOBAL, MSGL_INFO,"\t%s\t%s\n", info->short_name, info->name); | ||
426 | + } | ||
427 | + mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n"); | ||
428 | +} | ||
429 | + | ||
430 | +struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11, | ||
431 | + struct mp_fifo *key_fifo, | ||
432 | + struct input_ctx *input_ctx) | ||
433 | +{ | ||
434 | + char **vo_list = opts->video_driver_list; | ||
435 | + int i; | ||
436 | + struct vo *vo = talloc_ptrtype(NULL, vo); | ||
437 | + struct vo initial_values = { | ||
438 | + .opts = opts, | ||
439 | + .x11 = x11, | ||
440 | + .key_fifo = key_fifo, | ||
441 | + .input_ctx = input_ctx, | ||
442 | + .event_fd = -1, | ||
443 | + .registered_fd = -1, | ||
444 | + }; | ||
445 | + // first try the preferred drivers, with their optional subdevice param: | ||
446 | + if (vo_list && vo_list[0]) | ||
447 | + while (vo_list[0][0]) { | ||
448 | + char *name = strdup(vo_list[0]); | ||
449 | + vo_subdevice = strchr(name,':'); | ||
450 | + if (!strcmp(name, "pgm")) | ||
451 | + mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "The pgm video output driver has been replaced by -vo pnm:pgmyuv.\n"); | ||
452 | + if (!strcmp(name, "md5")) | ||
453 | + mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "The md5 video output driver has been replaced by -vo md5sum.\n"); | ||
454 | + if (vo_subdevice) { | ||
455 | + vo_subdevice[0] = 0; | ||
456 | + ++vo_subdevice; | ||
457 | + } | ||
458 | + for (i = 0; video_out_drivers[i]; i++) { | ||
459 | + const struct vo_driver *video_driver = video_out_drivers[i]; | ||
460 | + const vo_info_t *info = video_driver->info; | ||
461 | + if (!strcmp(info->short_name, name)) { | ||
462 | + // name matches, try it | ||
463 | + *vo = initial_values; | ||
464 | + vo->driver = video_driver; | ||
465 | + if (!vo_preinit(vo, vo_subdevice)) { | ||
466 | + free(name); | ||
467 | + return vo; // success! | ||
468 | + } | ||
469 | + talloc_free_children(vo); | ||
470 | + } | ||
471 | + } | ||
472 | + // continue... | ||
473 | + free(name); | ||
474 | + ++vo_list; | ||
475 | + if (!(vo_list[0])) | ||
476 | + return NULL; // do NOT fallback to others | ||
477 | + } | ||
478 | + // now try the rest... | ||
479 | + vo_subdevice = NULL; | ||
480 | + for (i = 0; video_out_drivers[i]; i++) { | ||
481 | + const struct vo_driver *video_driver = video_out_drivers[i]; | ||
482 | + *vo = initial_values; | ||
483 | + vo->driver = video_driver; | ||
484 | + if (!vo_preinit(vo, vo_subdevice)) | ||
485 | + return vo; // success! | ||
486 | + talloc_free_children(vo); | ||
487 | + } | ||
488 | + free(vo); | ||
489 | + return NULL; | ||
490 | +} | ||
491 | + | ||
492 | +static int event_fd_callback(void *ctx, int fd) | ||
493 | +{ | ||
494 | + struct vo *vo = ctx; | ||
495 | + vo_check_events(vo); | ||
496 | + return MP_INPUT_NOTHING; | ||
497 | +} | ||
498 | + | ||
499 | +int vo_config(struct vo *vo, uint32_t width, uint32_t height, | ||
500 | + uint32_t d_width, uint32_t d_height, uint32_t flags, | ||
501 | + char *title, uint32_t format) | ||
502 | +{ | ||
503 | + struct MPOpts *opts = vo->opts; | ||
504 | + panscan_init(vo); | ||
505 | + aspect_save_orig(vo, width, height); | ||
506 | + aspect_save_prescale(vo, d_width, d_height); | ||
507 | + | ||
508 | + if (vo_control(vo, VOCTRL_UPDATE_SCREENINFO, NULL) == VO_TRUE) { | ||
509 | + aspect(vo, &d_width, &d_height, A_NOZOOM); | ||
510 | + vo->dx = (int)(opts->vo_screenwidth - d_width) / 2; | ||
511 | + vo->dy = (int)(opts->vo_screenheight - d_height) / 2; | ||
512 | + geometry(&vo->dx, &vo->dy, &d_width, &d_height, | ||
513 | + opts->vo_screenwidth, opts->vo_screenheight); | ||
514 | + geometry_xy_changed |= xinerama_screen >= 0; | ||
515 | + vo->dx += xinerama_x; | ||
516 | + vo->dy += xinerama_y; | ||
517 | + vo->dwidth = d_width; | ||
518 | + vo->dheight = d_height; | ||
519 | + } | ||
520 | + | ||
521 | + int ret = vo->driver->config(vo, width, height, d_width, d_height, flags, | ||
522 | + title, format); | ||
523 | + vo->config_ok = (ret == 0); | ||
524 | + vo->config_count += vo->config_ok; | ||
525 | + if (vo->registered_fd == -1 && vo->event_fd != -1 && vo->config_ok) { | ||
526 | + mp_input_add_key_fd(vo->input_ctx, vo->event_fd, 1, event_fd_callback, | ||
527 | + NULL, vo); | ||
528 | + vo->registered_fd = vo->event_fd; | ||
529 | + } | ||
530 | + return ret; | ||
531 | +} | ||
532 | + | ||
533 | +/** | ||
534 | + * \brief lookup an integer in a table, table must have 0 as the last key | ||
535 | + * \param key key to search for | ||
536 | + * \result translation corresponding to key or "to" value of last mapping | ||
537 | + * if not found. | ||
538 | + */ | ||
539 | +int lookup_keymap_table(const struct mp_keymap *map, int key) { | ||
540 | + while (map->from && map->from != key) map++; | ||
541 | + return map->to; | ||
542 | +} | ||
543 | + | ||
544 | +/** | ||
545 | + * \brief helper function for the kind of panscan-scaling that needs a source | ||
546 | + * and destination rectangle like Direct3D and VDPAU | ||
547 | + */ | ||
548 | +static void src_dst_split_scaling(int src_size, int dst_size, int scaled_src_size, | ||
549 | + int *src_start, int *src_end, int *dst_start, int *dst_end) { | ||
550 | + if (scaled_src_size > dst_size) { | ||
551 | + int border = src_size * (scaled_src_size - dst_size) / scaled_src_size; | ||
552 | + // round to a multiple of 2, this is at least needed for vo_direct3d and ATI cards | ||
553 | + border = (border / 2 + 1) & ~1; | ||
554 | + *src_start = border; | ||
555 | + *src_end = src_size - border; | ||
556 | + *dst_start = 0; | ||
557 | + *dst_end = dst_size; | ||
558 | + } else { | ||
559 | + *src_start = 0; | ||
560 | + *src_end = src_size; | ||
561 | + *dst_start = (dst_size - scaled_src_size) / 2; | ||
562 | + *dst_end = *dst_start + scaled_src_size; | ||
563 | + } | ||
564 | +} | ||
565 | + | ||
566 | +/** | ||
567 | + * Calculate the appropriate source and destination rectangle to | ||
568 | + * get a correctly scaled picture, including pan-scan. | ||
569 | + * Can be extended to take future cropping support into account. | ||
570 | + * | ||
571 | + * \param crop specifies the cropping border size in the left, right, top and bottom members, may be NULL | ||
572 | + * \param borders the border values as e.g. EOSD (ASS) and properly placed DVD highlight support requires, | ||
573 | + * may be NULL and only left and top are currently valid. | ||
574 | + */ | ||
575 | +void calc_src_dst_rects(struct vo *vo, int src_width, int src_height, | ||
576 | + struct vo_rect *src, struct vo_rect *dst, | ||
577 | + struct vo_rect *borders, const struct vo_rect *crop) | ||
578 | +{ | ||
579 | + static const struct vo_rect no_crop = {0, 0, 0, 0, 0, 0}; | ||
580 | + int scaled_width = 0; | ||
581 | + int scaled_height = 0; | ||
582 | + if (!crop) crop = &no_crop; | ||
583 | + src_width -= crop->left + crop->right; | ||
584 | + src_height -= crop->top + crop->bottom; | ||
585 | + if (src_width < 2) src_width = 2; | ||
586 | + if (src_height < 2) src_height = 2; | ||
587 | + dst->left = 0; dst->right = vo->dwidth; | ||
588 | + dst->top = 0; dst->bottom = vo->dheight; | ||
589 | + src->left = 0; src->right = src_width; | ||
590 | + src->top = 0; src->bottom = src_height; | ||
591 | + if (borders) { | ||
592 | + borders->left = 0; borders->top = 0; | ||
593 | + } | ||
594 | + if (aspect_scaling()) { | ||
595 | + aspect(vo, &scaled_width, &scaled_height, A_WINZOOM); | ||
596 | + panscan_calc_windowed(vo); | ||
597 | + scaled_width += vo->panscan_x; | ||
598 | + scaled_height += vo->panscan_y; | ||
599 | + if (borders) { | ||
600 | + borders->left = (vo->dwidth - scaled_width ) / 2; | ||
601 | + borders->top = (vo->dheight - scaled_height) / 2; | ||
602 | + } | ||
603 | + src_dst_split_scaling(src_width, vo->dwidth, scaled_width, | ||
604 | + &src->left, &src->right, &dst->left, &dst->right); | ||
605 | + src_dst_split_scaling(src_height, vo->dheight, scaled_height, | ||
606 | + &src->top, &src->bottom, &dst->top, &dst->bottom); | ||
607 | + } | ||
608 | + src->left += crop->left; src->right += crop->left; | ||
609 | + src->top += crop->top; src->bottom += crop->top; | ||
610 | + src->width = src->right - src->left; | ||
611 | + src->height = src->bottom - src->top; | ||
612 | + dst->width = dst->right - dst->left; | ||
613 | + dst->height = dst->bottom - dst->top; | ||
614 | +} | ||
615 | + | ||
616 | +/** | ||
617 | + * Generates a mouse movement message if those are enable and sends it | ||
618 | + * to the "main" MPlayer. | ||
619 | + * | ||
620 | + * \param posx new x position of mouse | ||
621 | + * \param posy new y position of mouse | ||
622 | + */ | ||
623 | +void vo_mouse_movement(struct vo *vo, int posx, int posy) | ||
624 | +{ | ||
625 | + char cmd_str[40]; | ||
626 | + if (!enable_mouse_movements) | ||
627 | + return; | ||
628 | + snprintf(cmd_str, sizeof(cmd_str), "set_mouse_pos %i %i", posx, posy); | ||
629 | + mp_input_queue_cmd(vo->input_ctx, mp_input_parse_cmd(cmd_str)); | ||
630 | +} | ||
631 | + | ||
632 | +#if defined(CONFIG_FBDEV) || defined(CONFIG_VESA) | ||
633 | +/* Borrowed from vo_fbdev.c | ||
634 | +Monitor ranges related functions*/ | ||
635 | + | ||
636 | +char *monitor_hfreq_str = NULL; | ||
637 | +char *monitor_vfreq_str = NULL; | ||
638 | +char *monitor_dotclock_str = NULL; | ||
639 | + | ||
640 | +float range_max(range_t *r) | ||
641 | +{ | ||
642 | +float max = 0; | ||
643 | + | ||
644 | + for (/* NOTHING */; (r->min != -1 && r->max != -1); r++) | ||
645 | + if (max < r->max) max = r->max; | ||
646 | + return max; | ||
647 | +} | ||
648 | + | ||
649 | + | ||
650 | +int in_range(range_t *r, float f) | ||
651 | +{ | ||
652 | + for (/* NOTHING */; (r->min != -1 && r->max != -1); r++) | ||
653 | + if (f >= r->min && f <= r->max) | ||
654 | + return 1; | ||
655 | + return 0; | ||
656 | +} | ||
657 | + | ||
658 | +range_t *str2range(char *s) | ||
659 | +{ | ||
660 | + float tmp_min, tmp_max; | ||
661 | + char *endptr = s; // to start the loop | ||
662 | + range_t *r = NULL; | ||
663 | + int i; | ||
664 | + | ||
665 | + if (!s) | ||
666 | + return NULL; | ||
667 | + for (i = 0; *endptr; i++) { | ||
668 | + if (*s == ',') | ||
669 | + goto out_err; | ||
670 | + if (!(r = realloc(r, sizeof(*r) * (i + 2)))) { | ||
671 | + mp_msg(MSGT_GLOBAL, MSGL_WARN,"can't realloc 'r'\n"); | ||
672 | + return NULL; | ||
673 | + } | ||
674 | + tmp_min = strtod(s, &endptr); | ||
675 | + if (*endptr == 'k' || *endptr == 'K') { | ||
676 | + tmp_min *= 1000.0; | ||
677 | + endptr++; | ||
678 | + } else if (*endptr == 'm' || *endptr == 'M') { | ||
679 | + tmp_min *= 1000000.0; | ||
680 | + endptr++; | ||
681 | + } | ||
682 | + if (*endptr == '-') { | ||
683 | + tmp_max = strtod(endptr + 1, &endptr); | ||
684 | + if (*endptr == 'k' || *endptr == 'K') { | ||
685 | + tmp_max *= 1000.0; | ||
686 | + endptr++; | ||
687 | + } else if (*endptr == 'm' || *endptr == 'M') { | ||
688 | + tmp_max *= 1000000.0; | ||
689 | + endptr++; | ||
690 | + } | ||
691 | + if (*endptr != ',' && *endptr) | ||
692 | + goto out_err; | ||
693 | + } else if (*endptr == ',' || !*endptr) { | ||
694 | + tmp_max = tmp_min; | ||
695 | + } else | ||
696 | + goto out_err; | ||
697 | + r[i].min = tmp_min; | ||
698 | + r[i].max = tmp_max; | ||
699 | + if (r[i].min < 0 || r[i].max < 0) | ||
700 | + goto out_err; | ||
701 | + s = endptr + 1; | ||
702 | + } | ||
703 | + r[i].min = r[i].max = -1; | ||
704 | + return r; | ||
705 | +out_err: | ||
706 | + free(r); | ||
707 | + return NULL; | ||
708 | +} | ||
709 | + | ||
710 | +/* Borrowed from vo_fbdev.c END */ | ||
711 | +#endif | ||
712 | diff --git a/libvo/vo_omapfb.c b/libvo/vo_omapfb.c | ||
713 | new file mode 100644 | ||
714 | index 0000000..8c927b7 | ||
715 | --- /dev/null | ||
716 | +++ b/libvo/vo_omapfb.c | ||
717 | @@ -0,0 +1,591 @@ | ||
718 | +/* | ||
719 | + | ||
720 | +Copyright (C) 2008 Gregoire Gentil <gregoire@gentil.com> | ||
721 | +Portions Copyright (C) 2009 Howard Chu <hyc@symas.com> | ||
722 | +This file adds an optimized vo output to mplayer for the OMAP platform. This is a first pass and an attempt to help to improve | ||
723 | +media playing on the OMAP platform. The usual disclaimer comes here: this code is provided without any warranty. | ||
724 | +Many bugs and issues still exist. Feed-back is welcome. | ||
725 | + | ||
726 | +This output uses the yuv420_to_yuv422 conversion from Mans Rullgard, and is heavily inspired from the work of Siarhei Siamashka. | ||
727 | +I would like to thank those two persons here, without them this code would certainly not exist. | ||
728 | + | ||
729 | +Two options of the output are available: | ||
730 | +fb_overlay_only (disabled by default): only the overlay is drawn. X11 stuff is ignored. | ||
731 | +dbl_buffer (disabled by default): add double buffering. Some tearsync flags are probably missing in the code. | ||
732 | + | ||
733 | +Syntax is the following: | ||
734 | +mplayer -ao alsa -vo omapfb /test.avi | ||
735 | +mplayer -nosound -vo omapfb:fb_overlay_only:dbl_buffer /test.avi | ||
736 | + | ||
737 | +You need to have two planes on your system. On beagleboard, it means something like: video=omapfb:vram:2M,vram:4M | ||
738 | + | ||
739 | +Known issues: | ||
740 | +1) A green line or some vertical lines (if mplayer decides to draw bands instead of frame) may appear. | ||
741 | +It's an interpolation bug in the color conversion that needs to be fixed | ||
742 | + | ||
743 | +2) The color conversion accepts only 16-pixel multiple for width and height. | ||
744 | + | ||
745 | +3) The scaling down is disabled as the scaling down kernel patch for the OMAP3 platform doesn't seem to work yet. | ||
746 | + | ||
747 | + * This program is free software; you can redistribute it and/or modify | ||
748 | + * it under the terms of the GNU General Public License as published by | ||
749 | + * the Free Software Foundation; either version 2 of the License, or | ||
750 | + * (at your option) any later version. | ||
751 | + * | ||
752 | + * This program is distributed in the hope that it will be useful, | ||
753 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
754 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
755 | + * GNU General Public License for more details. | ||
756 | + * | ||
757 | + * You should have received a copy of the GNU General Public License | ||
758 | + * along with this program; if not, write to the Free Software | ||
759 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
760 | +*/ | ||
761 | + | ||
762 | +#include <stdio.h> | ||
763 | +#include <stdlib.h> | ||
764 | +#include <string.h> | ||
765 | +#include <fcntl.h> | ||
766 | +#include <unistd.h> | ||
767 | +#include <errno.h> | ||
768 | + | ||
769 | +#include <sys/mman.h> | ||
770 | +#include <sys/ioctl.h> | ||
771 | +#include <linux/fb.h> | ||
772 | + | ||
773 | +#include "config.h" | ||
774 | +#include "video_out.h" | ||
775 | +#include "video_out_internal.h" | ||
776 | +#include "fastmemcpy.h" | ||
777 | +#include "sub/sub.h" | ||
778 | +#include "mp_msg.h" | ||
779 | +#include "omapfb.h" | ||
780 | +#include "x11_common.h" | ||
781 | + | ||
782 | +#include "libswscale/swscale.h" | ||
783 | +#include "libmpcodecs/vf_scale.h" | ||
784 | +#include "libavcodec/avcodec.h" | ||
785 | + | ||
786 | +#include "aspect.h" | ||
787 | + | ||
788 | +#include "subopt-helper.h" | ||
789 | + | ||
790 | +#include <X11/Xlib.h> | ||
791 | +#include <X11/Xutil.h> | ||
792 | +#include <X11/Xatom.h> | ||
793 | +#include "wskeys.h" | ||
794 | + | ||
795 | +static vo_info_t info = { | ||
796 | + "omapfb video driver", | ||
797 | + "omapfb", | ||
798 | + "", | ||
799 | + "" | ||
800 | +}; | ||
801 | + | ||
802 | +LIBVO_EXTERN(omapfb) | ||
803 | + | ||
804 | +static int fb_overlay_only = 0; // if set, we need only framebuffer overlay, but do not need any x11 code | ||
805 | +static int dbl_buffer = 0; | ||
806 | +static int fullscreen_flag = 0; | ||
807 | +static int plane_ready = 0; | ||
808 | +static uint32_t drwX, drwY; | ||
809 | + | ||
810 | +extern void yuv420_to_yuv422(uint8_t *yuv, uint8_t *y, uint8_t *u, uint8_t *v, int w, int h, int yw, int cw, int dw); | ||
811 | +static struct fb_var_screeninfo sinfo_p0; | ||
812 | +static struct fb_var_screeninfo sinfo; | ||
813 | +static struct fb_var_screeninfo sinfo2; | ||
814 | +static struct fb_fix_screeninfo finfo; | ||
815 | +static struct omapfb_mem_info minfo; | ||
816 | +static struct omapfb_plane_info pinfo; | ||
817 | +static int xoff, yoff; | ||
818 | + | ||
819 | +static struct { | ||
820 | + unsigned x; | ||
821 | + unsigned y; | ||
822 | + uint8_t *buf; | ||
823 | +} fb_pages[2]; | ||
824 | +static int dev_fd = -1; | ||
825 | +static int fb_page_flip = 0; | ||
826 | +static int page = 0; | ||
827 | +static void omapfb_update(int x, int y, int out_w, int out_h, int show); | ||
828 | + | ||
829 | +extern void mplayer_put_key( int code ); | ||
830 | +#include "osdep/keycodes.h" | ||
831 | + | ||
832 | +#define TRANSPARENT_COLOR_KEY 0xff0 | ||
833 | + | ||
834 | +static Display *display = NULL; // pointer to X Display structure. | ||
835 | +static int screen_num; // number of screen to place the window on. | ||
836 | +static Window win = 0; | ||
837 | +static Window parent = 0; // pointer to the newly created window. | ||
838 | + | ||
839 | +/* This is used to intercept window closing requests. */ | ||
840 | +static Atom wm_delete_window; | ||
841 | + | ||
842 | + | ||
843 | +void vo_calc_drwXY(uint32_t *drwX, uint32_t *drwY) | ||
844 | +{ | ||
845 | + *drwX = *drwY = 0; | ||
846 | + if (vo_fs) { | ||
847 | + aspect(&vo_dwidth, &vo_dheight, A_ZOOM); | ||
848 | + vo_dwidth = FFMIN(vo_dwidth, vo_screenwidth); | ||
849 | + vo_dheight = FFMIN(vo_dheight, vo_screenheight); | ||
850 | + *drwX = (vo_screenwidth - vo_dwidth) / 2; | ||
851 | + *drwY = (vo_screenheight - vo_dheight) / 2; | ||
852 | + mp_msg(MSGT_VO, MSGL_V, "[vo-fs] dx: %d dy: %d dw: %d dh: %d\n", | ||
853 | + *drwX, *drwY, vo_dwidth, vo_dheight); | ||
854 | + } else if (WinID == 0) { | ||
855 | + *drwX = vo_dx; | ||
856 | + *drwY = vo_dy; | ||
857 | + } | ||
858 | +} | ||
859 | + | ||
860 | +static void getPrimaryPlaneInfo() | ||
861 | +{ | ||
862 | + int dev_fd = open("/dev/fb0", O_RDWR); | ||
863 | + | ||
864 | + if (dev_fd == -1) { | ||
865 | + mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Error /dev/fb0\n"); | ||
866 | + return -1; | ||
867 | + } | ||
868 | + | ||
869 | + ioctl(dev_fd, FBIOGET_VSCREENINFO, &sinfo_p0); | ||
870 | + close(dev_fd); | ||
871 | +} | ||
872 | + | ||
873 | +/** | ||
874 | + * Function to get the offset to be used when in windowed mode | ||
875 | + * or when using -wid option | ||
876 | + */ | ||
877 | +static void x11_get_window_abs_position(Display *display, Window window, | ||
878 | + int *wx, int *wy, int *ww, int *wh) | ||
879 | +{ | ||
880 | + Window root, parent; | ||
881 | + Window *child; | ||
882 | + unsigned int n_children; | ||
883 | + XWindowAttributes attribs; | ||
884 | + | ||
885 | + /* Get window attributes */ | ||
886 | + XGetWindowAttributes(display, window, &attribs); | ||
887 | + | ||
888 | + /* Get relative position of given window */ | ||
889 | + *wx = attribs.x; | ||
890 | + *wy = attribs.y; | ||
891 | + if (ww) | ||
892 | + *ww = attribs.width; | ||
893 | + if (wh) | ||
894 | + *wh = attribs.height; | ||
895 | + | ||
896 | + /* Query window tree information */ | ||
897 | + XQueryTree(display, window, &root, &parent, &child, &n_children); | ||
898 | + if (parent) | ||
899 | + { | ||
900 | + int x, y; | ||
901 | + /* If we have a parent we must go there and discover his position*/ | ||
902 | + x11_get_window_abs_position(display, parent, &x, &y, NULL, NULL); | ||
903 | + *wx += x; | ||
904 | + *wy += y; | ||
905 | + } | ||
906 | + | ||
907 | + /* If we had children, free it */ | ||
908 | + if(n_children) | ||
909 | + XFree(child); | ||
910 | +} | ||
911 | + | ||
912 | +static void x11_check_events(void) | ||
913 | +{ | ||
914 | + int e = vo_x11_check_events(mDisplay); | ||
915 | + | ||
916 | + if (e & VO_EVENT_RESIZE) | ||
917 | + vo_calc_drwXY(&drwX, &drwY); | ||
918 | + | ||
919 | + if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) | ||
920 | + { | ||
921 | + vo_xv_draw_colorkey(drwX, drwY, vo_dwidth - 1, vo_dheight - 1); | ||
922 | + omapfb_update(0, 0, 0, 0, 1); | ||
923 | + } | ||
924 | +} | ||
925 | + | ||
926 | +static void x11_uninit() | ||
927 | +{ | ||
928 | + if (display) { | ||
929 | + XCloseDisplay(display); | ||
930 | + display = NULL; | ||
931 | + } | ||
932 | +} | ||
933 | + | ||
934 | +/** | ||
935 | + * Initialize framebuffer | ||
936 | + */ | ||
937 | +static int preinit(const char *arg) | ||
938 | +{ | ||
939 | + opt_t subopts[] = { | ||
940 | + {"fb_overlay_only", OPT_ARG_BOOL, &fb_overlay_only, NULL}, | ||
941 | + {"dbl_buffer", OPT_ARG_BOOL, &dbl_buffer, NULL}, | ||
942 | + {NULL} | ||
943 | + }; | ||
944 | + | ||
945 | + if (subopt_parse(arg, subopts) != 0) { | ||
946 | + mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] unknown suboptions: %s\n", arg); | ||
947 | + return -1; | ||
948 | + } | ||
949 | + | ||
950 | + getPrimaryPlaneInfo(); | ||
951 | + dev_fd = open("/dev/fb1", O_RDWR); | ||
952 | + | ||
953 | + if (dev_fd == -1) { | ||
954 | + mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Error /dev/fb1\n"); | ||
955 | + return -1; | ||
956 | + } | ||
957 | + | ||
958 | + ioctl(dev_fd, FBIOGET_VSCREENINFO, &sinfo); | ||
959 | + ioctl(dev_fd, OMAPFB_QUERY_PLANE, &pinfo); | ||
960 | + ioctl(dev_fd, OMAPFB_QUERY_MEM, &minfo); | ||
961 | + | ||
962 | + if (!fb_overlay_only && !vo_init()) | ||
963 | + { | ||
964 | + mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Could not open X, overlay only...\n"); | ||
965 | + fb_overlay_only = 1; | ||
966 | + } | ||
967 | + | ||
968 | + return 0; | ||
969 | +} | ||
970 | + | ||
971 | +static void omapfb_update(int x, int y, int out_w, int out_h, int show) | ||
972 | +{ | ||
973 | + int xres, yres; | ||
974 | + if (!fb_overlay_only) | ||
975 | + x11_get_window_abs_position(mDisplay, vo_window, &x, &y, &out_w, &out_h); | ||
976 | + | ||
977 | + /* Check for new screen rotation */ | ||
978 | + ioctl(dev_fd, FBIOGET_VSCREENINFO, &sinfo2); | ||
979 | + if (sinfo2.rotate != sinfo_p0.rotate) | ||
980 | + getPrimaryPlaneInfo(); | ||
981 | + | ||
982 | + if ( (!x && !y && !out_w && !out_h) || | ||
983 | + (out_w < sinfo.xres_virtual / 4) || (out_h < sinfo.yres_virtual / 4) || /* HW can't scale down by more than 4x */ | ||
984 | + (out_w > sinfo.xres_virtual * 8) || (out_h > sinfo.yres_virtual * 8) ) { /* HW can't scale up by more than 8x */ | ||
985 | + pinfo.enabled = 0; | ||
986 | + pinfo.pos_x = 0; | ||
987 | + pinfo.pos_y = 0; | ||
988 | + ioctl(dev_fd, OMAPFB_SETUP_PLANE, &pinfo); | ||
989 | + return; | ||
990 | + } | ||
991 | + | ||
992 | + xres = sinfo.xres_virtual; | ||
993 | + yres = sinfo.yres_virtual; | ||
994 | + | ||
995 | + /* Handle clipping: if the left or top edge of the window goes | ||
996 | + * offscreen, clamp the overlay to the left or top edge of the | ||
997 | + * screen, and set the difference into the frame offset. Also | ||
998 | + * decrease the overlay size by the offset. The offset must | ||
999 | + * take window scaling into account as well. | ||
1000 | + * | ||
1001 | + * Likewise, if the right or bottom edge of the window goes | ||
1002 | + * offscreen, clamp the overlay to the right or bottom edge of | ||
1003 | + * the screen, and decrease the overlay size accordingly. The | ||
1004 | + * hardware will truncate the output accordingly, so no offset | ||
1005 | + * is needed. Also take window scaling into account. -- hyc | ||
1006 | + */ | ||
1007 | + if (x < 0) { | ||
1008 | + /* clamp to left edge */ | ||
1009 | + xoff = -x; | ||
1010 | + if (out_w != sinfo.xres_virtual) { | ||
1011 | + /* account for scaling */ | ||
1012 | + xoff *= sinfo.xres_virtual; | ||
1013 | + xoff /= out_w; | ||
1014 | + } | ||
1015 | + xres -= xoff; | ||
1016 | + out_w += x; | ||
1017 | + x = 0; | ||
1018 | + } else { | ||
1019 | + xoff = 0; | ||
1020 | + if (x + out_w > sinfo_p0.xres) { | ||
1021 | + /* clamp to right edge */ | ||
1022 | + int diff = sinfo_p0.xres - x; | ||
1023 | + if (out_w != sinfo.xres_virtual) { | ||
1024 | + /* account for scaling */ | ||
1025 | + xres = diff * sinfo.xres_virtual; | ||
1026 | + xres /= out_w; | ||
1027 | + } else { | ||
1028 | + xres = diff; | ||
1029 | + } | ||
1030 | + out_w = diff; | ||
1031 | + } | ||
1032 | + } | ||
1033 | + | ||
1034 | + if (y < 0) { | ||
1035 | + /* clamp to top edge - this seldom occurs since the window | ||
1036 | + * titlebar is usually forced to stay visible | ||
1037 | + */ | ||
1038 | + yoff = -y; | ||
1039 | + if (out_h != sinfo.yres_virtual) { | ||
1040 | + /* account for scaling */ | ||
1041 | + yoff *= sinfo.yres_virtual; | ||
1042 | + yoff /= out_h; | ||
1043 | + } | ||
1044 | + yres -= yoff; | ||
1045 | + out_h += y; | ||
1046 | + y = 0; | ||
1047 | + } else { | ||
1048 | + yoff = 0; | ||
1049 | + if (y + out_h > sinfo_p0.yres) { | ||
1050 | + /* clamp to bottom edge */ | ||
1051 | + int diff = sinfo_p0.yres - y; | ||
1052 | + if (out_h != sinfo.yres_virtual) { | ||
1053 | + /* account for scaling */ | ||
1054 | + yres = diff * sinfo.yres_virtual; | ||
1055 | + yres /= out_h; | ||
1056 | + } else { | ||
1057 | + yres = diff; | ||
1058 | + } | ||
1059 | + out_h = diff; | ||
1060 | + } | ||
1061 | + } | ||
1062 | + | ||
1063 | + if (xoff & 1) | ||
1064 | + xoff++; | ||
1065 | + if (xres & 1) | ||
1066 | + xres--; | ||
1067 | + | ||
1068 | + pinfo.enabled = show; | ||
1069 | + pinfo.pos_x = x; | ||
1070 | + pinfo.pos_y = y; | ||
1071 | + pinfo.out_width = out_w; | ||
1072 | + pinfo.out_height = out_h; | ||
1073 | + | ||
1074 | + sinfo.xoffset = fb_pages[page].x + xoff; | ||
1075 | + sinfo.yoffset = fb_pages[page].y + yoff; | ||
1076 | + /* If we had to change the overlay dimensions, update it */ | ||
1077 | + if (xres != sinfo2.xres || yres != sinfo2.yres || | ||
1078 | + sinfo.xoffset != sinfo2.xoffset || | ||
1079 | + sinfo.yoffset != sinfo2.yoffset) { | ||
1080 | + sinfo.xres = xres; | ||
1081 | + sinfo.yres = yres; | ||
1082 | + sinfo.rotate = sinfo2.rotate; | ||
1083 | + ioctl(dev_fd, FBIOPUT_VSCREENINFO, &sinfo); | ||
1084 | + } | ||
1085 | + | ||
1086 | + ioctl(dev_fd, OMAPFB_SETUP_PLANE, &pinfo); | ||
1087 | +} | ||
1088 | + | ||
1089 | +static int config(uint32_t width, uint32_t height, uint32_t d_width, | ||
1090 | + uint32_t d_height, uint32_t flags, char *title, | ||
1091 | + uint32_t format) | ||
1092 | +{ | ||
1093 | + uint8_t *fbmem; | ||
1094 | + int i; | ||
1095 | + struct omapfb_color_key color_key; | ||
1096 | + | ||
1097 | + XVisualInfo vinfo; | ||
1098 | + XSetWindowAttributes xswa; | ||
1099 | + XWindowAttributes attribs; | ||
1100 | + unsigned long xswamask; | ||
1101 | + int depth; | ||
1102 | + | ||
1103 | + Window root, parent; | ||
1104 | + Window *child; | ||
1105 | + unsigned int n_children; | ||
1106 | + | ||
1107 | + fullscreen_flag = flags & VOFLAG_FULLSCREEN; | ||
1108 | + if (!fb_overlay_only) | ||
1109 | + { | ||
1110 | + if (!title) | ||
1111 | + title = "MPlayer OMAPFB (X11/FB) render"; | ||
1112 | + | ||
1113 | + XGetWindowAttributes(mDisplay, mRootWin, &attribs); | ||
1114 | + depth = attribs.depth; | ||
1115 | + if (depth != 15 && depth != 16 && depth != 24 && depth != 32) | ||
1116 | + depth = 24; | ||
1117 | + XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); | ||
1118 | + | ||
1119 | + xswa.border_pixel = 0; | ||
1120 | + xswa.background_pixel = xv_colorkey = TRANSPARENT_COLOR_KEY; | ||
1121 | + | ||
1122 | + xswamask = CWBackPixel | CWBorderPixel; | ||
1123 | + xv_ck_info.method = CK_METHOD_BACKGROUND; | ||
1124 | + | ||
1125 | + vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, vo_dwidth, vo_dheight, | ||
1126 | + flags, CopyFromParent, "omapfb", title); | ||
1127 | + XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); | ||
1128 | + | ||
1129 | + /* Need to receive events on the parent window -- so when it is | ||
1130 | + moved / resized / etc., we know. */ | ||
1131 | + if(WinID > 0) | ||
1132 | + { | ||
1133 | + /* Query window tree information */ | ||
1134 | + XQueryTree(mDisplay, vo_window, &root, &parent, &child, &n_children); | ||
1135 | + if (n_children) | ||
1136 | + XFree(child); | ||
1137 | + | ||
1138 | + XUnmapWindow(mDisplay, vo_window); | ||
1139 | + if (parent) | ||
1140 | + XSelectInput(mDisplay, parent, StructureNotifyMask); | ||
1141 | + XMapWindow(mDisplay, vo_window); | ||
1142 | + } | ||
1143 | + | ||
1144 | + vo_calc_drwXY(&drwX, &drwY); | ||
1145 | + vo_xv_draw_colorkey(drwX, drwY, vo_dwidth - 1, vo_dheight - 1); | ||
1146 | + } | ||
1147 | + | ||
1148 | + fbmem = mmap(NULL, minfo.size, PROT_READ|PROT_WRITE, MAP_SHARED, dev_fd, 0); | ||
1149 | + if (fbmem == MAP_FAILED) { | ||
1150 | + mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Error mmap\n"); | ||
1151 | + return -1; | ||
1152 | + } | ||
1153 | + | ||
1154 | + for (i = 0; i < minfo.size / 4; i++) | ||
1155 | + ((uint32_t*)fbmem)[i] = 0x80008000; | ||
1156 | + | ||
1157 | + sinfo.xres = width & ~15; | ||
1158 | + sinfo.yres = height & ~15; | ||
1159 | + sinfo.xoffset = 0; | ||
1160 | + sinfo.yoffset = 0; | ||
1161 | + sinfo.nonstd = OMAPFB_COLOR_YUY422; | ||
1162 | + | ||
1163 | + fb_pages[0].x = 0; | ||
1164 | + fb_pages[0].y = 0; | ||
1165 | + fb_pages[0].buf = fbmem; | ||
1166 | + | ||
1167 | + if (dbl_buffer && minfo.size >= sinfo.xres * sinfo.yres * 2) { | ||
1168 | + sinfo.xres_virtual = sinfo.xres; | ||
1169 | + sinfo.yres_virtual = sinfo.yres * 2; | ||
1170 | + fb_pages[1].x = 0; | ||
1171 | + fb_pages[1].y = sinfo.yres; | ||
1172 | + fb_pages[1].buf = fbmem + sinfo.xres * sinfo.yres * 2; | ||
1173 | + fb_page_flip = 1; | ||
1174 | + } else { | ||
1175 | + sinfo.xres_virtual = sinfo.xres; | ||
1176 | + sinfo.yres_virtual = sinfo.yres; | ||
1177 | + fb_page_flip = 0; | ||
1178 | + } | ||
1179 | + | ||
1180 | + ioctl(dev_fd, FBIOPUT_VSCREENINFO, &sinfo); | ||
1181 | + ioctl(dev_fd, FBIOGET_FSCREENINFO, &finfo); | ||
1182 | + | ||
1183 | + if (WinID <= 0) { | ||
1184 | + if (fullscreen_flag) { | ||
1185 | + omapfb_update(0, 0, sinfo_p0.xres, sinfo_p0.yres, 1); | ||
1186 | + } else { | ||
1187 | + omapfb_update(sinfo_p0.xres / 2 - sinfo.xres / 2, sinfo_p0.yres / 2 - sinfo.yres / 2, sinfo.xres, sinfo.yres, 1); | ||
1188 | + } | ||
1189 | + } | ||
1190 | + | ||
1191 | + color_key.channel_out = OMAPFB_CHANNEL_OUT_LCD; | ||
1192 | + color_key.background = 0x0; | ||
1193 | + color_key.trans_key = TRANSPARENT_COLOR_KEY; | ||
1194 | + if (fb_overlay_only) | ||
1195 | + color_key.key_type = OMAPFB_COLOR_KEY_DISABLED; | ||
1196 | + else | ||
1197 | + color_key.key_type = OMAPFB_COLOR_KEY_GFX_DST; | ||
1198 | + ioctl(dev_fd, OMAPFB_SET_COLOR_KEY, &color_key); | ||
1199 | + | ||
1200 | + plane_ready = 1; | ||
1201 | + return 0; | ||
1202 | +} | ||
1203 | + | ||
1204 | +static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, int stride) | ||
1205 | +{ | ||
1206 | + vo_draw_alpha_yuy2(w, h, src, srca, stride, fb_pages[page].buf + y0 * finfo.line_length + x0 * 2, finfo.line_length); | ||
1207 | +} | ||
1208 | + | ||
1209 | +static void draw_osd(void) | ||
1210 | +{ | ||
1211 | + vo_draw_text(sinfo.xres, sinfo.yres, draw_alpha); | ||
1212 | +} | ||
1213 | + | ||
1214 | +static int draw_frame(uint8_t *src[]) | ||
1215 | +{ | ||
1216 | + return 1; | ||
1217 | +} | ||
1218 | + | ||
1219 | +static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y) | ||
1220 | +{ | ||
1221 | + if (x!=0) | ||
1222 | + return 0; | ||
1223 | + | ||
1224 | + if (!plane_ready) | ||
1225 | + return 0; | ||
1226 | + | ||
1227 | + ioctl(dev_fd, OMAPFB_SYNC_GFX); | ||
1228 | + | ||
1229 | + yuv420_to_yuv422(fb_pages[page].buf + y * finfo.line_length, src[0], src[1], src[2], w & ~15, h, stride[0], stride[1], finfo.line_length); | ||
1230 | + return 0; | ||
1231 | +} | ||
1232 | + | ||
1233 | +static void flip_page(void) | ||
1234 | +{ | ||
1235 | + if (fb_page_flip) { | ||
1236 | + sinfo.xoffset = fb_pages[page].x + xoff; | ||
1237 | + sinfo.yoffset = fb_pages[page].y + yoff; | ||
1238 | + ioctl(dev_fd, FBIOPAN_DISPLAY, &sinfo); | ||
1239 | + page ^= fb_page_flip; | ||
1240 | + } | ||
1241 | +} | ||
1242 | + | ||
1243 | +static int query_format(uint32_t format) | ||
1244 | +{ | ||
1245 | + // For simplicity pretend that we can only do YV12, support for | ||
1246 | + // other formats can be added quite easily if/when needed | ||
1247 | + if (format != IMGFMT_YV12) | ||
1248 | + return 0; | ||
1249 | + | ||
1250 | + return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_SWSCALE | VFCAP_ACCEPT_STRIDE; | ||
1251 | +} | ||
1252 | + | ||
1253 | + | ||
1254 | +/** | ||
1255 | + * Uninitialize framebuffer | ||
1256 | + */ | ||
1257 | +static void uninit() | ||
1258 | +{ | ||
1259 | + pinfo.enabled = 0; | ||
1260 | + ioctl(dev_fd, OMAPFB_SETUP_PLANE, &pinfo); | ||
1261 | + | ||
1262 | + if (!fb_overlay_only) { | ||
1263 | + struct omapfb_color_key color_key; | ||
1264 | + color_key.channel_out = OMAPFB_CHANNEL_OUT_LCD; | ||
1265 | + color_key.key_type = OMAPFB_COLOR_KEY_DISABLED; | ||
1266 | + ioctl(dev_fd, OMAPFB_SET_COLOR_KEY, &color_key); | ||
1267 | + } | ||
1268 | + | ||
1269 | + close(dev_fd); | ||
1270 | + | ||
1271 | + if (!fb_overlay_only) | ||
1272 | + x11_uninit(); | ||
1273 | +} | ||
1274 | + | ||
1275 | + | ||
1276 | +static int control(uint32_t request, void *data) | ||
1277 | +{ | ||
1278 | + switch (request) { | ||
1279 | + case VOCTRL_QUERY_FORMAT: | ||
1280 | + return query_format(*((uint32_t*)data)); | ||
1281 | + case VOCTRL_FULLSCREEN: { | ||
1282 | + if (WinID > 0) return VO_FALSE; | ||
1283 | + if (fullscreen_flag) { | ||
1284 | + if (!fb_overlay_only) | ||
1285 | + vo_x11_fullscreen(); | ||
1286 | + fullscreen_flag = 0; | ||
1287 | + omapfb_update(sinfo_p0.xres / 2 - sinfo.xres / 2, sinfo_p0.yres / 2 - sinfo.yres / 2, sinfo.xres, sinfo.yres, 1); | ||
1288 | + } else { | ||
1289 | + if (!fb_overlay_only) | ||
1290 | + vo_x11_fullscreen(); | ||
1291 | + fullscreen_flag = 1; | ||
1292 | + omapfb_update(0, 0, sinfo_p0.xres, sinfo_p0.yres, 1); | ||
1293 | + } | ||
1294 | + return VO_TRUE; | ||
1295 | + } | ||
1296 | + case VOCTRL_UPDATE_SCREENINFO: | ||
1297 | + update_xinerama_info(); | ||
1298 | + return VO_TRUE; | ||
1299 | + } | ||
1300 | + return VO_NOTIMPL; | ||
1301 | +} | ||
1302 | + | ||
1303 | + | ||
1304 | +static void check_events(void) | ||
1305 | +{ | ||
1306 | + if (!fb_overlay_only) | ||
1307 | + x11_check_events(); | ||
1308 | +} | ||
1309 | diff --git a/libvo/yuv.S b/libvo/yuv.S | ||
1310 | new file mode 100644 | ||
1311 | index 0000000..1cd2c1d | ||
1312 | --- /dev/null | ||
1313 | +++ b/libvo/yuv.S | ||
1314 | @@ -0,0 +1,170 @@ | ||
1315 | +/* | ||
1316 | + Copyright (C) 2008 Mans Rullgard | ||
1317 | + | ||
1318 | + Permission is hereby granted, free of charge, to any person | ||
1319 | + obtaining a copy of this software and associated documentation | ||
1320 | + files (the "Software"), to deal in the Software without | ||
1321 | + restriction, including without limitation the rights to use, copy, | ||
1322 | + modify, merge, publish, distribute, sublicense, and/or sell copies | ||
1323 | + of the Software, and to permit persons to whom the Software is | ||
1324 | + furnished to do so, subject to the following conditions: | ||
1325 | + | ||
1326 | + The above copyright notice and this permission notice shall be | ||
1327 | + included in all copies or substantial portions of the Software. | ||
1328 | + | ||
1329 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
1330 | + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
1331 | + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
1332 | + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
1333 | + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
1334 | + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
1335 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
1336 | + DEALINGS IN THE SOFTWARE. | ||
1337 | + */ | ||
1338 | + | ||
1339 | + .macro mov32 rd, val | ||
1340 | + movw \rd, #:lower16:\val | ||
1341 | + movt \rd, #:upper16:\val | ||
1342 | + .endm | ||
1343 | + | ||
1344 | + .fpu neon | ||
1345 | + .text | ||
1346 | + | ||
1347 | +@ yuv420_to_yuv422(uint8_t *yuv, uint8_t *y, uint8_t *u, uint8_t *v, | ||
1348 | +@ int w, int h, int yw, int cw, int dw) | ||
1349 | + | ||
1350 | +#define yuv r0 | ||
1351 | +#define y r1 | ||
1352 | +#define u r2 | ||
1353 | +#define v r3 | ||
1354 | +#define w r4 | ||
1355 | +#define h r5 | ||
1356 | +#define yw r6 | ||
1357 | +#define cw r7 | ||
1358 | +#define dw r8 | ||
1359 | + | ||
1360 | +#define tyuv r9 | ||
1361 | +#define ty r10 | ||
1362 | +#define tu r11 | ||
1363 | +#define tv r12 | ||
1364 | +#define i lr | ||
1365 | + | ||
1366 | + .global yuv420_to_yuv422 | ||
1367 | + .func yuv420_to_yuv422 | ||
1368 | +yuv420_to_yuv422: | ||
1369 | + push {r4-r11,lr} | ||
1370 | + add r4, sp, #36 | ||
1371 | +.Ldo_conv: | ||
1372 | + ldm r4, {r4-r8} | ||
1373 | + push {r4} | ||
1374 | +1: | ||
1375 | + mov tu, u | ||
1376 | + mov tv, v | ||
1377 | + vld1.64 {d2}, [u,:64], cw @ u0 | ||
1378 | + vld1.64 {d3}, [v,:64], cw @ v0 | ||
1379 | + mov tyuv, yuv | ||
1380 | + mov ty, y | ||
1381 | + vzip.8 d2, d3 @ u0v0 | ||
1382 | + mov i, #16 | ||
1383 | +2: | ||
1384 | + pld [y, #64] | ||
1385 | + vld1.64 {d0, d1}, [y,:128], yw @ y0 | ||
1386 | + pld [u, #64] | ||
1387 | + subs i, i, #4 | ||
1388 | + vld1.64 {d6}, [u,:64], cw @ u2 | ||
1389 | + pld [y, #64] | ||
1390 | + vld1.64 {d4, d5}, [y,:128], yw @ y1 | ||
1391 | + pld [v, #64] | ||
1392 | + vld1.64 {d7}, [v,:64], cw @ v2 | ||
1393 | + pld [y, #64] | ||
1394 | + vld1.64 {d16,d17}, [y,:128], yw @ y2 | ||
1395 | + vzip.8 d6, d7 @ u2v2 | ||
1396 | + pld [u, #64] | ||
1397 | + vld1.64 {d22}, [u,:64], cw @ u4 | ||
1398 | + pld [v, #64] | ||
1399 | + vld1.64 {d23}, [v,:64], cw @ v4 | ||
1400 | + pld [y, #64] | ||
1401 | + vld1.64 {d20,d21}, [y,:128], yw @ y3 | ||
1402 | + vmov q9, q3 @ u2v2 | ||
1403 | + vzip.8 d22, d23 @ u4v4 | ||
1404 | + vrhadd.u8 q3, q1, q3 @ u1v1 | ||
1405 | + vzip.8 q0, q1 @ y0u0y0v0 | ||
1406 | + vmov q12, q11 @ u4v4 | ||
1407 | + vzip.8 q2, q3 @ y1u1y1v1 | ||
1408 | + vrhadd.u8 q11, q9, q11 @ u3v3 | ||
1409 | + vst1.64 {d0-d3}, [yuv,:128], dw @ y0u0y0v0 | ||
1410 | + vzip.8 q8, q9 @ y2u2y2v2 | ||
1411 | + vst1.64 {d4-d7}, [yuv,:128], dw @ y1u1y1v1 | ||
1412 | + vzip.8 q10, q11 @ y3u3y3v3 | ||
1413 | + vst1.64 {d16-d19}, [yuv,:128], dw @ y2u2y2v2 | ||
1414 | + vmov q1, q12 | ||
1415 | + vst1.64 {d20-d23}, [yuv,:128], dw @ y3u3y3v3 | ||
1416 | + bgt 2b | ||
1417 | + | ||
1418 | + subs w, w, #16 | ||
1419 | + add yuv, tyuv, #32 | ||
1420 | + add y, ty, #16 | ||
1421 | + add u, tu, #8 | ||
1422 | + add v, tv, #8 | ||
1423 | + bgt 1b | ||
1424 | + | ||
1425 | + ldr w, [sp] | ||
1426 | + subs h, h, #16 | ||
1427 | + add yuv, yuv, dw, lsl #4 | ||
1428 | + sub yuv, yuv, w, lsl #1 | ||
1429 | + add y, y, yw, lsl #4 | ||
1430 | + sub y, y, w | ||
1431 | + add u, u, cw, lsl #3 | ||
1432 | + sub u, u, w, asr #1 | ||
1433 | + add v, v, cw, lsl #3 | ||
1434 | + sub v, v, w, asr #1 | ||
1435 | + bgt 1b | ||
1436 | + | ||
1437 | + pop {r3-r11,pc} | ||
1438 | + .endfunc | ||
1439 | + | ||
1440 | + .func neon_open | ||
1441 | +neon_open: | ||
1442 | + push {r4-r8,lr} | ||
1443 | + ldrd r4, r5, [r0, #16] | ||
1444 | + ldrd r6, r7, [r0, #24] | ||
1445 | + lsl r8, r4, #1 | ||
1446 | + mov32 r0, conv_params | ||
1447 | + stm r0, {r4-r8} | ||
1448 | + mov r0, #0 | ||
1449 | + pop {r4-r8,pc} | ||
1450 | + .endfunc | ||
1451 | + | ||
1452 | + .func neon_convert | ||
1453 | +neon_convert: | ||
1454 | + push {r4-r11,lr} | ||
1455 | + ldr r0, [r0] | ||
1456 | + mov32 r4, conv_params | ||
1457 | + ldm r1, {r1-r3} | ||
1458 | + b .Ldo_conv | ||
1459 | + .endfunc | ||
1460 | + | ||
1461 | + .func neon_nop | ||
1462 | +neon_nop: | ||
1463 | + bx lr | ||
1464 | + .endfunc | ||
1465 | + | ||
1466 | + .section .bss | ||
1467 | +conv_params: | ||
1468 | + .skip 5*4 | ||
1469 | + .size conv_params, . - conv_params | ||
1470 | + | ||
1471 | + .section .rodata | ||
1472 | +.Lname: .asciz "neon" | ||
1473 | +ofb_pixconv_neon: | ||
1474 | + .word .Lname | ||
1475 | + .word 0 @ flags | ||
1476 | + .word neon_open | ||
1477 | + .word neon_convert | ||
1478 | + .word neon_nop @ finish | ||
1479 | + .word neon_nop @ close | ||
1480 | + .size ofb_pixconv_neon, . - ofb_pixconv_neon | ||
1481 | + | ||
1482 | + .section .ofb_pixconv, "a" | ||
1483 | +ofb_pixconv_neon_p: | ||
1484 | + .word ofb_pixconv_neon | ||
1485 | -- | ||
1486 | 1.7.7.1 | ||
1487 | |||
diff --git a/meta-oe/recipes-multimedia/mplayer/mplayer2/cross.compile.codec-cfg.patch b/meta-oe/recipes-multimedia/mplayer/mplayer2/cross.compile.codec-cfg.patch new file mode 100644 index 0000000000..7b290b5051 --- /dev/null +++ b/meta-oe/recipes-multimedia/mplayer/mplayer2/cross.compile.codec-cfg.patch | |||
@@ -0,0 +1,16 @@ | |||
1 | Upstream-Status: Pending | ||
2 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
3 | |||
4 | diff --git a/Makefile b/Makefile | ||
5 | index 6013ca3..28c6383 100644 | ||
6 | --- a/Makefile | ||
7 | +++ b/Makefile | ||
8 | @@ -600,7 +602,7 @@ mplayer$(EXESUF): | ||
9 | $(CC) -o $@ $^ $(EXTRALIBS) | ||
10 | |||
11 | codec-cfg$(EXESUF): codec-cfg.c codec-cfg.h | ||
12 | - $(HOST_CC) -O -DCODECS2HTML -I. -o $@ $< | ||
13 | + $(BUILD_CC) -O -DCODECS2HTML -I. -Iffmpeg -o $@ $< | ||
14 | |||
15 | codecs.conf.h: codec-cfg$(EXESUF) etc/codecs.conf | ||
16 | ./$^ > $@ | ||
diff --git a/meta-oe/recipes-multimedia/mplayer/mplayer2_git.bb b/meta-oe/recipes-multimedia/mplayer/mplayer2_git.bb new file mode 100644 index 0000000000..4a5fc822e4 --- /dev/null +++ b/meta-oe/recipes-multimedia/mplayer/mplayer2_git.bb | |||
@@ -0,0 +1,175 @@ | |||
1 | DESCRIPTION = "Open Source multimedia player." | ||
2 | SECTION = "multimedia" | ||
3 | PRIORITY = "optional" | ||
4 | HOMEPAGE = "http://www.mplayerhq.hu/" | ||
5 | DEPENDS = "libvpx live555 libdvdread libtheora virtual/libsdl ffmpeg xsp zlib libpng jpeg liba52 freetype fontconfig alsa-lib lzo ncurses lame libxv virtual/libx11 virtual/kernel libass \ | ||
6 | ${@base_conditional('ENTERPRISE_DISTRO', '1', '', 'libmad liba52 lame', d)}" | ||
7 | |||
8 | #RDEPENDS_${PN} = "mplayer-common" | ||
9 | PROVIDES = "mplayer" | ||
10 | RPROVIDES_${PN} = "mplayer" | ||
11 | RCONFLICTS_${PN} = "mplayer" | ||
12 | |||
13 | LICENSE = "GPLv3" | ||
14 | LIC_FILES_CHKSUM = "file://LICENSE;md5=d32239bcb673463ab874e80d47fae504" | ||
15 | |||
16 | SRC_URI = "git://repo.or.cz/mplayer.git;protocol=git;branch=master \ | ||
17 | file://cross.compile.codec-cfg.patch \ | ||
18 | " | ||
19 | |||
20 | SRC_URI_append_armv7a = " \ | ||
21 | file://0001-video-out-for-omapfb-support.patch \ | ||
22 | " | ||
23 | |||
24 | SRCREV = "e3f5043233336d8b4b0731c6a8b42a8fda5535ac" | ||
25 | |||
26 | ARM_INSTRUCTION_SET = "ARM" | ||
27 | |||
28 | PV = "2.0+gitr${SRCPV}" | ||
29 | |||
30 | PARALLEL_MAKE = "" | ||
31 | |||
32 | S = "${WORKDIR}/git" | ||
33 | |||
34 | FILES_${PN} = "${bindir}/mplayer ${libdir} /usr/etc/mplayer/" | ||
35 | CONFFILES_${PN} += "/usr/etc/mplayer/input.conf \ | ||
36 | /usr/etc/mplayer/example.conf \ | ||
37 | /usr/etc/mplayer/codecs.conf \ | ||
38 | " | ||
39 | |||
40 | inherit autotools pkgconfig | ||
41 | |||
42 | # We want a kernel header for armv7a, but we don't want to make mplayer machine specific for that | ||
43 | STAGING_KERNEL_DIR = "${STAGING_DIR}/${MACHINE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/kernel" | ||
44 | |||
45 | EXTRA_OECONF = " \ | ||
46 | --prefix=/usr \ | ||
47 | --mandir=${mandir} \ | ||
48 | --target=${SIMPLE_TARGET_SYS} \ | ||
49 | \ | ||
50 | --disable-lirc \ | ||
51 | --disable-lircc \ | ||
52 | --disable-joystick \ | ||
53 | --disable-vm \ | ||
54 | --disable-xf86keysym \ | ||
55 | --enable-tv \ | ||
56 | --disable-tv-v4l1 \ | ||
57 | --enable-tv-v4l2 \ | ||
58 | --disable-tv-bsdbt848 \ | ||
59 | --enable-rtc \ | ||
60 | --enable-networking \ | ||
61 | --disable-smb \ | ||
62 | --enable-live \ | ||
63 | --disable-dvdnav \ | ||
64 | --enable-dvdread \ | ||
65 | --disable-dvdread-internal \ | ||
66 | --disable-libdvdcss-internal \ | ||
67 | --disable-cdparanoia \ | ||
68 | --enable-freetype \ | ||
69 | --enable-sortsub \ | ||
70 | --disable-fribidi \ | ||
71 | --disable-enca \ | ||
72 | --disable-ftp \ | ||
73 | --disable-vstream \ | ||
74 | \ | ||
75 | --disable-gif \ | ||
76 | --enable-png \ | ||
77 | --enable-jpeg \ | ||
78 | --disable-libcdio \ | ||
79 | --disable-qtx \ | ||
80 | --disable-xanim \ | ||
81 | --disable-real \ | ||
82 | --disable-xvid \ | ||
83 | \ | ||
84 | --disable-speex \ | ||
85 | --enable-theora \ | ||
86 | --disable-ladspa \ | ||
87 | --disable-libdv \ | ||
88 | --enable-mad \ | ||
89 | --disable-xmms \ | ||
90 | --disable-musepack \ | ||
91 | \ | ||
92 | --disable-gl \ | ||
93 | --disable-vesa \ | ||
94 | --disable-svga \ | ||
95 | --enable-sdl \ | ||
96 | --disable-aa \ | ||
97 | --disable-caca \ | ||
98 | --disable-ggi \ | ||
99 | --disable-ggiwmh \ | ||
100 | --disable-directx \ | ||
101 | --disable-dxr3 \ | ||
102 | --disable-dvb \ | ||
103 | --disable-mga \ | ||
104 | --disable-xmga \ | ||
105 | --enable-xv \ | ||
106 | --disable-vm \ | ||
107 | --disable-xinerama \ | ||
108 | --enable-x11 \ | ||
109 | --enable-fbdev \ | ||
110 | --disable-3dfx \ | ||
111 | --disable-tdfxfb \ | ||
112 | --disable-s3fb \ | ||
113 | --disable-directfb \ | ||
114 | --disable-bl \ | ||
115 | --disable-tdfxvid \ | ||
116 | --disable-tga \ | ||
117 | --disable-pnm \ | ||
118 | --disable-md5sum \ | ||
119 | \ | ||
120 | --enable-alsa \ | ||
121 | --enable-ossaudio \ | ||
122 | --disable-arts \ | ||
123 | --disable-esd \ | ||
124 | --disable-pulse \ | ||
125 | --disable-jack \ | ||
126 | --disable-openal \ | ||
127 | --disable-nas \ | ||
128 | --disable-sgiaudio \ | ||
129 | --disable-sunaudio \ | ||
130 | --disable-win32waveout \ | ||
131 | --enable-select \ | ||
132 | --enable-libass \ | ||
133 | \ | ||
134 | --extra-libs=' -lBasicUsageEnvironment -lUsageEnvironment -lgroupsock -lliveMedia -lstdc++' \ | ||
135 | " | ||
136 | |||
137 | EXTRA_OECONF_append_armv6 = " --enable-armv6" | ||
138 | EXTRA_OECONF_append_armv7a = " --enable-armv6 --enable-neon" | ||
139 | |||
140 | FULL_OPTIMIZATION = "-fexpensive-optimizations -fomit-frame-pointer -frename-registers -O4 -ffast-math" | ||
141 | FULL_OPTIMIZATION_armv7a = "-fexpensive-optimizations -ftree-vectorize -fomit-frame-pointer -O4 -ffast-math" | ||
142 | BUILD_OPTIMIZATION = "${FULL_OPTIMIZATION}" | ||
143 | |||
144 | do_configure_prepend_armv7a() { | ||
145 | cp ${STAGING_KERNEL_DIR}/arch/arm/plat-omap/include/mach/omapfb.h ${S}/libvo/omapfb.h || true | ||
146 | cp ${STAGING_KERNEL_DIR}/include/asm-arm/arch-omap/omapfb.h ${S}/libvo/omapfb.h || true | ||
147 | cp ${STAGING_KERNEL_DIR}/include/linux/omapfb.h ${S}/libvo/omapfb.h || true | ||
148 | sed -e 's/__user//g' -i ${S}/libvo/omapfb.h || true | ||
149 | } | ||
150 | |||
151 | CFLAGS_append = " -I${S}/libdvdread4 " | ||
152 | |||
153 | do_configure() { | ||
154 | sed -i 's|/usr/include|${STAGING_INCDIR}|g' ${S}/configure | ||
155 | sed -i 's|/usr/lib|${STAGING_LIBDIR}|g' ${S}/configure | ||
156 | sed -i 's|/usr/\S*include[\w/]*||g' ${S}/configure | ||
157 | sed -i 's|/usr/\S*lib[\w/]*||g' ${S}/configure | ||
158 | sed -i 's|_install_strip="-s"|_install_strip=""|g' ${S}/configure | ||
159 | sed -i 's|HOST_CC|BUILD_CC|' ${S}/Makefile | ||
160 | |||
161 | export SIMPLE_TARGET_SYS="$(echo ${TARGET_SYS} | sed s:${TARGET_VENDOR}::g)" | ||
162 | ./configure ${EXTRA_OECONF} | ||
163 | |||
164 | } | ||
165 | |||
166 | do_compile () { | ||
167 | oe_runmake | ||
168 | } | ||
169 | |||
170 | do_install_append() { | ||
171 | install -d ${D}/usr/etc/mplayer | ||
172 | install ${S}/etc/input.conf ${D}/usr/etc/mplayer/ | ||
173 | install ${S}/etc/example.conf ${D}/usr/etc/mplayer/ | ||
174 | install ${S}/etc/codecs.conf ${D}/usr/etc/mplayer/ | ||
175 | } | ||