From 0c5271baafa8a88f85ffb75045b32b83c3de4f93 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Sat, 3 Oct 2009 22:57:45 +0200 Subject: [PATCH] new package: - add mplayer for upcoming enna --- .../mplayer/720_dvdnav-colorspu.diff | 3875 +++++++++++++++++ packages/multimedia/mplayer/build | 289 ++ packages/multimedia/mplayer/config/input.conf | 129 + .../multimedia/mplayer/config/mplayer.enna | 45 + packages/multimedia/mplayer/install | 35 + .../165_playtree-pop-only-if-pushed.diff | 18 + .../mplayer/patches/185_slave-set-option.diff | 39 + .../mplayer/patches/250_bgvideo.diff | 153 + .../mplayer/patches/575_streaminfo-dump.diff | 163 + .../mplayer/patches/600_dvb-includes.diff | 22 + .../mplayer/patches/655_tvkeepon.diff | 11 + .../mplayer/patches/800_mt-vdec.diff | 21 + .../patches/850_ps3_controller_hack.diff | 72 + .../mplayer/patches/900_vo_ps3.diff.ps3 | 855 ++++ packages/multimedia/mplayer/unpack.1 | 7 + packages/multimedia/mplayer/url | 1 + 16 files changed, 5735 insertions(+) create mode 100644 packages/multimedia/mplayer/720_dvdnav-colorspu.diff create mode 100644 packages/multimedia/mplayer/build create mode 100644 packages/multimedia/mplayer/config/input.conf create mode 100644 packages/multimedia/mplayer/config/mplayer.enna create mode 100644 packages/multimedia/mplayer/install create mode 100644 packages/multimedia/mplayer/patches/165_playtree-pop-only-if-pushed.diff create mode 100644 packages/multimedia/mplayer/patches/185_slave-set-option.diff create mode 100644 packages/multimedia/mplayer/patches/250_bgvideo.diff create mode 100644 packages/multimedia/mplayer/patches/575_streaminfo-dump.diff create mode 100644 packages/multimedia/mplayer/patches/600_dvb-includes.diff create mode 100644 packages/multimedia/mplayer/patches/655_tvkeepon.diff create mode 100644 packages/multimedia/mplayer/patches/800_mt-vdec.diff create mode 100644 packages/multimedia/mplayer/patches/850_ps3_controller_hack.diff create mode 100644 packages/multimedia/mplayer/patches/900_vo_ps3.diff.ps3 create mode 100644 packages/multimedia/mplayer/unpack.1 create mode 100644 packages/multimedia/mplayer/url diff --git a/packages/multimedia/mplayer/720_dvdnav-colorspu.diff b/packages/multimedia/mplayer/720_dvdnav-colorspu.diff new file mode 100644 index 0000000000..5f4661d19e --- /dev/null +++ b/packages/multimedia/mplayer/720_dvdnav-colorspu.diff @@ -0,0 +1,3875 @@ +diff -Naur MPlayer-export-2009-06-13.orig/cfg-mplayer.h MPlayer-export-2009-06-13/cfg-mplayer.h +--- MPlayer-export-2009-06-13.orig/cfg-mplayer.h 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/cfg-mplayer.h 2009-06-14 00:10:51.000000000 +0200 +@@ -277,6 +277,8 @@ + #ifdef CONFIG_UNRAR_EXEC + {"unrarexec", &unrar_executable, CONF_TYPE_STRING, 0, 0, 0, NULL}, + #endif ++ {"colorspu", &colorspu, CONF_TYPE_FLAG, 0, 0, 1, NULL}, ++ {"nocolorspu", &colorspu, CONF_TYPE_FLAG, 0, 1, 0, NULL}, + + {"sstep", &step_sec, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, + +diff -Naur MPlayer-export-2009-06-13.orig/command.c MPlayer-export-2009-06-13/command.c +--- MPlayer-export-2009-06-13.orig/command.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/command.c 2009-06-14 00:10:51.000000000 +0200 +@@ -875,6 +875,10 @@ + reinit_audio_chain(); + } + } ++#ifdef USE_DVDNAV ++ if (mpctx->stream->type == STREAMTYPE_DVDNAV) ++ mp_dvdnav_set_aid(mpctx->stream, audio_id); ++#endif + mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_TRACK=%d\n", audio_id); + return M_PROPERTY_OK; + default: +@@ -1510,6 +1514,10 @@ + d_sub->id = dvdsub_id; + } + #endif ++#ifdef USE_DVDNAV ++ if (mpctx->stream->type == STREAMTYPE_DVDNAV) ++ mp_dvdnav_set_sid(mpctx->stream, dvdsub_id); ++#endif + update_subtitles(mpctx->sh_video, d_sub, 1); + + return M_PROPERTY_OK; +diff -Naur MPlayer-export-2009-06-13.orig/libmenu/menu.c MPlayer-export-2009-06-13/libmenu/menu.c +--- MPlayer-export-2009-06-13.orig/libmenu/menu.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libmenu/menu.c 2009-06-14 00:10:51.000000000 +0200 +@@ -29,6 +29,7 @@ + #include "libvo/osd.h" + #include "libvo/font_load.h" + #include "libvo/sub.h" ++#include "libvo/video_out.h" + #include "osdep/keycodes.h" + #include "asxparser.h" + #include "stream/stream.h" +@@ -371,7 +372,7 @@ + + ///////////////////////////// Helpers //////////////////////////////////// + +-typedef void (*draw_alpha_f)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride); ++typedef void (*draw_alpha_f)(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride); + + inline static draw_alpha_f get_draw_alpha(uint32_t fmt) { + switch(fmt) { +@@ -484,7 +485,7 @@ + while (*txt) { + int c=utf8_get_char((const char**)&txt); + if ((font=vo_font->font[c])>=0 && (x + vo_font->width[c] <= mpi->w) && (y + vo_font->pic_a[font]->h <= mpi->h)) +- draw_alpha(vo_font->width[c], vo_font->pic_a[font]->h, ++ draw_alpha(vo_font->width[c], vo_font->pic_a[font]->h, DEST_PLANES_Y, + vo_font->pic_b[font]->bmp+vo_font->start[c], + vo_font->pic_a[font]->bmp+vo_font->start[c], + vo_font->pic_a[font]->w, +@@ -654,7 +655,7 @@ + if(font >= 0) { + int cs = (vo_font->pic_a[font]->h - vo_font->height) / 2; + if ((sx + vo_font->width[c] <= xmax) && (sy + vo_font->height <= ymax) ) +- draw_alpha(vo_font->width[c], vo_font->height, ++ draw_alpha(vo_font->width[c], vo_font->height, DEST_PLANES_Y, + vo_font->pic_b[font]->bmp+vo_font->start[c] + + cs * vo_font->pic_a[font]->w, + vo_font->pic_a[font]->bmp+vo_font->start[c] + +@@ -767,7 +768,7 @@ + char pic[stride*h],pic_alpha[stride*h]; + memset(pic,g,stride*h); + memset(pic_alpha,alpha,stride*h); +- draw_alpha(w,h,pic,pic_alpha,stride, ++ draw_alpha(w,h,DEST_PLANES_Y,pic,pic_alpha,stride, + mpi->planes[0] + y * mpi->stride[0] + x * (mpi->bpp>>3), + mpi->stride[0]); + } +diff -Naur MPlayer-export-2009-06-13.orig/libmpcodecs/vf_expand.c MPlayer-export-2009-06-13/libmpcodecs/vf_expand.c +--- MPlayer-export-2009-06-13.orig/libmpcodecs/vf_expand.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libmpcodecs/vf_expand.c 2009-06-14 00:10:51.000000000 +0200 +@@ -13,6 +13,7 @@ + #include "vf.h" + + #include "libvo/fastmemcpy.h" ++#include "libvo/video_out.h" + + #ifdef OSD_SUPPORT + #include "libvo/sub.h" +@@ -96,7 +97,47 @@ + } + } + +-static void draw_func(int x0,int y0, int w,int h,unsigned char* src, unsigned char *srca, int stride){ ++static void draw_alpha_yv12(int x0, int y0, int w, int h, int dp, ++ unsigned char *src, unsigned char *srca, ++ int stride, mp_image_t *dmpi) { ++ unsigned char *dst; ++ ++ switch (dp) { ++ case DEST_PLANES_U: ++ dst=dmpi->planes[2]+dmpi->stride[2]*(y0>>0)+(dmpi->bpp>>3)*(x0>>0); ++ vo_draw_alpha_yv12(w, h, dp, src, srca, stride, dst, ++ dmpi->stride[2]); ++ break; ++ case DEST_PLANES_V: ++ dst=dmpi->planes[1]+dmpi->stride[1]*(y0>>0)+(dmpi->bpp>>3)*(x0>>0); ++ vo_draw_alpha_yv12(w, h, dp, src, srca, stride, dst, ++ dmpi->stride[1]); ++ break; ++ case DEST_PLANES_Y: ++ dst=dmpi->planes[0]+dmpi->stride[0]*y0+(dmpi->bpp>>3)*x0; ++ vo_draw_alpha_yv12(w, h, dp, src, srca, stride, dst, ++ dmpi->stride[0]); ++ break; ++ } ++} ++ ++static void draw_alpha_yuy2(int x0, int y0, int w, int h, int dp, ++ unsigned char *src, unsigned char *srca, ++ int stride, mp_image_t *dmpi) { ++ unsigned char *dst; ++ ++ dst=dmpi->planes[0]+dmpi->stride[0]*y0+(dmpi->bpp>>3)*x0; ++ switch (dp) { ++ case DEST_PLANES_Y : ++ vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,dst,dmpi->stride[0]); ++ break; ++ case DEST_PLANES_YUYV : ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,dst,dmpi->stride[0]); ++ break; ++ } ++} ++ ++static void draw_func(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride){ + unsigned char* dst; + if(!vo_osd_changed_flag && vf->dmpi->planes[0]==vf->priv->fb_ptr){ + // ok, enough to update the area inside the video, leave the black bands +@@ -124,19 +165,19 @@ + switch(vf->dmpi->imgfmt){ + case IMGFMT_BGR15: + case IMGFMT_RGB15: +- vo_draw_alpha_rgb15(w,h,src,srca,stride,dst,vf->dmpi->stride[0]); ++ vo_draw_alpha_rgb15(w,h,dp,src,srca,stride,dst,vf->dmpi->stride[0]); + break; + case IMGFMT_BGR16: + case IMGFMT_RGB16: +- vo_draw_alpha_rgb16(w,h,src,srca,stride,dst,vf->dmpi->stride[0]); ++ vo_draw_alpha_rgb16(w,h,dp,src,srca,stride,dst,vf->dmpi->stride[0]); + break; + case IMGFMT_BGR24: + case IMGFMT_RGB24: +- vo_draw_alpha_rgb24(w,h,src,srca,stride,dst,vf->dmpi->stride[0]); ++ vo_draw_alpha_rgb24(w,h,dp,src,srca,stride,dst,vf->dmpi->stride[0]); + break; + case IMGFMT_BGR32: + case IMGFMT_RGB32: +- vo_draw_alpha_rgb32(w,h,src,srca,stride,dst,vf->dmpi->stride[0]); ++ vo_draw_alpha_rgb32(w,h,dp,src,srca,stride,dst,vf->dmpi->stride[0]); + break; + case IMGFMT_YV12: + case IMGFMT_I420: +@@ -145,13 +186,13 @@ + case IMGFMT_IF09: + case IMGFMT_Y800: + case IMGFMT_Y8: +- vo_draw_alpha_yv12(w,h,src,srca,stride,dst,vf->dmpi->stride[0]); ++ draw_alpha_yv12(x0,y0,w,h,dp,src,srca,stride,vf->dmpi); + break; + case IMGFMT_YUY2: +- vo_draw_alpha_yuy2(w,h,src,srca,stride,dst,vf->dmpi->stride[0]); ++ draw_alpha_yuy2(x0,y0,w,h,dp,src,srca,stride,vf->dmpi); + break; + case IMGFMT_UYVY: +- vo_draw_alpha_yuy2(w,h,src,srca,stride,dst+1,vf->dmpi->stride[0]); ++ vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,dst+1,vf->dmpi->stride[0]); + break; + } + } +@@ -415,6 +456,14 @@ + switch(request){ + case VFCTRL_DRAW_OSD: + if(vf->priv->osd) return CONTROL_TRUE; ++ break; ++ case VFCTRL_GET_OSD_FORMAT: ++ if(!vf->priv->osd) ++ break; ++ if(!vf->dmpi) ++ return CONTROL_FALSE; ++ *(unsigned int*)data=vf->dmpi->imgfmt; ++ return CONTROL_TRUE; + } + #endif + return vf_next_control(vf,request,data); +diff -Naur MPlayer-export-2009-06-13.orig/libmpcodecs/vf.h MPlayer-export-2009-06-13/libmpcodecs/vf.h +--- MPlayer-export-2009-06-13.orig/libmpcodecs/vf.h 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libmpcodecs/vf.h 2009-06-14 00:10:51.000000000 +0200 +@@ -89,6 +89,7 @@ + #define VFCTRL_GET_PTS 17 /* Return last pts value that reached vf_vo*/ + #define VFCTRL_SET_DEINTERLACE 18 /* Set deinterlacing status */ + #define VFCTRL_GET_DEINTERLACE 19 /* Get deinterlacing status */ ++#define VFCTRL_GET_OSD_FORMAT 20 /* Query format to color osd */ + + #include "vfcap.h" + +diff -Naur MPlayer-export-2009-06-13.orig/libmpcodecs/vf_vo.c MPlayer-export-2009-06-13/libmpcodecs/vf_vo.c +--- MPlayer-export-2009-06-13.orig/libmpcodecs/vf_vo.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libmpcodecs/vf_vo.c 2009-06-14 00:10:51.000000000 +0200 +@@ -28,6 +28,7 @@ + ass_renderer_t* ass_priv; + int prev_visibility; + #endif ++ unsigned int outfmt; + }; + #define video_out (vf->priv->vo) + +@@ -67,6 +68,8 @@ + if(config_video_out(video_out,width,height,d_width,d_height,flags,"MPlayer",outfmt)) + return 0; + ++ vf->priv->outfmt=outfmt; ++ + #ifdef CONFIG_ASS + if (vf->priv->ass_priv) + ass_configure(vf->priv->ass_priv, width, height, !!(vf->default_caps & VFCAP_EOSD_UNSCALED)); +@@ -151,6 +154,13 @@ + *(double *)data = vf->priv->pts; + return CONTROL_TRUE; + } ++ case VFCTRL_GET_OSD_FORMAT: ++ { ++ if(video_out->control(VOCTRL_GET_OSD_FORMAT,data) == VO_TRUE) ++ return CONTROL_TRUE; ++ *(unsigned int*)data = vf->priv->outfmt; ++ return CONTROL_TRUE; ++ } + } + // return video_out->control(request,data); + return CONTROL_UNKNOWN; +diff -Naur MPlayer-export-2009-06-13.orig/libvo/mga_common.c MPlayer-export-2009-06-13/libvo/mga_common.c +--- MPlayer-export-2009-06-13.orig/libvo/mga_common.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/mga_common.c 2009-06-14 00:10:51.000000000 +0200 +@@ -42,20 +42,54 @@ + #endif + static uint32_t drwcX,drwcY,dwidth,dheight; + +-static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ ++static void draw_alpha(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride){ + uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31; + x0+=mga_vid_config.src_width*(vo_panscan_x>>1)/(vo_dwidth+vo_panscan_x); + switch(mga_vid_config.format){ + case MGA_VID_FORMAT_YV12: + case MGA_VID_FORMAT_IYUV: + case MGA_VID_FORMAT_I420: +- vo_draw_alpha_yv12(w,h,src,srca,stride,vid_data+bespitch*y0+x0,bespitch); ++ switch (dp) { ++ case DEST_PLANES_Y : ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,vid_data+bespitch*y0+x0,bespitch); ++ break; ++ case DEST_PLANES_U : ++ dest = vid_data + bespitch*mga_vid_config.src_height + ++ bespitch/2 * y0/2 + x0/2; ++ if(mga_vid_config.format==MGA_VID_FORMAT_YV12) ++ dest += bespitch/2*mga_vid_config.src_height / 2; ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,dest,bespitch/2); ++ break; ++ case DEST_PLANES_V : ++ dest = vid_data + bespitch*mga_vid_config.src_height + ++ bespitch/2 * y0/2 + x0/2; ++ if(mga_vid_config.format!=MGA_VID_FORMAT_YV12) ++ dest += bespitch/2*mga_vid_config.src_height / 2; ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,dest,bespitch/2); ++ break; ++ } + break; + case MGA_VID_FORMAT_YUY2: +- vo_draw_alpha_yuy2(w,h,src,srca,stride,vid_data+2*(bespitch*y0+x0),2*bespitch); ++ switch (dp) { ++ case DEST_PLANES_Y : ++ vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,vid_data+2*(bespitch*y0+x0),2*bespitch); ++ break; ++ case DEST_PLANES_YUYV : ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ vid_data+2*(bespitch*y0+x0),2*bespitch); ++ break; ++ } + break; + case MGA_VID_FORMAT_UYVY: +- vo_draw_alpha_yuy2(w,h,src,srca,stride,vid_data+2*(bespitch*y0+x0)+1,2*bespitch); ++ switch (dp) { ++ case DEST_PLANES_Y : ++ vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,vid_data+2*(bespitch*y0+x0)+1,2*bespitch); ++ break; ++ case DEST_PLANES_YUYV : ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ vid_data+2*(bespitch*y0+x0)+1,2*bespitch); ++ break; ++ } + break; + } + } +diff -Naur MPlayer-export-2009-06-13.orig/libvo/osd.c MPlayer-export-2009-06-13/libvo/osd.c +--- MPlayer-export-2009-06-13.orig/libvo/osd.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/osd.c 2009-06-14 00:15:36.000000000 +0200 +@@ -28,6 +28,7 @@ + #include "mp_msg.h" + #include + #include "cpudetect.h" ++#include "video_out.h" + + #if ARCH_X86 + static const uint64_t bFF __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL; +@@ -133,152 +134,152 @@ + + #endif /* ARCH_X86 */ + +-void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ ++void vo_draw_alpha_yv12(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ + #if CONFIG_RUNTIME_CPUDETECT + #if ARCH_X86 + // ordered by speed / fastest first + if(gCpuCaps.hasMMX2) +- vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yv12_MMX2(w, h, dp, src, srca, srcstride, dstbase, dststride); + else if(gCpuCaps.has3DNow) +- vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yv12_3DNow(w, h, dp, src, srca, srcstride, dstbase, dststride); + else if(gCpuCaps.hasMMX) +- vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yv12_MMX(w, h, dp, src, srca, srcstride, dstbase, dststride); + else +- vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yv12_X86(w, h, dp, src, srca, srcstride, dstbase, dststride); + #else +- vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yv12_C(w, h, dp, src, srca, srcstride, dstbase, dststride); + #endif + #else //CONFIG_RUNTIME_CPUDETECT + #if HAVE_MMX2 +- vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yv12_MMX2(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif HAVE_AMD3DNOW +- vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yv12_3DNow(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif HAVE_MMX +- vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yv12_MMX(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif ARCH_X86 +- vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yv12_X86(w, h, dp, src, srca, srcstride, dstbase, dststride); + #else +- vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yv12_C(w, h, dp, src, srca, srcstride, dstbase, dststride); + #endif + #endif //!CONFIG_RUNTIME_CPUDETECT + } + +-void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ ++void vo_draw_alpha_yuy2(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ + #if CONFIG_RUNTIME_CPUDETECT + #if ARCH_X86 + // ordered by speed / fastest first + if(gCpuCaps.hasMMX2) +- vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yuy2_MMX2(w, h, dp, src, srca, srcstride, dstbase, dststride); + else if(gCpuCaps.has3DNow) +- vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yuy2_3DNow(w, h, dp, src, srca, srcstride, dstbase, dststride); + else if(gCpuCaps.hasMMX) +- vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yuy2_MMX(w, h, dp, src, srca, srcstride, dstbase, dststride); + else +- vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yuy2_X86(w, h, dp, src, srca, srcstride, dstbase, dststride); + #else +- vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yuy2_C(w, h, dp, src, srca, srcstride, dstbase, dststride); + #endif + #else //CONFIG_RUNTIME_CPUDETECT + #if HAVE_MMX2 +- vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yuy2_MMX2(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif HAVE_AMD3DNOW +- vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yuy2_3DNow(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif HAVE_MMX +- vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yuy2_MMX(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif ARCH_X86 +- vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yuy2_X86(w, h, dp, src, srca, srcstride, dstbase, dststride); + #else +- vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_yuy2_C(w, h, dp, src, srca, srcstride, dstbase, dststride); + #endif + #endif //!CONFIG_RUNTIME_CPUDETECT + } + +-void vo_draw_alpha_uyvy(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ ++void vo_draw_alpha_uyvy(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ + #if CONFIG_RUNTIME_CPUDETECT + #if ARCH_X86 + // ordered by speed / fastest first + if(gCpuCaps.hasMMX2) +- vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_uyvy_MMX2(w, h, dp, src, srca, srcstride, dstbase, dststride); + else if(gCpuCaps.has3DNow) +- vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_uyvy_3DNow(w, h, dp, src, srca, srcstride, dstbase, dststride); + else if(gCpuCaps.hasMMX) +- vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_uyvy_MMX(w, h, dp, src, srca, srcstride, dstbase, dststride); + else +- vo_draw_alpha_uyvy_X86(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_uyvy_X86(w, h, dp, src, srca, srcstride, dstbase, dststride); + #else +- vo_draw_alpha_uyvy_C(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_uyvy_C(w, h, dp, src, srca, srcstride, dstbase, dststride); + #endif + #else //CONFIG_RUNTIME_CPUDETECT + #if HAVE_MMX2 +- vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_uyvy_MMX2(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif HAVE_AMD3DNOW +- vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_uyvy_3DNow(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif HAVE_MMX +- vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_uyvy_MMX(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif ARCH_X86 +- vo_draw_alpha_uyvy_X86(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_uyvy_X86(w, h, dp, src, srca, srcstride, dstbase, dststride); + #else +- vo_draw_alpha_uyvy_C(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_uyvy_C(w, h, dp, src, srca, srcstride, dstbase, dststride); + #endif + #endif //!CONFIG_RUNTIME_CPUDETECT + } + +-void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ ++void vo_draw_alpha_rgb24(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ + #if CONFIG_RUNTIME_CPUDETECT + #if ARCH_X86 + // ordered by speed / fastest first + if(gCpuCaps.hasMMX2) +- vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb24_MMX2(w, h, dp, src, srca, srcstride, dstbase, dststride); + else if(gCpuCaps.has3DNow) +- vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb24_3DNow(w, h, dp, src, srca, srcstride, dstbase, dststride); + else if(gCpuCaps.hasMMX) +- vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb24_MMX(w, h, dp, src, srca, srcstride, dstbase, dststride); + else +- vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb24_X86(w, h, dp, src, srca, srcstride, dstbase, dststride); + #else +- vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb24_C(w, h, dp, src, srca, srcstride, dstbase, dststride); + #endif + #else //CONFIG_RUNTIME_CPUDETECT + #if HAVE_MMX2 +- vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb24_MMX2(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif HAVE_AMD3DNOW +- vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb24_3DNow(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif HAVE_MMX +- vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb24_MMX(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif ARCH_X86 +- vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb24_X86(w, h, dp, src, srca, srcstride, dstbase, dststride); + #else +- vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb24_C(w, h, dp, src, srca, srcstride, dstbase, dststride); + #endif + #endif //!CONFIG_RUNTIME_CPUDETECT + } + +-void vo_draw_alpha_rgb32(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ ++void vo_draw_alpha_rgb32(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ + #if CONFIG_RUNTIME_CPUDETECT + #if ARCH_X86 + // ordered by speed / fastest first + if(gCpuCaps.hasMMX2) +- vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb32_MMX2(w, h, dp, src, srca, srcstride, dstbase, dststride); + else if(gCpuCaps.has3DNow) +- vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb32_3DNow(w, h, dp, src, srca, srcstride, dstbase, dststride); + else if(gCpuCaps.hasMMX) +- vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb32_MMX(w, h, dp, src, srca, srcstride, dstbase, dststride); + else +- vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb32_X86(w, h, dp, src, srca, srcstride, dstbase, dststride); + #else +- vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb32_C(w, h, dp, src, srca, srcstride, dstbase, dststride); + #endif + #else //CONFIG_RUNTIME_CPUDETECT + #if HAVE_MMX2 +- vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb32_MMX2(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif HAVE_AMD3DNOW +- vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb32_3DNow(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif HAVE_MMX +- vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb32_MMX(w, h, dp, src, srca, srcstride, dstbase, dststride); + #elif ARCH_X86 +- vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb32_X86(w, h, dp, src, srca, srcstride, dstbase, dststride); + #else +- vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride); ++ vo_draw_alpha_rgb32_C(w, h, dp, src, srca, srcstride, dstbase, dststride); + #endif + #endif //!CONFIG_RUNTIME_CPUDETECT + } +@@ -329,8 +330,10 @@ + } + } + +-void vo_draw_alpha_rgb15(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ ++void vo_draw_alpha_rgb15(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ + int y; ++switch (dp) { ++ case DEST_PLANES_Y: + for(y=0;y>5)&0x1F; ++ unsigned char b=(dst[x]>>10)&0x1F; ++ r=(((r*srca[x])>>5)+src[x])>>3; ++ dst[x]=(b<<10)|(g<<5)|r; ++ } ++ } ++ src+=srcstride; ++ srca+=srcstride; ++ dstbase+=dststride; ++ } ++ return; ++ case DEST_PLANES_G: ++ for(y=0;y>5)&0x1F; ++ unsigned char b=(dst[x]>>10)&0x1F; ++ g=(((g*srca[x])>>5)+src[x])>>3; ++ dst[x]=(b<<10)|(g<<5)|r; ++ } ++ } ++ src+=srcstride; ++ srca+=srcstride; ++ dstbase+=dststride; ++ } ++ return; ++ case DEST_PLANES_BR: ++ for(y=0;y>5)&0x1F; ++ unsigned char b=(dst[x]>>10)&0x1F; ++ b=(((b*srca[x])>>5)+src[x])>>3; ++ dst[x]=(b<<10)|(g<<5)|r; ++ } ++ } ++ src+=srcstride; ++ srca+=srcstride; ++ dstbase+=dststride; ++ } ++ return; ++ } + } + +-void vo_draw_alpha_rgb16(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ ++void vo_draw_alpha_rgb16(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ + int y; ++switch (dp) { ++ case DEST_PLANES_Y: + for(y=0;y>11)&0x1F; ++ unsigned char g=(dst[x]>>5)&0x3F; ++ r=(((r*srca[x])>>5)+src[x])>>3; ++ dst[x]=(b<<11)|(g<<5)|r; ++ } ++ } ++ src+=srcstride; ++ srca+=srcstride; ++ dstbase+=dststride; ++ } ++ return; ++ case DEST_PLANES_G: ++ for(y=0;y>5)&0x3F; ++ unsigned char b=(dst[x]>>11)&0x1F; ++ g=(((g*srca[x])>>6)+src[x])>>2; ++ dst[x]=(b<<11)|(g<<5)|r; ++ } ++ } ++ src+=srcstride; ++ srca+=srcstride; ++ dstbase+=dststride; ++ } ++ return; ++ case DEST_PLANES_BR: ++ for(y=0;y>5)&0x3F; ++ unsigned char b=(dst[x]>>11)&0x1F; ++ b=(((b*srca[x])>>5)+src[x])>>3; ++ dst[x]=(b<<11)|(g<<5)|r; ++ } ++ } ++ src+=srcstride; ++ srca+=srcstride; ++ dstbase+=dststride; ++ } ++ return; ++ } + } + +diff -Naur MPlayer-export-2009-06-13.orig/libvo/osd.h MPlayer-export-2009-06-13/libvo/osd.h +--- MPlayer-export-2009-06-13.orig/libvo/osd.h 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/osd.h 2009-06-14 00:10:51.000000000 +0200 +@@ -24,12 +24,12 @@ + + void vo_draw_alpha_init(void); // build tables + +-void vo_draw_alpha_yv12(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); +-void vo_draw_alpha_yuy2(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); +-void vo_draw_alpha_uyvy(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); +-void vo_draw_alpha_rgb24(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); +-void vo_draw_alpha_rgb32(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); +-void vo_draw_alpha_rgb15(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); +-void vo_draw_alpha_rgb16(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); ++void vo_draw_alpha_yv12(int w, int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); ++void vo_draw_alpha_yuy2(int w, int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); ++void vo_draw_alpha_uyvy(int w, int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); ++void vo_draw_alpha_rgb24(int w, int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); ++void vo_draw_alpha_rgb32(int w, int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); ++void vo_draw_alpha_rgb15(int w, int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); ++void vo_draw_alpha_rgb16(int w, int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride); + + #endif /* MPLAYER_OSD_H */ +diff -Naur MPlayer-export-2009-06-13.orig/libvo/osd_template.c MPlayer-export-2009-06-13/libvo/osd_template.c +--- MPlayer-export-2009-06-13.orig/libvo/osd_template.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/osd_template.c 2009-06-14 00:10:51.000000000 +0200 +@@ -44,7 +44,7 @@ + #define EMMS "emms" + #endif + +-static inline void RENAME(vo_draw_alpha_yv12)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ ++static inline void RENAME(vo_draw_alpha_yv12)(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ + int y; + #if defined(FAST_OSD) && !HAVE_MMX + w=w>>1; +@@ -114,7 +114,7 @@ + return; + } + +-static inline void RENAME(vo_draw_alpha_yuy2)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ ++static inline void RENAME(vo_draw_alpha_yuy2)(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ + int y; + #if defined(FAST_OSD) && !HAVE_MMX + w=w>>1; +@@ -186,7 +186,7 @@ + return; + } + +-static inline void RENAME(vo_draw_alpha_uyvy)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ ++static inline void RENAME(vo_draw_alpha_uyvy)(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ + int y; + #if defined(FAST_OSD) + w=w>>1; +@@ -210,8 +210,10 @@ + } + } + +-static inline void RENAME(vo_draw_alpha_rgb24)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ ++static inline void RENAME(vo_draw_alpha_rgb24)(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ + int y; ++ switch (dp) { ++ case DEST_PLANES_Y: + #if HAVE_MMX + __asm__ volatile( + "pxor %%mm7, %%mm7\n\t" +@@ -316,13 +318,58 @@ + __asm__ volatile(EMMS:::"memory"); + #endif + return; ++ case DEST_PLANES_RB: ++ for(y=0;y>8)+src[x]; ++ dst+=3; // 24bpp ++ } ++ src+=srcstride; ++ srca+=srcstride; ++ dstbase+=dststride; ++ } ++ return; ++ case DEST_PLANES_G: ++ for(y=0;y>8)+src[x]; ++ dst+=3; // 24bpp ++ } ++ src+=srcstride; ++ srca+=srcstride; ++ dstbase+=dststride; ++ } ++ return; ++ case DEST_PLANES_BR: ++ for(y=0;y>8)+src[x]; ++ dst+=3; // 24bpp ++ } ++ src+=srcstride; ++ srca+=srcstride; ++ dstbase+=dststride; ++ } ++ return; ++ } + } + +-static inline void RENAME(vo_draw_alpha_rgb32)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ ++static inline void RENAME(vo_draw_alpha_rgb32)(int w,int h, int dp, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ + int y; + #ifdef WORDS_BIGENDIAN + dstbase++; + #endif ++ switch (dp) { ++ case DEST_PLANES_Y: + #if HAVE_MMX + #if HAVE_AMD3DNOW + __asm__ volatile( +@@ -481,4 +528,41 @@ + __asm__ volatile(EMMS:::"memory"); + #endif + return; ++ case DEST_PLANES_RB: ++ for(y=0;y>8)+src[x])&0xff; ++ } ++ src+=srcstride; ++ srca+=srcstride; ++ dstbase+=dststride; ++ } ++ return; ++ case DEST_PLANES_G: ++ for(y=0;y>8)+src[x])&0xff; ++ } ++ src+=srcstride; ++ srca+=srcstride; ++ dstbase+=dststride; ++ } ++ return; ++ case DEST_PLANES_BR: ++ for(y=0;y>8)+src[x])&0xff; ++ } ++ src+=srcstride; ++ srca+=srcstride; ++ dstbase+=dststride; ++ } ++ return; ++ } + } +diff -Naur MPlayer-export-2009-06-13.orig/libvo/sub.c MPlayer-export-2009-06-13/libvo/sub.c +--- MPlayer-export-2009-06-13.orig/libvo/sub.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/sub.c 2009-06-14 00:10:51.000000000 +0200 +@@ -167,11 +167,12 @@ + } + + // renders the buffer +-inline static void vo_draw_text_from_buffer(mp_osd_obj_t* obj,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){ ++inline static void vo_draw_text_from_buffer(mp_osd_obj_t* obj,void (*draw_alpha)(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride)){ + if (obj->allocated > 0) { + draw_alpha(obj->bbox.x1,obj->bbox.y1, + obj->bbox.x2-obj->bbox.x1, + obj->bbox.y2-obj->bbox.y1, ++ DEST_PLANES_Y, + obj->bitmap_buffer, + obj->alpha_buffer, + obj->stride); +@@ -1052,7 +1053,7 @@ + obj->flags |= OSDFLAG_BBOX; + } + +-inline static void vo_draw_spudec_sub(mp_osd_obj_t* obj, void (*draw_alpha)(int x0, int y0, int w, int h, unsigned char* src, unsigned char* srca, int stride)) ++inline static void vo_draw_spudec_sub(mp_osd_obj_t* obj, void (*draw_alpha)(int x0, int y0, int w, int h, int dp, unsigned char* src, unsigned char* srca, int stride)) + { + spudec_draw_scaled(vo_spudec, obj->dxs, obj->dys, draw_alpha); + } +@@ -1260,7 +1261,7 @@ + + void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border, + int right_border, int bottom_border, int orig_w, int orig_h, +- void (*draw_alpha)(int x0, int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) { ++ void (*draw_alpha)(int x0, int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride)) { + mp_osd_obj_t* obj=vo_osd_list; + vo_update_osd_ext(dxs, dys, left_border, top_border, right_border, bottom_border, orig_w, orig_h); + while(obj){ +@@ -1290,7 +1291,7 @@ + } + } + +-void vo_draw_text(int dxs, int dys, void (*draw_alpha)(int x0, int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) { ++void vo_draw_text(int dxs, int dys, void (*draw_alpha)(int x0, int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride)) { + vo_draw_text_ext(dxs, dys, 0, 0, 0, 0, dxs, dys, draw_alpha); + } + +diff -Naur MPlayer-export-2009-06-13.orig/libvo/sub.h MPlayer-export-2009-06-13/libvo/sub.h +--- MPlayer-export-2009-06-13.orig/libvo/sub.h 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/sub.h 2009-06-14 00:10:51.000000000 +0200 +@@ -122,10 +122,10 @@ + extern int spu_aamode; + extern float spu_gaussvar; + +-void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); ++void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h,int dp, unsigned char* src, unsigned char *srca, int stride)); + void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border, + int right_border, int bottom_border, int orig_w, int orig_h, +- void (*draw_alpha)(int x0, int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); ++ void (*draw_alpha)(int x0, int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride)); + void vo_remove_text(int dxs,int dys,void (*remove)(int x0,int y0, int w,int h)); + + void vo_init_osd(void); +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vesa_lvo.c MPlayer-export-2009-06-13/libvo/vesa_lvo.c +--- MPlayer-export-2009-06-13.orig/libvo/vesa_lvo.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vesa_lvo.c 2009-06-14 00:10:51.000000000 +0200 +@@ -246,50 +246,51 @@ + } + + #if 0 +-static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) ++static void draw_alpha_null(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride) + { + UNUSED(x0); + UNUSED(y0); + UNUSED(w); + UNUSED(h); ++ UNUSED(dp); + UNUSED(src); + UNUSED(srca); + UNUSED(stride); + } + +-static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) ++static void draw_alpha(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride) + { + uint32_t bespitch = /*(*/mga_vid_config.src_width;// + 15) & ~15; + switch(mga_vid_config.format){ + case IMGFMT_BGR15: + case IMGFMT_RGB15: +- vo_draw_alpha_rgb15(w,h,src,srca,stride,lvo_mem+2*(y0*bespitch+x0),2*bespitch); ++ vo_draw_alpha_rgb15(w,h,dp,src,srca,stride,lvo_mem+2*(y0*bespitch+x0),2*bespitch); + break; + case IMGFMT_BGR16: + case IMGFMT_RGB16: +- vo_draw_alpha_rgb16(w,h,src,srca,stride,lvo_mem+2*(y0*bespitch+x0),2*bespitch); ++ vo_draw_alpha_rgb16(w,h,dp,src,srca,stride,lvo_mem+2*(y0*bespitch+x0),2*bespitch); + break; + case IMGFMT_BGR24: + case IMGFMT_RGB24: +- vo_draw_alpha_rgb24(w,h,src,srca,stride,lvo_mem+3*(y0*bespitch+x0),3*bespitch); ++ vo_draw_alpha_rgb24(w,h,dp,src,srca,stride,lvo_mem+3*(y0*bespitch+x0),3*bespitch); + break; + case IMGFMT_BGR32: + case IMGFMT_RGB32: +- vo_draw_alpha_rgb32(w,h,src,srca,stride,lvo_mem+4*(y0*bespitch+x0),4*bespitch); ++ vo_draw_alpha_rgb32(w,h,dp,src,srca,stride,lvo_mem+4*(y0*bespitch+x0),4*bespitch); + break; + case IMGFMT_YV12: + case IMGFMT_IYUV: + case IMGFMT_I420: +- vo_draw_alpha_yv12(w,h,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch); ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch); + break; + case IMGFMT_YUY2: +- vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+2*(bespitch*y0+x0),bespitch); ++ vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,lvo_mem+2*(bespitch*y0+x0),bespitch); + break; + case IMGFMT_UYVY: +- vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+2*(bespitch*y0+x0)+1,bespitch); ++ vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,lvo_mem+2*(bespitch*y0+x0)+1,bespitch); + break; + default: +- draw_alpha_null(x0,y0,w,h,src,srca,stride); ++ draw_alpha_null(x0,y0,w,h,dp,src,srca,stride); + } + } + #endif +diff -Naur MPlayer-export-2009-06-13.orig/libvo/video_out.h MPlayer-export-2009-06-13/libvo/video_out.h +--- MPlayer-export-2009-06-13.orig/libvo/video_out.h 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/video_out.h 2009-06-14 00:10:51.000000000 +0200 +@@ -97,6 +97,8 @@ + int w,h; + } mp_win_t; + ++#define VOCTRL_GET_OSD_FORMAT 24 ++ + #define VO_TRUE 1 + #define VO_FALSE 0 + #define VO_ERROR -1 +@@ -109,6 +111,15 @@ + #define VOFLAG_FLIPPING 0x08 + #define VOFLAG_XOVERLAY_SUB_VO 0x10000 + ++// dest planes (draw_alpha) ++#define DEST_PLANES_Y 0 // Y planes (default) ++#define DEST_PLANES_U 1 // U planes in YUV mode ++#define DEST_PLANES_V 2 // V planes in YUV mode ++#define DEST_PLANES_RB 3 // R or B planes in RGB or BGR mode ++#define DEST_PLANES_G 4 // G planes in RGB or BGR mode ++#define DEST_PLANES_BR 5 // B or R planes in RGB or BGR mode ++#define DEST_PLANES_YUYV 6 // Yuv (all) planes in YUYV mode ++ + typedef struct vo_info_s + { + /* driver name ("Matrox Millennium G200/G400" */ +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_aa.c MPlayer-export-2009-06-13/libvo/vo_aa.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_aa.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_aa.c 2009-06-14 00:10:51.000000000 +0200 +@@ -518,7 +518,7 @@ + aa_close(c); + } + +-static void draw_alpha(int x,int y, int w,int h, unsigned char* src, unsigned char *srca, int stride){ ++static void draw_alpha(int x,int y, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride){ + int i,j; + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_dfbmga.c MPlayer-export-2009-06-13/libvo/vo_dfbmga.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_dfbmga.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_dfbmga.c 2009-06-14 00:10:51.000000000 +0200 +@@ -990,7 +990,7 @@ + } + + static void +-vo_draw_alpha_alut44( int w, int h, ++vo_draw_alpha_alut44( int w, int h, int dp, + unsigned char* src, + unsigned char *srca, + int srcstride, +@@ -1019,7 +1019,7 @@ + } + + static void +-draw_alpha( int x0, int y0, ++draw_alpha( int x0, int y0, int dp, + int w, int h, + unsigned char *src, + unsigned char *srca, +@@ -1047,46 +1047,90 @@ + + switch (subframe_format) { + case DSPF_ALUT44: +- vo_draw_alpha_alut44( w, h, src, srca, stride, ++ vo_draw_alpha_alut44( w, h, dp, src, srca, stride, + dst + pitch * y0 + x0, + pitch ); + break; + case DSPF_RGB32: + case DSPF_ARGB: +- vo_draw_alpha_rgb32( w, h, src, srca, stride, ++ vo_draw_alpha_rgb32( w, h, dp, src, srca, stride, + dst + pitch * y0 + 4 * x0, + pitch ); + break; + case DSPF_RGB16: +- vo_draw_alpha_rgb16( w, h, src, srca, stride, ++ vo_draw_alpha_rgb16( w, h, dp, src, srca, stride, + dst + pitch * y0 + 2 * x0, + pitch ); + break; + case DSPF_ARGB1555: +- vo_draw_alpha_rgb15( w, h, src, srca, stride, ++ vo_draw_alpha_rgb15( w, h, dp, src, srca, stride, + dst + pitch * y0 + 2 * x0, + pitch ); + break; + case DSPF_YUY2: +- vo_draw_alpha_yuy2( w, h, src, srca, stride, ++ switch (dp) { ++ case DEST_PLANES_Y: ++ vo_draw_alpha_yuy2( w, h, dp, src, srca, stride, + dst + pitch * y0 + 2 * x0, + pitch ); + break; ++ case DEST_PLANES_YUYV: ++ vo_draw_alpha_yv12( w, h, dp, src, srca, stride, ++ ((uint8_t *) dst) + pitch * y0 + 2 * x0, ++ pitch ); ++ break; ++ } ++ break; + case DSPF_UYVY: +- vo_draw_alpha_yuy2( w, h, src, srca, stride, ++ switch (dp) { ++ case DEST_PLANES_Y: ++ vo_draw_alpha_yuy2( w, h, dp, src, srca, stride, + dst + pitch * y0 + 2 * x0 + 1, + pitch ); + break; ++ case DEST_PLANES_YUYV: ++ vo_draw_alpha_yv12( w, h, dp, src, srca, stride, ++ ((uint8_t *) dst) + pitch * y0 + 2 * x0, ++ pitch ); ++ break; ++ } ++ break; + #if DIRECTFBVERSION > DFB_VERSION(0,9,21) + case DSPF_NV12: + case DSPF_NV21: + #endif + case DSPF_I420: + case DSPF_YV12: +- vo_draw_alpha_yv12( w, h, src, srca, stride, ++ switch (dp) { ++ case DEST_PLANES_Y: ++ vo_draw_alpha_yv12( w, h, dp, src, srca, stride, + dst + pitch * y0 + x0, + pitch ); + break; ++ case DEST_PLANES_U: ++ if (subframe_format==DSPF_YV12) ++ vo_draw_alpha_yv12( w, h, dp, src, srca, stride, ++ ((uint8_t *) dst) + pitch * y0 + x0 + ++ pitch * in_height, pitch ); ++ else ++ vo_draw_alpha_yv12( w, h, dp, src, srca, stride, ++ ((uint8_t *) dst) + pitch * y0 + x0 + ++ pitch * (in_height+in_height/2), ++ pitch ); ++ break; ++ case DEST_PLANES_V: ++ if (subframe_format==DSPF_YV12) ++ vo_draw_alpha_yv12( w, h, dp, src, srca, stride, ++ ((uint8_t *) dst) + pitch * y0 + x0 + ++ pitch * (in_height+in_height/2), ++ pitch ); ++ else ++ vo_draw_alpha_yv12( w, h, dp, src, srca, stride, ++ ((uint8_t *) dst) + pitch * y0 + x0 + ++ pitch * in_height, pitch ); ++ break; ++ } ++ break; + } + + subframe->Unlock( subframe ); +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_dga.c MPlayer-export-2009-06-13/libvo/vo_dga.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_dga.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_dga.c 2009-06-14 00:10:51.000000000 +0200 +@@ -239,7 +239,7 @@ + //--------------------------------------------------------- + + static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, +- unsigned char *srca, int stride) ++ int dp, unsigned char *srca, int stride) + { + + char *d; +@@ -254,19 +254,19 @@ + { + + case 32: +- vo_draw_alpha_rgb32(w, h, src, srca, stride, d + 4 * offset, ++ vo_draw_alpha_rgb32(w, h, dp, src, srca, stride, d + 4 * offset, + 4 * buffer_stride); + break; + case 24: +- vo_draw_alpha_rgb24(w, h, src, srca, stride, d + 3 * offset, ++ vo_draw_alpha_rgb24(w, h, dp, src, srca, stride, d + 3 * offset, + 3 * buffer_stride); + break; + case 15: +- vo_draw_alpha_rgb15(w, h, src, srca, stride, d + 2 * offset, ++ vo_draw_alpha_rgb15(w, h, dp, src, srca, stride, d + 2 * offset, + 2 * buffer_stride); + break; + case 16: +- vo_draw_alpha_rgb16(w, h, src, srca, stride, d + 2 * offset, ++ vo_draw_alpha_rgb16(w, h, dp, src, srca, stride, d + 2 * offset, + 2 * buffer_stride); + break; + } +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_directfb2.c MPlayer-export-2009-06-13/libvo/vo_directfb2.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_directfb2.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_directfb2.c 2009-06-14 00:10:51.000000000 +0200 +@@ -1456,7 +1456,7 @@ + + // hopefully will be removed soon + +-static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, ++static void draw_alpha(int x0, int y0, int w, int h, int dp, unsigned char *src, + unsigned char *srca, int stride) + { + void *dst; +@@ -1475,36 +1475,82 @@ + switch(pixel_format) { + case DSPF_RGB32: + case DSPF_ARGB: +- vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 4*x0,pitch); ++ vo_draw_alpha_rgb32(w,h,dp,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 4*x0,pitch); + break; + + case DSPF_RGB24: +- vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 3*x0,pitch); ++ vo_draw_alpha_rgb24(w,h,dp,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 3*x0,pitch); + break; + + case DSPF_RGB16: +- vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch); ++ vo_draw_alpha_rgb16(w,h,dp,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch); + break; + #if DIRECTFBVERSION > DFB_VERSION(0,9,15) + case DSPF_ARGB1555: + #else + case DSPF_RGB15: + #endif +- vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch); ++ vo_draw_alpha_rgb15(w,h,dp,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch); + break; + + case DSPF_YUY2: +- vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0,pitch); ++ switch (dp) { ++ case DEST_PLANES_Y: ++ vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0,pitch); + break; ++ case DEST_PLANES_YUYV: ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ ((uint8_t *) dst) + ++ pitch*y0 + 2*x0,pitch); ++ break; ++ } ++ break; + + case DSPF_UYVY: +- vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0 + 1,pitch); ++ switch (dp) { ++ case DEST_PLANES_Y: ++ vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0 + 1,pitch); + break; ++ case DEST_PLANES_YUYV: ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ ((uint8_t *) dst) + ++ pitch*y0 + 2*x0,pitch); ++ break; ++ } ++ break; + + case DSPF_I420: + case DSPF_YV12: +- vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 1*x0,pitch); ++ switch (dp) { ++ case DEST_PLANES_Y: ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 1*x0,pitch); + break; ++ case DEST_PLANES_U: ++ if (pixel_format==DSPF_YV12) ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ ((uint8_t *) dst) + ++ pitch*height/4 + ++ pitch*y0 + 1*x0,pitch); ++ else ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ ((uint8_t *) dst) + ++ pitch*height/2 + pitch*y0 + ++ 1*x0,pitch); ++ break; ++ case DEST_PLANES_V: ++ if (pixel_format==DSPF_YV12) ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ ((uint8_t *) dst) + ++ pitch*height/2 + pitch*y0 + ++ 1*x0,pitch); ++ else ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ ((uint8_t *) dst) + ++ pitch*height/4 + ++ pitch*y0 + 1*x0,pitch); ++ break; ++ } ++ break; + } + + unlock(); +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_directx.c MPlayer-export-2009-06-13/libvo/vo_directx.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_directx.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_directx.c 2009-06-14 00:10:51.000000000 +0200 +@@ -147,7 +147,7 @@ + + const LIBVO_EXTERN(directx) + +-static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, ++static void draw_alpha(int x0, int y0, int w, int h, int dp, unsigned char *src, + unsigned char *srca, int stride) + { + switch(image_format) { +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_dxr3.c MPlayer-export-2009-06-13/libvo/vo_dxr3.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_dxr3.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_dxr3.c 2009-06-14 00:10:51.000000000 +0200 +@@ -568,7 +568,7 @@ + return 0; + } + +-static void draw_alpha(int x, int y, int w, int h, unsigned char* src, unsigned char *srca, int srcstride) ++static void draw_alpha(int x, int y, int w, int h, int dp, unsigned char* src, unsigned char *srca, int srcstride) + { + #ifdef SPU_SUPPORT + unsigned char *buf = &osdpicbuf[(y * osdpicbuf_w) + x]; +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_fbdev2.c MPlayer-export-2009-06-13/libvo/vo_fbdev2.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_fbdev2.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_fbdev2.c 2009-06-14 00:10:51.000000000 +0200 +@@ -94,7 +94,7 @@ + static int fb_bpp; // 32: 32 24: 24 16: 16 15: 15 + static size_t fb_size; // size of frame_buffer + static int fb_line_len; // length of one line in bytes +-static void (*draw_alpha_p)(int w, int h, unsigned char *src, ++static void (*draw_alpha_p)(int w, int h, int dp, unsigned char *src, + unsigned char *srca, int stride, unsigned char *dst, + int dstride); + +@@ -332,7 +332,7 @@ + return 0; + } + +-static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, ++static void draw_alpha(int x0, int y0, int w, int h, int dp, unsigned char *src, + unsigned char *srca, int stride) + { + unsigned char *dst; +@@ -345,7 +345,7 @@ + dst = next_frame + (in_width * y0 + x0) * fb_pixel_size; + dstride = in_width * fb_pixel_size; + #endif +- (*draw_alpha_p)(w, h, src, srca, stride, dst, dstride); ++ (*draw_alpha_p)(w, h, dp, src, srca, stride, dst, dstride); + } + + static void draw_osd(void) +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_fbdev.c MPlayer-export-2009-06-13/libvo/vo_fbdev.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_fbdev.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_fbdev.c 2009-06-14 00:10:51.000000000 +0200 +@@ -575,7 +575,7 @@ + static int fb_line_len; + static int fb_xres; + static int fb_yres; +-static void (*draw_alpha_p)(int w, int h, unsigned char *src, ++static void (*draw_alpha_p)(int w, int h, int dp, unsigned char *src, + unsigned char *srca, int stride, + unsigned char *dst, int dstride); + +@@ -1000,14 +1000,14 @@ + return 0; + } + +-static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, ++static void draw_alpha(int x0, int y0, int w, int h, int dp, unsigned char *src, + unsigned char *srca, int stride) + { + unsigned char *dst; + + dst = center + fb_line_len * y0 + fb_pixel_size * x0; + +- (*draw_alpha_p)(w, h, src, srca, stride, dst, fb_line_len); ++ (*draw_alpha_p)(w, h, dp, src, srca, stride, dst, fb_line_len); + } + + static int draw_frame(uint8_t *src[]) +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_gl2.c MPlayer-export-2009-06-13/libvo/vo_gl2.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_gl2.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_gl2.c 2009-06-14 00:10:51.000000000 +0200 +@@ -100,7 +100,7 @@ + static int use_glFinish; + + static void (*draw_alpha_fnc) +- (int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); ++ (int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride); + + + /* The squares that are tiled to make up the game screen polygon */ +@@ -446,23 +446,23 @@ + glLoadIdentity(); + } + +-static void draw_alpha_32(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ +- vo_draw_alpha_rgb32(w,h,src,srca,stride,ImageData+4*(y0*image_width+x0),4*image_width); ++static void draw_alpha_32(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride){ ++ vo_draw_alpha_rgb32(w,h,dp,src,srca,stride,ImageData+4*(y0*image_width+x0),4*image_width); + } + +-static void draw_alpha_24(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ +- vo_draw_alpha_rgb24(w,h,src,srca,stride,ImageData+3*(y0*image_width+x0),3*image_width); ++static void draw_alpha_24(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride){ ++ vo_draw_alpha_rgb24(w,h,dp,src,srca,stride,ImageData+3*(y0*image_width+x0),3*image_width); + } + +-static void draw_alpha_16(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ +- vo_draw_alpha_rgb16(w,h,src,srca,stride,ImageData+2*(y0*image_width+x0),2*image_width); ++static void draw_alpha_16(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride){ ++ vo_draw_alpha_rgb16(w,h,dp,src,srca,stride,ImageData+2*(y0*image_width+x0),2*image_width); + } + +-static void draw_alpha_15(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ +- vo_draw_alpha_rgb15(w,h,src,srca,stride,ImageData+2*(y0*image_width+x0),2*image_width); ++static void draw_alpha_15(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride){ ++ vo_draw_alpha_rgb15(w,h,dp,src,srca,stride,ImageData+2*(y0*image_width+x0),2*image_width); + } + +-static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ ++static void draw_alpha_null(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride){ + } + + #ifdef GL_WIN32 +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_quartz.c MPlayer-export-2009-06-13/libvo/vo_quartz.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_quartz.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_quartz.c 2009-06-14 00:11:07.000000000 +0200 +@@ -210,23 +210,23 @@ + } + } + +-static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, int stride) ++static void draw_alpha(int x0, int y0, int w, int h, int dp, unsigned char *src, unsigned char *srca, int stride) + { + switch (image_format) + { + case IMGFMT_RGB32: +- vo_draw_alpha_rgb32(w, h, src, srca, stride, image_data + 4 * (y0 * imgRect.right + x0), 4 * imgRect.right); ++ vo_draw_alpha_rgb32(w, h, dp, src, srca, stride, image_data + 4 * (y0 * imgRect.right + x0), 4 * imgRect.right); + break; + case IMGFMT_YV12: + case IMGFMT_IYUV: + case IMGFMT_I420: +- vo_draw_alpha_yv12(w, h, src, srca, stride, ((char *)P) + be2me_32(P->componentInfoY.offset) + x0 + y0 * imgRect.right, imgRect.right); ++ vo_draw_alpha_yv12(w, h, dp, src, srca, stride, ((char *)P) + be2me_32(P->componentInfoY.offset) + x0 + y0 * imgRect.right, imgRect.right); + break; + case IMGFMT_UYVY: +- vo_draw_alpha_uyvy(w, h, src, srca, stride, ((char *)P) + (x0 + y0 * imgRect.right) * 2, imgRect.right * 2); ++ vo_draw_alpha_uyvy(w, h, dp, src, srca, stride, ((char *)P) + (x0 + y0 * imgRect.right) * 2, imgRect.right * 2); + break; + case IMGFMT_YUY2: +- vo_draw_alpha_yuy2(w, h, src, srca, stride, ((char *)P) + (x0 + y0 * imgRect.right) * 2, imgRect.right * 2); ++ vo_draw_alpha_yuy2(w, h, dp, src, srca, stride, ((char *)P) + (x0 + y0 * imgRect.right) * 2, imgRect.right * 2); + break; + } + } +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_sdl.c MPlayer-export-2009-06-13/libvo/vo_sdl.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_sdl.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_sdl.c 2009-06-14 00:22:27.000000000 +0200 +@@ -238,7 +238,7 @@ + * + **/ + +-static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ ++static void draw_alpha(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride){ + struct sdl_priv_s *priv = &sdl_priv; + + if(priv->osd_has_changed) { +@@ -278,18 +278,72 @@ + switch(priv->format) { + case IMGFMT_YV12: + case IMGFMT_I420: +- case IMGFMT_IYUV: +- vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]); +- break; ++ case IMGFMT_IYUV: ++ switch (dp) { ++ case DEST_PLANES_Y: ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]); ++ break; ++ case DEST_PLANES_U: ++ SDL_OVR_LOCK(-1) ++ if (priv->format==IMGFMT_YV12) ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ ((uint8_t *) (priv->overlay->pixels[1]))+ ++ priv->overlay->pitches[1]*y0+x0, ++ priv->overlay->pitches[1]); ++ else ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ ((uint8_t *) (priv->overlay->pixels[2]))+ ++ priv->overlay->pitches[2]*y0+x0, ++ priv->overlay->pitches[2]); ++ SDL_OVR_UNLOCK ++ break; ++ case DEST_PLANES_V: ++ SDL_OVR_LOCK(-1) ++ if (priv->format==IMGFMT_YV12) ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ ((uint8_t *) (priv->overlay->pixels[2]))+ ++ priv->overlay->pitches[2]*y0+x0, ++ priv->overlay->pitches[2]); ++ else ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ ((uint8_t *) (priv->overlay->pixels[1]))+ ++ priv->overlay->pitches[1]*y0+x0, ++ priv->overlay->pitches[1]); ++ SDL_OVR_UNLOCK ++ break; ++ } ++ break; ++ + case IMGFMT_YUY2: + case IMGFMT_YVYU: +- x0 *= 2; +- vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]); +- break; ++ x0 *= 2; ++ switch (dp) { ++ case DEST_PLANES_Y: ++ vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]); ++ break; ++ case DEST_PLANES_YUYV: ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ ((uint8_t *) *(priv->overlay->pixels))+ ++ priv->overlay->pitches[0]*y0+x0, ++ priv->overlay->pitches[0]); ++ break; ++ } ++ break; ++ + case IMGFMT_UYVY: +- x0 *= 2; +- vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]); +- break; ++ x0 *= 2; ++ switch (dp) { ++ case DEST_PLANES_Y: ++ vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->overlay->pitches[0]*y0+x0,priv->overlay->pitches[0]); ++ break; ++ case DEST_PLANES_YUYV: ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride, ++ ((uint8_t *) *(priv->overlay->pixels))+ ++ priv->overlay->pitches[0]*y0+x0, ++ priv->overlay->pitches[0]); ++ break; ++ } ++ break; + + default: + if(priv->dblit) { +@@ -297,19 +351,19 @@ + switch(priv->format) { + case IMGFMT_RGB15: + case IMGFMT_BGR15: +- vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); ++ vo_draw_alpha_rgb15(w,h,dp,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); + break; + case IMGFMT_RGB16: + case IMGFMT_BGR16: +- vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); ++ vo_draw_alpha_rgb16(w,h,dp,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); + break; + case IMGFMT_RGB24: + case IMGFMT_BGR24: +- vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); ++ vo_draw_alpha_rgb24(w,h,dp,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); + break; + case IMGFMT_RGB32: + case IMGFMT_BGR32: +- vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); ++ vo_draw_alpha_rgb32(w,h,dp,src,srca,stride,((uint8_t *) priv->surface->pixels)+y0*priv->surface->pitch+x0,priv->surface->pitch); + break; + } + } +@@ -318,19 +372,19 @@ + switch(priv->format) { + case IMGFMT_RGB15: + case IMGFMT_BGR15: +- vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); ++ vo_draw_alpha_rgb15(w,h,dp,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); + break; + case IMGFMT_RGB16: + case IMGFMT_BGR16: +- vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); ++ vo_draw_alpha_rgb16(w,h,dp,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); + break; + case IMGFMT_RGB24: + case IMGFMT_BGR24: +- vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); ++ vo_draw_alpha_rgb24(w,h,dp,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); + break; + case IMGFMT_RGB32: + case IMGFMT_BGR32: +- vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); ++ vo_draw_alpha_rgb32(w,h,dp,src,srca,stride,((uint8_t *) priv->rgbsurface->pixels)+y0*priv->rgbsurface->pitch+x0,priv->rgbsurface->pitch); + break; + } + } +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vosub_vidix.c MPlayer-export-2009-06-13/libvo/vosub_vidix.c +--- MPlayer-export-2009-06-13.orig/libvo/vosub_vidix.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vosub_vidix.c 2009-06-14 00:11:07.000000000 +0200 +@@ -286,7 +286,7 @@ + } + } + +-static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) ++static void draw_alpha(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride) + { + uint32_t apitch,bespitch; + char *lvo_mem; +@@ -301,36 +301,68 @@ + case IMGFMT_IF09: + case IMGFMT_Y8: + case IMGFMT_Y800: ++ switch (dp) { ++ case DEST_PLANES_Y: + bespitch = (vidix_play.src.w + apitch) & (~apitch); +- vo_draw_alpha_yv12(w,h,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch); ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch); ++ break; ++ case DEST_PLANES_U: ++ lvo_mem = vidix_mem + vidix_play.offsets[next_frame] + ++ vidix_play.offset.u; ++ lvo_mem += dstrides.u*y0/2 + x0; ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,lvo_mem,dstrides.u/2); ++ break; ++ case DEST_PLANES_V: ++ lvo_mem = vidix_mem + vidix_play.offsets[next_frame] + ++ vidix_play.offset.v; ++ lvo_mem += dstrides.v*y0/2 + x0; ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,lvo_mem,dstrides.v/2); ++ break; ++ } + break; + case IMGFMT_YUY2: + bespitch = (vidix_play.src.w*2 + apitch) & (~apitch); +- vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0,bespitch); ++ switch (dp) { ++ case DEST_PLANES_Y: ++ vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,lvo_mem+bespitch*y0+2*x0,bespitch); ++ break; ++ case DEST_PLANES_YUYV: ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,lvo_mem+bespitch*y0+x0, ++ bespitch); ++ break; ++ } + break; + case IMGFMT_UYVY: + bespitch = (vidix_play.src.w*2 + apitch) & (~apitch); +- vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+bespitch*y0+2*x0+1,bespitch); ++ switch (dp) { ++ case DEST_PLANES_Y: ++ vo_draw_alpha_yuy2(w,h,dp,src,srca,stride,lvo_mem+bespitch*y0+2*x0+1,bespitch); ++ break; ++ case DEST_PLANES_YUYV: ++ vo_draw_alpha_yv12(w,h,dp,src,srca,stride,lvo_mem+bespitch*y0+x0, ++ bespitch); ++ break; ++ } + break; + case IMGFMT_RGB32: + case IMGFMT_BGR32: + bespitch = (vidix_play.src.w*4 + apitch) & (~apitch); +- vo_draw_alpha_rgb32(w,h,src,srca,stride,lvo_mem+y0*bespitch+4*x0,bespitch); ++ vo_draw_alpha_rgb32(w,h,dp,src,srca,stride,lvo_mem+y0*bespitch+4*x0,bespitch); + break; + case IMGFMT_RGB24: + case IMGFMT_BGR24: + bespitch = (vidix_play.src.w*3 + apitch) & (~apitch); +- vo_draw_alpha_rgb24(w,h,src,srca,stride,lvo_mem+y0*bespitch+3*x0,bespitch); ++ vo_draw_alpha_rgb24(w,h,dp,src,srca,stride,lvo_mem+y0*bespitch+3*x0,bespitch); + break; + case IMGFMT_RGB16: + case IMGFMT_BGR16: + bespitch = (vidix_play.src.w*2 + apitch) & (~apitch); +- vo_draw_alpha_rgb16(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch); ++ vo_draw_alpha_rgb16(w,h,dp,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch); + break; + case IMGFMT_RGB15: + case IMGFMT_BGR15: + bespitch = (vidix_play.src.w*2 + apitch) & (~apitch); +- vo_draw_alpha_rgb15(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch); ++ vo_draw_alpha_rgb15(w,h,dp,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch); + break; + default: + return; +@@ -480,7 +512,7 @@ + next_frame = i; + memset(vidix_mem + vidix_play.offsets[i], 0x80, + vidix_play.frame_size); +- draw_alpha(0, 0, image_width, image_height, tmp, tmpa, image_width); ++ draw_alpha(0, 0, image_width, image_height, DEST_PLANES_Y, tmp, tmpa, image_width); + } + free(tmp); + free(tmpa); +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_vesa.c MPlayer-export-2009-06-13/libvo/vo_vesa.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_vesa.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_vesa.c 2009-06-14 00:11:07.000000000 +0200 +@@ -111,7 +111,7 @@ + static unsigned video_mode; /* selected video mode for playback */ + static struct VesaModeInfoBlock video_mode_info; + static int flip_trigger = 0; +-static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); ++static void (*draw_alpha_fnc)(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride); + + /* multibuffering */ + uint8_t* video_base; /* should be never changed */ +@@ -299,7 +299,7 @@ + /* Please comment it out if you want have OSD within movie */ + /*#define OSD_OUTSIDE_MOVIE 1*/ + +-static void draw_alpha_32(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) ++static void draw_alpha_32(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride) + { + int dstride=HAS_DGA()?video_mode_info.XResolution:dstW; + #ifndef OSD_OUTSIDE_MOVIE +@@ -309,10 +309,10 @@ + y0 += y_offset; + } + #endif +- vo_draw_alpha_rgb32(w,h,src,srca,stride,dga_buffer+4*(y0*dstride+x0),4*dstride); ++ vo_draw_alpha_rgb32(w,h,dp,src,srca,stride,dga_buffer+4*(y0*dstride+x0),4*dstride); + } + +-static void draw_alpha_24(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) ++static void draw_alpha_24(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride) + { + int dstride=HAS_DGA()?video_mode_info.XResolution:dstW; + #ifndef OSD_OUTSIDE_MOVIE +@@ -322,10 +322,10 @@ + y0 += y_offset; + } + #endif +- vo_draw_alpha_rgb24(w,h,src,srca,stride,dga_buffer+3*(y0*dstride+x0),3*dstride); ++ vo_draw_alpha_rgb24(w,h,dp,src,srca,stride,dga_buffer+3*(y0*dstride+x0),3*dstride); + } + +-static void draw_alpha_16(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) ++static void draw_alpha_16(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride) + { + int dstride=HAS_DGA()?video_mode_info.XResolution:dstW; + #ifndef OSD_OUTSIDE_MOVIE +@@ -335,10 +335,10 @@ + y0 += y_offset; + } + #endif +- vo_draw_alpha_rgb16(w,h,src,srca,stride,dga_buffer+2*(y0*dstride+x0),2*dstride); ++ vo_draw_alpha_rgb16(w,h,dp,src,srca,stride,dga_buffer+2*(y0*dstride+x0),2*dstride); + } + +-static void draw_alpha_15(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) ++static void draw_alpha_15(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride) + { + int dstride=HAS_DGA()?video_mode_info.XResolution:dstW; + #ifndef OSD_OUTSIDE_MOVIE +@@ -348,15 +348,16 @@ + y0 += y_offset; + } + #endif +- vo_draw_alpha_rgb15(w,h,src,srca,stride,dga_buffer+2*(y0*dstride+x0),2*dstride); ++ vo_draw_alpha_rgb15(w,h,dp,src,srca,stride,dga_buffer+2*(y0*dstride+x0),2*dstride); + } + +-static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) ++static void draw_alpha_null(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride) + { + UNUSED(x0); + UNUSED(y0); + UNUSED(w); + UNUSED(h); ++ UNUSED(dp); + UNUSED(src); + UNUSED(srca); + UNUSED(stride); +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_x11.c MPlayer-export-2009-06-13/libvo/vo_x11.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_x11.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_x11.c 2009-06-14 00:11:07.000000000 +0200 +@@ -70,7 +70,7 @@ + + const LIBVO_EXTERN(x11) + /* private prototypes */ +-static void (*draw_alpha_fnc) (int x0, int y0, int w, int h, ++static void (*draw_alpha_fnc) (int x0, int y0, int w, int h, int dp, + unsigned char *src, unsigned char *srca, + int stride); + +@@ -114,39 +114,39 @@ + flip_page(); + } + +-static void draw_alpha_32(int x0, int y0, int w, int h, unsigned char *src, ++static void draw_alpha_32(int x0, int y0, int w, int h, int dp, unsigned char *src, + unsigned char *srca, int stride) + { +- vo_draw_alpha_rgb32(w, h, src, srca, stride, ++ vo_draw_alpha_rgb32(w, h, dp, src, srca, stride, + ImageData + 4 * (y0 * image_width + x0), + 4 * image_width); + } + +-static void draw_alpha_24(int x0, int y0, int w, int h, unsigned char *src, ++static void draw_alpha_24(int x0, int y0, int w, int h, int dp, unsigned char *src, + unsigned char *srca, int stride) + { +- vo_draw_alpha_rgb24(w, h, src, srca, stride, ++ vo_draw_alpha_rgb24(w, h, dp, src, srca, stride, + ImageData + 3 * (y0 * image_width + x0), + 3 * image_width); + } + +-static void draw_alpha_16(int x0, int y0, int w, int h, unsigned char *src, ++static void draw_alpha_16(int x0, int y0, int w, int h, int dp, unsigned char *src, + unsigned char *srca, int stride) + { +- vo_draw_alpha_rgb16(w, h, src, srca, stride, ++ vo_draw_alpha_rgb16(w, h, dp, src, srca, stride, + ImageData + 2 * (y0 * image_width + x0), + 2 * image_width); + } + +-static void draw_alpha_15(int x0, int y0, int w, int h, unsigned char *src, ++static void draw_alpha_15(int x0, int y0, int w, int h, int dp, unsigned char *src, + unsigned char *srca, int stride) + { +- vo_draw_alpha_rgb15(w, h, src, srca, stride, ++ vo_draw_alpha_rgb15(w, h, dp, src, srca, stride, + ImageData + 2 * (y0 * image_width + x0), + 2 * image_width); + } + +-static void draw_alpha_null(int x0, int y0, int w, int h, ++static void draw_alpha_null(int x0, int y0, int w, int h, int dp, + unsigned char *src, unsigned char *srca, + int stride) + { +@@ -711,6 +711,9 @@ + case VOCTRL_UPDATE_SCREENINFO: + update_xinerama_info(); + return VO_TRUE; ++ case VOCTRL_GET_OSD_FORMAT: ++ *(uint32_t *)data=out_format; ++ return VO_TRUE; + } + return VO_NOTIMPL; + } +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_xv.c MPlayer-export-2009-06-13/libvo/vo_xv.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_xv.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_xv.c 2009-06-14 00:11:07.000000000 +0200 +@@ -110,47 +110,91 @@ + static struct vo_rect dst_rect; + static uint32_t max_width = 0, max_height = 0; // zero means: not set + +-static void (*draw_alpha_fnc) (int x0, int y0, int w, int h, ++static void (*draw_alpha_fnc) (int x0, int y0, int w, int h, int dp, + unsigned char *src, unsigned char *srca, + int stride); + +-static void draw_alpha_yv12(int x0, int y0, int w, int h, ++static void draw_alpha_yv12(int x0, int y0, int w, int h, int dp, + unsigned char *src, unsigned char *srca, + int stride) + { ++ switch (dp) { ++ case DEST_PLANES_U: ++ x0 += image_width/2 * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); ++ vo_draw_alpha_yv12(w, h, dp, src, srca, stride, ++ xvimage[current_buf]->data + ++ xvimage[current_buf]->offsets[1] + ++ xvimage[current_buf]->pitches[1] * y0 + x0, ++ xvimage[current_buf]->pitches[1]); ++ break; ++ case DEST_PLANES_V: ++ x0 += image_width/2 * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); ++ vo_draw_alpha_yv12(w, h, dp, src, srca, stride, ++ xvimage[current_buf]->data + ++ xvimage[current_buf]->offsets[2] + ++ xvimage[current_buf]->pitches[2] * y0 + x0, ++ xvimage[current_buf]->pitches[2]); ++ break; ++ case DEST_PLANES_Y: + x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); +- vo_draw_alpha_yv12(w, h, src, srca, stride, ++ vo_draw_alpha_yv12(w, h, dp, src, srca, stride, + xvimage[current_buf]->data + + xvimage[current_buf]->offsets[0] + + xvimage[current_buf]->pitches[0] * y0 + x0, + xvimage[current_buf]->pitches[0]); ++ break; ++ } + } + +-static void draw_alpha_yuy2(int x0, int y0, int w, int h, ++static void draw_alpha_yuy2(int x0, int y0, int w, int h, int dp, + unsigned char *src, unsigned char *srca, + int stride) + { ++ switch (dp) { ++ case DEST_PLANES_Y: + x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); +- vo_draw_alpha_yuy2(w, h, src, srca, stride, ++ vo_draw_alpha_yuy2(w, h, dp, src, srca, stride, + xvimage[current_buf]->data + + xvimage[current_buf]->offsets[0] + + xvimage[current_buf]->pitches[0] * y0 + 2 * x0, + xvimage[current_buf]->pitches[0]); ++ break; ++ case DEST_PLANES_YUYV: ++ x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); ++ vo_draw_alpha_yv12(w, h, dp, src, srca, stride, ++ xvimage[current_buf]->data + ++ xvimage[current_buf]->offsets[0] + ++ xvimage[current_buf]->pitches[0] * y0 + 2 * x0, ++ xvimage[current_buf]->pitches[0]); ++ break; ++ } + } + +-static void draw_alpha_uyvy(int x0, int y0, int w, int h, ++static void draw_alpha_uyvy(int x0, int y0, int w, int h, int dp, + unsigned char *src, unsigned char *srca, + int stride) + { ++ switch (dp) { ++ case DEST_PLANES_Y: + x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); +- vo_draw_alpha_yuy2(w, h, src, srca, stride, ++ vo_draw_alpha_yuy2(w, h, dp, src, srca, stride, + xvimage[current_buf]->data + + xvimage[current_buf]->offsets[0] + + xvimage[current_buf]->pitches[0] * y0 + 2 * x0 + 1, + xvimage[current_buf]->pitches[0]); ++ break; ++ case DEST_PLANES_YUYV: ++ x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x); ++ vo_draw_alpha_yv12(w, h, dp, src, srca, stride, ++ xvimage[current_buf]->data + ++ xvimage[current_buf]->offsets[0] + ++ xvimage[current_buf]->pitches[0] * y0 + 2 * x0, ++ xvimage[current_buf]->pitches[0]); ++ break; ++ } + } + +-static void draw_alpha_null(int x0, int y0, int w, int h, ++static void draw_alpha_null(int x0, int y0, int w, int h, int dp, + unsigned char *src, unsigned char *srca, + int stride) + { +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_xvmc.c MPlayer-export-2009-06-13/libvo/vo_xvmc.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_xvmc.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_xvmc.c 2009-06-14 00:11:07.000000000 +0200 +@@ -108,12 +108,12 @@ + static int free_element; + + +-static void (*draw_osd_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); ++static void (*draw_osd_fnc)(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride); + static void (*clear_osd_fnc)(int x0,int y0, int w,int h); + static void (*init_osd_fnc)(void); + +-static void draw_osd_AI44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); +-static void draw_osd_IA44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); ++static void draw_osd_AI44(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride); ++static void draw_osd_IA44(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride); + static void clear_osd_subpic(int x0,int y0, int w,int h); + static void init_osd_yuv_pal(void); + +@@ -791,7 +791,7 @@ + subpicture_alloc = 1; + } + +-static void draw_osd_IA44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ ++static void draw_osd_IA44(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride){ + int ox,oy; + int rez; + +@@ -810,7 +810,7 @@ + } + } + +-static void draw_osd_AI44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ ++static void draw_osd_AI44(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride){ + int ox,oy; + int rez; + +diff -Naur MPlayer-export-2009-06-13.orig/libvo/vo_yuv4mpeg.c MPlayer-export-2009-06-13/libvo/vo_yuv4mpeg.c +--- MPlayer-export-2009-06-13.orig/libvo/vo_yuv4mpeg.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libvo/vo_yuv4mpeg.c 2009-06-14 00:18:48.000000000 +0200 +@@ -196,25 +196,41 @@ + } + } + +-static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, ++static void draw_alpha(int x0, int y0, int w, int h, int dp, unsigned char *src, + unsigned char *srca, int stride) { + switch (using_format) + { + case IMGFMT_YV12: +- vo_draw_alpha_yv12(w, h, src, srca, stride, +- image + y0 * image_width + x0, image_width); +- break; ++ switch (dp) { ++ case DEST_PLANES_Y: ++ vo_draw_alpha_yv12(w, h, dp, src, srca, stride, ++ image + y0 * image_width + x0, image_width); ++ break; ++ case DEST_PLANES_U: ++ if (image_u) ++ vo_draw_alpha_yv12(w, h, dp, src, srca, stride, ++ image_u + y0 * image_width + x0, ++ image_width); ++ break; ++ case DEST_PLANES_V: ++ if (image_v) ++ vo_draw_alpha_yv12(w, h, dp, src, srca, stride, ++ image_v + y0 * image_width + x0, ++ image_width); ++ break; ++ } ++ break; + + case IMGFMT_BGR|24: + case IMGFMT_RGB|24: + if (config_interlace != Y4M_ILACE_BOTTOM_FIRST) +- vo_draw_alpha_rgb24(w, h, src, srca, stride, ++ vo_draw_alpha_rgb24(w, h, dp, src, srca, stride, + rgb_buffer + (y0 * image_width + x0) * 3, image_width * 3); + else + { + swap_fields (rgb_buffer, image_height, image_width * 3); + +- vo_draw_alpha_rgb24(w, h, src, srca, stride, ++ vo_draw_alpha_rgb24(w, h, dp, src, srca, stride, + rgb_buffer + (y0 * image_width + x0) * 3, image_width * 3); + + swap_fields (rgb_buffer, image_height, image_width * 3); +diff -Naur MPlayer-export-2009-06-13.orig/mp_core.h MPlayer-export-2009-06-13/mp_core.h +--- MPlayer-export-2009-06-13.orig/mp_core.h 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/mp_core.h 2009-06-14 00:11:07.000000000 +0200 +@@ -111,6 +111,7 @@ + unsigned char *nav_start; ///< pointer to last read video buffer + int nav_in_size; ///< last read size + #endif ++ int spu_color_inited; + } MPContext; + + +diff -Naur MPlayer-export-2009-06-13.orig/mplayer.c MPlayer-export-2009-06-13/mplayer.c +--- MPlayer-export-2009-06-13.orig/mplayer.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/mplayer.c 2009-06-14 00:11:07.000000000 +0200 +@@ -229,6 +229,7 @@ + // if nonzero, hide current OSD contents when GetTimerMS() reaches this + unsigned int osd_visible; + int osd_duration = 1000; ++int colorspu=1; + + int term_osd = 1; + static char* term_osd_esc = "\x1b[A\r\x1b[K"; +@@ -1092,6 +1093,7 @@ + void init_vo_spudec(void) { + if (vo_spudec) + spudec_free(vo_spudec); ++ mpctx->spu_color_inited=0; + initialized_flags &= ~INITIALIZED_SPUDEC; + vo_spudec = NULL; + if (spudec_ifo) { +@@ -1131,6 +1133,16 @@ + } + } + ++void init_spu_color(void) ++{ ++ uint32_t fmt=0; ++ ++ if (mpctx->sh_video->vfilter) ++ ((vf_instance_t *)mpctx->sh_video->vfilter)->control(mpctx->sh_video->vfilter, VFCTRL_GET_OSD_FORMAT, &fmt); ++ spudec_set_spu_format(vo_spudec, fmt); ++ mpctx->spu_color_inited=1; ++} ++ + /* + * In Mac OS X the SDL-lib is built upon Cocoa. The easiest way to + * make it all work is to use the builtin SDL-bootstrap code, which +@@ -1932,6 +1944,85 @@ + if (decoded_frame && mpctx->nav_smpi != decoded_frame) + mpctx->nav_smpi = mp_dvdnav_copy_mpi(mpctx->nav_smpi,decoded_frame); + } ++ ++// ++// set dvd menu buttons ++// ++static void mp_dvdnav_highlight_handle(int stream_is_change) { ++ nav_highlight_t highlight; ++ unsigned int *spu_clut; ++ ++ if (vo_spudec!=NULL && mpctx->sh_video && !mpctx->spu_color_inited) ++ init_spu_color(); ++ spu_clut = mp_dvdnav_get_spu_clut(mpctx->stream); ++ mp_dvdnav_get_highlight(mpctx->stream,&highlight); ++ if (highlight.sx==0 && highlight.sy==0 && highlight.ex==0 && highlight.ey==0) { /// is no button ++ if (stream_is_change || (spudec_visible(vo_spudec) && !mpctx->global_sub_size)) { ++ if(!colorspu) ++ spudec_set_spu_format(vo_spudec, 0); ++ spudec_update_palette(vo_spudec,spu_clut); ++ spudec_dvdnav_mode(vo_spudec, 0); /// spu menu button off ++ spudec_dvdnav_area(vo_spudec,highlight.sx,highlight.sy,highlight.ex, ++ highlight.ey,highlight.palette); /// set spu button area & palette ++ if(vo_spudec) spudec_reset(vo_spudec); ++ vo_osd_changed(OSDTYPE_SPU); ++ } ++ } else { ++ if(vo_spudec!=NULL && mpctx->sh_video && !colorspu) ++ init_spu_color(); ++ spudec_update_palette(vo_spudec,spu_clut); ++ spudec_dvdnav_mode(vo_spudec, mpctx->spu_color_inited); /// spu menu button on ++ spudec_dvdnav_area(vo_spudec,highlight.sx,highlight.sy,highlight.ex, ++ highlight.ey,highlight.palette); /// set spu button area & palette ++ vo_osd_changed(OSDTYPE_SPU); ++ if (!vo_spudec || !spudec_visible(vo_spudec)) { /// if unsucessful spu button visible ++ osd_set_nav_box(highlight.sx,highlight.sy,highlight.ex,highlight.ey); /// then use simple box ++ vo_osd_changed(OSDTYPE_DVDNAV); ++ } else { ++ osd_set_nav_box(0,0,0,0); /// if sucessful spu button visible the ++ vo_osd_changed(OSDTYPE_DVDNAV); /// then hide simple box ++ } ++ } ++} ++ ++/// Switch audio stream of DVDNAV ++static int mp_dvdnav_switch_audio(void) { ++ int new_aid=mp_dvdnav_get_current_audio(mpctx->stream); ++ int old_aid=mpctx->demuxer->audio->id; ++ int aid; ++ ++ if (new_aid<0) { ++ demuxer_switch_audio(mpctx->demuxer, new_aid); ++ return 1; ++ } ++ if (new_aid==old_aid) ++ return 1; ++ aid = demuxer_switch_audio(mpctx->demuxer, new_aid); ++ if (aid!=new_aid) ++ return 0; ++ if (mpctx->demuxer->audio->id==-2) { ++ mpctx->demuxer->audio->id=-1; ++ return 1; ++ } ++ if (old_aid & 0x0F == new_aid & 0x0F) // codec unchanged ++ return 1; ++ if (new_aid == -2 || (new_aid > -1 && old_aid != -2 && ++ mpctx->demuxer->audio->id != old_aid)) { ++ uninit_player(INITIALIZED_AO | INITIALIZED_ACODEC); ++ if (audio_id > -1 && mpctx->demuxer->audio->id != old_aid) { ++ sh_audio_t *sh2; ++ sh2 = mpctx->demuxer->a_streams[mpctx->demuxer->audio->id]; ++ if (sh2) { ++ sh2->ds = mpctx->demuxer->audio; ++ mpctx->sh_audio = sh2; ++ reinit_audio_chain(); ++ } ++ } ++ } ++ if (mpctx->demuxer->audio->id==-2) ++ mpctx->demuxer->audio->id=-1; ++ return 1; ++} + #endif /* CONFIG_DVDNAV */ + + static void adjust_sync_and_print_status(int between_frames, float timing_error) +@@ -3781,20 +3872,34 @@ + + } // end if(mpctx->sh_video) + ++ if (vo_spudec!=NULL && mpctx->sh_video ++ && !mpctx->spu_color_inited && colorspu) ++ init_spu_color(); ++ + #ifdef CONFIG_DVDNAV + if (mpctx->stream->type == STREAMTYPE_DVDNAV) { +- nav_highlight_t hl; +- mp_dvdnav_get_highlight (mpctx->stream, &hl); +- osd_set_nav_box (hl.sx, hl.sy, hl.ex, hl.ey); +- vo_osd_changed (OSDTYPE_DVDNAV); +- ++ if (mp_dvdnav_audio_has_changed(mpctx->stream,0)) ++ if (mp_dvdnav_switch_audio()) ++ mp_dvdnav_audio_has_changed(mpctx->stream,1); ++ ++ if (mp_dvdnav_spu_has_changed(mpctx->stream,1) || dvdsub_id==-2) { ++ mpctx->global_sub_size=mp_dvdnav_number_of_subs(mpctx->stream); ++ if (mpctx->d_sub) { ++ dvdsub_id=mp_dvdnav_get_current_spu(mpctx->stream); ++ if(dvdsub_id<0) dvdsub_id=-2; ++ mpctx->d_sub->id = dvdsub_id; ++ } ++ } ++ + if (mp_dvdnav_stream_has_changed(mpctx->stream)) { + double ar = -1.0; ++ mp_dvdnav_highlight_handle(1); + if (stream_control (mpctx->demuxer->stream, + STREAM_CTRL_GET_ASPECT_RATIO, &ar) + != STREAM_UNSUPPORTED) + mpctx->sh_video->stream_aspect = ar; +- } ++ } else ++ mp_dvdnav_highlight_handle(0); + } + #endif + +diff -Naur MPlayer-export-2009-06-13.orig/spudec.c MPlayer-export-2009-06-13/spudec.c +--- MPlayer-export-2009-06-13.orig/spudec.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/spudec.c 2009-06-14 00:29:55.000000000 +0200 +@@ -41,6 +41,15 @@ + float spu_gaussvar = 1.0; + extern int sub_pos; + ++/* color mode flags */ ++typedef enum { ++ COLORSPU_Y = 0, /* Grayscale */ ++ COLORSPU_YUV = 1, ++ COLORSPU_YUY = 2, ++ COLORSPU_RGB = 3, ++ COLORSPU_BGR = 4, ++} colorspu_t; ++ + typedef struct packet_t packet_t; + struct packet_t { + unsigned char *packet; +@@ -76,22 +85,47 @@ + unsigned int start_pts, end_pts; + unsigned int start_col, end_col; + unsigned int start_row, end_row; ++ unsigned int start_coluv, end_coluv; ++ unsigned int start_rowuv, end_rowuv; + unsigned int width, height, stride; ++ unsigned int widthuv, heightuv, strideuv, strideyuy; + size_t image_size; /* Size of the image buffer */ +- unsigned char *image; /* Grayscale value */ ++ size_t image_sizeuv; /* Size of the imageuv buffer */ ++ size_t image_sizeyuy; /* Size of the imageyuy buffer */ ++ unsigned char *image; /* Grayscale value or Y value or RB value */ ++ unsigned char *imageu; /* U value or G value */ ++ unsigned char *imagev; /* V value or BR value */ ++ unsigned char *imageyuy; /* image yuy */ + unsigned char *aimage; /* Alpha value */ ++ unsigned char *aimageuv; /* Alpha value to uv planes */ ++ unsigned char *aimageyuy; /* Alpha valur to yuy planes */ + unsigned int scaled_frame_width, scaled_frame_height; + unsigned int scaled_start_col, scaled_start_row; + unsigned int scaled_width, scaled_height, scaled_stride; ++ unsigned int scaled_frame_widthuv, scaled_frame_heightuv; ++ unsigned int scaled_start_coluv, scaled_start_rowuv; ++ unsigned int scaled_widthuv, scaled_heightuv, scaled_strideuv; + size_t scaled_image_size; ++ size_t scaled_image_sizeuv; + unsigned char *scaled_image; + unsigned char *scaled_aimage; ++ unsigned char *scaled_imageu; ++ unsigned char *scaled_imagev; ++ unsigned char *scaled_aimageuv; + int auto_palette; /* 1 if we lack a palette and must use an heuristic. */ + int font_start_level; /* Darkest value used for the computed font */ + const vo_functions_t *hw_spu; + int spu_changed; + unsigned int forced_subs_only; /* flag: 0=display all subtitle, !0 display only forced subtitles */ + unsigned int is_forced_sub; /* true if current subtitle is a forced subtitle */ ++ colorspu_t colorspu; /* spu color mode */ ++ uint32_t dvdnav_palette; /* dvdnav menu button palette */ ++ unsigned int spu_sx; /* dvdnav menu item box */ ++ unsigned int spu_ex; ++ unsigned int spu_sy; ++ unsigned int spu_ey; ++ int dvdnav_menu; ++ packet_t *last_packet; + } spudec_handle_t; + + static void spudec_queue_packet(spudec_handle_t *this, packet_t *packet) +@@ -176,6 +210,8 @@ + unsigned int first_y, last_y; + unsigned char *image; + unsigned char *aimage; ++ unsigned char *imageu; ++ unsigned char *imagev; + + if (this->stride == 0 || this->height == 0) { + return; +@@ -211,12 +247,152 @@ + } else { + mp_msg(MSGT_SPUDEC, MSGL_FATAL, "Fatal: update_spu: malloc requested %d bytes\n", 2 * this->stride * this->height); + } ++// ++// Cut the sub to visible part UV planes ++// ++ switch (this->colorspu) { ++ case COLORSPU_YUV: ++ case COLORSPU_YUY: ++ for (fy = 0; fy < this->image_sizeuv && !this->aimageuv[fy]; fy++); ++ for (ly = this->strideuv * this->heightuv-1; ++ ly && !this->aimageuv[ly]; ly--); ++ first_y = fy / this->strideuv; ++ last_y = ly / this->strideuv; ++ this->start_rowuv += first_y; ++ // Some subtitles trigger this condition ++ if (last_y + 1 > first_y ) { ++ this->heightuv = last_y - first_y +1; ++ } else { ++ this->heightuv = 0; ++ this->image_sizeuv = 0; ++ return; ++ } ++ // printf("new h %d new start %d (sz %d st %d)---\n\n", this->height, this->start_row, this->image_size, this->stride); ++ imageu = malloc(3 * this->strideuv * this->heightuv); ++ if(imageu){ ++ this->image_sizeuv = this->strideuv * this->heightuv; ++ imagev = imageu + this->image_sizeuv; ++ aimage = imagev + this->image_sizeuv; ++ memcpy(imageu, this->imageu + this->strideuv * first_y, ++ this->image_sizeuv); ++ memcpy(imagev, this->imagev + this->strideuv * first_y, ++ this->image_sizeuv); ++ memcpy(aimage, this->aimageuv + this->strideuv * first_y, ++ this->image_sizeuv); ++ free(this->imageu); ++ this->imageu = imageu; ++ this->imagev = imagev; ++ this->aimageuv = aimage; ++ } else { ++ mp_msg(MSGT_SPUDEC, MSGL_FATAL, ++ "Fatal: update_spu: malloc requested %d bytes\n", ++ 3 * this->strideuv * this->height); ++ } ++ break; ++ case COLORSPU_RGB: ++ case COLORSPU_BGR: ++ this->image_sizeuv = this->stride * this->height; ++ imageu = malloc(2 * this->stride * this->height); ++ if(imageu){ ++ imagev = imageu + this->image_size; ++ memcpy(imageu, this->imageu + this->stride * first_y, this->image_size); ++ memcpy(imagev, this->imagev + this->stride * first_y, this->image_size); ++ free(this->imageu); ++ this->imageu = imageu; ++ this->imagev = imagev; ++ this->aimageuv = NULL; ++ } else { ++ mp_msg(MSGT_SPUDEC, MSGL_FATAL, ++ "Fatal: update_spu: malloc requested %d bytes\n", ++ 2 * this->stride * this->height); ++ } ++ break; ++ } ++} ++ ++// ++// Fill to spu image buffer ++// y : image col ++// x : start pos in image row ++// len : fill length in image row ++// color : Y: (YUV,YUY,Y), Red: (RGB) or Blue: (BGR) ++// coloru: U: (YUV,YUY), Green: (RGB,BGR) ++// colorv: V: (YUV,YUY), Blue: (RGB) or Red (BGR) ++// alpha: alpha channel ++static void spudec_process_fill(spudec_handle_t *this, int x, int y, int len, ++ unsigned char color, unsigned char coloru, unsigned char colorv, ++ unsigned char alpha) ++{ ++ unsigned int corrx, corry, corrl; ++ ++ if (this->stride-x-len<0) return; ++ if (len<0) return; ++ switch (this->colorspu) { ++ case COLORSPU_YUV: ++ case COLORSPU_YUY: ++ corry=y & 0x01; ++ corrx=x & 0x01; ++ corrl=len & 0x01; ++ memset(this->image + y * this->stride + x, color, len); ++ memset(this->aimage + y * this->stride + x, alpha, len); ++ memset(this->imageu + (y-corry)/2 * this->strideuv + (x+corrx)/2, coloru, ++ (len-corrl)/2); ++ memset(this->imagev + (y-corry)/2 * this->strideuv + (x+corrx)/2, colorv, ++ (len-corrl)/2); ++ memset(this->aimageuv + (y-corry)/2 * this->strideuv + (x+corrx)/2, alpha, ++ (len-corrl)/2); ++ break; ++ case COLORSPU_RGB: ++ case COLORSPU_BGR: ++ memset(this->image + y * this->stride + x, color, len); ++ memset(this->imageu + y * this->stride + x, coloru, len); ++ memset(this->imagev + y * this->stride + x, colorv, len); ++ memset(this->aimage + y * this->stride + x, alpha, len); ++ break; ++ default: ++ memset(this->image + y * this->stride + x, color, len); ++ memset(this->aimage + y * this->stride + x, alpha, len); ++ break; ++ } ++} ++ ++// ++// Convert yuv color to rgb color ++// ++void spu_yuv_to_rgb(unsigned int y,unsigned int u,unsigned int v, ++ unsigned int *r,unsigned int *g,unsigned int *b) ++{ ++ int ty,tu,tv; ++ int tr,tg,tb; ++ ++ ty=y;tv=u;tu=v; ++ tr = (298*(ty-16)+408*(tv-128))/256; ++ tg = (298*(ty-16)-100*(tu-128)-208*(tv-128))/256; ++ tb = (298*(ty-16)+516*(tu-128))/256; ++ if(tr>255) tr=255; if(tr<0) tr=0; ++ if(tg>255) tg=255; if(tg<0) tg=0; ++ if(tb>255) tb=255; if(tb<0) tb=0; ++ *r=tr; *g=tg; *b=tb; ++return; + } + + static void spudec_process_data(spudec_handle_t *this, packet_t *packet) + { + unsigned int cmap[4], alpha[4]; ++ unsigned int thpalette[4], thalpha[4]; /* dvdnav highlight menu palette */ ++ unsigned int hcmap[4], halpha[4]; /* dvdnav highlight map */ ++ unsigned int cmapu[4], cmapv[4]; ++ unsigned int hcmapu[4], hcmapv[4]; ++ unsigned int ty, tu, tv, tr, tg, tb; + unsigned int i, x, y; ++ unsigned int control_start; ++ unsigned int current_nibble[2]; ++ int deinterlace_oddness; ++ ++ control_start = packet->control_start; ++ current_nibble[0]=packet->current_nibble[0]; ++ current_nibble[1]=packet->current_nibble[1]; ++ deinterlace_oddness=packet->deinterlace_oddness; + + this->scaled_frame_width = 0; + this->scaled_frame_height = 0; +@@ -227,7 +403,136 @@ + this->height = packet->height; + this->width = packet->width; + this->stride = packet->stride; ++ this->strideuv = packet->stride; ++ ++ this->start_coluv = packet->start_col/2; ++ this->end_coluv = packet->end_col/2; ++ this->start_rowuv = packet->start_row/2; ++ this->end_rowuv = packet->end_row/2; ++ this->heightuv = packet->height/2+1; ++ this->widthuv = packet->width/2+1; ++ + for (i = 0; i < 4; ++i) { ++ thalpha[i]=(this->dvdnav_palette >> ((3-i)*4)) & 0x0f; ++ thpalette[i]=(this->dvdnav_palette >> (16+(3-i)*4)) & 0x0f; ++ halpha[i] = mkalpha(thalpha[i]); ++ hcmap[i] = ((this->global_palette[thpalette[i]] >> 16) & 0xff); ++ alpha[i] = mkalpha(packet->alpha[i]); ++ if (this->custom && (this->cuspal[i] >> 31) != 0) ++ alpha[i] = 0; ++ ++ switch(this->colorspu) { ++ case COLORSPU_YUV: ++ case COLORSPU_YUY: ++ if (alpha[i] == 0) ++ cmap[i] = cmapu[i] = cmapv[i] = 0; ++ else if (this->custom){ ++ cmap[i] = ((this->cuspal[i] >> 16) & 0xff); ++ cmapu[i] = ((this->cuspal[i] >> 8) & 0xff); ++ cmapv[i] = ((this->cuspal[i] >> 0) & 0xff); ++ if (cmap[i] + alpha[i] > 255) ++ cmap[i] = 256 - alpha[i]; ++ } else { ++ cmap[i] = ((this->global_palette[packet->palette[i]] >> 16) & 0xff); ++ cmapu[i] = ((this->global_palette[packet->palette[i]] >> 8) & 0xff); ++ cmapv[i] = ((this->global_palette[packet->palette[i]] >> 0) & 0xff); ++ if (cmap[i] + alpha[i] > 255) ++ cmap[i] = 256 - alpha[i]; ++ } ++ if (halpha[i] == 0) {hcmap[i] = 0; hcmapu[i] = 0; hcmapv[i] = 0;} else { ++ if (hcmap[i] + halpha[i] > 255) ++ hcmap[i] = 256 - halpha[i]; ++ hcmap[i] = ((this->global_palette[thpalette[i]] >> 16) & 0xff); // Y ++ hcmap[i] = ((0x100-halpha[i])*hcmap[i]) >> 8; ++ hcmapu[i] = ((this->global_palette[thpalette[i]] >> 8) & 0xff); // u ++ hcmapu[i] = ((0x100-halpha[i])*hcmapu[i]) >> 8; ++ hcmapv[i] = ((this->global_palette[thpalette[i]] >> 0) & 0xff); // v ++ hcmapv[i] = ((0x100-halpha[i])*hcmapv[i]) >> 8; ++ } ++ break; ++ case COLORSPU_RGB: ++ if (alpha[i] == 0) ++ cmap[i] = cmapu[i] = cmapv[i] = 0; ++ else if (this->custom){ ++ ty = ((this->cuspal[i] >> 16) & 0xff); ++ tu = ((this->cuspal[i] >> 8) & 0xff); ++ tv = ((this->cuspal[i] >> 0) & 0xff); ++ spu_yuv_to_rgb(ty,tu,tv,&tr,&tg,&tb); ++ cmap[i] = tr; // Red ++ cmapu[i] = tg; // Green ++ cmapv[i] = tb; // Blue ++ cmap[i] = ((0x100-alpha[i])*cmap[i]) >> 8; ++ cmapu[i] = ((0x100-alpha[i])*cmapu[i]) >> 8; ++ cmapv[i] = ((0x100-alpha[i])*cmapv[i]) >> 8; ++ } else { ++ ty = ((this->global_palette[packet->palette[i]] >> 16) & 0xff); ++ tu = ((this->global_palette[packet->palette[i]] >> 8) & 0xff); ++ tv = ((this->global_palette[packet->palette[i]] >> 0) & 0xff); ++ spu_yuv_to_rgb(ty,tu,tv,&tr,&tg,&tb); ++ cmap[i] = tr; // Red ++ cmapu[i] = tg; // Green ++ cmapv[i] = tb; // Blue ++ cmap[i] = ((0x100-alpha[i])*cmap[i]) >> 8; ++ cmapu[i] = ((0x100-alpha[i])*cmapu[i]) >> 8; ++ cmapv[i] = ((0x100-alpha[i])*cmapv[i]) >> 8; ++ } ++ if (halpha[i] == 0) {hcmap[i] = 0; hcmapu[i] = 0; hcmapv[i] = 0;} else { ++ if (hcmap[i] + halpha[i] > 255) ++ hcmap[i] = 256 - halpha[i]; ++ ty = ((this->global_palette[thpalette[i]] >> 16) & 0xff); // Y ++ tu = ((this->global_palette[thpalette[i]] >> 8) & 0xff); // u ++ tv = ((this->global_palette[thpalette[i]] >> 0) & 0xff); // v ++ spu_yuv_to_rgb(ty,tu,tv,&tr,&tg,&tb); ++ hcmap[i] = tr; ++ hcmapu[i] = tg; ++ hcmapv[i] = tb; ++ hcmap[i] = ((0x100-halpha[i])*hcmap[i]) >> 8; ++ hcmapu[i] = ((0x100-halpha[i])*hcmapu[i]) >> 8; ++ hcmapv[i] = ((0x100-halpha[i])*hcmapv[i]) >> 8; ++ } ++ break; ++ case COLORSPU_BGR: ++ if (alpha[i] == 0) ++ cmap[i] = cmapu[i] = cmapv[i] = 0; ++ else if (this->custom){ ++ ty = ((this->cuspal[i] >> 16) & 0xff); ++ tu = ((this->cuspal[i] >> 8) & 0xff); ++ tv = ((this->cuspal[i] >> 0) & 0xff); ++ spu_yuv_to_rgb(ty,tu,tv,&tr,&tg,&tb); ++ cmap[i] = tb; // Red ++ cmapu[i] = tg; // Green ++ cmapv[i] = tr; // Blue ++ cmap[i] = ((0x100-alpha[i])*cmap[i]) >> 8; ++ cmapu[i] = ((0x100-alpha[i])*cmapu[i]) >> 8; ++ cmapv[i] = ((0x100-alpha[i])*cmapv[i]) >> 8; ++ } else { ++ ty = ((this->global_palette[packet->palette[i]] >> 16) & 0xff); ++ tu = ((this->global_palette[packet->palette[i]] >> 8) & 0xff); ++ tv = ((this->global_palette[packet->palette[i]] >> 0) & 0xff); ++ spu_yuv_to_rgb(ty,tu,tv,&tr,&tg,&tb); ++ cmap[i] = tb; // Red ++ cmapu[i] = tg; // Green ++ cmapv[i] = tr; // Blue ++ cmap[i] = ((0x100-alpha[i])*cmap[i]) >> 8; ++ cmapu[i] = ((0x100-alpha[i])*cmapu[i]) >> 8; ++ cmapv[i] = ((0x100-alpha[i])*cmapv[i]) >> 8; ++ } ++ if (halpha[i] == 0) {hcmap[i] = 0; hcmapu[i] = 0; hcmapv[i] = 0;} else { ++ if (hcmap[i] + halpha[i] > 255) ++ hcmap[i] = 256 - halpha[i]; ++ ty = ((this->global_palette[thpalette[i]] >> 16) & 0xff); // Y ++ tu = ((this->global_palette[thpalette[i]] >> 8) & 0xff); // u ++ tv = ((this->global_palette[thpalette[i]] >> 0) & 0xff); // v ++ spu_yuv_to_rgb(ty,tu,tv,&tr,&tg,&tb); ++ hcmap[i] = tb; ++ hcmapu[i] = tg; ++ hcmapv[i] = tr; ++ hcmap[i] = ((0x100-halpha[i])*hcmap[i]) >> 8; ++ hcmapu[i] = ((0x100-halpha[i])*hcmapu[i]) >> 8; ++ hcmapv[i] = ((0x100-halpha[i])*hcmapv[i]) >> 8; ++ } ++ break; ++ default: + alpha[i] = mkalpha(packet->alpha[i]); + if (this->custom && (this->cuspal[i] >> 31) != 0) + alpha[i] = 0; +@@ -244,6 +549,7 @@ + cmap[i] = 256 - alpha[i]; + } + } ++ } + + if (this->image_size < this->stride * this->height) { + if (this->image != NULL) { +@@ -267,6 +573,52 @@ + memset(this->image + y * this->stride + this->width, 0, this->stride - this->width); + } + ++ if (this->imageyuy) { ++ free(this->imageyuy); ++ this->imageyuy=NULL; ++ this->aimageyuy=NULL; ++ } ++ switch(this->colorspu) { ++ case COLORSPU_YUY: ++ case COLORSPU_YUV: ++ if (this->image_sizeuv < this->strideuv * this->heightuv) { ++ if (this->imageu != NULL) { ++ free(this->imageu); ++ this->image_sizeuv = 0; ++ } ++ this->imageu = malloc(3 * this->strideuv * this->heightuv); ++ if (this->imageu) { ++ this->image_sizeuv = this->strideuv * this->heightuv; ++ this->imagev = this->imageu + this->image_sizeuv; ++ this->aimageuv = this->imagev + this->image_sizeuv; ++ } ++ } ++ if (this->imageu == NULL) return; ++ memset(this->imageu,0,3 * this->strideuv * this->heightuv); ++ break; ++ case COLORSPU_RGB: ++ case COLORSPU_BGR: ++ if (this->image_sizeuv < this->stride * this->height) { ++ if (this->imageu != NULL) { ++ free(this->imageu); ++ this->image_sizeuv = 0; ++ } ++ this->imageu = malloc(2 * this->stride * this->height); ++ if (this->imageu) { ++ this->image_sizeuv = this->stride * this->height; ++ this->imagev = this->imageu + this->image_sizeuv; ++ this->aimageuv = this->imagev + this->image_sizeuv; ++ } ++ } ++ if (this->imageu == NULL) return; ++ memset(this->imageu,0,2 * this->stride * this->height); ++ break; ++ default: ++ if (this->imageu) free(this->imageu); ++ this->imageu=NULL; ++ this->image_sizeuv=0; ++ } ++ + i = packet->current_nibble[1]; + x = 0; + y = 0; +@@ -292,8 +644,71 @@ + if (len > this->width - x || len == 0) + len = this->width - x; + /* FIXME have to use palette and alpha map*/ ++ switch(this->colorspu) { ++ case COLORSPU_YUV: ++ case COLORSPU_YUY: ++ case COLORSPU_RGB: ++ case COLORSPU_BGR: ++ if (!this->spu_sx && !this->spu_sy &&!this->spu_ex && !this->spu_ey) { ++ spudec_process_fill(this, x, y, len, ++ cmap[color], cmapu[color], ++ cmapv[color], alpha[color]); ++ } else { ++ if (this->start_row+y>=this->spu_sy && ++ this->start_row+y<=this->spu_ey) { ++ if (this->start_col+x>=this->spu_sx && ++ this->start_col+x+len<=this->spu_ex) ++ spudec_process_fill(this, x, y, len, ++ hcmap[color], hcmapu[color], ++ hcmapv[color], halpha[color]); ++ else if(this->start_col+xspu_sx && ++ this->start_col+x+len>this->spu_sx && ++ this->start_col+x+len<=this->spu_ex) { ++ spudec_process_fill(this, x, y, this->spu_sx-this->start_col-x, ++ cmap[color], cmapu[color], ++ cmapv[color], alpha[color]); ++ spudec_process_fill(this, this->spu_sx-this->start_col, y, ++ len+this->start_col+x-this->spu_sx, ++ hcmap[color], hcmapu[color], ++ hcmapv[color], halpha[color]); ++ } else if(this->start_col+xspu_sx && ++ this->start_col+x+len>this->spu_sx && ++ this->start_col+x+len>this->spu_ex) { ++ spudec_process_fill(this, x, y, this->spu_sx-this->start_col-x, ++ cmap[color], cmapu[color], ++ cmapv[color], alpha[color]); ++ spudec_process_fill(this, this->spu_sx-this->start_col, y, ++ this->spu_ex-this->spu_sx, ++ hcmap[color], hcmapu[color], ++ hcmapv[color], halpha[color]); ++ spudec_process_fill(this, this->spu_ex-this->start_col, y, ++ x+len+this->start_col-this->spu_ex, ++ cmap[color], cmapu[color], ++ cmapv[color], alpha[color]); ++ } else if(this->start_col+x>=this->spu_sx && ++ this->start_col+xspu_ex && ++ this->start_col+x+len>this->spu_ex) { ++ spudec_process_fill(this, x, y, this->spu_ex-this->start_col-x, ++ hcmap[color], hcmapu[color], ++ hcmapv[color], halpha[color]); ++ spudec_process_fill(this, this->spu_ex-this->start_col, y, ++ len+this->start_col+x-this->spu_ex, ++ cmap[color], cmapu[color], ++ cmapv[color], alpha[color]); ++ } else ++ spudec_process_fill(this, x, y, len, ++ cmap[color], cmapu[color], ++ cmapv[color], alpha[color]); ++ } else ++ spudec_process_fill(this, x, y, len, ++ cmap[color], cmapu[color], ++ cmapv[color], alpha[color]); ++ } ++ break; ++ default: + memset(this->image + y * this->stride + x, cmap[color], len); + memset(this->aimage + y * this->stride + x, alpha[color], len); ++ } + x += len; + if (x >= this->width) { + next_line(packet); +@@ -301,6 +716,10 @@ + ++y; + } + } ++ packet->control_start = control_start; ++ packet->current_nibble[0]=current_nibble[0]; ++ packet->current_nibble[1]=current_nibble[1]; ++ packet->deinterlace_oddness=deinterlace_oddness; + spudec_cut_image(this); + } + +@@ -505,6 +924,9 @@ + void spudec_assemble(void *this, unsigned char *packet, unsigned int len, int pts100) + { + spudec_handle_t *spu = (spudec_handle_t*)this; ++ ++ if(spu->dvdnav_menu) ++ pts100=0; + // spudec_heartbeat(this, pts100); + if (len < 2) { + mp_msg(MSGT_SPUDEC,MSGL_WARN,"SPUasm: packet too short\n"); +@@ -601,9 +1023,15 @@ + packet_t *packet = spudec_dequeue_packet(spu); + spu->start_pts = packet->start_pts; + spu->end_pts = packet->end_pts; +- if (spu->auto_palette) ++ if (spu->auto_palette && spu->colorspu==COLORSPU_Y) + compute_palette(spu, packet); + spudec_process_data(spu, packet); ++ if (spu->dvdnav_menu) { ++ if(spu->last_packet) { ++ spudec_free_packet(spu->last_packet); ++ } ++ spu->last_packet=packet; ++ } else + spudec_free_packet(packet); + spu->spu_changed = 1; + } +@@ -611,7 +1039,12 @@ + + int spudec_visible(void *this){ + spudec_handle_t *spu = (spudec_handle_t *)this; +- int ret=(spu->start_pts <= spu->now_pts && ++ int ret; ++ if (spu->dvdnav_menu && spu->height > 0) { ++ if(spu->height>0) spu->end_pts=UINT_MAX; ++ return 1; ++ } ++ ret=(spu->start_pts <= spu->now_pts && + spu->now_pts < spu->end_pts && + spu->height > 0); + // printf("spu visible: %d \n",ret); +@@ -626,13 +1059,106 @@ + } + } + +-void spudec_draw(void *this, void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) ++// ++// Convert Yuv image to YuY image ++// ++void spudec_create_yuy(void *this, int spu_scaled) ++{ ++ spudec_handle_t *spu = this; ++ unsigned char *dptr; ++ unsigned char *daptr; ++ unsigned char *sptry; ++ unsigned char *sptru; ++ unsigned char *sptrv; ++ unsigned char *saptr; ++ unsigned char *saptruv; ++ int y,x; ++ ++ if (spu_scaled) { ++ spu->strideyuy=spu->scaled_stride*2; ++ spu->imageyuy=malloc(spu->strideyuy*(spu->height+2)*2); ++ memset(spu->imageyuy,0,spu->strideyuy*(spu->height+2)*2); ++ spu->aimageyuy=spu->imageyuy+spu->strideyuy*spu->scaled_height; ++ for(y=0;yscaled_height;y++) { ++ dptr=spu->imageyuy+y*spu->strideyuy; ++ daptr=spu->aimageyuy+y*spu->strideyuy; ++ sptry=spu->scaled_image+y*spu->scaled_stride; ++ sptru=spu->scaled_imageu+y/2*spu->scaled_strideuv; ++ sptrv=spu->scaled_imagev+y/2*spu->scaled_strideuv; ++ saptr=spu->scaled_aimage+y*spu->scaled_stride; ++ saptruv=spu->scaled_aimageuv+y/2*spu->scaled_strideuv; ++ for(x=0;xscaled_widthuv-1;x++) { ++ *dptr++=*sptry++; ++ *dptr++=*sptrv++; ++ *dptr++=*sptry++; ++ *dptr++=*sptru++; ++ *daptr++=*saptr++; ++ *daptr++=*saptruv; ++ *daptr++=*saptr++; ++ *daptr++=*saptruv++; ++ } ++ } ++ } else { ++ spu->strideyuy=spu->stride*2; ++ spu->imageyuy=malloc(spu->strideyuy*(spu->height+2)*2); ++ memset(spu->imageyuy,0,spu->strideyuy*(spu->height+2)*2); ++ spu->aimageyuy=spu->imageyuy+spu->strideyuy*spu->height; ++ for(y=0;yheight;y++) { ++ dptr=spu->imageyuy+y*spu->strideyuy; ++ daptr=spu->aimageyuy+y*spu->strideyuy; ++ sptry=spu->image+y*spu->stride; ++ sptru=spu->imageu+y/2*spu->strideuv; ++ sptrv=spu->imagev+y/2*spu->strideuv; ++ saptr=spu->aimage+y*spu->stride; ++ saptruv=spu->aimageuv+y/2*spu->strideuv; ++ for(x=0;xwidthuv-1;x++) { ++ *dptr++=*sptry++; ++ *dptr++=*sptrv++; ++ *dptr++=*sptry++; ++ *dptr++=*sptru++; ++ *daptr++=*saptr++; ++ *daptr++=*saptruv; ++ *daptr++=*saptr++; ++ *daptr++=*saptruv++; ++ } ++ } ++ } ++} ++ ++ ++void spudec_draw(void *this, void (*draw_alpha)(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride)) + { + spudec_handle_t *spu = (spudec_handle_t *)this; + if (spu->start_pts <= spu->now_pts && spu->now_pts < spu->end_pts && spu->image) + { ++ switch(spu->colorspu) { ++ case COLORSPU_YUY: ++ if (!spu->imageyuy) spudec_create_yuy(spu,0); ++ if (spu->imageyuy) ++ draw_alpha(spu->start_col, spu->start_row, spu->width*2, spu->height/2, ++ DEST_PLANES_YUYV, spu->imageyuy, spu->aimageyuy, spu->strideyuy); ++ break; ++ case COLORSPU_YUV: ++ draw_alpha(spu->start_col, spu->start_row, spu->width, spu->height, ++ DEST_PLANES_Y, spu->image, spu->aimage, spu->stride); ++ draw_alpha(spu->start_coluv, spu->start_rowuv, spu->widthuv, spu->heightuv, ++ DEST_PLANES_U, spu->imageu, spu->aimageuv, spu->strideuv); ++ draw_alpha(spu->start_coluv, spu->start_rowuv, spu->widthuv, spu->heightuv, ++ DEST_PLANES_V, spu->imagev, spu->aimageuv, spu->strideuv); ++ break; ++ case COLORSPU_RGB: ++ case COLORSPU_BGR: ++ draw_alpha(spu->start_col, spu->start_row, spu->width, spu->height, ++ DEST_PLANES_BR, spu->imagev, spu->aimage, spu->stride); ++ draw_alpha(spu->start_col, spu->start_row, spu->width, spu->height, ++ DEST_PLANES_G, spu->imageu, spu->aimage, spu->stride); ++ draw_alpha(spu->start_col, spu->start_row, spu->width, spu->height, ++ DEST_PLANES_RB, spu->image, spu->aimage, spu->stride); ++ break; ++ default: + draw_alpha(spu->start_col, spu->start_row, spu->width, spu->height, +- spu->image, spu->aimage, spu->stride); ++ DEST_PLANES_Y, spu->image, spu->aimage, spu->stride); ++ } + spu->spu_changed = 0; + } + } +@@ -744,8 +1270,8 @@ + } + } + +-void sws_spu_image(unsigned char *d1, unsigned char *d2, int dw, int dh, int ds, +- unsigned char *s1, unsigned char *s2, int sw, int sh, int ss) ++void sws_spu_image(unsigned char *d1, unsigned char *d2, unsigned char *d3, unsigned char *d4, int dw, int dh, int ds, ++ unsigned char *s1, unsigned char *s2, unsigned char *s3, unsigned char *s4, int sw, int sh, int ss) + { + struct SwsContext *ctx; + static SwsFilter filter; +@@ -766,135 +1292,114 @@ + sws_scale(ctx,&s1,&ss,0,sh,&d1,&ds); + for (i=ss*sh-1; i>=0; i--) if (!s2[i]) s2[i] = 255; //else s2[i] = 1; + sws_scale(ctx,&s2,&ss,0,sh,&d2,&ds); ++ if(s3) ++ sws_scale(ctx,&s3,&ss,0,sh,&d3,&ds); ++ if(s4) ++ sws_scale(ctx,&s4,&ss,0,sh,&d4,&ds); + for (i=ds*dh-1; i>=0; i--) if (d2[i]==0) d2[i] = 1; else if (d2[i]==255) d2[i] = 0; + sws_freeContext(ctx); + } + +-void spudec_draw_scaled(void *me, unsigned int dxs, unsigned int dys, void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) +-{ +- spudec_handle_t *spu = (spudec_handle_t *)me; +- scale_pixel *table_x; +- scale_pixel *table_y; +- +- if (spu->start_pts <= spu->now_pts && spu->now_pts < spu->end_pts) { +- +- // check if only forced subtitles are requested +- if( (spu->forced_subs_only) && !(spu->is_forced_sub) ){ +- return; +- } +- +- if (!(spu_aamode&16) && (spu->orig_frame_width == 0 || spu->orig_frame_height == 0 +- || (spu->orig_frame_width == dxs && spu->orig_frame_height == dys))) { +- if (spu->image) +- { +- draw_alpha(spu->start_col, spu->start_row, spu->width, spu->height, +- spu->image, spu->aimage, spu->stride); +- spu->spu_changed = 0; ++void spu_scaled_none(unsigned int dxs, unsigned int dys, ++ int src_stride, ++ int dst_width, int dst_height, int dst_stride, ++ unsigned int scalex, unsigned int scaley, ++ unsigned char *src_y, unsigned char *src_a, ++ unsigned char *src_u, unsigned char *src_v, ++ unsigned char *dst_y, unsigned char *dst_a, ++ unsigned char *dst_u, unsigned char *dst_v) ++{ ++ unsigned int x, y; ++ ++ /* no antialiasing */ ++ for (y = 0; y < dst_height; ++y) { ++ int unscaled_y = y * 0x100 / scaley; ++ int strides = src_stride * unscaled_y; ++ int scaled_strides = dst_stride * y; ++ for (x = 0; x < dst_width; ++x) { ++ int unscaled_x = x * 0x100 / scalex; ++ dst_y[scaled_strides + x] = src_y[strides + unscaled_x]; ++ dst_a[scaled_strides + x] = src_a[strides + unscaled_x]; ++ if(src_u) ++ dst_u[scaled_strides + x] = src_u[strides + unscaled_x]; ++ if(src_v) ++ dst_v[scaled_strides + x] = src_v[strides + unscaled_x]; ++ } ++ } ++} ++ ++void spu_scaled_approx(int width, int height, unsigned int dxs, unsigned int dys, ++ int src_width, int src_height, int src_stride, ++ int dst_width, int dst_height, int dst_stride, ++ unsigned int scalex, unsigned int scaley, ++ unsigned char *src_y, unsigned char *src_a, ++ unsigned char *src_u, unsigned char *src_v, ++ unsigned char *dst_y, unsigned char *dst_a, ++ unsigned char *dst_u, unsigned char *dst_v) ++{ ++ unsigned int x, y; ++ ++ /* Intermediate antialiasing. */ ++ for (y = 0; y < dst_height; ++y) { ++ const unsigned int unscaled_top = y * src_height / dys; ++ unsigned int unscaled_bottom = (y + 1) * src_height / dys; ++ if (unscaled_bottom >= height) ++ unscaled_bottom = height - 1; ++ for (x = 0; x < dst_width; ++x) { ++ const unsigned int unscaled_left = x * src_width / dxs; ++ unsigned int unscaled_right = (x + 1) * src_width / dxs; ++ unsigned int color = 0; ++ unsigned int coloru = 0; ++ unsigned int colorv = 0; ++ unsigned int alpha = 0; ++ unsigned int walkx, walky; ++ unsigned int base, tmp; ++ if (unscaled_right >= width) ++ unscaled_right = width - 1; ++ for (walky = unscaled_top; walky <= unscaled_bottom; ++walky) ++ for (walkx = unscaled_left; walkx <= unscaled_right; ++walkx) { ++ base = walky * src_stride + walkx; ++ tmp = canon_alpha(src_a[base]); ++ alpha += tmp; ++ color += tmp * src_y[base]; ++ if(src_u) ++ coloru += tmp * src_u[base]; ++ if(src_v) ++ colorv += tmp * src_v[base]; ++ } ++ base = y * dst_stride + x; ++ dst_y[base] = alpha ? color / alpha : 0; ++ if(src_u) ++ dst_u[base] = alpha ? coloru / alpha : 0; ++ if(src_v) ++ dst_v[base] = alpha ? colorv / alpha : 0; ++ dst_a[base] = ++ alpha * (1 + unscaled_bottom - unscaled_top) * (1 + unscaled_right - unscaled_left); ++ /* spu->scaled_aimage[base] = ++ alpha * dxs * dys / spu->orig_frame_width / spu->orig_frame_height; */ ++ if (dst_a[base]) { ++ dst_a[base] = 256 - dst_a[base]; ++ if (dst_a[base] + dst_y[base] > 255) ++ dst_y[base] = 256 - dst_a[base]; ++ if (src_u && dst_a[base] + dst_u[base] > 255) ++ dst_u[base] = 256 - dst_a[base]; ++ if (src_v && dst_a[base] + dst_v[base] > 255) ++ dst_v[base] = 256 - dst_a[base]; + } + } +- else { +- if (spu->scaled_frame_width != dxs || spu->scaled_frame_height != dys) { /* Resizing is needed */ +- /* scaled_x = scalex * x / 0x100 +- scaled_y = scaley * y / 0x100 +- order of operations is important because of rounding. */ +- unsigned int scalex = 0x100 * dxs / spu->orig_frame_width; +- unsigned int scaley = 0x100 * dys / spu->orig_frame_height; +- spu->scaled_start_col = spu->start_col * scalex / 0x100; +- spu->scaled_start_row = spu->start_row * scaley / 0x100; +- spu->scaled_width = spu->width * scalex / 0x100; +- spu->scaled_height = spu->height * scaley / 0x100; +- /* Kludge: draw_alpha needs width multiple of 8 */ +- spu->scaled_stride = (spu->scaled_width + 7) & ~7; +- if (spu->scaled_image_size < spu->scaled_stride * spu->scaled_height) { +- if (spu->scaled_image) { +- free(spu->scaled_image); +- spu->scaled_image_size = 0; +- } +- spu->scaled_image = malloc(2 * spu->scaled_stride * spu->scaled_height); +- if (spu->scaled_image) { +- spu->scaled_image_size = spu->scaled_stride * spu->scaled_height; +- spu->scaled_aimage = spu->scaled_image + spu->scaled_image_size; +- } +- } +- if (spu->scaled_image) { +- unsigned int x, y; +- if (spu->scaled_width <= 1 || spu->scaled_height <= 1) { +- goto nothing_to_do; +- } +- switch(spu_aamode&15) { +- case 4: +- sws_spu_image(spu->scaled_image, spu->scaled_aimage, +- spu->scaled_width, spu->scaled_height, spu->scaled_stride, +- spu->image, spu->aimage, spu->width, spu->height, spu->stride); +- break; +- case 3: +- table_x = calloc(spu->scaled_width, sizeof(scale_pixel)); +- table_y = calloc(spu->scaled_height, sizeof(scale_pixel)); +- if (!table_x || !table_y) { +- mp_msg(MSGT_SPUDEC, MSGL_FATAL, "Fatal: spudec_draw_scaled: calloc failed\n"); +- } +- scale_table(0, 0, spu->width - 1, spu->scaled_width - 1, table_x); +- scale_table(0, 0, spu->height - 1, spu->scaled_height - 1, table_y); +- for (y = 0; y < spu->scaled_height; y++) +- for (x = 0; x < spu->scaled_width; x++) +- scale_image(x, y, table_x, table_y, spu); +- free(table_x); +- free(table_y); +- break; +- case 0: +- /* no antialiasing */ +- for (y = 0; y < spu->scaled_height; ++y) { +- int unscaled_y = y * 0x100 / scaley; +- int strides = spu->stride * unscaled_y; +- int scaled_strides = spu->scaled_stride * y; +- for (x = 0; x < spu->scaled_width; ++x) { +- int unscaled_x = x * 0x100 / scalex; +- spu->scaled_image[scaled_strides + x] = spu->image[strides + unscaled_x]; +- spu->scaled_aimage[scaled_strides + x] = spu->aimage[strides + unscaled_x]; +- } +- } +- break; +- case 1: +- { +- /* Intermediate antialiasing. */ +- for (y = 0; y < spu->scaled_height; ++y) { +- const unsigned int unscaled_top = y * spu->orig_frame_height / dys; +- unsigned int unscaled_bottom = (y + 1) * spu->orig_frame_height / dys; +- if (unscaled_bottom >= spu->height) +- unscaled_bottom = spu->height - 1; +- for (x = 0; x < spu->scaled_width; ++x) { +- const unsigned int unscaled_left = x * spu->orig_frame_width / dxs; +- unsigned int unscaled_right = (x + 1) * spu->orig_frame_width / dxs; +- unsigned int color = 0; +- unsigned int alpha = 0; +- unsigned int walkx, walky; +- unsigned int base, tmp; +- if (unscaled_right >= spu->width) +- unscaled_right = spu->width - 1; +- for (walky = unscaled_top; walky <= unscaled_bottom; ++walky) +- for (walkx = unscaled_left; walkx <= unscaled_right; ++walkx) { +- base = walky * spu->stride + walkx; +- tmp = canon_alpha(spu->aimage[base]); +- alpha += tmp; +- color += tmp * spu->image[base]; +- } +- base = y * spu->scaled_stride + x; +- spu->scaled_image[base] = alpha ? color / alpha : 0; +- spu->scaled_aimage[base] = +- alpha * (1 + unscaled_bottom - unscaled_top) * (1 + unscaled_right - unscaled_left); +- /* spu->scaled_aimage[base] = +- alpha * dxs * dys / spu->orig_frame_width / spu->orig_frame_height; */ +- if (spu->scaled_aimage[base]) { +- spu->scaled_aimage[base] = 256 - spu->scaled_aimage[base]; +- if (spu->scaled_aimage[base] + spu->scaled_image[base] > 255) +- spu->scaled_image[base] = 256 - spu->scaled_aimage[base]; +- } +- } +- } +- } +- break; +- case 2: +- { ++ } ++} ++ ++void spu_scaled_full(int src_stride, ++ int dst_width, int dst_height, int dst_stride, ++ unsigned int scalex, unsigned int scaley, ++ unsigned char *src_y, unsigned char *src_a, ++ unsigned char *src_u, unsigned char *src_v, ++ unsigned char *dst_y, unsigned char *dst_a, ++ unsigned char *dst_u, unsigned char *dst_v) ++{ ++ unsigned int x, y; ++ + /* Best antialiasing. Very slow. */ + /* Any pixel (x, y) represents pixels from the original + rectangular region comprised between the columns +@@ -936,7 +1441,7 @@ + unscaled_x_right. */ + const double inv_scalex = (double) 0x100 / scalex; + const double inv_scaley = (double) 0x100 / scaley; +- for (y = 0; y < spu->scaled_height; ++y) { ++ for (y = 0; y < dst_height; ++y) { + const double unscaled_y = y * inv_scaley; + const double unscaled_y_bottom = unscaled_y + inv_scaley; + const unsigned int top_low_row = FFMIN(unscaled_y_bottom, unscaled_y + 1.0); +@@ -947,7 +1452,7 @@ + const double bottom = unscaled_y_bottom > top_low_row + ? unscaled_y_bottom - floor(unscaled_y_bottom) + : 0.0; +- for (x = 0; x < spu->scaled_width; ++x) { ++ for (x = 0; x < dst_width; ++x) { + const double unscaled_x = x * inv_scalex; + const double unscaled_x_right = unscaled_x + inv_scalex; + const unsigned int left_right_column = FFMIN(unscaled_x_right, unscaled_x + 1.0); +@@ -959,6 +1464,8 @@ + ? unscaled_x_right - floor(unscaled_x_right) + : 0.0; + double color = 0.0; ++ double coloru = 0.0; ++ double colorv = 0.0; + double alpha = 0.0; + double tmp; + unsigned int base; +@@ -970,35 +1477,51 @@ + transformed color = sum(surface * alpha * color) / sum(surface * alpha) + */ + /* 1: top left part */ +- base = spu->stride * (unsigned int) unscaled_y; +- tmp = left * top * canon_alpha(spu->aimage[base + (unsigned int) unscaled_x]); ++ base = src_stride * (unsigned int) unscaled_y; ++ tmp = left * top * canon_alpha(src_a[base + (unsigned int) unscaled_x]); + alpha += tmp; +- color += tmp * spu->image[base + (unsigned int) unscaled_x]; ++ color += tmp * src_y[base + (unsigned int) unscaled_x]; ++ if(src_u) ++ coloru += tmp * src_u[base + (unsigned int) unscaled_x]; ++ if(src_v) ++ colorv += tmp * src_v[base + (unsigned int) unscaled_x]; + /* 2: top center part */ + if (width > 0) { + unsigned int walkx; + for (walkx = left_right_column; walkx < (unsigned int) unscaled_x_right; ++walkx) { +- base = spu->stride * (unsigned int) unscaled_y + walkx; +- tmp = /* 1.0 * */ top * canon_alpha(spu->aimage[base]); ++ base = src_stride * (unsigned int) unscaled_y + walkx; ++ tmp = /* 1.0 * */ top * canon_alpha(src_a[base]); + alpha += tmp; +- color += tmp * spu->image[base]; ++ color += tmp * src_y[base]; ++ if(src_u) ++ coloru += tmp * src_u[base]; ++ if(src_v) ++ colorv += tmp * src_v[base]; + } + } + /* 3: top right part */ + if (right > 0.0) { +- base = spu->stride * (unsigned int) unscaled_y + (unsigned int) unscaled_x_right; +- tmp = right * top * canon_alpha(spu->aimage[base]); ++ base = src_stride * (unsigned int) unscaled_y + (unsigned int) unscaled_x_right; ++ tmp = right * top * canon_alpha(src_a[base]); + alpha += tmp; +- color += tmp * spu->image[base]; ++ color += tmp * src_y[base]; ++ if(src_u) ++ coloru += tmp * src_u[base]; ++ if(src_u) ++ colorv += tmp * src_v[base]; + } + /* 4: center left part */ + if (height > 0) { + unsigned int walky; + for (walky = top_low_row; walky < (unsigned int) unscaled_y_bottom; ++walky) { +- base = spu->stride * walky + (unsigned int) unscaled_x; +- tmp = left /* * 1.0 */ * canon_alpha(spu->aimage[base]); ++ base = src_stride * walky + (unsigned int) unscaled_x; ++ tmp = left /* * 1.0 */ * canon_alpha(src_a[base]); + alpha += tmp; +- color += tmp * spu->image[base]; ++ color += tmp * src_y[base]; ++ if(src_u) ++ coloru += tmp * src_u[base]; ++ if(src_u) ++ colorv += tmp * src_v[base]; + } + } + /* 5: center part */ +@@ -1006,11 +1529,15 @@ + unsigned int walky; + for (walky = top_low_row; walky < (unsigned int) unscaled_y_bottom; ++walky) { + unsigned int walkx; +- base = spu->stride * walky; ++ base = src_stride * walky; + for (walkx = left_right_column; walkx < (unsigned int) unscaled_x_right; ++walkx) { +- tmp = /* 1.0 * 1.0 * */ canon_alpha(spu->aimage[base + walkx]); ++ tmp = /* 1.0 * 1.0 * */ canon_alpha(src_a[base + walkx]); + alpha += tmp; +- color += tmp * spu->image[base + walkx]; ++ color += tmp * src_y[base + walkx]; ++ if(src_u) ++ coloru += tmp * src_u[base]; ++ if(src_u) ++ colorv += tmp * src_v[base]; + } + } + } +@@ -1018,50 +1545,300 @@ + if (right > 0.0 && height > 0) { + unsigned int walky; + for (walky = top_low_row; walky < (unsigned int) unscaled_y_bottom; ++walky) { +- base = spu->stride * walky + (unsigned int) unscaled_x_right; +- tmp = right /* * 1.0 */ * canon_alpha(spu->aimage[base]); ++ base = src_stride * walky + (unsigned int) unscaled_x_right; ++ tmp = right /* * 1.0 */ * canon_alpha(src_a[base]); + alpha += tmp; +- color += tmp * spu->image[base]; ++ color += tmp * src_y[base]; ++ if(src_u) ++ coloru += tmp * src_u[base]; ++ if(src_u) ++ colorv += tmp * src_v[base]; + } + } + /* 7: bottom left part */ + if (bottom > 0.0) { +- base = spu->stride * (unsigned int) unscaled_y_bottom + (unsigned int) unscaled_x; +- tmp = left * bottom * canon_alpha(spu->aimage[base]); ++ base = src_stride * (unsigned int) unscaled_y_bottom + (unsigned int) unscaled_x; ++ tmp = left * bottom * canon_alpha(src_a[base]); + alpha += tmp; +- color += tmp * spu->image[base]; ++ color += tmp * src_y[base]; ++ if(src_u) ++ coloru += tmp * src_u[base]; ++ if(src_u) ++ colorv += tmp * src_v[base]; + } + /* 8: bottom center part */ + if (width > 0 && bottom > 0.0) { + unsigned int walkx; +- base = spu->stride * (unsigned int) unscaled_y_bottom; ++ base = src_stride * (unsigned int) unscaled_y_bottom; + for (walkx = left_right_column; walkx < (unsigned int) unscaled_x_right; ++walkx) { +- tmp = /* 1.0 * */ bottom * canon_alpha(spu->aimage[base + walkx]); ++ tmp = /* 1.0 * */ bottom * canon_alpha(src_a[base + walkx]); + alpha += tmp; +- color += tmp * spu->image[base + walkx]; ++ color += tmp * src_y[base + walkx]; ++ if(src_u) ++ coloru += tmp * src_u[base]; ++ if(src_u) ++ colorv += tmp * src_v[base]; + } + } + /* 9: bottom right part */ + if (right > 0.0 && bottom > 0.0) { +- base = spu->stride * (unsigned int) unscaled_y_bottom + (unsigned int) unscaled_x_right; +- tmp = right * bottom * canon_alpha(spu->aimage[base]); ++ base = src_stride * (unsigned int) unscaled_y_bottom + (unsigned int) unscaled_x_right; ++ tmp = right * bottom * canon_alpha(src_a[base]); + alpha += tmp; +- color += tmp * spu->image[base]; ++ color += tmp * src_y[base]; ++ if(src_u) ++ coloru += tmp * src_u[base]; ++ if(src_u) ++ colorv += tmp * src_v[base]; + } + /* Finally mix these transparency and brightness information suitably */ +- base = spu->scaled_stride * y + x; +- spu->scaled_image[base] = alpha > 0 ? color / alpha : 0; +- spu->scaled_aimage[base] = alpha * scalex * scaley / 0x10000; +- if (spu->scaled_aimage[base]) { +- spu->scaled_aimage[base] = 256 - spu->scaled_aimage[base]; +- if (spu->scaled_aimage[base] + spu->scaled_image[base] > 255) +- spu->scaled_image[base] = 256 - spu->scaled_aimage[base]; ++ base = dst_stride * y + x; ++ dst_y[base] = alpha > 0 ? color / alpha : 0; ++ if(src_u) ++ dst_u[base] = alpha > 0 ? coloru / alpha : 0; ++ if(src_v) ++ dst_v[base] = alpha > 0 ? colorv / alpha : 0; ++ dst_a[base] = alpha * scalex * scaley / 0x10000; ++ if (dst_a[base]) { ++ dst_a[base] = 256 - dst_a[base]; ++ if (dst_a[base] + dst_y[base] > 255) ++ dst_y[base] = 256 - dst_a[base]; ++ if (src_u && dst_a[base] + dst_u[base] > 255) ++ dst_u[base] = 256 - dst_a[base]; ++ if (src_v && dst_a[base] + dst_v[base] > 255) ++ dst_v[base] = 256 - dst_a[base]; + } + } + } + } ++ ++static void spu_scaled_bilinear(spudec_handle_t *spu) ++{ ++ unsigned int x, y; ++ scale_pixel *table_x; ++ scale_pixel *table_y; ++ ++ table_x = calloc(spu->scaled_width, sizeof(scale_pixel)); ++ table_y = calloc(spu->scaled_height, sizeof(scale_pixel)); ++ if (!table_x || !table_y) { ++ mp_msg(MSGT_SPUDEC, MSGL_FATAL, ++ "Fatal: spu_scaled_bilinear: calloc failed\n"); ++ } ++ scale_table(0, 0, spu->width - 1, spu->scaled_width - 1, table_x); ++ scale_table(0, 0, spu->height - 1, spu->scaled_height - 1, table_y); ++ for (y = 0; y < spu->scaled_height; y++) ++ for (x = 0; x < spu->scaled_width; x++) ++ scale_image(x, y, table_x, table_y, spu); ++ free(table_x); ++ free(table_y); ++} ++ ++ ++void spu_scaled_sws(int width, int height, unsigned int dxs, unsigned int dys, ++ int src_width, int src_height, int src_stride, ++ int dst_width, int dst_height, int dst_stride, ++ unsigned int scalex, unsigned int scaley, ++ unsigned char *src_y, unsigned char *src_a, ++ unsigned char *src_u, unsigned char *src_v, ++ unsigned char *dst_y, unsigned char *dst_a, ++ unsigned char *dst_u, unsigned char *dst_v) ++{ ++ sws_spu_image(dst_y, dst_a, dst_u, dst_y, ++ dst_width, dst_height, dst_stride, ++ src_y, src_a, src_u, src_y, width, height, src_stride); ++} ++ ++void aa_scaler(spudec_handle_t *spu, ++ int aamode, int width, int height, int dxs, int dys, ++ int src_width, int src_height, int src_stride, ++ int dst_width, int dst_height, int dst_stride, ++ unsigned int scalex, unsigned int scaley, ++ unsigned char *src_y, unsigned char *src_a, ++ unsigned char *src_u, unsigned char *src_v, ++ unsigned char *dst_y, unsigned char *dst_a, ++ unsigned char *dst_u, unsigned char *dst_v) ++{ ++switch(aamode&15) { ++ case 4: ++ spu_scaled_sws(width, height, dxs, dys, ++ src_width, src_height, src_stride, ++ dst_width, dst_height, dst_stride, ++ scalex,scaley, ++ src_y, src_a, src_u, src_v, ++ dst_y, dst_a, dst_u, dst_v); ++ break; ++ case 3: ++ spu_scaled_bilinear(spu); ++ break; ++ case 0: ++ spu_scaled_none(dxs, dys, ++ src_stride, ++ dst_width, dst_height, dst_stride, ++ scalex,scaley, ++ src_y, src_a, src_u, src_v, ++ dst_y, dst_a, dst_u, dst_v); ++ break; ++ case 1: ++ spu_scaled_approx(width, height, dxs, dys, ++ src_width, src_height, src_stride, ++ dst_width, dst_height, dst_stride, ++ scalex,scaley, ++ src_y, src_a, src_u, src_v, ++ dst_y, dst_a, dst_u, dst_v); ++ break; ++ case 2: ++ spu_scaled_full(src_stride, ++ dst_width, dst_height, dst_stride, ++ scalex,scaley, ++ src_y, src_a, src_u, src_v, ++ dst_y, dst_a, dst_u, dst_v); ++ break; ++ } ++} ++ ++void spudec_draw_scaled(void *me, unsigned int dxs, unsigned int dys, void (*draw_alpha)(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride)) ++{ ++ spudec_handle_t *spu = (spudec_handle_t *)me; ++ ++ if (spu->start_pts <= spu->now_pts && spu->now_pts < spu->end_pts) { ++ ++ // check if only forced subtitles are requested ++ if( (spu->forced_subs_only) && !(spu->is_forced_sub) ){ ++ return; ++ } ++ ++ if (!(spu_aamode&16) && (spu->orig_frame_width == 0 || spu->orig_frame_height == 0 ++ || (spu->orig_frame_width == dxs && spu->orig_frame_height == dys))) { ++ if (spu->image) ++ { ++ switch(spu->colorspu) { ++ case COLORSPU_YUY: ++ if (!spu->imageyuy) spudec_create_yuy(spu,0); ++ if (spu->imageyuy) ++ draw_alpha(spu->start_col, spu->start_row, spu->width*2, spu->height/2, ++ DEST_PLANES_YUYV, spu->imageyuy, spu->aimageyuy, spu->strideyuy); ++ break; ++ case COLORSPU_YUV: ++ draw_alpha(spu->start_col, spu->start_row, spu->width, spu->height, ++ DEST_PLANES_Y, spu->image, spu->aimage, spu->stride); ++ draw_alpha(spu->start_coluv, spu->start_rowuv, spu->widthuv, spu->heightuv, ++ DEST_PLANES_U, spu->imageu, spu->aimageuv, spu->strideuv); ++ draw_alpha(spu->start_coluv, spu->start_rowuv, spu->widthuv, spu->heightuv, ++ DEST_PLANES_V, spu->imagev, spu->aimageuv, spu->strideuv); ++ break; ++ case COLORSPU_RGB: ++ case COLORSPU_BGR: ++ draw_alpha(spu->start_col, spu->start_row, spu->width, spu->height, ++ DEST_PLANES_BR, spu->imagev, spu->aimage, spu->stride); ++ draw_alpha(spu->start_col, spu->start_row, spu->width, spu->height, ++ DEST_PLANES_G, spu->imageu, spu->aimage, spu->stride); ++ draw_alpha(spu->start_col, spu->start_row, spu->width, spu->height, ++ DEST_PLANES_RB, spu->image, spu->aimage, spu->stride); ++ break; ++ default: ++ draw_alpha(spu->start_col, spu->start_row, spu->width, spu->height, ++ DEST_PLANES_Y, spu->image, spu->aimage, spu->stride); ++ } ++ spu->spu_changed = 0; ++ } ++ } ++ else { ++ if (spu->scaled_frame_width != dxs || spu->scaled_frame_height != dys) { /* Resizing is needed */ ++ /* scaled_x = scalex * x / 0x100 ++ scaled_y = scaley * y / 0x100 ++ order of operations is important because of rounding. */ ++ unsigned int scalex = 0x100 * dxs / spu->orig_frame_width; ++ unsigned int scaley = 0x100 * dys / spu->orig_frame_height; ++ spu->scaled_start_col = spu->start_col * scalex / 0x100; ++ spu->scaled_start_row = spu->start_row * scaley / 0x100; ++ spu->scaled_width = spu->width * scalex / 0x100; ++ spu->scaled_height = spu->height * scaley / 0x100; ++ switch(spu->colorspu) { ++ case COLORSPU_YUV: ++ case COLORSPU_YUY: ++ spu->scaled_widthuv = spu->widthuv * scalex / 0x100; ++ spu->scaled_heightuv = spu->heightuv * scaley / 0x100; ++ spu->scaled_strideuv = (spu->scaled_widthuv + 7) & ~7; ++ spu->scaled_start_coluv = spu->start_coluv * scalex / 0x100; ++ spu->scaled_start_rowuv = spu->start_rowuv * scaley / 0x100; ++ break; ++ } ++ /* Kludge: draw_alpha needs width multiple of 8 */ ++ spu->scaled_stride = (spu->scaled_width + 7) & ~7; ++ if (spu->scaled_image_size < spu->scaled_stride * spu->scaled_height) { ++ if (spu->scaled_image) { ++ free(spu->scaled_image); ++ if (spu->scaled_imageu) ++ free(spu->scaled_imageu); ++ spu->scaled_image_size = 0; + } +-nothing_to_do: ++ spu->scaled_image = malloc(2 * spu->scaled_stride * spu->scaled_height); ++ if (spu->scaled_image) { ++ spu->scaled_image_size = spu->scaled_stride * spu->scaled_height; ++ spu->scaled_aimage = spu->scaled_image + spu->scaled_image_size; ++ } ++ } ++ switch(spu->colorspu) { ++ case COLORSPU_YUV: ++ case COLORSPU_YUY: ++ spu->scaled_imageu = malloc(3 * spu->scaled_strideuv * ++ (spu->scaled_height+2)); ++ if (spu->scaled_imageu) { ++ memset(spu->scaled_imageu,0,3 * spu->scaled_strideuv * ++ (spu->scaled_height+2)); ++ spu->scaled_image_sizeuv = spu->scaled_strideuv * ++ (spu->scaled_heightuv+2); ++ spu->scaled_imagev = spu->scaled_imageu + ++ spu->scaled_image_sizeuv; ++ spu->scaled_aimageuv = spu->scaled_imagev + ++ spu->scaled_image_sizeuv; ++ } ++ break; ++ case COLORSPU_RGB: ++ case COLORSPU_BGR: ++ spu->scaled_imageu = malloc(3 * spu->scaled_stride * spu->scaled_height); ++ if (spu->scaled_imageu) ++ spu->scaled_imagev = spu->scaled_imageu + spu->scaled_image_size; ++ break; ++ } ++ if (spu->scaled_image) { ++ unsigned int y; ++ if (spu->scaled_width > 1 && spu->scaled_height > 1) ++ switch(spu->colorspu) { ++ case COLORSPU_YUV: ++ case COLORSPU_YUY: ++ if (spu->scaled_widthuv <= 1 || spu->scaled_heightuv <= 1) { ++ aa_scaler(spu, spu_aamode&15, spu->width, spu->height, dxs, dys, ++ spu->orig_frame_width, spu->orig_frame_height,spu->stride, ++ spu->scaled_width, spu->scaled_height, spu->scaled_stride, ++ scalex, scaley, ++ spu->image, spu->aimage, NULL, NULL, ++ spu->scaled_image, spu->scaled_aimage, NULL, NULL); ++ aa_scaler(spu, spu_aamode&15, spu->widthuv, spu->heightuv, dxs/2, dys/2, ++ spu->orig_frame_width/2, spu->orig_frame_height/2, spu->strideuv, ++ spu->scaled_widthuv, spu->scaled_heightuv, spu->scaled_strideuv, ++ scalex, scaley, ++ spu->imageu, spu->aimage, spu->imagev, NULL, ++ spu->scaled_imageu, spu->scaled_aimage, spu->scaled_imagev, NULL); ++ } ++ break; ++ case COLORSPU_RGB: ++ case COLORSPU_BGR: ++ aa_scaler(spu, spu_aamode&15, spu->width, spu->height, dxs, dys, ++ spu->orig_frame_width, spu->orig_frame_height, spu->stride, ++ spu->scaled_width, spu->scaled_height, spu->scaled_stride, ++ scalex, scaley, ++ spu->image, spu->aimage, spu->imageu, spu->imagev, ++ spu->scaled_image, spu->scaled_aimage, spu->scaled_imageu, spu->scaled_imagev); ++ break; ++ default: ++ aa_scaler(spu, spu_aamode&15, spu->width, spu->height, dxs, dys, ++ spu->orig_frame_width, spu->orig_frame_height, spu->stride, ++ spu->scaled_width, spu->scaled_height, spu->scaled_stride, ++ scalex, scaley, ++ spu->image, spu->aimage, NULL, NULL, ++ spu->scaled_image, spu->scaled_aimage, NULL, NULL); ++ } + /* Kludge: draw_alpha needs width multiple of 8. */ + if (spu->scaled_width < spu->scaled_stride) + for (y = 0; y < spu->scaled_height; ++y) { +@@ -1070,6 +1847,16 @@ + } + spu->scaled_frame_width = dxs; + spu->scaled_frame_height = dys; ++ if (spu->colorspu==COLORSPU_YUY || spu->colorspu==COLORSPU_YUV) { ++ if (spu->scaled_widthuv < spu->scaled_strideuv) ++ for (y = 0; y < spu->scaled_heightuv; ++y) { ++ memset(spu->scaled_aimageuv + y * spu->scaled_stride + ++ spu->scaled_widthuv, 0, ++ spu->scaled_strideuv - spu->scaled_widthuv); ++ } ++ spu->scaled_frame_widthuv = dxs/2; ++ spu->scaled_frame_heightuv = dys/2; ++ } + } + } + if (spu->scaled_image){ +@@ -1078,18 +1865,60 @@ + spu->scaled_start_row = dys*sub_pos/100; + if (spu->scaled_start_row + spu->scaled_height > dys) + spu->scaled_start_row = dys - spu->scaled_height; ++ if (spu->colorspu==COLORSPU_YUY || spu->colorspu==COLORSPU_YUV) { ++ spu->scaled_start_rowuv = (dys/2)*sub_pos/100; ++ if (spu->scaled_start_rowuv + spu->scaled_heightuv > (dys/2)) ++ spu->scaled_start_rowuv = (dys/2) - spu->scaled_heightuv; ++ } + break; + case 1: + spu->scaled_start_row = dys*sub_pos/100 - spu->scaled_height/2; + if (sub_pos >= 50 && spu->scaled_start_row + spu->scaled_height > dys) + spu->scaled_start_row = dys - spu->scaled_height; ++ if (spu->colorspu==COLORSPU_YUY || spu->colorspu==COLORSPU_YUV) { ++ spu->scaled_start_rowuv = (dys/2)*sub_pos/100 - spu->scaled_heightuv/2; ++ if (sub_pos < 50) { ++ if (spu->scaled_start_rowuv < 0) spu->scaled_start_rowuv = 0; ++ } else { ++ if (spu->scaled_start_rowuv + spu->scaled_heightuv > (dys/2)) ++ spu->scaled_start_rowuv = (dys/2) - spu->scaled_heightuv; ++ } ++ } + break; + case 2: + spu->scaled_start_row = dys*sub_pos/100 - spu->scaled_height; ++ if (spu->colorspu==COLORSPU_YUY || spu->colorspu==COLORSPU_YUV) ++ spu->scaled_start_rowuv = (dys/2)*sub_pos/100 - spu->scaled_heightuv; + break; + } ++ switch(spu->colorspu) { ++ case COLORSPU_YUY: ++ if (!spu->imageyuy) spudec_create_yuy(spu,1); ++ if (spu->imageyuy) ++ draw_alpha(spu->start_col, spu->start_row, spu->width*2, spu->height/2, ++ DEST_PLANES_YUYV, spu->imageyuy, spu->aimageyuy, spu->strideyuy); ++ break; ++ case COLORSPU_YUV: + draw_alpha(spu->scaled_start_col, spu->scaled_start_row, spu->scaled_width, spu->scaled_height, +- spu->scaled_image, spu->scaled_aimage, spu->scaled_stride); ++ DEST_PLANES_Y, spu->scaled_image, spu->scaled_aimage, spu->scaled_stride); ++ draw_alpha(spu->scaled_start_coluv, spu->scaled_start_rowuv, spu->scaled_widthuv, spu->scaled_heightuv, ++ DEST_PLANES_U, spu->scaled_imageu, spu->scaled_aimageuv, spu->scaled_strideuv); ++ draw_alpha(spu->scaled_start_coluv, spu->scaled_start_rowuv, spu->scaled_widthuv, spu->scaled_heightuv, ++ DEST_PLANES_V, spu->scaled_imagev, spu->scaled_aimageuv, spu->scaled_strideuv); ++ break; ++ case COLORSPU_RGB: ++ case COLORSPU_BGR: ++ draw_alpha(spu->scaled_start_col, spu->scaled_start_row, spu->scaled_width, spu->scaled_height, ++ DEST_PLANES_BR, spu->scaled_imagev, spu->scaled_aimage, spu->scaled_stride); ++ draw_alpha(spu->scaled_start_col, spu->scaled_start_row, spu->scaled_width, spu->scaled_height, ++ DEST_PLANES_G, spu->scaled_imageu, spu->scaled_aimage, spu->scaled_stride); ++ draw_alpha(spu->scaled_start_col, spu->scaled_start_row, spu->scaled_width, spu->scaled_height, ++ DEST_PLANES_RB, spu->scaled_image, spu->scaled_aimage, spu->scaled_stride); ++ break; ++ default: ++ draw_alpha(spu->scaled_start_col, spu->scaled_start_row, spu->scaled_width, spu->scaled_height, ++ DEST_PLANES_Y, spu->scaled_image, spu->scaled_aimage, spu->scaled_stride); ++ } + spu->spu_changed = 0; + } + } +@@ -1207,6 +2036,17 @@ + free(spu->scaled_image); + if (spu->image) + free(spu->image); ++ if (spu->last_packet) { ++ spudec_free_packet(spu->last_packet); ++ spu->last_packet=NULL; ++ } ++ if (spu->imageu) // Free dvdnav SPU uv or GB image ++ free(spu->imageu); ++ if (spu->imageyuy) // Free dvdnav SPU YUY image ++ free(spu->imageyuy); ++ spu->imageyuy=NULL; ++ if (spu->scaled_imageu) // Free dvdnav SPU uv or GB alpha ++ free(spu->scaled_imageu); + free(spu); + } + } +@@ -1219,3 +2059,73 @@ + spu->hw_spu = hw_spu; + hw_spu->control(VOCTRL_SET_SPU_PALETTE,spu->global_palette); + } ++ ++void spudec_set_spu_format(void *this, uint32_t fmt) ++{ ++ spudec_handle_t *spu = (spudec_handle_t*)this; ++ if (!spu) ++ return; ++ switch(fmt) { ++ case IMGFMT_YV12: ++ case IMGFMT_I420: ++ case IMGFMT_IYUV: ++ case IMGFMT_YVU9: ++ case IMGFMT_IF09: ++ case IMGFMT_Y800: ++ case IMGFMT_Y8: ++ spu->colorspu=COLORSPU_YUV; ++ break; ++ case IMGFMT_YUY2: ++ spu->colorspu=COLORSPU_YUY; ++ break; ++ case IMGFMT_RGB15: ++ case IMGFMT_RGB16: ++ case IMGFMT_RGB24: ++ case IMGFMT_RGB32: ++ spu->colorspu=COLORSPU_RGB; ++ break; ++ case IMGFMT_BGR15: ++ case IMGFMT_BGR16: ++ case IMGFMT_BGR24: ++ case IMGFMT_BGR32: ++ spu->colorspu=COLORSPU_BGR; ++ break; ++ case 0: ++ default: ++ spu->colorspu=COLORSPU_Y; ++ } ++} ++ ++void spudec_dvdnav_mode(void *this, int mode) ++{ ++ spudec_handle_t *spu = (spudec_handle_t*)this; ++ if (!spu) ++ return; ++ spu->dvdnav_menu=mode; ++ if(!spu->dvdnav_menu) spu->spu_sx=spu->spu_ex=spu->spu_sy=spu->spu_ey=0; ++ if (!spu->dvdnav_menu && spu->last_packet) { ++ spudec_free_packet(spu->last_packet); ++ spu->last_packet=NULL; ++ } ++} ++ ++void spudec_dvdnav_area(void *this, int sx, int sy, int ex, int ey, uint32_t palette) ++{ ++ spudec_handle_t *spu = (spudec_handle_t*)this; ++ if (!spu) ++ return; ++ ++ if (spu->spu_sx==FFMIN(sx,ex) && ++ spu->spu_ex==FFMAX(sx,ex) && ++ spu->spu_sy==FFMIN(sy,ey) && ++ spu->spu_ey==FFMAX(sy,ey) && ++ spu->dvdnav_palette==palette) return; ++ spu->spu_sx=FFMIN(sx,ex); /* set spu button area, palette & on */ ++ spu->spu_ex=FFMAX(sx,ex); ++ spu->spu_sy=FFMIN(sy,ey); ++ spu->spu_ey=FFMAX(sy,ey); ++ spu->dvdnav_palette=palette; ++ if (spu->dvdnav_menu && spu->last_packet) ++ spudec_process_data(spu, spu->last_packet); ++} ++ +diff -Naur MPlayer-export-2009-06-13.orig/spudec.h MPlayer-export-2009-06-13/spudec.h +--- MPlayer-export-2009-06-13.orig/spudec.h 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/spudec.h 2009-06-14 00:11:07.000000000 +0200 +@@ -5,8 +5,8 @@ + + void spudec_heartbeat(void *this, unsigned int pts100); + void spudec_assemble(void *this, unsigned char *packet, unsigned int len, int pts100); +-void spudec_draw(void *this, void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); +-void spudec_draw_scaled(void *this, unsigned int dxs, unsigned int dys, void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)); ++void spudec_draw(void *this, void (*draw_alpha)(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride)); ++void spudec_draw_scaled(void *this, unsigned int dxs, unsigned int dys, void (*draw_alpha)(int x0,int y0, int w,int h, int dp, unsigned char* src, unsigned char *srca, int stride)); + void spudec_update_palette(void *this, unsigned int *palette); + void *spudec_new_scaled(unsigned int *palette, unsigned int frame_width, unsigned int frame_height, uint8_t *extradata, int extradata_len); + void *spudec_new(unsigned int *palette); +@@ -18,5 +18,8 @@ + int spudec_changed(void *this); + void spudec_calc_bbox(void *me, unsigned int dxs, unsigned int dys, unsigned int* bbox); + void spudec_set_forced_subs_only(void * const this, const unsigned int flag); ++void spudec_set_spu_format(void *this, uint32_t fmt); ++void spudec_dvdnav_mode(void *this, int mode); ++void spudec_dvdnav_area(void *this, int sx, int sy, int ex, int ey, uint32_t palette); + + #endif /* MPLAYER_SPUDEC_H */ +diff -Naur MPlayer-export-2009-06-13.orig/stream/stream_dvdnav.c MPlayer-export-2009-06-13/stream/stream_dvdnav.c +--- MPlayer-export-2009-06-13.orig/stream/stream_dvdnav.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/stream/stream_dvdnav.c 2009-06-14 00:11:07.000000000 +0200 +@@ -36,6 +36,14 @@ + } dvdnav_state_t; + + typedef struct { ++ int title; ++ int mp_aid; ++ int nav_aid; ++ int mp_sid; ++ int nav_sid; ++} title_lang_t; ++ ++typedef struct { + dvdnav_t * dvdnav; /* handle to libdvdnav stuff */ + char * filename; /* path */ + unsigned int duration; /* in milliseconds */ +@@ -45,6 +53,8 @@ + dvdnav_highlight_event_t hlev; + int still_length; /* still frame duration */ + unsigned int state; ++ int title_lang_num; ++ title_lang_t* title_lang; + } dvdnav_priv_t; + + extern char *dvd_device; +@@ -1006,6 +1016,130 @@ + return 1; + } + ++/** ++ * \brief seek_title_lang() seek title language info ++ * \param priv: - priv pointer ++ * \param title: - title number ++ * \return title_lang_t pointer if found ++ */ ++static title_lang_t* seek_title_lang(dvdnav_priv_t * priv, int title) { ++ int i; ++ ++ if (!priv->title_lang) ++ return NULL; ++ if (priv->state & NAV_FLAG_VTS_DOMAIN) ++ return NULL; ++ for(i=0;ititle_lang_num;i++) ++ if (priv->title_lang[i].title==title) ++ return &priv->title_lang[i]; ++ return NULL; ++} ++ ++/** ++ * \brief new_title_lang() new title to language info ++ * \param priv: - priv pointer ++ * \param title: - title number ++ * \return title_lang_t new pointer ++ */ ++static title_lang_t* new_title_lang(dvdnav_priv_t * priv, int title) { ++ title_lang_t* title_lang; ++ ++ priv->title_lang_num++; ++ if (priv->title_lang) ++ priv->title_lang=realloc(priv->title_lang, ++ priv->title_lang_num*sizeof(title_lang_t)); ++ else ++ priv->title_lang=malloc(priv->title_lang_num*sizeof(title_lang_t)); ++ title_lang=&priv->title_lang[priv->title_lang_num-1]; ++ title_lang->title=title; ++ title_lang->mp_aid=-1; ++ title_lang->nav_aid=-1; ++ title_lang->mp_sid=-1; ++ title_lang->nav_sid=-1; ++ return title_lang; ++} ++ ++/** ++ * \brief set "mplayer" audio to title lang ++ * \param stream: - stream pointer ++ * \param audio_id: - audio number ++ */ ++void mp_dvdnav_set_aid(stream_t *stream, int audio_id) { ++ dvdnav_priv_t* priv=(dvdnav_priv_t*)stream->priv; ++ ++ title_lang_t* title_lang = seek_title_lang(priv,priv->title); ++ if (priv->state & NAV_FLAG_VTS_DOMAIN) ++ return; ++ if (!title_lang) ++ title_lang=new_title_lang(priv,priv->title); ++ title_lang->mp_aid=audio_id; ++} ++ ++/** ++ * \brief get current audio stream id ++ * \param stream: - stream pointer ++ * \return audio number ++ */ ++int mp_dvdnav_get_current_audio(stream_t *stream) { ++ dvdnav_priv_t* priv=(dvdnav_priv_t*)stream->priv; ++ int audio_id; ++ title_lang_t* title_lang = seek_title_lang(priv,priv->title); ++ ++ audio_id = dvdnav_get_active_audio_stream(priv->dvdnav); ++ audio_id = mp_dvdnav_aid_from_audio_num(stream, audio_id); ++ if (priv->state & NAV_FLAG_VTS_DOMAIN) ++ return audio_id; ++ if (!title_lang) ++ title_lang=new_title_lang(priv,priv->title); ++ if (title_lang->nav_aid==audio_id && title_lang->mp_aid!=-1) { ++ title_lang->nav_aid=audio_id; ++ return title_lang->mp_aid; ++ } ++ title_lang->nav_aid=audio_id; ++ title_lang->mp_aid=-1; ++ return audio_id; ++} ++ ++/** ++ * \brief set "mplayer" spu to title lang ++ * \param stream: - stream pointer ++ * \param spu_id: - spu number ++ */ ++void mp_dvdnav_set_sid(stream_t *stream, int spu_id) { ++ dvdnav_priv_t* priv=(dvdnav_priv_t*)stream->priv; ++ ++ title_lang_t* title_lang = seek_title_lang(priv,priv->title); ++ if (priv->state & NAV_FLAG_VTS_DOMAIN) ++ return; ++ if (!title_lang) ++ title_lang=new_title_lang(priv,priv->title); ++ title_lang->mp_sid=spu_id; ++} ++ ++/** ++ * \brief get current spu stream id ++ * \param stream: - stream pointer ++ * \return spu number ++ */ ++int mp_dvdnav_get_current_spu(stream_t *stream) { ++ dvdnav_priv_t* priv=(dvdnav_priv_t*)stream->priv; ++ int sub_id; ++ title_lang_t* title_lang = seek_title_lang(priv,priv->title); ++ ++ sub_id = dvdnav_get_active_spu_stream(priv->dvdnav); ++ if (priv->state & NAV_FLAG_VTS_DOMAIN) ++ return sub_id; ++ if (!title_lang) ++ title_lang=new_title_lang(priv,priv->title); ++ if (title_lang->nav_sid==sub_id && title_lang->mp_sid!=-1) { ++ title_lang->nav_sid=sub_id; ++ return title_lang->mp_sid; ++ } ++ title_lang->nav_sid=sub_id; ++ title_lang->mp_sid=-1; ++ return sub_id; ++} ++ + const stream_info_t stream_info_dvdnav = { + "DVDNAV stream", + "null", +diff -Naur MPlayer-export-2009-06-13.orig/stream/stream_dvdnav.h MPlayer-export-2009-06-13/stream/stream_dvdnav.h +--- MPlayer-export-2009-06-13.orig/stream/stream_dvdnav.h 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/stream/stream_dvdnav.h 2009-06-14 00:11:07.000000000 +0200 +@@ -29,5 +29,7 @@ + int mp_dvdnav_audio_has_changed (stream_t *stream, int clear); + int mp_dvdnav_spu_has_changed (stream_t *stream, int clear); + int mp_dvdnav_stream_has_changed (stream_t *stream); ++int mp_dvdnav_get_current_spu(stream_t *stream); ++int mp_dvdnav_get_current_audio(stream_t *stream); + + #endif /* MPLAYER_STREAM_DVDNAV_H */ diff --git a/packages/multimedia/mplayer/build b/packages/multimedia/mplayer/build new file mode 100644 index 0000000000..c06874f6b1 --- /dev/null +++ b/packages/multimedia/mplayer/build @@ -0,0 +1,289 @@ +#!/bin/sh + +. config/options + +$SCRIPTS/build toolchain +$SCRIPTS/build zlib +$SCRIPTS/build alsa-lib +$SCRIPTS/build freetype +$SCRIPTS/build fribidi +$SCRIPTS/build libiconv +$SCRIPTS/build libcdio +$SCRIPTS/build lame +$SCRIPTS/build ffmpeg-mt +$SCRIPTS/build libdvdread +$SCRIPTS/build libdvdcss +$SCRIPTS/build libdvdnav + +if [ "$DISPLAYSERVER" = xorg-server ]; then + $SCRIPTS/build libX11 + $SCRIPTS/build libXv + $SCRIPTS/build libXvMC + $SCRIPTS/build $MESA + $SCRIPTS/build xorg-server + $SCRIPTS/build xf86-video-intel + + MPLAYER_CONFIGOPTS="--enable-xv \ + --enable-xvmc \ + --disable-vdpau \ + --disable-vm \ + --disable-xinerama \ + --enable-x11 \ + --enable-xf86keysym" +else + MPLAYER_CONFIGOPTS="--disable-xv \ + --disable-xvmc \ + --disable-vdpau \ + --disable-vm \ + --disable-xinerama \ + --disable-x11 \ + --disable-xf86keysym" +fi + +#$SCRIPTS/build vesautils + +# setup_toolchain --optimize target + +EXTRA_LIBDIR="-L$SYSROOT_PREFIX/usr/lib" +EXTRA_INCDIR="-I$SYSROOT_PREFIX/usr/include" +EXTRA_LIBS="-liconv" +EXTRA_LIBS="$EXTRA_LIBS -lavcodec -lavformat -lavutil -lpostproc -lswscale" +CFLAGS="$CFLAGS -ffast-math -DFIXED_POINT" + +VIDIX_DRV="cyberblade,ivtv,mach64,mga,mga_crtc2,nvidia,pm2,pm3,radeon,rage128,s3,sis,unichrome" +CODECS_DIR="/storage/.codecs" + +if [ "$DEBUG" = yes ]; then + DEBUG_CONFIG="--enable-debug=3 \ + --enable-sighandler \ + --enable-crash-debug" +else + DEBUG_CONFIG="--disable-debug \ + --disable-sighandler \ + --disable-crash-debug" +fi + +# --nm=$NM \ +# --ar=$AR \ +# --ranlib=$RANLIB \ +#\ + +cd $PKG_BUILD +./configure --prefix=/usr \ + --confdir=/usr/etc/mplayer \ + --libdir=/usr/lib \ + --codecsdir=$CODECS_DIR \ + --win32codecsdir=$CODECS_DIR \ + --xanimcodecsdir=$CODECS_DIR \ + --realcodecsdir=$CODECS_DIR \ +\ + --enable-runtime-cpudetection \ + --enable-cross-compile \ + --cc=$TARGET_CC \ + --host-cc=$HOST_CC \ + --as=$TARGET_AS \ + --target="$TARGET_ARCH-linux" \ + --disable-static \ + --disable-dynamic-plugins \ + --disable-profile \ + --extra-ldflags="$EXTRA_LIBDIR" \ + --extra-cflags="$EXTRA_INCDIR" \ + --extra-libs="$EXTRA_LIBS" \ +\ + $DEBUG_CONFIG \ + $MPLAYER_CONFIG \ +\ + --disable-dynamic-plugins \ + --disable-shm \ +\ + --charset=utf8 \ + --language-msg=en \ + --language=all \ +\ + --disable-mencoder \ + --enable-mplayer \ + --disable-gui \ + --disable-gtk1 \ + --enable-largefiles \ + --disable-linux-devfs \ + --disable-termcap \ + --disable-termios \ + --enable-iconv \ + --disable-langinfo \ +\ + --disable-lirc \ + --disable-lircc \ + --disable-joystick \ + --disable-apple-remote \ + --disable-apple-ir \ +\ + --disable-radio \ + --disable-radio-capture \ + --disable-radio-v4l2 \ + --disable-radio-bsdbt848 \ + --enable-tv \ + --disable-tv-v4l1 \ + --enable-tv-v4l2 \ + --disable-tv-bsdbt848 \ + --enable-tv-teletext \ + --disable-pvr \ + --enable-rtc \ + --enable-network \ + --disable-winsock2_h \ + --disable-smb \ + --disable-live \ + --disable-nemesi \ + --enable-vcd \ + --enable-dvdnav \ + --with-dvdnav-config="$ROOT/$TOOLCHAIN/bin/dvdnav-config" \ + --enable-dvdread \ + --with-dvdread-config="$ROOT/$TOOLCHAIN/bin/dvdread-config" \ + --disable-dvdread-internal \ + --disable-libdvdcss-internal \ + --disable-cdparanoia \ + --disable-cddb \ + --enable-bitmap-font \ + --enable-freetype \ + --with-freetype-config="$ROOT/$TOOLCHAIN/bin/freetype-config" \ + --disable-fontconfig \ + --disable-unrarexec \ + --enable-menu \ + --disable-sortsub \ + --enable-fribidi \ + --with-fribidi-config="$ROOT/$TOOLCHAIN/bin/fribidi-config" \ + --disable-enca \ + --disable-maemo \ + --disable-macosx-finder \ + --disable-macosx-bundle \ + --enable-inet6 \ + --enable-gethostbyname2 \ + --enable-ftp \ + --disable-vstream \ + --enable-pthreads \ + --disable-w32threads \ + --enable-ass \ + --disable-rpath \ +\ + --disable-libnut \ + --disable-libavutil_a \ + --disable-libavcodec_a \ + --disable-libavformat_a \ + --disable-libpostproc_a \ + --disable-libswscale_a \ + --enable-libavutil_so \ + --enable-libavcodec_so \ + --enable-libavformat_so \ + --enable-libpostproc_so \ + --enable-libswscale_so \ + --enable-libavcodec_mpegaudio_hp \ +\ + --disable-gif \ + --enable-png \ + --disable-mng \ + --disable-jpeg \ + --disable-libcdio \ + --disable-liblzo \ + --enable-win32dll \ + --enable-qtx \ + --enable-xanim \ + --enable-real \ + --disable-xvid \ + --enable-xvid-lavc \ + --disable-x264 \ + --enable-x264-lavc \ + --disable-libdirac-lavc \ + --disable-libschroedinger-lavc \ +\ + --disable-tremor-internal \ + --disable-tremor-low \ + --disable-tremor \ + --disable-libvorbis \ + --disable-speex \ + --disable-theora \ + --disable-faad \ + --enable-faad-internal \ + --disable-faad-fixed \ + --disable-faac \ + --enable-faac-lavc \ + --disable-ladspa \ + --disable-libbs2b \ + --disable-libdv \ + --disable-mad \ + --disable-mp3lame \ + --enable-mp3lame-lavc \ + --disable-toolame \ + --disable-twolame \ + --disable-xmms \ + --disable-libdca \ + --enable-mp3lib \ + --disable-liba52 \ + --enable-liba52-internal \ + --enable-libmpeg2 \ + --disable-musepack \ + --disable-libopencore_amrnb \ + --disable-libopencore_amrwb \ +\ + --disable-vidix \ + --with-vidix-drivers="$VIDIX_DRV" \ + --disable-vidix-pcidb \ + --disable-dhahelper \ + --disable-svgalib_helper \ + --enable-gl \ + --disable-dga2 \ + --disable-dga1 \ + --disable-vesa \ + --disable-svga \ + --disable-sdl \ + --disable-kva \ + --disable-aa \ + --disable-caca \ + --disable-ggi \ + --disable-ggiwmh \ + --disable-direct3d \ + --disable-directx \ + --disable-dxr2 \ + --disable-dxr3 \ + --disable-ivtv \ + --disable-v4l2 \ + --disable-dvb \ + --disable-dvbhead \ + --disable-mga \ + --disable-xmga \ + --disable-xshape \ + --disable-xss \ + --disable-fbdev \ + --disable-mlib \ + --disable-3dfx \ + --disable-tdfxfb \ + --disable-s3fb \ + --disable-wii \ + --disable-directfb \ + --disable-zr \ + --disable-bl \ + --disable-tdfxvid \ + --disable-xvr100 \ + --disable-tga \ + --disable-pnm \ + --disable-md5sum \ + --disable-yuv4mpeg \ + --disable-corevideo \ + --disable-quartz \ +\ + --enable-alsa \ + --disable-ossaudio \ + --disable-arts \ + --disable-esd \ + --disable-pulse \ + --disable-jack \ + --disable-openal \ + --disable-nas \ + --disable-sgiaudio \ + --disable-sunaudio \ + --disable-dart \ + --disable-win32waveout \ + --disable-coreaudio \ + --disable-select \ +\ + --disable-demuxer=matroska \ + +make diff --git a/packages/multimedia/mplayer/config/input.conf b/packages/multimedia/mplayer/config/input.conf new file mode 100644 index 0000000000..cc4068fb56 --- /dev/null +++ b/packages/multimedia/mplayer/config/input.conf @@ -0,0 +1,129 @@ +## +## GeeXboX MPlayer input control file +## + +## Playback +p pause +SPACE pause +f pt_step -1 +g pt_step 1 +h tv_step_channel 1 +l tv_step_channel -1 +n tv_step_norm +b tv_step_chanlist + +## Seeking +RIGHT seek +10 +LEFT seek -10 +DOWN seek -60 +UP seek +60 +PGUP seek 600 +PGDWN seek -600 + +## Audio properties +- audio_delay 0.100 ++ audio_delay -0.100 +/ volume -1 +* volume 1 +c mute +e switch_audio + +## Subtitle properties +z sub_delay -0.1 +x sub_delay +0.1 +r sub_pos -1 +t sub_pos +1 +w sub_select + +## DVD Menu Navigation +UP {dvdnav} dvdnav 1 # DVDNav UP +DOWN {dvdnav} dvdnav 2 # DVDNav DOWN +LEFT {dvdnav} dvdnav 3 # DVDNav LEFT +RIGHT {dvdnav} dvdnav 4 # DVDNav RIGHT +ESC {dvdnav} dvdnav 5 # DVDNav MENU +ENTER {dvdnav} dvdnav 6 # DVDNav SELECT (ok) +BS {dvdnav} dvdnav 7 # DVDNav PREVIOUS menu (in the order chapter->title->root) + +AR_VUP {dvdnav} dvdnav 1 # DVDNav UP +AR_VDOWN {dvdnav} dvdnav 2 # DVDNav DOWN +AR_PREV {dvdnav} dvdnav 3 # DVDNav LEFT +AR_NEXT {dvdnav} dvdnav 4 # DVDNav RIGHT +AR_MENU {dvdnav} dvdnav 5 # DVDNav MENU +AR_PLAY {dvdnav} dvdnav 6 # DVDNav SELECT (ok) + +## Miscelaneous +a quit +q quit +ESC quit +k halt +o osd +m menu toggle +; menu toggle +s run /usr/bin/tvswitch +y play_dvd +i set_menu info + +## Controls +1 contrast -1 +3 contrast 1 +7 brightness -1 +9 brightness 1 +INS hue -1 +DEL hue 1 +HOME saturation -1 +END saturation 1 + +## Joystick +JOY_RIGHT seek 10 +JOY_LEFT seek -10 +JOY_UP seek 60 +JOY_DOWN seek -60 +JOY_BTN1 menu hide +JOY_BTN2 pause +JOY_BTN3 osd +JOY_BTN4 mute +JOY_BTN5 volume -1 +JOY_BTN6 volume 1 + +## Apple Remote +AR_PLAY pause +AR_PLAY_HOLD quit +AR_NEXT seek 30 +AR_NEXT_HOLD seek 120 +AR_PREV seek -10 +AR_PREV_HOLD seek -120 +AR_MENU menu up +#AR_MENU menu cancel +AR_MENU_HOLD mute +AR_VUP volume 1 +AR_VDOWN volume -1 + +#Navigation between teletext pages +RIGHT {teletext} step_property teletext_page 1 +LEFT {teletext} step_property teletext_page -1 +UP {teletext} step_property teletext_page 100 +DOWN {teletext} step_property teletext_page -100 + +H step_property teletext_mode 1 +C step_property teletext_format 1 + +#Nagigation though teletext subpages +PGUP {teletext} step_property teletext_subpage -1 +PGDWN {teletext} step_property teletext_subpage 1 + +#Entering page number manually +1 {teletext} teletext_add_dec 1 +2 {teletext} teletext_add_dec 2 +3 {teletext} teletext_add_dec 3 +4 {teletext} teletext_add_dec 4 +5 {teletext} teletext_add_dec 5 +6 {teletext} teletext_add_dec 6 +7 {teletext} teletext_add_dec 7 +8 {teletext} teletext_add_dec 8 +9 {teletext} teletext_add_dec 9 +0 {teletext} teletext_add_dec 0 +- {teletext} teletext_add_dec - + +#Switch TV chanels by LEFT/RIGHT keys +LEFT {tv} tv_step_channel -1 +RIGHT {tv} tv_step_channel 1 diff --git a/packages/multimedia/mplayer/config/mplayer.enna b/packages/multimedia/mplayer/config/mplayer.enna new file mode 100644 index 0000000000..b258d7b68e --- /dev/null +++ b/packages/multimedia/mplayer/config/mplayer.enna @@ -0,0 +1,45 @@ +[deinterlace] +profile-desc="Profile for picture de-interlacing" +vf-add=pp=fd + +[lang] +profile-desc="Profile for language" +alang=en + +[protocol.cdda] +profile-desc="Profile for cdda:// streams" +cdda=speed=2 + +[extension.mkv] +profile-desc="Profile for Matroska files" +profile=lang + +[default] +vo=cvidix,vesa +mixer-channel=Master +framedrop=yes +vsync=yes +fs=yes +zoom=yes +double=yes +fixed-vo=yes +nocolorkey=yes +cache=4096 +cache-min=2 +idx=yes +sub-fuzziness=1 +spuaa=4 + +# Set Post Processing (h deblock, v deblock, dering, auto luminance) +# Consumes CPU power, disabled for low configs, uncomment to enable it. +#vf=pp=hb:a/vb:a/dr:a/al:a + +# Forces RTSP client's port (usefull for FreeboxTV users in router mode) +# Do _NOT_ uncomment the line without LIVE555 support +#rtsp-port = 31337 + +# Subtitles properties +ass=yes +embeddedfonts=yes +ass-use-margins=yes +ass-color=FFFFFF00 # plain white (no alpha) diff --git a/packages/multimedia/mplayer/install b/packages/multimedia/mplayer/install new file mode 100644 index 0000000000..7bbb5b31e7 --- /dev/null +++ b/packages/multimedia/mplayer/install @@ -0,0 +1,35 @@ +#!/bin/sh + +. config/options + +$SCRIPTS/install zlib +$SCRIPTS/install alsa +$SCRIPTS/install freetype +$SCRIPTS/install libiconv +$SCRIPTS/install libcdio +#$SCRIPTS/install faad2 +$SCRIPTS/install ffmpeg-mt +$SCRIPTS/install libdvdread +$SCRIPTS/install libdvdcss +$SCRIPTS/install libdvdnav + +if [ "$DISPLAYSERVER" = xorg-server ]; then + $SCRIPTS/install libX11 + $SCRIPTS/install libXv + $SCRIPTS/install libXvMC + $SCRIPTS/install $MESA + $SCRIPTS/install xorg-server + $SCRIPTS/install xf86-video-intel +fi + +PKG_DIR=`find $PACKAGES -type d -name $1` + +mkdir -p $INSTALL/etc/mplayer + cp $PKG_DIR/config/mplayer.enna $INSTALL/etc/mplayer/mplayer.conf + cp $PKG_DIR/config/input.conf $INSTALL/etc/mplayer + cp $PKG_BUILD/etc/codecs.conf $INSTALL/etc/mplayer + +mkdir -p $INSTALL/usr/bin + cp $PKG_BUILD/mplayer $INSTALL/usr/bin + +mkdir -p $INSTALL/codecs diff --git a/packages/multimedia/mplayer/patches/165_playtree-pop-only-if-pushed.diff b/packages/multimedia/mplayer/patches/165_playtree-pop-only-if-pushed.diff new file mode 100644 index 0000000000..918862821c --- /dev/null +++ b/packages/multimedia/mplayer/patches/165_playtree-pop-only-if-pushed.diff @@ -0,0 +1,18 @@ +* Only "pop" subtree params if they had previously been "pushed", and + afterwards reset the "pushed" value to 0 again. Similarly only set the + PLAY_TREE_RND_PLAYED flag if the entry had been pushed before. + OBSOLETE: remove this patch at next MPlayer upgrade. +diff -Naur MPlayer-export-2009-06-13.orig/playtree.c MPlayer-export-2009-06-13/playtree.c +--- MPlayer-export-2009-06-13.orig/playtree.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/playtree.c 2009-06-13 22:54:13.000000000 +0200 +@@ -712,8 +712,9 @@ + iter->tree = iter->tree->parent; + + // Pop subtree params +- if(iter->config) { ++ if(iter->config && iter->entry_pushed > 0) { + m_config_pop(iter->config); ++ iter->entry_pushed = 0; + if(iter->mode == PLAY_TREE_ITER_RND) + iter->tree->flags |= PLAY_TREE_RND_PLAYED; + } diff --git a/packages/multimedia/mplayer/patches/185_slave-set-option.diff b/packages/multimedia/mplayer/patches/185_slave-set-option.diff new file mode 100644 index 0000000000..1ebfba509b --- /dev/null +++ b/packages/multimedia/mplayer/patches/185_slave-set-option.diff @@ -0,0 +1,39 @@ +diff -Naur MPlayer-export-2009-06-13.orig/command.c MPlayer-export-2009-06-13/command.c +--- MPlayer-export-2009-06-13.orig/command.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/command.c 2009-06-13 22:55:21.000000000 +0200 +@@ -2510,7 +2510,12 @@ + exit_player_with_rc(EXIT_QUIT, + (cmd->nargs > 0) ? cmd->args[0].v.i : 0); + +- case MP_CMD_PLAY_TREE_STEP:{ ++ case MP_CMD_SET_OPTION: { ++ extern struct m_config* mconfig; ++ m_config_set_option(mconfig, cmd->args[0].v.s, cmd->args[1].v.s); ++ } break; ++ ++ case MP_CMD_PLAY_TREE_STEP:{ + int n = cmd->args[0].v.i == 0 ? 1 : cmd->args[0].v.i; + int force = cmd->args[1].v.i; + +diff -Naur MPlayer-export-2009-06-13.orig/input/input.c MPlayer-export-2009-06-13/input/input.c +--- MPlayer-export-2009-06-13.orig/input/input.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/input/input.c 2009-06-13 22:55:21.000000000 +0200 +@@ -140,6 +140,7 @@ + { MP_CMD_SWITCH_AUDIO, "switch_audio", 0, { { MP_CMD_ARG_INT,{-1} }, {-1,{0}} } }, + { MP_CMD_SWITCH_ANGLE, "switch_angle", 0, { { MP_CMD_ARG_INT,{-1} }, {-1,{0}} } }, + { MP_CMD_SWITCH_TITLE, "switch_title", 0, { { MP_CMD_ARG_INT,{-1} }, {-1,{0}} } }, ++ { MP_CMD_SET_OPTION, "set_option", 2, { { MP_CMD_ARG_STRING, {0}}, { MP_CMD_ARG_STRING, {0}}, {-1,{0}} } }, + #ifdef CONFIG_TV + { MP_CMD_TV_START_SCAN, "tv_start_scan", 0, { {-1,{0}} }}, + { MP_CMD_TV_STEP_CHANNEL, "tv_step_channel", 1, { { MP_CMD_ARG_INT ,{0}}, {-1,{0}} }}, +diff -Naur MPlayer-export-2009-06-13.orig/input/input.h MPlayer-export-2009-06-13/input/input.h +--- MPlayer-export-2009-06-13.orig/input/input.h 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/input/input.h 2009-06-13 22:55:21.000000000 +0200 +@@ -129,6 +129,7 @@ + MP_CMD_ASS_USE_MARGINS, + MP_CMD_SWITCH_TITLE, + MP_CMD_STOP, ++ MP_CMD_SET_OPTION, + + /// DVDNAV commands + MP_CMD_DVDNAV_UP = 1000, diff --git a/packages/multimedia/mplayer/patches/250_bgvideo.diff b/packages/multimedia/mplayer/patches/250_bgvideo.diff new file mode 100644 index 0000000000..73ee70261c --- /dev/null +++ b/packages/multimedia/mplayer/patches/250_bgvideo.diff @@ -0,0 +1,153 @@ +diff -Naur MPlayer-export-2009-06-13.orig/cfg-mplayer.h MPlayer-export-2009-06-13/cfg-mplayer.h +--- MPlayer-export-2009-06-13.orig/cfg-mplayer.h 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/cfg-mplayer.h 2009-06-13 22:56:04.000000000 +0200 +@@ -315,6 +315,8 @@ + {"guiwid", &guiWinID, CONF_TYPE_INT, 0, 0, 0, NULL}, + #endif + ++ {"bgvideo", &bg_video, CONF_TYPE_STRING, 0, 0, 0, NULL}, ++ + {"noloop", &mpctx_s.loop_times, CONF_TYPE_FLAG, 0, 0, -1, NULL}, + {"loop", &mpctx_s.loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000, NULL}, + {"playlist", NULL, CONF_TYPE_STRING, 0, 0, 0, NULL}, +diff -Naur MPlayer-export-2009-06-13.orig/mp_core.h MPlayer-export-2009-06-13/mp_core.h +--- MPlayer-export-2009-06-13.orig/mp_core.h 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/mp_core.h 2009-06-13 22:56:04.000000000 +0200 +@@ -60,6 +60,7 @@ + + stream_t *stream; + demuxer_t *demuxer; ++ demuxer_t *bg_demuxer; + sh_audio_t *sh_audio; + sh_video_t *sh_video; + demux_stream_t *d_audio; +diff -Naur MPlayer-export-2009-06-13.orig/mplayer.c MPlayer-export-2009-06-13/mplayer.c +--- MPlayer-export-2009-06-13.orig/mplayer.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/mplayer.c 2009-06-13 22:58:14.000000000 +0200 +@@ -271,6 +271,8 @@ + int forced_subs_only=0; + int file_filter=1; + ++static char* bg_video = NULL; ++ + // cache2: + int stream_cache_size=-1; + #ifdef CONFIG_STREAM_CACHE +@@ -608,6 +610,13 @@ + free_demuxer(mpctx->demuxer); + } + mpctx->demuxer=NULL; ++ current_module="free_bg_demuxer"; ++ if(mpctx->bg_demuxer) { ++ stream_t* bg_s = mpctx->bg_demuxer->stream; ++ free_demuxer(mpctx->bg_demuxer); ++ mpctx->bg_demuxer = NULL; ++ free_stream(bg_s); ++ } + } + + // kill the cache process: +@@ -1528,6 +1537,8 @@ + int percentage = -1; + char percentage_text[10]; + int pts = demuxer_get_current_time(mpctx->demuxer); ++ if (mpctx->bg_demuxer) ++ pts = playing_audio_pts(mpctx->sh_audio, mpctx->d_audio, mpctx->audio_out); + + if (mpctx->osd_show_percentage) + percentage = demuxer_get_percent_pos(mpctx->demuxer); +@@ -1743,10 +1754,17 @@ + current_module = "video_read_frame"; + in_size = ds_get_packet_pts(d_video, &start, &pts); + if (in_size < 0) { ++ if(mpctx->bg_demuxer) { ++ if(!demux_seek(mpctx->bg_demuxer,0,0,1)) ++ hit_eof = 1; ++ else ++ continue; ++ } else { + // try to extract last frames in case of decoder lag + in_size = 0; + pts = 1e300; + hit_eof = 1; ++ } + } + if (in_size > max_framesize) + max_framesize = in_size; +@@ -1939,6 +1957,13 @@ + current_module="av_sync"; + + if(mpctx->sh_audio){ ++ if(mpctx->bg_demuxer) { ++ if(!quiet) mp_msg(MSGT_AVSYNC,MSGL_STATUS,"A:%6.1f %4.1f%% %d%% \r" ++ ,mpctx->delay - mpctx->audio_out->get_delay() ++ ,(mpctx->delay>0.5)?100.0*audio_time_usage/(double)mpctx->delay:0 ++ ,cache_fill_status ++ ); ++ } else { + double a_pts, v_pts; + + if (autosync) +@@ -1989,6 +2014,7 @@ + if(!quiet) + print_status(a_pts - audio_delay, AV_delay, c_total); + } ++ } + + } else { + // No audio: +@@ -3348,6 +3374,34 @@ + mpctx->sh_audio=mpctx->d_audio->sh; + mpctx->sh_video=mpctx->d_video->sh; + ++while(mpctx->sh_audio && !mpctx->sh_video && bg_video) { ++ int bg_file_format = 0; ++ stream_t* bg_s; ++ mp_msg(MSGT_CPLAYER,MSGL_INFO, "Open bgvideo: %s\n",bg_video); ++ bg_s = open_stream(bg_video,NULL,&bg_file_format); ++ if(!bg_s) { ++ mp_msg(MSGT_CPLAYER,MSGL_ERR, "Couldn't open the stream for back ground video: %s\n",bg_video); ++ break; ++ } ++ mpctx->bg_demuxer = demux_open(bg_s,bg_file_format,-2,video_id,dvdsub_id,bg_video); ++ if(!mpctx->bg_demuxer) { ++ mp_msg(MSGT_DEMUXER,MSGL_ERR,"Failed to open background video\n"); ++ free_stream(bg_s); ++ break; ++ } ++ if(!mpctx->bg_demuxer->video && !mpctx->bg_demuxer->video->sh) { ++ mp_msg(MSGT_DEMUXER,MSGL_ERR,"The background video don't have a video stream\n"); ++ free_demuxer(mpctx->bg_demuxer); ++ mpctx->bg_demuxer = NULL; ++ free_stream(bg_s); ++ break; ++ } ++ mpctx->d_video = mpctx->bg_demuxer->video; ++ mpctx->sh_video = mpctx->d_video->sh; ++ mp_msg(MSGT_DEMUXER,MSGL_INFO,"Background video should work ;)\n"); ++ break; ++} ++ + if(mpctx->sh_video){ + + current_module="video_read_properties"; +@@ -3665,6 +3719,7 @@ + if (!mpctx->sh_video) + mpctx->eof = PT_NEXT_ENTRY; + ++if(mpctx->bg_demuxer && mpctx->d_audio->eof) mpctx->eof=1; + + if(!mpctx->sh_video) { + // handle audio-only case: +@@ -3696,6 +3751,11 @@ + mpctx->eof = 1; goto goto_next_file; + } + if (frame_time < 0) ++ if(mpctx->bg_demuxer) { ++ if(!demux_seek(mpctx->bg_demuxer,0,0,1)) ++ mpctx->eof = PT_NEXT_ENTRY; ++ } ++ else + mpctx->eof = 1; + else { + // might return with !eof && !blit_frame if !correct_pts diff --git a/packages/multimedia/mplayer/patches/575_streaminfo-dump.diff b/packages/multimedia/mplayer/patches/575_streaminfo-dump.diff new file mode 100644 index 0000000000..031d054f7d --- /dev/null +++ b/packages/multimedia/mplayer/patches/575_streaminfo-dump.diff @@ -0,0 +1,163 @@ +diff -Naur MPlayer-export-2009-06-13.orig/cfg-mplayer.h MPlayer-export-2009-06-13/cfg-mplayer.h +--- MPlayer-export-2009-06-13.orig/cfg-mplayer.h 2009-06-14 15:23:59.000000000 +0200 ++++ MPlayer-export-2009-06-13/cfg-mplayer.h 2009-06-14 19:43:05.000000000 +0200 +@@ -193,6 +193,8 @@ + {"novsync", &vo_vsync, CONF_TYPE_FLAG, 0, 1, 0, NULL}, + {"panscan", &vo_panscan, CONF_TYPE_FLOAT, CONF_RANGE, -1.0, 1.0, NULL}, + {"panscanrange", &vo_panscanrange, CONF_TYPE_FLOAT, CONF_RANGE, -19.0, 99.0, NULL}, ++ {"info-fifo", &info_fifo, CONF_TYPE_STRING, 0, 0, 0, NULL}, ++ {"bg-lcdbanner", &bg_lcdbanner, CONF_TYPE_STRING, 0, 0, 0, NULL}, + + {"grabpointer", &vo_grabpointer, CONF_TYPE_FLAG, 0, 0, 1, NULL}, + {"nograbpointer", &vo_grabpointer, CONF_TYPE_FLAG, 0, 1, 0, NULL}, +diff -Naur MPlayer-export-2009-06-13.orig/mplayer.c MPlayer-export-2009-06-13/mplayer.c +--- MPlayer-export-2009-06-13.orig/mplayer.c 2009-06-14 15:23:59.000000000 +0200 ++++ MPlayer-export-2009-06-13/mplayer.c 2009-06-14 19:46:38.000000000 +0200 +@@ -276,6 +276,9 @@ + #ifdef CONFIG_STREAM_CACHE + extern int cache_fill_status; + ++char* info_fifo=NULL; ++char* bg_lcdbanner=NULL; ++ + float stream_cache_min_percent=20.0; + float stream_cache_seek_min_percent=50.0; + #else +@@ -365,6 +368,128 @@ + + #define mp_basename2(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1)) + ++#define mp_basename(s) (strrchr(s,'\\')==NULL?(mp_basename2(s)):(strrchr(s,'\\')+1)) ++ ++static void dump_stream_info(void) ++{ ++ FILE *f; ++ int fd; ++ ++ if (!info_fifo) ++ return; ++ ++ mkfifo (info_fifo, 0644); ++ ++ fd = open(info_fifo, O_RDWR | O_NONBLOCK); ++ if (fd < 0) ++ return; ++ ++ f = fdopen (fd, "w"); ++ if (!f) ++ return; ++ ++ fprintf (f, "ID_FILENAME=%s\n", ++ (bg_video && strcmp (filename, bg_video)) ? ++ mp_basename (filename) : (bg_lcdbanner ? bg_lcdbanner : "")); ++ ++ if (!mpctx) ++ { ++ fflush (f); ++ fclose (f); ++ return; ++ } ++ ++ if (mpctx->demuxer) ++ { ++ int len, pts; ++ ++ if (mpctx->demuxer->desc && mpctx->demuxer->desc->name) ++ fprintf (f, "ID_DEMUXER=%s\n", mpctx->demuxer->desc->name); ++ ++ len = (int) demuxer_get_time_length (mpctx->demuxer); ++ fprintf (f, "ID_LENGTH=%02d:%02d:%02d\n", ++ (len / 3600), (len / 60) % 60, len % 60); ++ fprintf (f, "ID_VIDEO_PERCENT=%d\n", ++ demuxer_get_percent_pos (mpctx->demuxer)); ++ pts = demuxer_get_current_time (mpctx->demuxer); ++ ++ if (mpctx->bg_demuxer) ++ pts = playing_audio_pts (mpctx->sh_audio, ++ mpctx->d_audio, mpctx->audio_out); ++ fprintf (f, "ID_TIME_ELAPSED=%02d:%02d:%02d\n", ++ (pts / 3600), (pts / 60 ) % 60, pts % 60); ++ } ++ ++ if (mpctx->sh_video) ++ { ++ /* Assume FOURCC if all bytes >= 0x20 (' ') */ ++ if (mpctx->sh_video->format >= 0x20202020) ++ fprintf (f, "ID_VIDEO_FORMAT=%.4s\n", ++ (char *) &mpctx->sh_video->format); ++ else ++ fprintf (f, "ID_VIDEO_FORMAT=0x%08X\n", mpctx->sh_video->format); ++ ++ fprintf (f, "ID_VIDEO_BITRATE=%d\n", mpctx->sh_video->i_bps*8); ++ fprintf (f, "ID_VIDEO_WIDTH=%d\n", mpctx->sh_video->disp_w); ++ fprintf (f, "ID_VIDEO_HEIGHT=%d\n", mpctx->sh_video->disp_h); ++ fprintf (f, "ID_VIDEO_FPS=%5.3f\n", mpctx->sh_video->fps); ++ fprintf (f, "ID_VIDEO_ASPECT=%1.4f\n", mpctx->sh_video->aspect); ++ } ++ ++ if (mpctx->demuxer) ++ { ++ char *info; ++ ++ info = demux_info_get (mpctx->demuxer, "Title"); ++ if (info) ++ fprintf (f, "ID_AUDIO_TITLE=%s\n", info); ++ ++ info = demux_info_get (mpctx->demuxer, "Artist"); ++ if (info) ++ fprintf (f, "ID_AUDIO_ARTIST=%s\n", info); ++ ++ info = demux_info_get (mpctx->demuxer, "Album"); ++ if (info) ++ fprintf (f, "ID_AUDIO_ALBUM=%s\n", info); ++ ++ info = demux_info_get (mpctx->demuxer, "Year"); ++ if (info) ++ fprintf (f, "ID_AUDIO_YEAR=%s\n", info); ++ ++ info = demux_info_get (mpctx->demuxer, "Comment"); ++ if (info) ++ fprintf (f, "ID_AUDIO_COMMENT=%s\n", info); ++ ++ info = demux_info_get (mpctx->demuxer, "Track"); ++ if (info) ++ fprintf (f, "ID_AUDIO_TRACK=%s\n", info); ++ ++ info = demux_info_get (mpctx->demuxer, "Genre"); ++ if (info) ++ fprintf (f, "ID_AUDIO_GENRE=%s\n", info); ++ } ++ ++ if (mpctx->sh_audio) ++ { ++ if (mpctx->sh_audio->codec && mpctx->sh_audio->codec->name) ++ fprintf (f, "ID_AUDIO_CODEC=%s\n", mpctx->sh_audio->codec->name); ++ ++ /* Assume FOURCC if all bytes >= 0x20 (' ') */ ++ if (mpctx->sh_audio->format >= 0x20202020) ++ fprintf (f, "ID_AUDIO_FORMAT=%.4s\n", ++ (char *) &mpctx->sh_audio->format); ++ else ++ fprintf (f, "ID_AUDIO_FORMAT=%d\n", mpctx->sh_audio->format); ++ ++ fprintf (f, "ID_AUDIO_BITRATE=%d\n", mpctx->sh_audio->i_bps * 8); ++ fprintf (f, "ID_AUDIO_RATE=%d\n", mpctx->sh_audio->samplerate); ++ fprintf (f, "ID_AUDIO_NCH=%d\n", mpctx->sh_audio->channels); ++ } ++ ++ fflush (f); ++ fclose (f); ++} ++ + const void *mpctx_get_video_out(MPContext *mpctx) + { + return mpctx->video_out; +@@ -3843,6 +3968,8 @@ + loop_seek = 1; + } + ++ dump_stream_info(); ++ + if(rel_seek_secs || abs_seek_pos){ + if (seek(mpctx, rel_seek_secs, abs_seek_pos) >= 0) { + // Set OSD: diff --git a/packages/multimedia/mplayer/patches/600_dvb-includes.diff b/packages/multimedia/mplayer/patches/600_dvb-includes.diff new file mode 100644 index 0000000000..220eeaab89 --- /dev/null +++ b/packages/multimedia/mplayer/patches/600_dvb-includes.diff @@ -0,0 +1,22 @@ +diff -Naur MPlayer-r28852.orig/libao2/ao_mpegpes.c MPlayer-r28852/libao2/ao_mpegpes.c +--- MPlayer-r28852.orig/libao2/ao_mpegpes.c 2009-03-06 20:57:55.000000000 +0100 ++++ MPlayer-r28852/libao2/ao_mpegpes.c 2009-06-01 22:29:16.000000000 +0200 +@@ -50,6 +50,7 @@ + #include + audioMixer_t dvb_mixer={255,255}; + #else ++#include + #include + audio_mixer_t dvb_mixer={255,255}; + #endif +diff -Naur MPlayer-r28852.orig/libvo/vo_mpegpes.c MPlayer-r28852/libvo/vo_mpegpes.c +--- MPlayer-r28852.orig/libvo/vo_mpegpes.c 2009-03-06 20:57:55.000000000 +0100 ++++ MPlayer-r28852/libvo/vo_mpegpes.c 2009-06-01 22:29:26.000000000 +0200 +@@ -60,6 +60,7 @@ + #include + #include + ++#include + #include + #include + #include diff --git a/packages/multimedia/mplayer/patches/655_tvkeepon.diff b/packages/multimedia/mplayer/patches/655_tvkeepon.diff new file mode 100644 index 0000000000..234a40f5dc --- /dev/null +++ b/packages/multimedia/mplayer/patches/655_tvkeepon.diff @@ -0,0 +1,11 @@ +diff -r 5f88e25ccf52 mplayer.c +--- a/mplayer.c Sun Apr 30 16:54:44 2006 +0200 ++++ b/mplayer.c Sun Apr 30 16:54:44 2006 +0200 +@@ -2225,6 +2225,7 @@ + mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorInitializingVODevice); + goto err_out; + } ++ system("[ -x /usr/bin/tvkeepon ] && /usr/bin/tvkeepon"); + initialized_flags|=INITIALIZED_VO; + } + diff --git a/packages/multimedia/mplayer/patches/800_mt-vdec.diff b/packages/multimedia/mplayer/patches/800_mt-vdec.diff new file mode 100644 index 0000000000..db6fbacbbe --- /dev/null +++ b/packages/multimedia/mplayer/patches/800_mt-vdec.diff @@ -0,0 +1,21 @@ +diff -Naur MPlayer-export-2009-06-13.orig/libmpcodecs/vd_ffmpeg.c MPlayer-export-2009-06-13/libmpcodecs/vd_ffmpeg.c +--- MPlayer-export-2009-06-13.orig/libmpcodecs/vd_ffmpeg.c 2009-06-13 22:53:58.000000000 +0200 ++++ MPlayer-export-2009-06-13/libmpcodecs/vd_ffmpeg.c 2009-06-14 00:32:06.000000000 +0200 +@@ -145,7 +145,16 @@ + avcodec_flush_buffers(avctx); + return CONTROL_TRUE; + case VDCTRL_QUERY_UNSEEN_FRAMES: +- return avctx->has_b_frames + 10; ++#ifdef FF_THREAD_FRAME ++ { ++ int thread_delay = 0; ++ if (avctx->active_thread_type & FF_THREAD_FRAME) ++ thread_delay = avctx->thread_count - 1; ++ return avctx->has_b_frames + thread_delay + 10; ++ } ++#else ++ return avctx->has_b_frames + 10; ++#endif + } + return CONTROL_UNKNOWN; + } diff --git a/packages/multimedia/mplayer/patches/850_ps3_controller_hack.diff b/packages/multimedia/mplayer/patches/850_ps3_controller_hack.diff new file mode 100644 index 0000000000..7350709b0c --- /dev/null +++ b/packages/multimedia/mplayer/patches/850_ps3_controller_hack.diff @@ -0,0 +1,72 @@ +diff -Nurp a/input/input.c b/input/input.c +--- a/input/input.c 2009-05-28 22:11:18.000000000 +0800 ++++ b/input/input.c 2009-05-28 21:48:56.000000000 +0800 +@@ -317,6 +317,13 @@ static const mp_key_name_t key_names[] = + { JOY_BTN7, "JOY_BTN7" }, + { JOY_BTN8, "JOY_BTN8" }, + { JOY_BTN9, "JOY_BTN9" }, ++ { JOY_BTN10, "JOY_BTN10" }, ++ { JOY_BTN11, "JOY_BTN11" }, ++ { JOY_BTN12, "JOY_BTN12" }, ++ { JOY_BTN13, "JOY_BTN13" }, ++ { JOY_BTN14, "JOY_BTN14" }, ++ { JOY_BTN15, "JOY_BTN15" }, ++ { JOY_BTN16, "JOY_BTN16" }, + + { AR_PLAY, "AR_PLAY" }, + { AR_PLAY_HOLD, "AR_PLAY_HOLD" }, +diff -Nurp a/input/joystick.c b/input/joystick.c +--- a/input/joystick.c 2008-12-14 02:28:00.000000000 +0800 ++++ b/input/joystick.c 2009-05-28 22:09:07.000000000 +0800 +@@ -45,6 +45,7 @@ + + int axis[256]; + int btns = 0; ++char name[128]; + + int mp_input_joystick_init(char* dev) { + int fd,l=0; +@@ -68,6 +69,9 @@ int mp_input_joystick_init(char* dev) { + continue; + else if(errno == EAGAIN) { + initialized = 1; ++ if (ioctl(fd, JSIOCGNAME(sizeof(name)), name) < 0) ++ strncpy(name, "Unknown", sizeof(name)); ++ mp_msg(MSGT_INPUT,MSGL_INFO,"Using joystick: %s\n",name); + break; + } + mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_ErrReading,strerror(errno)); +@@ -76,6 +79,7 @@ int mp_input_joystick_init(char* dev) { + } + l += r; + } ++ + if((unsigned int)l < sizeof(struct js_event)) { + if(l > 0) + mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_INPUT_JOYSTICK_LoosingBytes,l); +@@ -141,6 +145,8 @@ int mp_input_joystick_read(int fd) { + else + return JOY_BTN0 + ev.number; + } else if(ev.type & JS_EVENT_AXIS) { ++ if (!strncmp(name, "Sony PLAYSTATION(R)3 Controller", 31)) ++ return MP_INPUT_NOTHING; // input doesn't handle axis events well, ignore them all + if(ev.value < -JOY_AXIS_DELTA && axis[ev.number] != -1) { + axis[ev.number] = -1; + return (JOY_AXIS0_MINUS+(2*ev.number)) | MP_KEY_DOWN; +diff -Nurp a/input/joystick.h b/input/joystick.h +--- a/input/joystick.h 2008-12-14 02:28:00.000000000 +0800 ++++ b/input/joystick.h 2009-05-28 21:47:52.000000000 +0800 +@@ -52,6 +52,13 @@ + #define JOY_BTN7 (JOY_BTN_BASE+7) + #define JOY_BTN8 (JOY_BTN_BASE+8) + #define JOY_BTN9 (JOY_BTN_BASE+9) ++#define JOY_BTN10 (JOY_BTN_BASE+10) ++#define JOY_BTN11 (JOY_BTN_BASE+11) ++#define JOY_BTN12 (JOY_BTN_BASE+12) ++#define JOY_BTN13 (JOY_BTN_BASE+13) ++#define JOY_BTN14 (JOY_BTN_BASE+14) ++#define JOY_BTN15 (JOY_BTN_BASE+15) ++#define JOY_BTN16 (JOY_BTN_BASE+16) + + int mp_input_joystick_init(char* dev); + diff --git a/packages/multimedia/mplayer/patches/900_vo_ps3.diff.ps3 b/packages/multimedia/mplayer/patches/900_vo_ps3.diff.ps3 new file mode 100644 index 0000000000..c6d55c5608 --- /dev/null +++ b/packages/multimedia/mplayer/patches/900_vo_ps3.diff.ps3 @@ -0,0 +1,855 @@ +Index: Makefile +=================================================================== +--- a/Makefile (revision 29136) ++++ b/Makefile (working copy) +@@ -618,6 +618,7 @@ + SRCS_MPLAYER-$(OSS) += libao2/ao_oss.c + SRCS_MPLAYER-$(PNG) += libvo/vo_png.c + SRCS_MPLAYER-$(PNM) += libvo/vo_pnm.c ++SRCS_MPLAYER-$(PS3) += libvo/vo_ps3.c + SRCS_MPLAYER-$(PULSE) += libao2/ao_pulse.c + SRCS_MPLAYER-$(QUARTZ) += libvo/vo_quartz.c + SRCS_MPLAYER-$(S3FB) += libvo/vo_s3fb.c +Index: libvo/video_out.c +=================================================================== +--- a/libvo/video_out.c (revision 29136) ++++ b/libvo/video_out.c (working copy) +@@ -114,6 +114,7 @@ + extern vo_functions_t video_out_directx; + extern vo_functions_t video_out_kva; + extern vo_functions_t video_out_dxr2; ++extern vo_functions_t video_out_ps3; + extern vo_functions_t video_out_dxr3; + extern vo_functions_t video_out_ivtv; + extern vo_functions_t video_out_v4l2; +@@ -201,6 +202,9 @@ + &video_out_fbdev, + &video_out_fbdev2, + #endif ++#ifdef CONFIG_PS3 ++ &video_out_ps3, ++#endif + #ifdef CONFIG_SVGALIB + &video_out_svga, + #endif +Index: libvo/vo_ps3.c +=================================================================== +--- a/libvo/vo_ps3.c (revision 0) ++++ b/libvo/vo_ps3.c (revision 0) +@@ -0,0 +1,744 @@ ++/* ++ * video driver for cell / BE Playstation3 framebuffer ++ * Copyright 2007 by Bill Garrett ++ * Copyright 2009 by Kristian Jerpetjøn ++ * ++ * This video out device uses the Cell Broadband Engine spes to accelerate ++ * scaling and colorspace conversion ++ * ++ * This vo depends on spu-medialib which is a BSDv2 library ++ * ++ * This file is part of MPlayer. ++ * ++ * MPlayer is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * MPlayer is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with MPlayer; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "config.h" ++#include "mplayer.h" ++#include "aspect.h" ++#include "mp_msg.h" ++#include "help_mp.h" ++#include "video_out.h" ++#include "video_out_internal.h" ++#include "subopt-helper.h" ++#include "fastmemcpy.h" ++#include "osd.h" ++#include "sub.h" ++ ++#if HAVE_MALLOC_H ++#include ++#endif ++ ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define NUM_BUFFERS 2 ++#define FB_DEV "/dev/fb0" ++#define CONSOLE "/dev/tty" ++#define FALLBACK "/dev/console" ++ ++static vo_info_t info = ++{ ++ "PS3 framebuffer w/ spe offload courtesy of spu_medialib (https://sourceforge.net/projects/spu-medialib)", ++ "ps3", ++ "Bill Garrett ", ++ "Kristian Jerpetjøn " ++}; ++ ++LIBVO_EXTERN(ps3) ++ ++static int maxW=1920, maxH=1200; ++ ++static int page, parking_lot_page, offset; ++ ++static uint8_t *inbuf_y[NUM_BUFFERS], *inbuf_u[NUM_BUFFERS], *inbuf_v[NUM_BUFFERS]; ++ ++static uint8_t *parking_lot_y[NUM_BUFFERS],*parking_lot_u[NUM_BUFFERS], *parking_lot_v[NUM_BUFFERS]; ++static uint32_t srcW, srcH, src_buf_siz, src_stride[3], src_p_siz[3], src_fmt, src_bpp; ++static uint32_t dstW, dstH; ++static uint32_t suggestedW, suggestedH; ++static uint8_t *buf_plane_ptr[3]; ++ ++static char *src_title; ++ ++static struct ps3fb_ioctl_res ps3_fb; ++static void *fb_buf0; ++static int fb, console, fb_length; ++ ++ ++static int debug, snap; ++ ++static yuvscaler2argb_t *yuvcsc; ++static unsigned int yuvcsc_msg; ++static int wait_yuvcsc, yuvcsc_not_ready; ++ ++static int draw_slice_count, draw_image_count, get_image_count , flip_count; ++ ++/** ++ * Makes a copy of inbufs to .yuv files in current directory ++ * ++ * handy for testing - try with single stepping! '.' ++ */ ++static void snapshot(void) ++{ ++ ++ int i; ++ FILE * snapshot; ++ char *inbuf_file[]={"inbuf0.yuv", "inbuf1.yuv"}; ++ ++ for (i = 0; i < 2; i++) { ++ ++ snapshot = fopen(inbuf_file[i], "wb"); ++ fwrite ( inbuf_y[i], 1, src_p_siz[0], snapshot ); ++ fwrite ( inbuf_u[i], 1, src_p_siz[1], snapshot ); ++ fwrite ( inbuf_v[i], 1, src_p_siz[2], snapshot ); ++ fclose ( snapshot ); ++ } ++ mp_msg(MSGT_VO, MSGL_INFO, ++ "[vo_ps3] snapshot: wrote current inbuf_*[]" ++ "to inbuf0.yuv & inbuf1.yuv\n"); ++} ++ ++/** ++ * yuvcsc_check - check spu_yuv2argb_scaler process ++ * make sure it's ready to run, and if not wait for it to finish ++ */ ++static void yuvcsc_check(void) ++{ ++ ++ if (!wait_yuvcsc) ++ return; ++ ++ yuvcsc_msg = yuvscsc_receive_message(yuvcsc); ++ ++ while (yuvcsc_msg != RDY) { ++ ++ yuvcsc_not_ready++; ++ mp_msg(MSGT_VO, MSGL_WARN, ++ "[vo_ps3] yuvcsc_check: ***yuvcsc not ready to run! :(\n" ); ++ ++ yuvcsc_msg = yuvscsc_receive_message(yuvcsc); ++ } ++ ++ wait_yuvcsc = 0; ++} ++ ++/** ++ * yuvcsc_run - put the image on the framebuffer ++ * ++ */ ++static void yuvcsc_run(void) ++{ ++ //confirm last run finished ++ yuvcsc_check(); ++ ++ wait_yuvcsc = 1; ++ ++ yuvscsc_send_message(yuvcsc, RUN); ++} ++ ++ ++static void draw_alpha(int x0, int y0, int w, int h, int dp, unsigned char* src, ++ unsigned char *srca, int stride) ++{ ++ switch(src_fmt) ++ { ++ case IMGFMT_I420: //Planar I420 0x30323449 ++ case IMGFMT_YV12: //Planar YV12 0x32315659 ++ case IMGFMT_IYUV: //Planar IYUV 0x56555949 ++ vo_draw_alpha_yv12(w, h, dp, src, srca, stride, ++ buf_plane_ptr[0] + ( y0 * src_stride[0] + x0 ), ++ src_stride[0] ); ++ } ++} ++ ++ ++ ++/** ++ * Initiates the spu medialib spe vo accellerator ++ * TODO change spu-medialib api to handle a struct ++ */ ++static void init_spu_medialib(void) ++{ ++ //init spu-medialib's scaler & colorspace converter on an spe ++ yuvcsc = yuvscsc_init_yuv2argb_scaler(srcW, srcH, dstW, dstH, offset, maxW, ++ ( ea_t * ) inbuf_y[0], ( ea_t * ) inbuf_y[1], ++ ( ea_t * ) inbuf_u[0], ( ea_t * ) inbuf_u[1], ++ ( ea_t * ) inbuf_v[0], ( ea_t * ) inbuf_v[1], ++ fb_buf0, fb_buf0 ); ++ ++ mp_msg(MSGT_VO, MSGL_INFO, ++ "[vo_ps3] init_spu_medialib:" ++ " Initialized spu-medialib's spu_yuv2argb_scaler with:\n" ++ " %ix%i=>%ix%i, offset:%i, maxW:%i\n", ++ srcW, srcH, dstW, dstH, offset, maxW); ++} ++ ++/** ++ * Updates the spu-medialib accellerator ++ * TODO change spu-medialib api to handle a struct ++ */ ++static void update_spu_medialib(void) ++{ ++ yuvscsc_set_srcW(yuvcsc, srcW); ++ yuvscsc_set_srcH(yuvcsc, srcH); ++ yuvscsc_set_dstW(yuvcsc, dstW); ++ yuvscsc_set_dstH(yuvcsc, dstH); ++ yuvscsc_set_offset(yuvcsc, offset); ++ yuvscsc_set_maxwidth(yuvcsc, maxW); ++ yuvscsc_send_message(yuvcsc, UPDATE); ++} ++ ++ ++/** ++ * Waits for any running spu-medialib operations and closes spu-medialib ++ */ ++static void cleanup_spu_medialib(void) ++{ ++ ++ yuvcsc_check(); ++ ++ yuvscsc_destroy(yuvcsc); ++ ++ mp_msg(MSGT_VO, MSGL_INFO, ++ "[vo_ps3] cleanup_spu_medialib:" ++ " Destroyed spu-medialib's scaler/converter\n" ); ++} ++ ++/** ++ * Clears the ps3 framebuffer ++ */ ++static void clear_framebuffer(void) ++{ ++ //make sure spu medialib is not currently drawing to the surface ++ yuvcsc_check(); ++ ++ mp_msg(MSGT_VO, MSGL_INFO, ++ "[vo_ps3] clear: Clearing buffers\n"); ++ ++ //clear target framebuffer ++ memset(fb_buf0, 0, fb_length); ++} ++ ++static void setup_screen(void) ++{ ++ ++ vo_dx = vo_dy = 0; ++ vo_screenwidth=ps3_fb.xres - (ps3_fb.xoff * 2); ++ vo_screenheight=ps3_fb.yres- (ps3_fb.yoff * 2); ++ ++ dstW = suggestedW; ++ dstH = suggestedH; ++ ++ if (vo_fs || dstW > vo_screenwidth || dstH > vo_screenheight) ++ /* DISABLED BY GEEXBOX PORTER */ // aspect_fit(&dstW, &dstH, vo_screenwidth, vo_screenheight); ++ ++ mp_msg(MSGT_VO, MSGL_INFO, ++ "[vo_ps3] setup_scale: Using dest WxH:%ix%i\n", dstW, dstH); ++ ++ //set aspect stuff ++ aspect_save_orig(srcW, srcH); ++ aspect_save_screenres(vo_screenwidth, vo_screenheight); ++ aspect_save_prescale(dstW, dstH); ++ ++ geometry(&vo_dx, &vo_dy, &dstW, &dstH, vo_screenwidth, vo_screenheight); ++ aspect(&dstW, &dstH, A_NOZOOM); ++ ++ //take care of scaling and scaler requirements/restrictions ++ aspect_fit(&dstW, &dstH, (dstW&(~0xF)), (dstH&(~0x3))); ++ ++ //center image -because ++ //spu-medialib handles this and we don't have to draw the extra black bars ++ vo_dx = (((vo_screenwidth - dstW)/2)&(~0x3)); ++ vo_dy = (vo_screenheight - dstH)/2; ++ offset = vo_dx + (ps3_fb.xres * vo_dy); ++ ++ mp_msg(MSGT_VO, MSGL_INFO, ++ "[vo_ps3] setup_screen: After mplayer aspectchanges:\n" ++ " vo_dx/dy=%ix%i, vo_screenwidth/height=%ix%i, offset=%i\n" ++ " desired image size=%ix%i\n", ++ vo_dx, vo_dy, vo_screenwidth, vo_screenheight, offset, dstW, dstH); ++ ++ clear_framebuffer(); ++} ++ ++static int query_format(uint32_t format) ++{ ++ ++ mp_msg(MSGT_VO, MSGL_INFO, ++ "[vo_ps3] query_format: Called for %s (0x%x)\n", ++ vo_format_name(format), format); ++ ++ switch(format) ++ { ++ case IMGFMT_I420: //Planar I420 0x30323449 ++ case IMGFMT_YV12: //Planar YV12 0x32315659 ++ case IMGFMT_IYUV: //Planar IYUV 0x56555949 ++ return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | \ ++ VFCAP_ACCEPT_STRIDE; ++ default: ++ return VO_FALSE; //not supporting anything else yet ++ } ++} ++ ++static int config(uint32_t width, uint32_t height, uint32_t d_width, ++ uint32_t d_height, uint32_t flags, char *title, uint32_t format) ++{ ++ ++ int i; ++ ++ srcW = dstW = width; ++ srcH = dstH = height; ++ ++ src_fmt = format; ++ src_title = title; ++ ++ suggestedW = d_width; ++ suggestedH = d_height; ++ ++ maxW=ps3_fb.xres; ++ maxH=ps3_fb.yres; ++ ++ if (flags && VOFLAG_FULLSCREEN) ++ vo_fs = 1; ++ ++ switch(format) ++ { ++ case IMGFMT_I420: //Planar I420 0x30323449 ++ case IMGFMT_YV12: //Planar YV12 0x32315659 ++ case IMGFMT_IYUV: //Planar IYUV 0x56555949 ++ src_buf_siz = srcW*srcH + srcW*srcH/2; ++ src_stride[0] = srcW; //buffer plane strides 0=y, 1=u, 2=v ++ src_stride[1] = src_stride[2] = src_stride[0]/2; ++ src_p_siz[0] = srcW * srcH; //buffer plane sizes 0=y, 1=u, 2=v ++ src_p_siz[1] = src_p_siz[2] = srcW/2 * srcH/2; ++ src_bpp = 12; ++ break; ++ default: ++ mp_msg(MSGT_VO, MSGL_FATAL, ++ "[vo_ps3] config: Unsupported format: %i\n", format ); ++ return 1; ++ } ++ ++ for (i=0; i < NUM_BUFFERS; i++) { ++ ++ inbuf_y[i]= memalign ( 128, src_p_siz[0]*2 ); ++ inbuf_u[i]= memalign ( 128, src_p_siz[1]*2 ); ++ inbuf_v[i]= memalign ( 128, src_p_siz[2]*2 ); ++ parking_lot_y[i]= memalign ( 128, src_p_siz[0]*2 ); ++ parking_lot_u[i]= memalign ( 128, src_p_siz[1]*2 ); ++ parking_lot_v[i]= memalign ( 128, src_p_siz[2]*2 ); ++ } ++ ++ clear_framebuffer(); ++ ++ setup_screen(); ++ ++ init_spu_medialib(); ++ ++ return 0; ++} ++ ++static uint32_t get_image(mp_image_t * mpi) ++{ ++ //TODO fix this whole mess somehow ++ get_image_count++; ++ ++ if ( ( mpi->flags & MP_IMGFLAG_READABLE ) && ( mpi->type == MP_IMGTYPE_IPB ++ || mpi->type == MP_IMGTYPE_IP ) ) { ++ ++ buf_plane_ptr[0] = parking_lot_y[parking_lot_page]; ++ buf_plane_ptr[1] = parking_lot_u[parking_lot_page]; ++ buf_plane_ptr[2] = parking_lot_v[parking_lot_page]; ++ //mpi->flags |=MP_IMGFLAG_DIRECT; ++ //FIXME crash without understand what Bill was thinking here ++ mpi->flags |= MP_IMGFLAG_ALLOCATED; ++ parking_lot_page^=1; ++ } ++ else { ++ ++ buf_plane_ptr[0] = inbuf_y[page]; ++ buf_plane_ptr[1] = inbuf_u[page]; ++ buf_plane_ptr[2] = inbuf_v[page]; ++ mpi->flags |= MP_IMGFLAG_DIRECT; ++ } ++ ++ mpi->planes[0] = buf_plane_ptr[0]; ++ mpi->planes[1] = buf_plane_ptr[1]; ++ mpi->planes[2] = buf_plane_ptr[2]; ++ ++ mpi->stride[0] = src_stride[0]; ++ mpi->stride[1] = src_stride[1]; ++ mpi->stride[2] = src_stride[2]; ++ ++ mpi->priv = buf_plane_ptr[0]; ++ ++ return 0; ++} ++ ++static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y) ++{ ++ ++ int i; ++ int slice_siz[3], slice_p_w[3], slice_p_h[3], offset[3]; ++ ++ draw_slice_count++; ++ ++ //todo: should we care about MP_IMGFLAG_PRESERVE for a slice? ++ ++ buf_plane_ptr[0] = inbuf_y[page]; ++ buf_plane_ptr[1] = inbuf_u[page]; ++ buf_plane_ptr[2] = inbuf_v[page]; ++ ++ // setup for YV12 - should add switch statement to 'check' format ++ slice_siz[0] = stride[0] * h; ++ slice_siz[1] = stride[1] * h/2; ++ slice_siz[2] = stride[2] * h/2; ++ ++ slice_p_w[0] = w; ++ slice_p_w[1] = slice_p_w[2] = w/2; ++ ++ slice_p_h[0] = h; ++ slice_p_h[1] = slice_p_h[2] = h/2; ++ ++ offset[0] = y * src_stride[0] + x; ++ offset[1] = y/2 * src_stride[1] + x/2; ++ offset[2] = y/2 * src_stride[2] + x/2; ++ ++ for ( i=0; i<3; i++ ) { ++ ++ memcpy_pic(buf_plane_ptr[i]+offset[i], src[i], slice_p_w[i], ++ slice_p_h[i], src_stride[i], stride[i] ); ++ } ++ return 0; ++} ++ ++ ++static uint32_t draw_image(mp_image_t *mpi) ++{ ++ ++ int i; ++ ++ int mpi_p_siz[3], mpi_p_w[3], mpi_p_h[3]; ++ ++ draw_image_count++; ++ ++ if (mpi->flags & MP_IMGFLAG_DIRECT) ++ return 0; ++ ++ ++ //TODO Understand what bill was trying to do here ++ //not (mpi->flags & MP_IMGFLAG_DIRECT) (no -dr flag for direct rendering), ++ // may need to handle MP_IMGFLAG_READABLE IPB (B) frames differently ++ // When direct rendering is enabled (-dr), I moved the B frames to a ++ // non-direct ++ // buffer and then when drawn with draw_image, they (seem) to work fine ++ // BUT, without direct rendering, don't know how to handle them :( ++ // Just drawing them as called makes a mess of the video. ++ ++ // if ( ( mpi->flags & MP_IMGFLAG_READABLE ) && ++ // ( mpi->type == MP_IMGTYPE_IPB || mpi->type == MP_IMGTYPE_IP ) ) ++ // { ++ // buf_plane_ptr[0] = inbuf_y[page]; ++ // buf_plane_ptr[1] = inbuf_u[page]; ++ // buf_plane_ptr[2] = inbuf_v[page]; ++ // } ++ // else ++ // { ++ buf_plane_ptr[0] = inbuf_y[page]; ++ buf_plane_ptr[1] = inbuf_u[page]; ++ buf_plane_ptr[2] = inbuf_v[page]; ++ // } ++ ++ ++ // draw_slice(mpi->planes, buf_plane_ptr,mpi->w, mpi->h, 0, 0); ++ ++ //messing with strides ++ mpi_p_siz[0] = mpi->stride[0] * mpi->height; ++ mpi_p_siz[1] = mpi->stride[1] * mpi->chroma_height; ++ mpi_p_siz[2] = mpi->stride[2] * mpi->chroma_height; ++ ++ mpi_p_w[0] = mpi->w; ++ mpi_p_w[1] = mpi_p_w[2] = mpi->chroma_width; ++ ++ mpi_p_h[0] = mpi->h; ++ mpi_p_h[1] = mpi_p_h[2] = mpi->chroma_height; ++ ++ for (i = 0; i < 3; i++){ ++ ++ memcpy_pic(buf_plane_ptr[i], mpi->planes[i], mpi_p_w[i], ++ mpi_p_h[i], src_stride[i], mpi->stride[i]); ++ } ++ ++ return 0; ++} ++ ++//FIXME Cannot remove compile issues sort this ++static int draw_frame(uint8_t *src[]) ++{ ++ return 0; ++} ++ ++static void draw_osd(void) ++{ ++ ++ vo_draw_text (srcW, srcH, draw_alpha); ++} ++ ++static void flip_page(void) ++{ ++ int frame = 0; ++ ++ int crt = 0; ++ ++ flip_count++; ++ ++ //make sure last frame is done ++ yuvcsc_check(); ++ ++ //flip output to monitor ++ ioctl(fb, PS3FB_IOCTL_FSEL, (unsigned long)&frame); ++ ++ //make sure flip is complete ++ ioctl(fb, FBIO_WAITFORVSYNC, (unsigned long)&crt); ++ ++ //run process next frame ++ yuvcsc_run(); ++ ++ //flip input buffer ++ page = page^1; ++} ++ ++ ++/** ++ * Toggles fullscreen off and on ++ */ ++static void toggle_fullscreen(void) ++{ ++ ++ vo_fs = !vo_fs; ++ ++ setup_screen(); ++ ++ update_spu_medialib(); ++} ++ ++static int control (uint32_t request, void *data, ...) ++{ ++ ++ switch(request) ++ { ++ case VOCTRL_QUERY_FORMAT: ++ return query_format (*(uint32_t*)data); ++ ++ case VOCTRL_FULLSCREEN: ++ toggle_fullscreen(); ++ return 0; ++ ++ case VOCTRL_PAUSE: ++ if (snap) ++ snapshot(); ++ return 0; ++ ++ case VOCTRL_RESUME: ++ return 0; ++ ++ case VOCTRL_GET_IMAGE: ++ return get_image(data); ++ ++ case VOCTRL_DRAW_IMAGE: ++ return draw_image(data); ++ ++ //TODO Handle upate screeninfo ++ case VOCTRL_UPDATE_SCREENINFO: ++ return VO_NOTIMPL; ++ ++ default: ++ return VO_NOTIMPL; ++ } ++} ++ ++static void check_events(void) ++{ ++ //no events to check or is there ? ++} ++ ++static void uninit(void) ++{ ++ ++ int i; ++ ++ cleanup_spu_medialib(); ++ ++ /* Cleanup FrameBuffer and re-enable console */ ++ ioctl(fb, PS3FB_IOCTL_OFF); ++ ++ ioctl(console, KDSETMODE, KD_TEXT); ++ ++ if (console >= 0) ++ close(console); ++ ++ if (console >= 0) ++ close(fb); ++ ++ mp_msg(MSGT_VO, MSGL_INFO, ++ "[vo_ps3] uninit: Cleaned up FB and re-enabled console.\n" ); ++ ++ for ( i=0; i= 0) ++ res = ioctl(console, KDGETMODE, &arg); ++ ++ //ok the previous failed lets attempt to open as root ++ if (console < 0 || res < 0) { ++ ++ if (console >= 0) ++ close(console); ++ //This will only work if you are root ++ console = open(FALLBACK, O_NONBLOCK); ++ res = ioctl(console, KDGETMODE, &arg); ++ } ++ ++ //all options to open the FB has failed but we continue in good fait ++ //it will only annoy you slightly ++ if (console >= 0) { ++ ++ if (arg !=KD_GRAPHICS && ioctl(console, KDSETMODE, KD_GRAPHICS) < 0) ++ mp_msg(MSGT_VO,MSGL_INFO,"[vo_ps3] failed to disable console\n"); ++ } ++ //we got this far now even if the console failed we continue ++ res = 0; ++ ++ fb = open(FB_DEV, O_RDWR); ++ ++ if (fb < 0) { ++ ++ mp_msg(MSGT_VO, MSGL_INFO, ++ "[vo_ps3] init_framebuffer: failed to open fb\n" ); ++ goto fail; ++ } ++ ++ if (ioctl(fb, PS3FB_IOCTL_SCREENINFO, (unsigned long)&ps3_fb) < 0) { ++ ++ mp_msg(MSGT_VO, MSGL_INFO, ++ "[vo_ps3] init_framebuffer: failed to get fb info\n" ); ++ goto fail; ++ } ++ ++ if (ioctl(fb, PS3FB_IOCTL_ON ) < 0) { ++ ++ mp_msg(MSGT_VO, MSGL_INFO, ++ "[vo_ps3] init_framebuffer: failed to set manual swap control\n" ++ ); ++ goto fail; ++ } ++ ++ fb_length = ps3_fb.xres*ps3_fb.yres*4; ++ ++ //get the FB mmap ++ fb_buf0 = mmap(NULL, fb_length, PROT_WRITE, MAP_SHARED, fb, 0); ++ ++ mp_msg(MSGT_VO, MSGL_INFO, "[vo_ps3] init_framebuffer:" ++ " Initialized framebuffer & disabled console\n" ++ "FB is %ix%i at offset %ix%i\n", ++ ps3_fb.xres, ps3_fb.yres, ps3_fb.xoff, ps3_fb.yoff); ++ ++ ++ return 0; ++ ++fail: ++ if (fb >= 0) { ++ ioctl(fb,PS3FB_IOCTL_OFF); ++ close(fb); ++ } ++ ++ if (console >= 0) { ++ ++ ioctl (console, KDSETMODE, KD_TEXT); ++ close(console); ++ } ++ ++ return -1; ++} ++ ++static int preinit (const char *arg) ++{ ++ ++ const opt_t subopts[] = ++ { ++ /* name arg type arg var test */ ++ { "debug", OPT_ARG_BOOL, &debug, NULL }, ++ { "snapshot", OPT_ARG_BOOL, &snap, NULL }, ++ { NULL, 0, NULL, NULL } ++ }; ++ ++ if (subopt_parse(arg, subopts)) { ++ ++ mp_msg(MSGT_VO, MSGL_WARN, ++ "Suboptions for -vo ps3:\n" ++ " debug - turn on debugging output specific to vo_ps3\n" ++ " snapshot - take a raw yuv snapshot of input buffers on pause" ++ "\n\n" ); ++ return -1; ++ } ++ ++ mp_msg(MSGT_VO, MSGL_INFO, ++ "ps3 suboptions:\n" ++ " debug:%i\n" ++ " snapshot:%i\n", ++ debug, snap); ++ ++ /* init PS3 FrameBuffer */ ++ if (init_framebuffer() < 0) ++ return -1; ++ ++ return 0; ++} +Index: configure +=================================================================== +--- a/configure (revision 29136) ++++ b/configure (working copy) +@@ -391,6 +391,7 @@ + --enable-xshape enable XShape support [autodetect] + --disable-xss disable screensaver support via xss [autodetect] + --enable-fbdev enable FBDev video output [autodetect] ++ --enable-ps3 enable FBDev video output SPU optimized for PS3 [autodetect] + --enable-mlib enable mediaLib video output (Solaris) [disable] + --enable-3dfx enable obsolete /dev/3dfx video output [disable] + --enable-tdfxfb enable tdfxfb video output [disable] +@@ -577,6 +578,7 @@ + _svga=auto + _vesa=auto + _fbdev=auto ++_ps3=auto + _dvb=auto + _dvbhead=auto + _dxr2=auto +@@ -931,6 +933,8 @@ + --disable-vesa) _vesa=no ;; + --enable-fbdev) _fbdev=yes ;; + --disable-fbdev) _fbdev=no ;; ++ --enable-ps3) _ps3=yes ;; ++ --disable-ps3) _ps3=no ;; + --enable-dvb) _dvb=yes ;; + --disable-dvb) _dvb=no ;; + --enable-dvbhead) _dvbhead=yes ;; +@@ -4758,6 +4762,26 @@ + echores "$_fbdev" + + ++echocheck "PS3" ++if test "$_ps3" = auto ; then ++ cat > $TMPC << EOF ++#include ++#include ++#include ++int main(void) { return 0; } ++EOF ++ _ps3=no ++ cc_check -lspu-medialib -lspe2 && _ps3=yes ++fi ++if test "$_ps3" = yes; then ++ def_ps3='#define CONFIG_PS3 1' ++ _libs_mplayer="$_libs_mplayer -lspu-medialib -lspe2" ++ _vomodules="ps3 $_vomodules" ++else ++ def_ps3='#undef CONFIG_PS3' ++ _novomodules="ps3 $_novomodules" ++fi ++echores "$_ps3" + + echocheck "DVB" + if test "$_dvb" = auto ; then +@@ -8257,6 +8281,7 @@ + PNG = $_png + PNM = $_pnm + PRIORITY = $_priority ++PS3 = $_ps3 + PULSE = $_pulse + PVR = $_pvr + QTX_CODECS = $_qtx +@@ -8730,6 +8755,7 @@ + $def_mng + $def_png + $def_pnm ++$def_ps3 + $def_quartz + $def_s3fb + $def_sdl diff --git a/packages/multimedia/mplayer/unpack.1 b/packages/multimedia/mplayer/unpack.1 new file mode 100644 index 0000000000..178b7c415b --- /dev/null +++ b/packages/multimedia/mplayer/unpack.1 @@ -0,0 +1,7 @@ +#!/bin/sh + +. config/options + +$SCRIPTS/build toolchain + +sed -i 's/\(cc_check -lpthread\) && $TMPO/\1/' $BUILD/$1*/configure diff --git a/packages/multimedia/mplayer/url b/packages/multimedia/mplayer/url new file mode 100644 index 0000000000..14adb3c278 --- /dev/null +++ b/packages/multimedia/mplayer/url @@ -0,0 +1 @@ +http://sources.openelec.tv/svn/mplayer-29746.tar.bz2