summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-multimedia/mplayer
diff options
context:
space:
mode:
authorKoen Kooi <koen@dominion.thruhere.net>2011-11-04 17:40:49 +0100
committerKoen Kooi <koen@dominion.thruhere.net>2011-11-04 17:40:49 +0100
commit7f5ca6706aa51dd7f1512e41757b0345aba59a47 (patch)
treebee219c9d922a40416621f5759f2b02d231e3806 /meta-oe/recipes-multimedia/mplayer
parent54458a43c8988826f7d7b738a6f942a2aef52e74 (diff)
downloadmeta-openembedded-7f5ca6706aa51dd7f1512e41757b0345aba59a47.tar.gz
mplayer2: armv7a fixes
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe/recipes-multimedia/mplayer')
-rw-r--r--meta-oe/recipes-multimedia/mplayer/mplayer2/0001-video-out-for-omapfb-support.patch691
-rw-r--r--meta-oe/recipes-multimedia/mplayer/mplayer2_git.bb7
2 files changed, 19 insertions, 679 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
index 0354ccf79..a362ef679 100644
--- 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
@@ -1,26 +1,25 @@
1From 23eb4c4051c7acb2babd4b224ef85cc8ee8fa511 Mon Sep 17 00:00:00 2001 1From 2a42cec41a018008d07ea33b2b91dca191d78481 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com> 2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Thu, 25 Nov 2010 16:49:53 +0100 3Date: Thu, 25 Nov 2010 16:49:53 +0100
4Subject: [PATCH] video out for omapfb support 4Subject: [PATCH] video out for omapfb support
5 5
6Upstream-Status: Pending 6Upstream-Status: Pending
7Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> 7Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
8Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
8--- 9---
9 Makefile | 2 +- 10 Makefile | 2 +-
10 libvo/video_out.c | 2 + 11 libvo/video_out.c | 2 +
11 libvo/video_out.c.orig | 654 ++++++++++++++++++++++++++++++++++++++++++++++++ 12 libvo/vo_omapfb.c | 591 +++++++++++++++++++++++++++++++++++++++++++++++++++++
12 libvo/vo_omapfb.c | 591 +++++++++++++++++++++++++++++++++++++++++++ 13 libvo/yuv.S | 170 +++++++++++++++
13 libvo/yuv.S | 170 +++++++++++++ 14 4 files changed, 764 insertions(+), 1 deletions(-)
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 15 create mode 100644 libvo/vo_omapfb.c
17 create mode 100644 libvo/yuv.S 16 create mode 100644 libvo/yuv.S
18 17
19diff --git a/Makefile b/Makefile 18diff --git a/Makefile b/Makefile
20index 28c6383..b023136 100644 19index 83304a2..1e88d40 100644
21--- a/Makefile 20--- a/Makefile
22+++ b/Makefile 21+++ b/Makefile
23@@ -451,7 +451,7 @@ SRCS_MPLAYER-$(DIRECTFB) += libvo/vo_directfb2.c libvo/vo_dfbmga.c 22@@ -450,7 +450,7 @@ SRCS_MPLAYER-$(DIRECTFB) += libvo/vo_directfb2.c libvo/vo_dfbmga.c
24 SRCS_MPLAYER-$(DIRECTX) += libao2/ao_dsound.c libvo/vo_directx.c 23 SRCS_MPLAYER-$(DIRECTX) += libao2/ao_dsound.c libvo/vo_directx.c
25 SRCS_MPLAYER-$(DXR3) += libvo/vo_dxr3.c 24 SRCS_MPLAYER-$(DXR3) += libvo/vo_dxr3.c
26 SRCS_MPLAYER-$(ESD) += libao2/ao_esd.c 25 SRCS_MPLAYER-$(ESD) += libao2/ao_esd.c
@@ -30,7 +29,7 @@ index 28c6383..b023136 100644
30 SRCS_MPLAYER-$(GGI) += libvo/vo_ggi.c 29 SRCS_MPLAYER-$(GGI) += libvo/vo_ggi.c
31 SRCS_MPLAYER-$(GIF) += libvo/vo_gif89a.c 30 SRCS_MPLAYER-$(GIF) += libvo/vo_gif89a.c
32diff --git a/libvo/video_out.c b/libvo/video_out.c 31diff --git a/libvo/video_out.c b/libvo/video_out.c
33index 2ed0c86..fc9a1cd 100644 32index e796784..1433834 100644
34--- a/libvo/video_out.c 33--- a/libvo/video_out.c
35+++ b/libvo/video_out.c 34+++ b/libvo/video_out.c
36@@ -95,6 +95,7 @@ extern struct vo_driver video_out_null; 35@@ -95,6 +95,7 @@ extern struct vo_driver video_out_null;
@@ -41,7 +40,7 @@ index 2ed0c86..fc9a1cd 100644
41 extern struct vo_driver video_out_svga; 40 extern struct vo_driver video_out_svga;
42 extern struct vo_driver video_out_png; 41 extern struct vo_driver video_out_png;
43 extern struct vo_driver video_out_ggi; 42 extern struct vo_driver video_out_ggi;
44@@ -194,6 +195,7 @@ const struct vo_driver *video_out_drivers[] = 43@@ -193,6 +194,7 @@ const struct vo_driver *video_out_drivers[] =
45 #ifdef CONFIG_FBDEV 44 #ifdef CONFIG_FBDEV
46 &video_out_fbdev, 45 &video_out_fbdev,
47 &video_out_fbdev2, 46 &video_out_fbdev2,
@@ -49,669 +48,9 @@ index 2ed0c86..fc9a1cd 100644
49 #endif 48 #endif
50 #ifdef CONFIG_SVGALIB 49 #ifdef CONFIG_SVGALIB
51 &video_out_svga, 50 &video_out_svga,
52diff --git a/libvo/video_out.c.orig b/libvo/video_out.c.orig
53new file mode 100644
54index 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
712diff --git a/libvo/vo_omapfb.c b/libvo/vo_omapfb.c 51diff --git a/libvo/vo_omapfb.c b/libvo/vo_omapfb.c
713new file mode 100644 52new file mode 100644
714index 0000000..8c927b7 53index 0000000..7bd8927
715--- /dev/null 54--- /dev/null
716+++ b/libvo/vo_omapfb.c 55+++ b/libvo/vo_omapfb.c
717@@ -0,0 +1,591 @@ 56@@ -0,0 +1,591 @@
@@ -827,7 +166,7 @@ index 0000000..8c927b7
827+static void omapfb_update(int x, int y, int out_w, int out_h, int show); 166+static void omapfb_update(int x, int y, int out_w, int out_h, int show);
828+ 167+
829+extern void mplayer_put_key( int code ); 168+extern void mplayer_put_key( int code );
830+#include "osdep/keycodes.h" 169+#include "input/keycodes.h"
831+ 170+
832+#define TRANSPARENT_COLOR_KEY 0xff0 171+#define TRANSPARENT_COLOR_KEY 0xff0
833+ 172+
@@ -1273,7 +612,7 @@ index 0000000..8c927b7
1273+} 612+}
1274+ 613+
1275+ 614+
1276+static int control(uint32_t request, void *data) 615+static int control(uint32_t request, void *data, ...)
1277+{ 616+{
1278+ switch (request) { 617+ switch (request) {
1279+ case VOCTRL_QUERY_FORMAT: 618+ case VOCTRL_QUERY_FORMAT:
@@ -1483,5 +822,5 @@ index 0000000..1cd2c1d
1483+ofb_pixconv_neon_p: 822+ofb_pixconv_neon_p:
1484+ .word ofb_pixconv_neon 823+ .word ofb_pixconv_neon
1485-- 824--
14861.7.7.1 8251.7.2.5
1487 826
diff --git a/meta-oe/recipes-multimedia/mplayer/mplayer2_git.bb b/meta-oe/recipes-multimedia/mplayer/mplayer2_git.bb
index 4a5fc822e..2e50d6cf0 100644
--- a/meta-oe/recipes-multimedia/mplayer/mplayer2_git.bb
+++ b/meta-oe/recipes-multimedia/mplayer/mplayer2_git.bb
@@ -17,7 +17,7 @@ SRC_URI = "git://repo.or.cz/mplayer.git;protocol=git;branch=master \
17 file://cross.compile.codec-cfg.patch \ 17 file://cross.compile.codec-cfg.patch \
18" 18"
19 19
20SRC_URI_append_armv7a = " \ 20SRC_URI_append_aarmv7a = " \
21 file://0001-video-out-for-omapfb-support.patch \ 21 file://0001-video-out-for-omapfb-support.patch \
22 " 22 "
23 23
@@ -143,9 +143,10 @@ BUILD_OPTIMIZATION = "${FULL_OPTIMIZATION}"
143 143
144do_configure_prepend_armv7a() { 144do_configure_prepend_armv7a() {
145 cp ${STAGING_KERNEL_DIR}/arch/arm/plat-omap/include/mach/omapfb.h ${S}/libvo/omapfb.h || true 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 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 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 148 cp ${STAGING_DIR_TARGET}/kernel/include/linux/omapfb.h ${S}/libvo/omapfb.h || true
149 sed -e 's/__user//g' -i ${S}/libvo/omapfb.h || true
149} 150}
150 151
151CFLAGS_append = " -I${S}/libdvdread4 " 152CFLAGS_append = " -I${S}/libdvdread4 "