From 27e1e9c5936c57be598615b2d22817d159b23396 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Thu, 22 Oct 2009 08:19:02 +0200 Subject: [PATCH] move package mplayer: - no more need, move to pkg-archive branch --- packages/multimedia/mplayer/build | 270 -- 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/720_dvdnav-colorspu.diff | 3876 ----------------- .../mplayer/patches/800_mt-vdec.diff | 21 - .../patches/850_ps3_controller_hack.diff | 72 - .../mplayer/patches/900_vo_ps3.diff.ps3 | 855 ---- .../patches/MPlayer-gcc_4.4.0_hack.diff | 32 - .../patches/MPlayer-vaapi_20091010.diff | 2003 --------- packages/multimedia/mplayer/url | 1 - 17 files changed, 7745 deletions(-) delete mode 100755 packages/multimedia/mplayer/build delete mode 100644 packages/multimedia/mplayer/config/input.conf delete mode 100644 packages/multimedia/mplayer/config/mplayer.enna delete mode 100755 packages/multimedia/mplayer/install delete mode 100644 packages/multimedia/mplayer/patches/165_playtree-pop-only-if-pushed.diff delete mode 100644 packages/multimedia/mplayer/patches/185_slave-set-option.diff delete mode 100644 packages/multimedia/mplayer/patches/250_bgvideo.diff delete mode 100644 packages/multimedia/mplayer/patches/575_streaminfo-dump.diff delete mode 100644 packages/multimedia/mplayer/patches/600_dvb-includes.diff delete mode 100644 packages/multimedia/mplayer/patches/655_tvkeepon.diff delete mode 100644 packages/multimedia/mplayer/patches/720_dvdnav-colorspu.diff delete mode 100644 packages/multimedia/mplayer/patches/800_mt-vdec.diff delete mode 100644 packages/multimedia/mplayer/patches/850_ps3_controller_hack.diff delete mode 100644 packages/multimedia/mplayer/patches/900_vo_ps3.diff.ps3 delete mode 100644 packages/multimedia/mplayer/patches/MPlayer-gcc_4.4.0_hack.diff delete mode 100644 packages/multimedia/mplayer/patches/MPlayer-vaapi_20091010.diff delete mode 100644 packages/multimedia/mplayer/url diff --git a/packages/multimedia/mplayer/build b/packages/multimedia/mplayer/build deleted file mode 100755 index a57af71927..0000000000 --- a/packages/multimedia/mplayer/build +++ /dev/null @@ -1,270 +0,0 @@ -#!/bin/sh - -. config/options - -$SCRIPTS/build toolchain -$SCRIPTS/build zlib -$SCRIPTS/build alsa-lib -$SCRIPTS/build freetype -$SCRIPTS/build libpng -$SCRIPTS/build libiconv -$SCRIPTS/build libcdio -$SCRIPTS/build lame -$SCRIPTS/build ffmpeg -$SCRIPTS/build libdvdread -$SCRIPTS/build libdvdcss -$SCRIPTS/build libdvdnav -$SCRIPTS/build libva -$SCRIPTS/build libX11 -$SCRIPTS/build libXv -$SCRIPTS/build libXvMC -$SCRIPTS/build $MESA -$SCRIPTS/build xorg-server -$SCRIPTS/build xf86-video-intel - - -EXTRA_LIBDIR="-L$SYSROOT_PREFIX/usr/lib" -EXTRA_INCDIR="-I$SYSROOT_PREFIX/usr/include" -EXTRA_LIBS="-liconv -lstdc++" -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 - -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 \ - --enable-xv \ - --enable-xvmc \ - --disable-vdpau \ - --enable-vaapi \ - --disable-vm \ - --disable-xinerama \ - --enable-x11 \ - --enable-xf86keysym \ -\ - --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 \ - --disable-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 \ - --enable-v4l2 \ - --enable-dvb \ - --enable-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 deleted file mode 100644 index cc4068fb56..0000000000 --- a/packages/multimedia/mplayer/config/input.conf +++ /dev/null @@ -1,129 +0,0 @@ -## -## 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 deleted file mode 100644 index b258d7b68e..0000000000 --- a/packages/multimedia/mplayer/config/mplayer.enna +++ /dev/null @@ -1,45 +0,0 @@ -[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 deleted file mode 100755 index 3283ab40d0..0000000000 --- a/packages/multimedia/mplayer/install +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -. config/options - -$SCRIPTS/install zlib -$SCRIPTS/install alsa -$SCRIPTS/install freetype -$SCRIPTS/install libpng -$SCRIPTS/install libiconv -$SCRIPTS/install libcdio -#$SCRIPTS/install faad2 -$SCRIPTS/install ffmpeg -$SCRIPTS/install libdvdread -$SCRIPTS/install libdvdcss -$SCRIPTS/install libdvdnav -$SCRIPTS/install libX11 -$SCRIPTS/install libXv -$SCRIPTS/install libXvMC -$SCRIPTS/install libva -$SCRIPTS/install $MESA -$SCRIPTS/install xorg-server -$SCRIPTS/install xf86-video-intel - - -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 deleted file mode 100644 index 918862821c..0000000000 --- a/packages/multimedia/mplayer/patches/165_playtree-pop-only-if-pushed.diff +++ /dev/null @@ -1,18 +0,0 @@ -* 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 deleted file mode 100644 index 1ebfba509b..0000000000 --- a/packages/multimedia/mplayer/patches/185_slave-set-option.diff +++ /dev/null @@ -1,39 +0,0 @@ -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 deleted file mode 100644 index 73ee70261c..0000000000 --- a/packages/multimedia/mplayer/patches/250_bgvideo.diff +++ /dev/null @@ -1,153 +0,0 @@ -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 deleted file mode 100644 index 031d054f7d..0000000000 --- a/packages/multimedia/mplayer/patches/575_streaminfo-dump.diff +++ /dev/null @@ -1,163 +0,0 @@ -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 deleted file mode 100644 index 220eeaab89..0000000000 --- a/packages/multimedia/mplayer/patches/600_dvb-includes.diff +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100644 index 234a40f5dc..0000000000 --- a/packages/multimedia/mplayer/patches/655_tvkeepon.diff +++ /dev/null @@ -1,11 +0,0 @@ -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/720_dvdnav-colorspu.diff b/packages/multimedia/mplayer/patches/720_dvdnav-colorspu.diff deleted file mode 100644 index 24ba6941b7..0000000000 --- a/packages/multimedia/mplayer/patches/720_dvdnav-colorspu.diff +++ /dev/null @@ -1,3876 +0,0 @@ -diff -Naur MPlayer-export-2009-10-03.orig/cfg-mplayer.h MPlayer-export-2009-10-03/cfg-mplayer.h ---- MPlayer-export-2009-10-03.orig/cfg-mplayer.h 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/cfg-mplayer.h 2009-10-03 20:35:35.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-10-03.orig/command.c MPlayer-export-2009-10-03/command.c ---- MPlayer-export-2009-10-03.orig/command.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/command.c 2009-10-03 20:36:37.000000000 +0200 -@@ -861,6 +861,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: -@@ -1505,6 +1509,10 @@ - pts = mpctx->sh_audio->pts; - if (mpctx->sh_video) - pts = mpctx->sh_video->pts; -+#ifdef USE_DVDNAV -+ if (mpctx->stream->type == STREAMTYPE_DVDNAV) -+ mp_dvdnav_set_sid(mpctx->stream, dvdsub_id); -+#endif - update_subtitles(mpctx->sh_video, pts, d_sub, 1); - - return M_PROPERTY_OK; -diff -Naur MPlayer-export-2009-10-03.orig/libmenu/menu.c MPlayer-export-2009-10-03/libmenu/menu.c ---- MPlayer-export-2009-10-03.orig/libmenu/menu.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libmenu/menu.c 2009-10-03 20:35:35.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-10-03.orig/libmpcodecs/vf_expand.c MPlayer-export-2009-10-03/libmpcodecs/vf_expand.c ---- MPlayer-export-2009-10-03.orig/libmpcodecs/vf_expand.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libmpcodecs/vf_expand.c 2009-10-03 21:08:16.000000000 +0200 -@@ -15,6 +15,8 @@ - #include "libvo/fastmemcpy.h" - #include "libavutil/avutil.h" - -+#include "libvo/video_out.h" -+ - #ifdef OSD_SUPPORT - #include "libvo/sub.h" - #include "libvo/osd.h" -@@ -102,7 +104,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 -@@ -130,19 +172,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: -@@ -151,13 +193,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; - } - } -@@ -425,6 +467,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-10-03.orig/libmpcodecs/vf.h MPlayer-export-2009-10-03/libmpcodecs/vf.h ---- MPlayer-export-2009-10-03.orig/libmpcodecs/vf.h 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libmpcodecs/vf.h 2009-10-03 20:35:35.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-10-03.orig/libmpcodecs/vf_vo.c MPlayer-export-2009-10-03/libmpcodecs/vf_vo.c ---- MPlayer-export-2009-10-03.orig/libmpcodecs/vf_vo.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libmpcodecs/vf_vo.c 2009-10-03 20:35:35.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-10-03.orig/libvo/mga_common.c MPlayer-export-2009-10-03/libvo/mga_common.c ---- MPlayer-export-2009-10-03.orig/libvo/mga_common.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/mga_common.c 2009-10-03 20:35:35.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-10-03.orig/libvo/osd.c MPlayer-export-2009-10-03/libvo/osd.c ---- MPlayer-export-2009-10-03.orig/libvo/osd.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/osd.c 2009-10-03 20:35:35.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-10-03.orig/libvo/osd.h MPlayer-export-2009-10-03/libvo/osd.h ---- MPlayer-export-2009-10-03.orig/libvo/osd.h 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/osd.h 2009-10-03 20:35:35.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-10-03.orig/libvo/osd_template.c MPlayer-export-2009-10-03/libvo/osd_template.c ---- MPlayer-export-2009-10-03.orig/libvo/osd_template.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/osd_template.c 2009-10-03 21:25:49.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; - #if HAVE_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-10-03.orig/libvo/sub.c MPlayer-export-2009-10-03/libvo/sub.c ---- MPlayer-export-2009-10-03.orig/libvo/sub.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/sub.c 2009-10-03 20:35:35.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-10-03.orig/libvo/sub.h MPlayer-export-2009-10-03/libvo/sub.h ---- MPlayer-export-2009-10-03.orig/libvo/sub.h 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/sub.h 2009-10-03 20:35:35.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-10-03.orig/libvo/vesa_lvo.c MPlayer-export-2009-10-03/libvo/vesa_lvo.c ---- MPlayer-export-2009-10-03.orig/libvo/vesa_lvo.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vesa_lvo.c 2009-10-03 20:35:35.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-10-03.orig/libvo/video_out.h MPlayer-export-2009-10-03/libvo/video_out.h ---- MPlayer-export-2009-10-03.orig/libvo/video_out.h 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/video_out.h 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_aa.c MPlayer-export-2009-10-03/libvo/vo_aa.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_aa.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_aa.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_dfbmga.c MPlayer-export-2009-10-03/libvo/vo_dfbmga.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_dfbmga.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_dfbmga.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_dga.c MPlayer-export-2009-10-03/libvo/vo_dga.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_dga.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_dga.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_directfb2.c MPlayer-export-2009-10-03/libvo/vo_directfb2.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_directfb2.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_directfb2.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_directx.c MPlayer-export-2009-10-03/libvo/vo_directx.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_directx.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_directx.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_dxr3.c MPlayer-export-2009-10-03/libvo/vo_dxr3.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_dxr3.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_dxr3.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_fbdev2.c MPlayer-export-2009-10-03/libvo/vo_fbdev2.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_fbdev2.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_fbdev2.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_fbdev.c MPlayer-export-2009-10-03/libvo/vo_fbdev.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_fbdev.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_fbdev.c 2009-10-03 20:35:35.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); - -@@ -994,14 +994,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-10-03.orig/libvo/vo_gl2.c MPlayer-export-2009-10-03/libvo/vo_gl2.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_gl2.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_gl2.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_quartz.c MPlayer-export-2009-10-03/libvo/vo_quartz.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_quartz.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_quartz.c 2009-10-03 20:35:35.000000000 +0200 -@@ -153,23 +153,23 @@ - void window_fullscreen(void); - void window_panscan(void); - --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-10-03.orig/libvo/vo_sdl.c MPlayer-export-2009-10-03/libvo/vo_sdl.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_sdl.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_sdl.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vosub_vidix.c MPlayer-export-2009-10-03/libvo/vosub_vidix.c ---- MPlayer-export-2009-10-03.orig/libvo/vosub_vidix.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vosub_vidix.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_vesa.c MPlayer-export-2009-10-03/libvo/vo_vesa.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_vesa.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_vesa.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_x11.c MPlayer-export-2009-10-03/libvo/vo_x11.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_x11.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_x11.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_xv.c MPlayer-export-2009-10-03/libvo/vo_xv.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_xv.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_xv.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_xvmc.c MPlayer-export-2009-10-03/libvo/vo_xvmc.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_xvmc.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_xvmc.c 2009-10-03 20:35:35.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-10-03.orig/libvo/vo_yuv4mpeg.c MPlayer-export-2009-10-03/libvo/vo_yuv4mpeg.c ---- MPlayer-export-2009-10-03.orig/libvo/vo_yuv4mpeg.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/libvo/vo_yuv4mpeg.c 2009-10-03 20:35:35.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-10-03.orig/mp_core.h MPlayer-export-2009-10-03/mp_core.h ---- MPlayer-export-2009-10-03.orig/mp_core.h 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/mp_core.h 2009-10-03 20:35:35.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-10-03.orig/mplayer.c MPlayer-export-2009-10-03/mplayer.c ---- MPlayer-export-2009-10-03.orig/mplayer.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/mplayer.c 2009-10-03 20:35:35.000000000 +0200 -@@ -220,6 +220,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"; -@@ -1106,6 +1107,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) { -@@ -1145,6 +1147,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 -@@ -1966,6 +1978,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) -@@ -3828,20 +3919,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-10-03.orig/spudec.c MPlayer-export-2009-10-03/spudec.c ---- MPlayer-export-2009-10-03.orig/spudec.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/spudec.c 2009-10-03 20:35:35.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-10-03.orig/spudec.h MPlayer-export-2009-10-03/spudec.h ---- MPlayer-export-2009-10-03.orig/spudec.h 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/spudec.h 2009-10-03 20:35:35.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-10-03.orig/stream/stream_dvdnav.c MPlayer-export-2009-10-03/stream/stream_dvdnav.c ---- MPlayer-export-2009-10-03.orig/stream/stream_dvdnav.c 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/stream/stream_dvdnav.c 2009-10-03 20:35:35.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-10-03.orig/stream/stream_dvdnav.h MPlayer-export-2009-10-03/stream/stream_dvdnav.h ---- MPlayer-export-2009-10-03.orig/stream/stream_dvdnav.h 2009-10-03 20:27:28.000000000 +0200 -+++ MPlayer-export-2009-10-03/stream/stream_dvdnav.h 2009-10-03 20:35:35.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/patches/800_mt-vdec.diff b/packages/multimedia/mplayer/patches/800_mt-vdec.diff deleted file mode 100644 index db6fbacbbe..0000000000 --- a/packages/multimedia/mplayer/patches/800_mt-vdec.diff +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 7350709b0c..0000000000 --- a/packages/multimedia/mplayer/patches/850_ps3_controller_hack.diff +++ /dev/null @@ -1,72 +0,0 @@ -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 deleted file mode 100644 index c6d55c5608..0000000000 --- a/packages/multimedia/mplayer/patches/900_vo_ps3.diff.ps3 +++ /dev/null @@ -1,855 +0,0 @@ -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/patches/MPlayer-gcc_4.4.0_hack.diff b/packages/multimedia/mplayer/patches/MPlayer-gcc_4.4.0_hack.diff deleted file mode 100644 index 975559ce1b..0000000000 --- a/packages/multimedia/mplayer/patches/MPlayer-gcc_4.4.0_hack.diff +++ /dev/null @@ -1,32 +0,0 @@ -diff -Naur MPlayer-29725-old/configure MPlayer-29725-new/configure ---- MPlayer-29725-old/configure 2009-09-27 15:37:17.000000000 -0700 -+++ MPlayer-29725-new/configure 2009-09-27 15:37:17.000000000 -0700 -@@ -2422,8 +2422,8 @@ - __attribute__((noinline)) static int foo3(int i1, int i2, int i3) { return i3; } - int main(void) { return foo3(1,2,3) == 3 ? 0 : 1; } - EOF -- cc_check -O4 -mstackrealign && tmp_run && cflags_stackrealign=-mstackrealign -- test -z "$cflags_stackrealign" && cc_check -O4 -mstackrealign -fno-unit-at-a-time \ -+ cc_check -O2 -mstackrealign && tmp_run && cflags_stackrealign=-mstackrealign -+ test -z "$cflags_stackrealign" && cc_check -O2 -mstackrealign -fno-unit-at-a-time \ - && tmp_run && cflags_stackrealign="-mstackrealign -fno-unit-at-a-time" - test -n "$cflags_stackrealign" && echores "yes" || echores "no" - fi # if darwin && test "$cc_vendor" = "gnu" ; then -@@ -2440,7 +2440,7 @@ - elif test "$cc_vendor" != "gnu" ; then - CFLAGS="-O2 $_march $_mcpu $_pipe" - else -- CFLAGS="-Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer" -+ CFLAGS="-Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O2 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer" - extra_ldflags="$extra_ldflags -ffast-math" - fi - else -@@ -6620,7 +6620,7 @@ - EOF - _faac=no - for _ld_faac in "-lfaac" "-lfaac -lmp4v2 -lstdc++" ; do -- cc_check -O4 $_ld_faac $_ld_lm && libs_mencoder="$libs_mencoder $_ld_faac" && _faac=yes && break -+ cc_check -O2 $_ld_faac $_ld_lm && libs_mencoder="$libs_mencoder $_ld_faac" && _faac=yes && break - done - fi - if test "$_faac" = yes ; then diff --git a/packages/multimedia/mplayer/patches/MPlayer-vaapi_20091010.diff b/packages/multimedia/mplayer/patches/MPlayer-vaapi_20091010.diff deleted file mode 100644 index dee2cf72b7..0000000000 --- a/packages/multimedia/mplayer/patches/MPlayer-vaapi_20091010.diff +++ /dev/null @@ -1,2003 +0,0 @@ -diff -Naur mplayer-29746/cfg-common-opts.h mplayer-29746.patch/cfg-common-opts.h ---- mplayer-29746/cfg-common-opts.h 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/cfg-common-opts.h 2009-10-11 01:04:05.510657179 +0200 -@@ -228,6 +228,7 @@ - // {"ac", &audio_codec, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"ac", &audio_codec_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL}, - {"vc", &video_codec_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL}, -+ {"va", &video_hwaccel_name, CONF_TYPE_STRING, 0, 0, 0, NULL}, - - // postprocessing: - #ifdef CONFIG_LIBAVCODEC -diff -Naur mplayer-29746/codec-cfg.c mplayer-29746.patch/codec-cfg.c ---- mplayer-29746/codec-cfg.c 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/codec-cfg.c 2009-10-11 01:04:13.245782745 +0200 -@@ -187,6 +187,13 @@ - {"IDCT_MPEG2",IMGFMT_XVMC_IDCT_MPEG2}, - {"MOCO_MPEG2",IMGFMT_XVMC_MOCO_MPEG2}, - -+ {"VAAPI_MPEG2", IMGFMT_VAAPI_MPEG2}, -+ {"VAAPI_MPEG4", IMGFMT_VAAPI_MPEG4}, -+ {"VAAPI_H263", IMGFMT_VAAPI_H263}, -+ {"VAAPI_H264", IMGFMT_VAAPI_H264}, -+ {"VAAPI_WMV3", IMGFMT_VAAPI_WMV3}, -+ {"VAAPI_VC1", IMGFMT_VAAPI_VC1}, -+ - {"VDPAU_MPEG1",IMGFMT_VDPAU_MPEG1}, - {"VDPAU_MPEG2",IMGFMT_VDPAU_MPEG2}, - {"VDPAU_H264",IMGFMT_VDPAU_H264}, -diff -Naur mplayer-29746/configure mplayer-29746.patch/configure ---- mplayer-29746/configure 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/configure 2009-10-11 01:04:17.984657798 +0200 -@@ -354,6 +354,9 @@ - --disable-muxer=MUXER disable specified FFmpeg muxer - --enable-muxer=MUXER enable specified FFmpeg muxer - -+Hardware acceleration: -+ --enable-vaapi enable VA API acceleration [disable] -+ - Video output: - --disable-vidix disable VIDIX [for x86 *nix] - --with-vidix-drivers[=*] list of VIDIX drivers to be compiled in -@@ -539,6 +542,8 @@ - _libavcodec_a=auto - _libopencore_amrnb=auto - _libopencore_amrwb=auto -+_libavhwaccels_all=$(sed -n 's/^[^#]*HWACCEL.*(.*, *\(.*\)).*/\1_hwaccel/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') -+_libavhwaccels="$_libavhwaccels_all" - _libavdecoders_all=$(sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') - _libavdecoders=$(echo $_libavdecoders_all | sed -e 's/ LIB[A-Z0-9_]*_DECODER//g' -e s/MPEG4AAC_DECODER//) - _libavencoders_all=$(sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') -@@ -562,6 +567,8 @@ - _libavcodec_mpegaudio_hp=yes - _mencoder=yes - _mplayer=yes -+_vaapi=auto -+_vaapi_glx=no - _x11=auto - _xshape=auto - _xss=auto -@@ -904,6 +911,8 @@ - --disable-mplayer) _mplayer=no ;; - --enable-dynamic-plugins) _dynamic_plugins=yes ;; - --disable-dynamic-plugins) _dynamic_plugins=no ;; -+ --enable-vaapi) _vaapi=yes ;; -+ --disable-vaapi) _vaapi=no ;; - --enable-x11) _x11=yes ;; - --disable-x11) _x11=no ;; - --enable-xshape) _xshape=yes ;; -@@ -4221,7 +4230,7 @@ - _novomodules="x11 $_novomodules" - _res_comment="check if the dev(el) packages are installed" - # disable stuff that depends on X -- _xv=no ; _xvmc=no ; _xinerama=no ; _vm=no ; _xf86keysym=no ; _vdpau=no -+ _xv=no ; _xvmc=no ; _xinerama=no ; _vm=no ; _xf86keysym=no ; _vaapi=no ; _vdpau=no - fi - echores "$_x11" - -@@ -4349,7 +4358,7 @@ - else - def_vdpau='#define CONFIG_VDPAU 0' - _novomodules="vdpau $_novomodules" -- _libavdecoders=$(echo $_libavdecoders | sed -e s/MPEG_VDPAU_DECODER// -e s/MPEG1_VDPAU_DECODER// -e s/H264_VDPAU_DECODER// -e s/WMV3_VDPAU_DECODER// -e s/VC1_VDPAU_DECODER//) -+ _libavdecoders=$(echo $_libavdecoders | sed -e "s/\(MPEG\|MPEG[124]\|H26[34]\|WMV3\|VC1\)_VDPAU_DECODER//g") - fi - echores "$_vdpau" - -@@ -4929,6 +4938,65 @@ - fi - echores "$_gl" - -+echocheck "OpenGL utilities (GLU)" -+_glu=no -+if test "$_gl" = yes; then -+ cat > $TMPC << EOF -+#include -+int main(void) { -+ gluPerspective(0.0, 0.0, 0.0, 0.0); -+ return 0; -+} -+EOF -+ cc_check -lGLU && _glu=yes -+fi -+if test "$_glu" = yes; then -+ libs_mplayer="$libs_mplayer -lGLU" -+fi -+echores "$_glu" -+ -+ -+echocheck "VA API" -+if test "$_vaapi" = yes -o "$_vaapi" = auto; then -+ _vaapi=no -+ cat > $TMPC < -+int main(void) { (void) vaGetDisplay(0); return 0; } -+EOF -+ cc_check -lva-x11 && _vaapi=yes -+fi -+ -+if test "$_vaapi" = yes ; then -+ def_vaapi='#define CONFIG_VAAPI 1' -+ libs_mencoder="$libs_mencoder -lva" -+ libs_mplayer="$libs_mplayer -lva-x11" -+ _vomodules="vaapi $_vomodules" -+else -+ def_vaapi='#define CONFIG_VAAPI 0' -+ _novomodules="vaapi $_novomodules" -+ _libavhwaccels=`echo $_libavhwaccels | sed -e "s/\(MPEG[124]\|H26[34]\|WMV3\|VC1\)_VAAPI_HWACCEL//g"` -+fi -+echores "$_vaapi" -+ -+echocheck "VA API (with GLX support)" -+if test "$_vaapi" = yes; then -+ _vaapi_glx=no -+ if test "$_gl" = "yes" -a "$_glu" = yes; then -+ cat > $TMPC < -+int main(void) { (void) vaGetDisplayGLX(0); return 0; } -+EOF -+ cc_check -lva-glx && _vaapi_glx=yes -+ fi -+fi -+if test "$_vaapi_glx" = yes; then -+ def_vaapi_glx='#define CONFIG_VAAPI_GLX 1' -+ libs_mplayer="$libs_mplayer -lva-glx" -+else -+ def_vaapi_glx='#define CONFIG_VAAPI_GLX 0' -+fi -+echores "$_vaapi_glx" -+ - - echocheck "PNG support" - if test "$_png" = auto ; then -@@ -8381,6 +8449,7 @@ - TWOLAME=$_twolame - UNRAR_EXEC = $_unrar_exec - V4L2 = $_v4l2 -+VAAPI = $_vaapi - VCD = $_vcd - VDPAU = $_vdpau - VESA = $_vesa -@@ -8474,6 +8543,7 @@ - CONFIG_POSTPROC = yes - # Prevent building libavcodec/imgresample.c with conflicting symbols - CONFIG_SWSCALE=yes -+CONFIG_VAAPI=$_vaapi - CONFIG_VDPAU=$_vdpau - CONFIG_XVMC=$_xvmc - CONFIG_ZLIB=$_zlib -@@ -8483,6 +8553,7 @@ - HAVE_W32THREADS = $_w32threads - HAVE_YASM = $_have_yasm - -+$(echo $_libavhwaccels | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/') - $(echo $_libavdecoders | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/') - $(echo $_libavencoders | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/') - $(echo $_libavparsers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/') -@@ -8842,6 +8913,8 @@ - $def_tdfxvid - $def_tga - $def_v4l2 -+$def_vaapi -+$def_vaapi_glx - $def_vdpau - $def_vesa - $def_vidix -@@ -8958,6 +9031,7 @@ - $def_x264_lavc - $def_xvid_lavc - -+$(ff_config_enable "$_libavhwaccels_all" "$_libavhwaccels") - $(ff_config_enable "$_libavdecoders_all" "$_libavdecoders") - $(ff_config_enable "$_libavencoders_all" "$_libavencoders") - $(ff_config_enable "$_libavparsers_all" "$_libavparsers") -@@ -8966,13 +9040,6 @@ - $(ff_config_enable "$_libavprotocols_all" "$_libavprotocols") - $(ff_config_enable "$_libavbsfs_all" "$_libavbsfs") - --#define CONFIG_H263_VAAPI_HWACCEL 0 --#define CONFIG_MPEG2_VAAPI_HWACCEL 0 --#define CONFIG_MPEG4_VAAPI_HWACCEL 0 --#define CONFIG_H264_VAAPI_HWACCEL 0 --#define CONFIG_VC1_VAAPI_HWACCEL 0 --#define CONFIG_WMV3_VAAPI_HWACCEL 0 -- - #endif /* MPLAYER_CONFIG_H */ - EOF - -diff -Naur mplayer-29746/etc/codecs.conf mplayer-29746.patch/etc/codecs.conf ---- mplayer-29746/etc/codecs.conf 2009-10-01 21:52:59.000000000 +0200 -+++ mplayer-29746.patch/etc/codecs.conf 2009-10-11 01:04:25.408658537 +0200 -@@ -164,6 +164,7 @@ - fourcc LMP2 ; Lead mpeg2 in avi - driver ffmpeg - dll "mpeg2video" -+ out VAAPI_MPEG2 - out YV12,I420,IYUV - out 422P,444P - -@@ -847,6 +848,7 @@ - fourcc WMV3,wmv3 - driver ffmpeg - dll wmv3 -+ out VAAPI_WMV3 - out YV12,I420,IYUV - - videocodec ffwmv3vdpau -@@ -864,6 +866,7 @@ - fourcc vc-1,VC-1 - driver ffmpeg - dll vc1 -+ out VAAPI_VC1 - out YV12,I420,IYUV - - videocodec ffvc1vdpau -@@ -885,6 +888,7 @@ - format 0x10000005 - driver ffmpeg - dll h264 -+ out VAAPI_H264 - out YV12,I420,IYUV - - videocodec ffh264vdpau -@@ -952,6 +956,7 @@ - fourcc EPHV,SN40 - driver ffmpeg - dll mpeg4 ;opendivx -+ out VAAPI_MPEG4 - out YV12,I420,IYUV - - videocodec ffwv1f -@@ -1461,6 +1466,7 @@ - fourcc VX1K ; Agora Labs VX1000S H263 - driver ffmpeg - dll h263 -+ out VAAPI_H263 - out YV12,I420,IYUV - - videocodec ffzygo -diff -Naur mplayer-29746/fmt-conversion.c mplayer-29746.patch/fmt-conversion.c ---- mplayer-29746/fmt-conversion.c 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/fmt-conversion.c 2009-10-11 01:04:31.485657984 +0200 -@@ -18,12 +18,14 @@ - - #include "mp_msg.h" - #include "libavutil/avutil.h" -+#include "libavcodec/avcodec.h" - #include "libmpcodecs/img_format.h" - #include "fmt-conversion.h" - - static const struct { - int fmt; - enum PixelFormat pix_fmt; -+ enum CodecID codec_id; - } conversion_map[] = { - {IMGFMT_BGR32, PIX_FMT_RGB32}, - {IMGFMT_BGR24, PIX_FMT_BGR24}, -@@ -73,6 +75,17 @@ - {IMGFMT_VDPAU_H264, PIX_FMT_VDPAU_H264}, - {IMGFMT_VDPAU_WMV3, PIX_FMT_VDPAU_WMV3}, - {IMGFMT_VDPAU_VC1, PIX_FMT_VDPAU_VC1}, -+ -+ /* VA API formats */ -+ {IMGFMT_VAAPI_MPEG2, PIX_FMT_VAAPI_VLD, CODEC_ID_MPEG2VIDEO}, -+ {IMGFMT_VAAPI_MPEG2_IDCT,PIX_FMT_VAAPI_IDCT, CODEC_ID_MPEG2VIDEO}, -+ {IMGFMT_VAAPI_MPEG2_MOCO,PIX_FMT_VAAPI_MOCO, CODEC_ID_MPEG2VIDEO}, -+ {IMGFMT_VAAPI_MPEG4, PIX_FMT_VAAPI_VLD, CODEC_ID_MPEG4}, -+ {IMGFMT_VAAPI_H263, PIX_FMT_VAAPI_VLD, CODEC_ID_H263}, -+ {IMGFMT_VAAPI_H264, PIX_FMT_VAAPI_VLD, CODEC_ID_H264}, -+ {IMGFMT_VAAPI_WMV3, PIX_FMT_VAAPI_VLD, CODEC_ID_WMV3}, -+ {IMGFMT_VAAPI_VC1, PIX_FMT_VAAPI_VLD, CODEC_ID_VC1}, -+ - {0, PIX_FMT_NONE} - }; - -@@ -89,12 +102,14 @@ - return pix_fmt; - } - --int pixfmt2imgfmt(enum PixelFormat pix_fmt) -+int pixfmt2imgfmt(enum PixelFormat pix_fmt, int codec_id) - { - int i; - int fmt; - for (i = 0; conversion_map[i].pix_fmt != PIX_FMT_NONE; i++) -- if (conversion_map[i].pix_fmt == pix_fmt) -+ if (conversion_map[i].pix_fmt == pix_fmt && -+ (conversion_map[i].codec_id == 0 || -+ conversion_map[i].codec_id == codec_id)) - break; - fmt = conversion_map[i].fmt; - if (!fmt) -diff -Naur mplayer-29746/fmt-conversion.h mplayer-29746.patch/fmt-conversion.h ---- mplayer-29746/fmt-conversion.h 2009-10-01 21:52:59.000000000 +0200 -+++ mplayer-29746.patch/fmt-conversion.h 2009-10-11 01:04:35.742657222 +0200 -@@ -4,6 +4,6 @@ - #include "libavutil/avutil.h" - - enum PixelFormat imgfmt2pixfmt(int fmt); --int pixfmt2imgfmt(enum PixelFormat pix_fmt); -+int pixfmt2imgfmt(enum PixelFormat pix_fmt, int codec_id); - - #endif /* MPLAYER_FMT_CONVERSION_H */ -diff -Naur mplayer-29746/gui/mplayer/gtk/opts.c mplayer-29746.patch/gui/mplayer/gtk/opts.c ---- mplayer-29746/gui/mplayer/gtk/opts.c 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/gui/mplayer/gtk/opts.c 2009-10-11 01:04:42.838683318 +0200 -@@ -63,9 +63,11 @@ - GtkWidget * prEFontName; - GtkWidget * prEDVDDevice; - GtkWidget * prECDRomDevice; -+static GtkWidget * EVHW; - static GtkWidget * EVFM; - static GtkWidget * EAFM; - -+static GtkWidget * CBVHW; - static GtkWidget * CBVFM; - static GtkWidget * CBAFM; - static GtkWidget * CBAudioEqualizer; -@@ -353,6 +355,26 @@ - // -- 5. page - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNonInterlaved ),force_ni ); - if ( index_mode == 1 ) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBIndex ),1 ); -+ -+ { -+ int i; -+ GList * Items = NULL; -+ char * name = NULL; -+ -+ Items = g_list_append(Items, MSGTR_PREFERENCES_None); -+ for (i = 0; i < HWACCEL_COUNT; i++) { -+ const char *hwaccel_name = get_video_hwaccel_name(i); -+ if (!hwaccel_name) -+ continue; -+ Items = g_list_append(Items, hwaccel_name); -+ if (video_hwaccel_name && !gstrcmp(video_hwaccel_name, get_video_hwaccel_short_name(i) ) ) name = hwaccel_name; -+ } -+ gtk_combo_set_popdown_strings(GTK_COMBO(CBVHW), Items); -+ g_list_free(Items); -+ if (name) -+ gtk_entry_set_text(GTK_ENTRY(EVHW), name); -+ } -+ - { - int i; - GList * Items = NULL; -@@ -599,6 +621,17 @@ - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBIndex ) ) ) index_mode=1; - - { -+ int i; -+ const char *tmp = gtk_entry_get_text(GTK_ENTRY(EVHW)); -+ for (i = 0; i < HWACCEL_COUNT; i++) { -+ if (!gstrcmp(tmp, get_video_hwaccel_name(i))) { -+ video_hwaccel_name = get_video_hwaccel_short_name(i); -+ break; -+ } -+ } -+ } -+ -+ { - int i; - const char * tmp = gtk_entry_get_text( GTK_ENTRY( EVFM ) ); - for( i=0;mpcodecs_vd_drivers[i];i++ ) -@@ -1198,6 +1231,20 @@ - - hbox5=AddHBox( vbox602,1 ); - -+ AddLabel( MSGTR_PREFERENCES_VideoHardwareAcceleration,hbox5 ); -+ -+ CBVHW=gtk_combo_new(); -+ gtk_widget_set_name( CBVHW,"CBVHW" ); -+ gtk_widget_show( CBVHW ); -+ gtk_box_pack_start( GTK_BOX( hbox5 ),CBVHW,TRUE,TRUE,0 ); -+ -+ EVHW=GTK_COMBO( CBVHW )->entry; -+ gtk_widget_set_name( EVHW,"CEVHW" ); -+ gtk_entry_set_editable( GTK_ENTRY( EVHW ),FALSE ); -+ gtk_widget_show( EVHW ); -+ -+ hbox5=AddHBox( vbox602,1 ); -+ - AddLabel( MSGTR_PREFERENCES_VideoCodecFamily,hbox5 ); - - CBVFM=gtk_combo_new(); -diff -Naur mplayer-29746/help/help_mp-en.h mplayer-29746.patch/help/help_mp-en.h ---- mplayer-29746/help/help_mp-en.h 2009-10-01 21:52:59.000000000 +0200 -+++ mplayer-29746.patch/help/help_mp-en.h 2009-10-11 01:04:48.607657819 +0200 -@@ -718,6 +718,7 @@ - #define MSGTR_PREFERENCES_IDX "Rebuild index table, if needed" - #define MSGTR_PREFERENCES_VideoCodecFamily "Video codec family:" - #define MSGTR_PREFERENCES_AudioCodecFamily "Audio codec family:" -+#define MSGTR_PREFERENCES_VideoHardwareAcceleration "Video hardware acceleration:" - #define MSGTR_PREFERENCES_FRAME_OSD_Level "OSD level" - #define MSGTR_PREFERENCES_FRAME_Subtitle "Subtitle" - #define MSGTR_PREFERENCES_FRAME_Font "Font" -@@ -1657,6 +1658,7 @@ - #define MSGTR_MPCODECS_UnexpectedInitVoError "[VD_FFMPEG] Unexpected init_vo error.\n" - #define MSGTR_MPCODECS_UnrecoverableErrorRenderBuffersNotTaken "[VD_FFMPEG] Unrecoverable error, render buffers not taken.\n" - #define MSGTR_MPCODECS_OnlyBuffersAllocatedByVoXvmcAllowed "[VD_FFMPEG] Only buffers allocated by vo_xvmc allowed.\n" -+#define MSGTR_MPCODECS_VAAPIAcceleratedCodec "[VD_FFMPEG] VA API accelerated codec.\n" - - // libmpcodecs/ve_lavc.c - #define MSGTR_MPCODECS_HighQualityEncodingSelected "[VE_LAVC] High quality encoding selected (non-realtime)!\n" -diff -Naur mplayer-29746/libmpcodecs/dec_video.c mplayer-29746.patch/libmpcodecs/dec_video.c ---- mplayer-29746/libmpcodecs/dec_video.c 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/libmpcodecs/dec_video.c 2009-10-11 01:05:00.374657820 +0200 -@@ -39,9 +39,47 @@ - int field_dominance=-1; - - int divx_quality=0; -+char *video_hwaccel_name=NULL; - - vd_functions_t* mpvdec=NULL; - -+int get_video_hwaccel(void) -+{ -+ static int video_hwaccel = -1; -+ if (video_hwaccel < 0) { -+ video_hwaccel = HWACCEL_NONE; -+ if (video_hwaccel_name) { -+ if (!strcmp(video_hwaccel_name,"xvmc")) -+ video_hwaccel = HWACCEL_XVMC; -+ else if (!strcmp(video_hwaccel_name,"vaapi")) -+ video_hwaccel = HWACCEL_VAAPI; -+ else if (!strcmp(video_hwaccel_name,"vdpau")) -+ video_hwaccel = HWACCEL_VDPAU; -+ } -+ } -+ return video_hwaccel; -+} -+ -+const char *get_video_hwaccel_name(int hwaccel) -+{ -+ switch (hwaccel) { -+ case HWACCEL_XVMC: return "XvMC"; -+ case HWACCEL_VAAPI: return "VA API"; -+ case HWACCEL_VDPAU: return "VDPAU"; -+ } -+ return NULL; -+} -+ -+const char *get_video_hwaccel_short_name(int hwaccel) -+{ -+ switch (hwaccel) { -+ case HWACCEL_XVMC: return "xvmc"; -+ case HWACCEL_VAAPI: return "vaapi"; -+ case HWACCEL_VDPAU: return "vdpau"; -+ } -+ return NULL; -+} -+ - int get_video_quality_max(sh_video_t *sh_video){ - vf_instance_t* vf=sh_video->vfilter; - if(vf){ -diff -Naur mplayer-29746/libmpcodecs/dec_video.h mplayer-29746.patch/libmpcodecs/dec_video.h ---- mplayer-29746/libmpcodecs/dec_video.h 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/libmpcodecs/dec_video.h 2009-10-11 01:05:03.454659098 +0200 -@@ -3,6 +3,14 @@ - - #include "libmpdemux/stheader.h" - -+enum { -+ HWACCEL_NONE = 0, -+ HWACCEL_XVMC, -+ HWACCEL_VAAPI, -+ HWACCEL_VDPAU, -+ HWACCEL_COUNT -+}; -+ - // dec_video.c: - void vfm_help(void); - -@@ -21,6 +29,11 @@ - void resync_video_stream(sh_video_t *sh_video); - int get_current_video_decoder_lag(sh_video_t *sh_video); - -+int get_video_hwaccel(void); -+const char *get_video_hwaccel_name(int hwaccel); -+const char *get_video_hwaccel_short_name(int hwaccel); -+ - extern int divx_quality; -+extern char *video_hwaccel_name; - - #endif /* MPLAYER_DEC_VIDEO_H */ -diff -Naur mplayer-29746/libmpcodecs/img_format.c mplayer-29746.patch/libmpcodecs/img_format.c ---- mplayer-29746/libmpcodecs/img_format.c 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/libmpcodecs/img_format.c 2009-10-11 01:05:08.827781855 +0200 -@@ -69,6 +69,14 @@ - case IMGFMT_ZRMJPEGIB: return "Zoran MJPEG bottom field first"; - case IMGFMT_XVMC_MOCO_MPEG2: return "MPEG1/2 Motion Compensation"; - case IMGFMT_XVMC_IDCT_MPEG2: return "MPEG1/2 Motion Compensation and IDCT"; -+ case IMGFMT_VAAPI_MPEG2: return "MPEG-2 VA API Acceleration"; -+ case IMGFMT_VAAPI_MPEG2_IDCT: return "MPEG-2 VA API Acceleration (Motion Compensation and IDCT)"; -+ case IMGFMT_VAAPI_MPEG2_MOCO: return "MPEG-2 VA API Acceleration (Motion Compensation)"; -+ case IMGFMT_VAAPI_MPEG4: return "MPEG-4 VA API Acceleration"; -+ case IMGFMT_VAAPI_H263: return "H.263 VA API Acceleration"; -+ case IMGFMT_VAAPI_H264: return "H.264 VA API Acceleration"; -+ case IMGFMT_VAAPI_WMV3: return "WMV3 VA API Acceleration"; -+ case IMGFMT_VAAPI_VC1: return "VC-1 VA API Acceleration"; - case IMGFMT_VDPAU_MPEG1: return "MPEG1 VDPAU acceleration"; - case IMGFMT_VDPAU_MPEG2: return "MPEG2 VDPAU acceleration"; - case IMGFMT_VDPAU_H264: return "H.264 VDPAU acceleration"; -diff -Naur mplayer-29746/libmpcodecs/img_format.h mplayer-29746.patch/libmpcodecs/img_format.h ---- mplayer-29746/libmpcodecs/img_format.h 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/libmpcodecs/img_format.h 2009-10-11 01:05:11.673791151 +0200 -@@ -109,6 +109,26 @@ - #define IMGFMT_XVMC_MOCO_MPEG2 (IMGFMT_XVMC|0x02) - #define IMGFMT_XVMC_IDCT_MPEG2 (IMGFMT_XVMC|0x82) - -+/* VA API Formats */ -+ -+#define IMGFMT_VAAPI 0x56410000 /* 'VA'00 */ -+#define IMGFMT_VAAPI_MASK 0xFFFF0000 -+#define IMGFMT_IS_VAAPI(fmt) (((fmt) & IMGFMT_VAAPI_MASK) == IMGFMT_VAAPI) -+#define IMGFMT_VAAPI_CODEC_MASK 0x000000F0 -+#define IMGFMT_VAAPI_CODEC(fmt) ((fmt) & IMGFMT_VAAPI_CODEC_MASK) -+#define IMGFMT_VAAPI_CODEC_MPEG2 (0x10) -+#define IMGFMT_VAAPI_CODEC_MPEG4 (0x20) -+#define IMGFMT_VAAPI_CODEC_H264 (0x30) -+#define IMGFMT_VAAPI_CODEC_VC1 (0x40) -+#define IMGFMT_VAAPI_MPEG2 (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_MPEG2) -+#define IMGFMT_VAAPI_MPEG2_IDCT (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_MPEG2|1) -+#define IMGFMT_VAAPI_MPEG2_MOCO (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_MPEG2|2) -+#define IMGFMT_VAAPI_MPEG4 (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_MPEG4) -+#define IMGFMT_VAAPI_H263 (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_MPEG4|1) -+#define IMGFMT_VAAPI_H264 (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_H264) -+#define IMGFMT_VAAPI_VC1 (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_VC1) -+#define IMGFMT_VAAPI_WMV3 (IMGFMT_VAAPI|IMGFMT_VAAPI_CODEC_VC1|1) -+ - // VDPAU specific format. - #define IMGFMT_VDPAU 0x1DC80000 - #define IMGFMT_VDPAU_MASK 0xFFFF0000 -diff -Naur mplayer-29746/libmpcodecs/mp_image.h mplayer-29746.patch/libmpcodecs/mp_image.h ---- mplayer-29746/libmpcodecs/mp_image.h 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/libmpcodecs/mp_image.h 2009-10-11 01:05:18.423658026 +0200 -@@ -111,6 +111,7 @@ - // compressed formats - if(out_fmt == IMGFMT_MPEGPES || - out_fmt == IMGFMT_ZRMJPEGNI || out_fmt == IMGFMT_ZRMJPEGIT || out_fmt == IMGFMT_ZRMJPEGIB || -+ IMGFMT_IS_VAAPI(out_fmt) || - IMGFMT_IS_VDPAU(out_fmt) || IMGFMT_IS_XVMC(out_fmt)){ - mpi->bpp=0; - return; -diff -Naur mplayer-29746/libmpcodecs/vd.c mplayer-29746.patch/libmpcodecs/vd.c ---- mplayer-29746/libmpcodecs/vd.c 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/libmpcodecs/vd.c 2009-10-11 01:05:26.010782203 +0200 -@@ -348,3 +348,12 @@ - if(vf->draw_slice) - vf->draw_slice(vf,src,stride,w,h,x,y); - } -+ -+void *mpcodecs_get_hwaccel_context(sh_video_t *sh) -+{ -+ void *ctx = NULL; -+ struct vf_instance_s *vf = sh->vfilter; -+ if (vf->control(vf, VFCTRL_GET_HWACCEL_CONTEXT, &ctx) == CONTROL_TRUE) -+ return ctx; -+ return NULL; -+} -diff -Naur mplayer-29746/libmpcodecs/vd_ffmpeg.c mplayer-29746.patch/libmpcodecs/vd_ffmpeg.c ---- mplayer-29746/libmpcodecs/vd_ffmpeg.c 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/libmpcodecs/vd_ffmpeg.c 2009-10-11 01:05:36.322660521 +0200 -@@ -14,6 +14,7 @@ - #include "fmt-conversion.h" - - #include "vd_internal.h" -+#include "dec_video.h" - - static vd_info_t info = { - "FFmpeg's libavcodec codec family", -@@ -202,8 +203,8 @@ - - static void set_format_params(struct AVCodecContext *avctx, enum PixelFormat fmt){ - int imgfmt; -- imgfmt = pixfmt2imgfmt(fmt); -- if (IMGFMT_IS_XVMC(imgfmt) || IMGFMT_IS_VDPAU(imgfmt)) { -+ imgfmt = pixfmt2imgfmt(fmt, avctx->codec_id); -+ if (IMGFMT_IS_XVMC(imgfmt) || IMGFMT_IS_VDPAU(imgfmt) || IMGFMT_IS_VAAPI(imgfmt)) { - sh_video_t *sh = avctx->opaque; - vd_ffmpeg_ctx *ctx = sh->context; - ctx->do_dr1 = 1; -@@ -260,6 +261,12 @@ - avctx->codec_type = CODEC_TYPE_VIDEO; - avctx->codec_id = lavc_codec->id; - -+#if CONFIG_VAAPI -+ if(get_video_hwaccel() == HWACCEL_VAAPI){ -+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_VAAPIAcceleratedCodec); -+ avctx->get_format = get_format; -+ } -+#endif /* CONFIG_VAAPI */ - #if CONFIG_VDPAU - if(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU){ - avctx->get_format = get_format; -@@ -453,7 +460,7 @@ - AVFrame *src, int offset[4], - int y, int type, int height){ - sh_video_t *sh = s->opaque; -- uint8_t *source[MP_MAX_PLANES]= {src->data[0] + offset[0], src->data[1] + offset[1], src->data[2] + offset[2]}; -+ uint8_t *source[MP_MAX_PLANES]= {src->data[0] + offset[0], src->data[1] + offset[1], src->data[2] + offset[2], src->data[3] + offset[3]}; - #if 0 - int start=0, i; - int width= s->width; -@@ -519,9 +526,10 @@ - sh->disp_w = width; - sh->disp_h = height; - ctx->pix_fmt = pix_fmt; -- ctx->best_csp = pixfmt2imgfmt(pix_fmt); -+ ctx->best_csp = pixfmt2imgfmt(pix_fmt, avctx->codec_id); - if (!mpcodecs_config_vo(sh, sh->disp_w, sh->disp_h, ctx->best_csp)) - return -1; -+ avctx->hwaccel_context = mpcodecs_get_hwaccel_context(sh); - ctx->vo_initialized = 1; - } - return 0; -@@ -574,7 +582,9 @@ - return avctx->get_buffer(avctx, pic); - } - -- if (IMGFMT_IS_XVMC(ctx->best_csp) || IMGFMT_IS_VDPAU(ctx->best_csp)) { -+ if (IMGFMT_IS_XVMC(ctx->best_csp) || -+ IMGFMT_IS_VAAPI(ctx->best_csp) || -+ IMGFMT_IS_VDPAU(ctx->best_csp)) { - type = MP_IMGTYPE_NUMBERED | (0xffff << 16); - } else - if (!pic->buffer_hints) { -@@ -605,6 +615,11 @@ - avctx->draw_horiz_band= draw_slice; - } else - avctx->draw_horiz_band= NULL; -+#if CONFIG_VAAPI -+ if(IMGFMT_IS_VAAPI(mpi->imgfmt)) { -+ avctx->draw_horiz_band= draw_slice; -+ } -+#endif - if(IMGFMT_IS_VDPAU(mpi->imgfmt)) { - avctx->draw_horiz_band= draw_slice; - } -@@ -639,6 +654,7 @@ - pic->data[0]= mpi->planes[0]; - pic->data[1]= mpi->planes[1]; - pic->data[2]= mpi->planes[2]; -+ pic->data[3]= mpi->planes[3]; - - #if 0 - assert(mpi->width >= ((width +align)&(~align))); -@@ -663,6 +679,7 @@ - pic->linesize[0]= mpi->stride[0]; - pic->linesize[1]= mpi->stride[1]; - pic->linesize[2]= mpi->stride[2]; -+ pic->linesize[3]= mpi->stride[3]; - - pic->opaque = mpi; - //printf("%X\n", (int)mpi->planes[0]); -@@ -884,9 +901,11 @@ - mpi->planes[0]=pic->data[0]; - mpi->planes[1]=pic->data[1]; - mpi->planes[2]=pic->data[2]; -+ mpi->planes[3]=pic->data[3]; - mpi->stride[0]=pic->linesize[0]; - mpi->stride[1]=pic->linesize[1]; - mpi->stride[2]=pic->linesize[2]; -+ mpi->stride[3]=pic->linesize[3]; - } - - if (!mpi->planes[0]) -@@ -916,24 +935,62 @@ - return mpi; - } - --#if CONFIG_XVMC || CONFIG_VDPAU -+#if CONFIG_XVMC || CONFIG_VAAPI || CONFIG_VDPAU -+static inline int is_hwaccel_format(int imgfmt) -+{ -+ switch (get_video_hwaccel()) { -+ case HWACCEL_VAAPI: return IMGFMT_IS_VAAPI(imgfmt) != 0; -+ case HWACCEL_VDPAU: return IMGFMT_IS_VDPAU(imgfmt) != 0; -+ case HWACCEL_XVMC: return IMGFMT_IS_XVMC(imgfmt) != 0; -+ } -+ return 0; -+} -+ -+static int query_format(sh_video_t *sh, int fmt) -+{ -+ vd_ffmpeg_ctx * const ctx = sh->context; -+ AVCodecContext * const avctx = ctx->avctx; -+ int r, width, height; -+ /* XXX: some codecs have not initialized width and height yet at -+ this point, so we are faking the dimensions so that init_vo() -+ doesn't fail because of 0x0 size */ -+ if ((width = avctx->width) == 0) -+ avctx->width = 64; -+ if ((height = avctx->height) == 0) -+ avctx->height = 64; -+ r = init_vo(sh, fmt); -+ avctx->width = width; -+ avctx->height = height; -+ return r; -+} -+ - static enum PixelFormat get_format(struct AVCodecContext *avctx, -- const enum PixelFormat *fmt){ -- enum PixelFormat selected_format; -+ const enum PixelFormat *fmt){ -+ enum PixelFormat selected_format = PIX_FMT_NONE; - int imgfmt; - sh_video_t *sh = avctx->opaque; -- int i; -+ int i, try_hwaccel; - -- for(i=0;fmt[i]!=PIX_FMT_NONE;i++){ -- imgfmt = pixfmt2imgfmt(fmt[i]); -- if(!IMGFMT_IS_XVMC(imgfmt) && !IMGFMT_IS_VDPAU(imgfmt)) continue; -- mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_TryingPixfmt, i); -- if(init_vo(sh, fmt[i]) >= 0) { -- break; -+ for (try_hwaccel = 1; try_hwaccel >= 0; --try_hwaccel) { -+ for (i = 0; fmt[i] != PIX_FMT_NONE; i++){ -+ imgfmt = pixfmt2imgfmt(fmt[i], avctx->codec_id); -+ if ((try_hwaccel ^ is_hwaccel_format(imgfmt)) != 0) -+ continue; -+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_TryingPixfmt, i); -+ if (query_format(sh, fmt[i]) >= 0) { -+ if (try_hwaccel) { -+ /* don't allow format conversion for HW acceleration */ -+ if (sh->codec->outfmt[sh->outfmtidx] != imgfmt) -+ continue; -+ } -+ selected_format = fmt[i]; -+ break; -+ } - } -+ if (selected_format != PIX_FMT_NONE) -+ break; - } -- selected_format = fmt[i]; - set_format_params(avctx, selected_format); - return selected_format; - } --#endif /* CONFIG_XVMC || CONFIG_VDPAU */ -+#endif /* CONFIG_XVMC || CONFIG_VAAPI || CONFIG_VDPAU */ -diff -Naur mplayer-29746/libmpcodecs/vd.h mplayer-29746.patch/libmpcodecs/vd.h ---- mplayer-29746/libmpcodecs/vd.h 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/libmpcodecs/vd.h 2009-10-11 01:05:30.070783401 +0200 -@@ -34,6 +34,7 @@ - int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt); - mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); - void mpcodecs_draw_slice(sh_video_t *sh, unsigned char** src, int* stride, int w,int h, int x, int y); -+void *mpcodecs_get_hwaccel_context(sh_video_t *sh); - - #define VDFLAGS_DROPFRAME 3 - -diff -Naur mplayer-29746/libmpcodecs/vf_vo.c mplayer-29746.patch/libmpcodecs/vf_vo.c ---- mplayer-29746/libmpcodecs/vf_vo.c 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/libmpcodecs/vf_vo.c 2009-10-11 01:06:03.827659782 +0200 -@@ -151,6 +151,12 @@ - *(double *)data = vf->priv->pts; - return CONTROL_TRUE; - } -+ case VFCTRL_GET_HWACCEL_CONTEXT: -+ { -+ if(!video_out) return CONTROL_FALSE; // vo not configured? -+ return(video_out->control(VOCTRL_GET_HWACCEL_CONTEXT, data) -+ == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE; -+ } - } - // return video_out->control(request,data); - return CONTROL_UNKNOWN; -@@ -170,6 +176,7 @@ - if(!vo_config_count) return; - // GET_IMAGE is required for hardware-accelerated formats - if(vo_directrendering || -+ IMGFMT_IS_VAAPI(mpi->imgfmt) || - IMGFMT_IS_XVMC(mpi->imgfmt) || IMGFMT_IS_VDPAU(mpi->imgfmt)) - video_out->control(VOCTRL_GET_IMAGE,mpi); - } -diff -Naur mplayer-29746/libvo/video_out.c mplayer-29746.patch/libvo/video_out.c ---- mplayer-29746/libvo/video_out.c 2009-10-01 21:52:59.000000000 +0200 -+++ mplayer-29746.patch/libvo/video_out.c 2009-10-11 01:06:21.584659559 +0200 -@@ -132,6 +132,7 @@ - extern vo_functions_t video_out_quartz; - extern vo_functions_t video_out_pnm; - extern vo_functions_t video_out_md5sum; -+extern vo_functions_t video_out_vaapi; - - const vo_functions_t* const video_out_drivers[] = - { -@@ -274,6 +275,9 @@ - #ifdef CONFIG_MD5SUM - &video_out_md5sum, - #endif -+#if CONFIG_VAAPI -+ &video_out_vaapi, -+#endif - NULL - }; - -diff -Naur mplayer-29746/libvo/video_out.h mplayer-29746.patch/libvo/video_out.h ---- mplayer-29746/libvo/video_out.h 2009-10-01 21:52:59.000000000 +0200 -+++ mplayer-29746.patch/libvo/video_out.h 2009-10-11 01:06:28.035657331 +0200 -@@ -97,6 +97,10 @@ - int w,h; - } mp_win_t; - -+// Return current HW acceleration context -+// void *get_hwaccel_context(void); -+#define VOCTRL_GET_HWACCEL_CONTEXT 33 -+ - #define VO_TRUE 1 - #define VO_FALSE 0 - #define VO_ERROR -1 -diff -Naur mplayer-29746/libvo/vo_vaapi.c mplayer-29746.patch/libvo/vo_vaapi.c ---- mplayer-29746/libvo/vo_vaapi.c 1970-01-01 01:00:00.000000000 +0100 -+++ mplayer-29746.patch/libvo/vo_vaapi.c 2009-10-11 01:06:34.634665887 +0200 -@@ -0,0 +1,1146 @@ -+/* -+ * VA API output module -+ * -+ * Copyright (C) 2008-2009 Splitted-Desktop Systems -+ * -+ * 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 "config.h" -+#include "mp_msg.h" -+#include "help_mp.h" -+#include "subopt-helper.h" -+#include "video_out.h" -+#include "video_out_internal.h" -+#include "x11_common.h" -+#include "libavutil/common.h" -+#include "libavcodec/vaapi.h" -+#include "gui/interface.h" -+ -+#if CONFIG_GL -+#include "gl_common.h" -+#include -+#endif -+ -+#include -+#include -+#include -+#include -+#if CONFIG_VAAPI_GLX -+#include -+#endif -+ -+static vo_info_t info = { -+ "VA API with X11", -+ "vaapi", -+ "Gwenole Beauchesne ", -+ "" -+}; -+ -+LIBVO_EXTERN(vaapi) -+ -+/* Numbers of video surfaces */ -+#define MAX_OUTPUT_SURFACES 2 /* Maintain synchronisation points in flip_page() */ -+#define MAX_VIDEO_SURFACES 21 /* Maintain free surfaces in a queue (use least-recently-used) */ -+#define NUM_VIDEO_SURFACES_MPEG2 3 /* 1 decode frame, up to 2 references */ -+#define NUM_VIDEO_SURFACES_MPEG4 3 /* 1 decode frame, up to 2 references */ -+#define NUM_VIDEO_SURFACES_H264 17 /* 1 decode frame, up to 16 references */ -+#define NUM_VIDEO_SURFACES_VC1 3 /* 1 decode frame, up to 2 references */ -+ -+static int g_is_paused; -+static uint32_t g_image_width; -+static uint32_t g_image_height; -+static uint32_t g_image_format; -+static struct vo_rect g_output_rect; -+static VASurfaceID g_output_surfaces[MAX_OUTPUT_SURFACES]; -+static unsigned int g_output_surface; -+ -+#if CONFIG_GL -+static int gl_enabled; -+static int gl_binding; -+static int gl_reflect; -+static GLuint gl_texture; -+#endif -+ -+#if CONFIG_VAAPI_GLX -+static GLXContext gl_context; -+static XVisualInfo *gl_visual_info; -+static int gl_visual_attr[] = { -+ GLX_RGBA, -+ GLX_RED_SIZE, 1, -+ GLX_GREEN_SIZE, 1, -+ GLX_BLUE_SIZE, 1, -+ GLX_DOUBLEBUFFER, -+ GL_NONE -+}; -+static void *gl_surface; -+#endif -+ -+static struct vaapi_context *va_context; -+static VAProfile *va_profiles; -+static int va_num_profiles; -+static VAEntrypoint *va_entrypoints; -+static int va_num_entrypoints; -+static VASurfaceID *va_surface_ids; -+static int va_num_surfaces; -+static VASurfaceID **va_free_surfaces; -+static int va_free_surfaces_head_index; -+static int va_free_surfaces_tail_index; -+static VAImageFormat *va_image_formats; -+static int va_num_image_formats; -+ -+///< Flag: direct surface mapping: use mpi->number to select free VA surface? -+static int va_dm; -+ -+static int check_status(VAStatus status, const char *msg) -+{ -+ if (status != VA_STATUS_SUCCESS) { -+ mp_msg(MSGT_VO, MSGL_ERR, "[vo_vaapi] %s: %s\n", msg, vaErrorStr(status)); -+ return 0; -+ } -+ return 1; -+} -+ -+static const char *string_of_VAImageFormat(VAImageFormat *imgfmt) -+{ -+ static char str[5]; -+ str[0] = imgfmt->fourcc; -+ str[1] = imgfmt->fourcc >> 8; -+ str[2] = imgfmt->fourcc >> 16; -+ str[3] = imgfmt->fourcc >> 24; -+ str[4] = '\0'; -+ return str; -+} -+ -+static const char *string_of_VAProfile(VAProfile profile) -+{ -+ switch (profile) { -+#define PROFILE(profile) \ -+ case VAProfile##profile: return "VAProfile" #profile -+ PROFILE(MPEG2Simple); -+ PROFILE(MPEG2Main); -+ PROFILE(MPEG4Simple); -+ PROFILE(MPEG4AdvancedSimple); -+ PROFILE(MPEG4Main); -+ PROFILE(H264Baseline); -+ PROFILE(H264Main); -+ PROFILE(H264High); -+ PROFILE(VC1Simple); -+ PROFILE(VC1Main); -+ PROFILE(VC1Advanced); -+#undef PROFILE -+ } -+ return ""; -+} -+ -+static const char *string_of_VAEntrypoint(VAEntrypoint entrypoint) -+{ -+ switch (entrypoint) { -+#define ENTRYPOINT(entrypoint) \ -+ case VAEntrypoint##entrypoint: return "VAEntrypoint" #entrypoint -+ ENTRYPOINT(VLD); -+ ENTRYPOINT(IZZ); -+ ENTRYPOINT(IDCT); -+ ENTRYPOINT(MoComp); -+ ENTRYPOINT(Deblocking); -+#undef ENTRYPOINT -+ } -+ return ""; -+} -+ -+static int has_profile(VAProfile profile) -+{ -+ if (va_profiles && va_num_profiles > 0) { -+ int i; -+ for (i = 0; i < va_num_profiles; i++) { -+ if (va_profiles[i] == profile) -+ return 1; -+ } -+ } -+ return 0; -+} -+ -+static int VAProfile_from_imgfmt(uint32_t format) -+{ -+ static const int mpeg2_profiles[] = -+ { VAProfileMPEG2Main, VAProfileMPEG2Simple, -1 }; -+ static const int mpeg4_profiles[] = -+ { VAProfileMPEG4Main, VAProfileMPEG4AdvancedSimple, VAProfileMPEG4Simple, -1 }; -+ static const int h264_profiles[] = -+ { VAProfileH264High, VAProfileH264Main, VAProfileH264Baseline, -1 }; -+ static const int wmv3_profiles[] = -+ { VAProfileVC1Main, VAProfileVC1Simple, -1 }; -+ static const int vc1_profiles[] = -+ { VAProfileVC1Advanced, -1 }; -+ -+ const int *profiles = NULL; -+ switch (IMGFMT_VAAPI_CODEC(format)) { -+ case IMGFMT_VAAPI_CODEC_MPEG2: -+ profiles = mpeg2_profiles; -+ break; -+ case IMGFMT_VAAPI_CODEC_MPEG4: -+ profiles = mpeg4_profiles; -+ break; -+ case IMGFMT_VAAPI_CODEC_H264: -+ profiles = h264_profiles; -+ break; -+ case IMGFMT_VAAPI_CODEC_VC1: -+ switch (format) { -+ case IMGFMT_VAAPI_WMV3: -+ profiles = wmv3_profiles; -+ break; -+ case IMGFMT_VAAPI_VC1: -+ profiles = vc1_profiles; -+ break; -+ } -+ break; -+ } -+ -+ if (profiles) { -+ for (int i = 0; profiles[i] != -1; i++) { -+ if (has_profile(profiles[i])) -+ return profiles[i]; -+ } -+ } -+ return -1; -+} -+ -+static int has_entrypoint(VAEntrypoint entrypoint) -+{ -+ if (va_entrypoints && va_num_entrypoints > 0) { -+ int i; -+ for (i = 0; i < va_num_entrypoints; i++) { -+ if (va_entrypoints[i] == entrypoint) -+ return 1; -+ } -+ } -+ return 0; -+} -+ -+static int VAEntrypoint_from_imgfmt(uint32_t format) -+{ -+ int entrypoint = 0; -+ switch (format) { -+ case IMGFMT_VAAPI_MPEG2: -+ case IMGFMT_VAAPI_MPEG4: -+ case IMGFMT_VAAPI_H263: -+ case IMGFMT_VAAPI_H264: -+ case IMGFMT_VAAPI_WMV3: -+ case IMGFMT_VAAPI_VC1: -+ entrypoint = VAEntrypointVLD; -+ break; -+ case IMGFMT_VAAPI_MPEG2_IDCT: -+ entrypoint = VAEntrypointIDCT; -+ break; -+ case IMGFMT_VAAPI_MPEG2_MOCO: -+ entrypoint = VAEntrypointMoComp; -+ break; -+ } -+ -+ if (entrypoint) -+ return has_entrypoint(entrypoint); -+ -+ return -1; -+} -+ -+static void resize(void) -+{ -+ struct vo_rect src; -+ -+ calc_src_dst_rects(g_image_width, g_image_height, -+ &src, &g_output_rect, NULL, NULL); -+ -+ vo_x11_clearwindow(mDisplay, vo_window); -+ -+#if CONFIG_GL -+#define FOVY 60.0f -+#define ASPECT 1.0f -+#define Z_NEAR 0.1f -+#define Z_FAR 100.0f -+#define Z_CAMERA 0.869f -+ -+ if (gl_enabled) { -+ glViewport(0, 0, vo_dwidth, vo_dheight); -+ glMatrixMode(GL_PROJECTION); -+ glLoadIdentity(); -+ gluPerspective(FOVY, ASPECT, Z_NEAR, Z_FAR); -+ glMatrixMode(GL_MODELVIEW); -+ glLoadIdentity(); -+ -+ glTranslatef(-0.5f, -0.5f, -Z_CAMERA); -+ glScalef(1.0f / (GLfloat)vo_dwidth, -+ -1.0f / (GLfloat)vo_dheight, -+ 1.0f / (GLfloat)vo_dwidth); -+ glTranslatef(0.0f, -1.0f * (GLfloat)vo_dheight, 0.0f); -+ } -+#endif -+ -+ flip_page(); -+} -+ -+static int is_direct_mapping_init(void) -+{ -+ VADisplayAttribute attr; -+ VAStatus status; -+ -+ if (va_dm < 2) -+ return va_dm; -+ -+ attr.type = VADisplayAttribDirectSurface; -+ attr.flags = VA_DISPLAY_ATTRIB_GETTABLE; -+ -+ status = vaGetDisplayAttributes(va_context->display, &attr, 1); -+ if (!check_status(status, "vaGetDisplayAttributes()") && -+ status != VA_STATUS_ERROR_ATTR_NOT_SUPPORTED) -+ return 0; -+ -+ return !attr.value; -+} -+ -+static inline int is_direct_mapping(void) -+{ -+ static int dm = -1; -+ if (dm < 0) { -+ dm = is_direct_mapping_init(); -+ if (dm) -+ mp_msg(MSGT_VO, MSGL_INFO, -+ "[vo_vaapi] Using 1:1 VA surface mapping\n"); -+ } -+ return dm; -+} -+ -+static int int_012(int *n) -+{ -+ return *n >= 0 && *n <= 2; -+} -+ -+static const opt_t subopts[] = { -+ { "dm", OPT_ARG_INT, &va_dm, (opt_test_f)int_012 }, -+#if CONFIG_GL -+ { "gl", OPT_ARG_BOOL, &gl_enabled, NULL }, -+ { "bind", OPT_ARG_BOOL, &gl_binding, NULL }, -+ { "reflect", OPT_ARG_BOOL, &gl_reflect, NULL }, -+#endif -+ { NULL, } -+}; -+ -+static int preinit(const char *arg) -+{ -+ VAStatus status; -+ int va_major_version, va_minor_version; -+ int i, max_image_formats, max_profiles; -+ -+ va_dm = 2; -+ if (subopt_parse(arg, subopts) != 0) { -+ mp_msg(MSGT_VO, MSGL_FATAL, -+ "\n-vo vaapi command line help:\n" -+ "Example: mplayer -vo vaapi:gl\n" -+ "\nOptions:\n" -+ " dm=0|1|2\n" -+ " Use direct surface mapping (default: 2 - autodetect)\n" -+#if CONFIG_GL -+ " gl\n" -+ " Enable OpenGL rendering\n" -+ " bind\n" -+ " Use VA surface binding instead of copy\n" -+ " reflect\n" -+ " Enable OpenGL reflection effects\n" -+#endif -+ "\n" ); -+ return -1; -+ } -+#if CONFIG_GL -+ if (gl_enabled) -+ mp_msg(MSGT_VO, MSGL_INFO, "[vo_vaapi] Using OpenGL rendering%s\n", -+ gl_reflect ? ", with reflection effects" : ""); -+#endif -+ -+ if (!vo_init()) -+ return -1; -+ -+ va_context = calloc(1, sizeof(*va_context)); -+ if (!va_context) -+ return -1; -+ -+#if CONFIG_VAAPI_GLX -+ if (gl_enabled) -+ va_context->display = vaGetDisplayGLX(mDisplay); -+ else -+#endif -+ va_context->display = vaGetDisplay(mDisplay); -+ if (!va_context->display) -+ return -1; -+ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] preinit(): VA display %p\n", va_context->display); -+ -+ status = vaInitialize(va_context->display, &va_major_version, &va_minor_version); -+ if (!check_status(status, "vaInitialize()")) -+ return -1; -+ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] preinit(): VA API version %d.%d\n", -+ va_major_version, va_minor_version); -+ -+ max_image_formats = vaMaxNumImageFormats(va_context->display); -+ va_image_formats = calloc(max_image_formats, sizeof(*va_image_formats)); -+ if (!va_image_formats) -+ return -1; -+ status = vaQueryImageFormats(va_context->display, va_image_formats, &va_num_image_formats); -+ if (!check_status(status, "vaQueryImageFormats()")) -+ return -1; -+ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] preinit(): %d image formats available\n", -+ va_num_image_formats); -+ for (i = 0; i < va_num_image_formats; i++) -+ mp_msg(MSGT_VO, MSGL_DBG2, " %s\n", string_of_VAImageFormat(&va_image_formats[i])); -+ -+ max_profiles = vaMaxNumProfiles(va_context->display); -+ va_profiles = calloc(max_profiles, sizeof(*va_profiles)); -+ if (!va_profiles) -+ return -1; -+ status = vaQueryConfigProfiles(va_context->display, va_profiles, &va_num_profiles); -+ if (!check_status(status, "vaQueryConfigProfiles()")) -+ return -1; -+ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] preinit(): %d profiles available\n", -+ va_num_profiles); -+ for (i = 0; i < va_num_profiles; i++) -+ mp_msg(MSGT_VO, MSGL_DBG2, " %s\n", string_of_VAProfile(va_profiles[i])); -+ -+ return 0; -+} -+ -+static void free_video_specific(void) -+{ -+#if CONFIG_VAAPI_GLX -+ if (gl_surface) { -+ VAStatus status; -+ status = vaDestroySurfaceGLX(va_context->display, gl_surface); -+ check_status(status, "vaDestroySurfaceGLX()"); -+ gl_surface = NULL; -+ } -+#endif -+ -+ if (va_context && va_context->context_id) { -+ vaDestroyContext(va_context->display, va_context->context_id); -+ va_context->context_id = 0; -+ } -+ -+ if (va_free_surfaces) { -+ free(va_free_surfaces); -+ va_free_surfaces = NULL; -+ } -+ -+ if (va_surface_ids) { -+ vaDestroySurfaces(va_context->display, va_surface_ids, va_num_surfaces); -+ free(va_surface_ids); -+ va_surface_ids = NULL; -+ } -+ -+ if (va_context && va_context->config_id) { -+ vaDestroyConfig(va_context->display, va_context->config_id); -+ va_context->config_id = 0; -+ } -+ -+ if (va_entrypoints) { -+ free(va_entrypoints); -+ va_entrypoints = NULL; -+ } -+ -+#if CONFIG_GL -+ if (gl_texture) { -+ glDeleteTextures(1, &gl_texture); -+ gl_texture = GL_NONE; -+ } -+#endif -+ -+#if CONFIG_VAAPI_GLX -+ if (gl_enabled) { -+ releaseGlContext(&gl_visual_info, &gl_context); -+ gl_visual_info = NULL; -+ } -+#endif -+} -+ -+static void uninit(void) -+{ -+ free_video_specific(); -+ -+ if (va_profiles) { -+ free(va_profiles); -+ va_profiles = NULL; -+ } -+ -+ if (va_image_formats) { -+ free(va_image_formats); -+ va_image_formats = NULL; -+ } -+ -+ if (va_context && va_context->display) { -+ vaTerminate(va_context->display); -+ va_context->display = NULL; -+ } -+ -+ if (va_context) { -+ free(va_context); -+ va_context = NULL; -+ } -+ -+#ifdef CONFIG_XF86VM -+ vo_vm_close(); -+#endif -+ vo_x11_uninit(); -+} -+ -+static int config_x11(uint32_t width, uint32_t height, -+ uint32_t display_width, uint32_t display_height, -+ uint32_t flags, char *title) -+{ -+ Colormap cmap; -+ XVisualInfo visualInfo; -+ XVisualInfo *vi; -+ XSetWindowAttributes xswa; -+ unsigned long xswa_mask; -+ XWindowAttributes wattr; -+ int depth; -+ -+#ifdef CONFIG_GUI -+ if (use_gui) -+ guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize our window -+ else -+#endif -+ { -+#ifdef CONFIG_XF86VM -+ if (flags & VOFLAG_MODESWITCHING) -+ vo_vm_switch(); -+#endif -+ XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &wattr); -+ depth = wattr.depth; -+ if (depth != 15 && depth != 16 && depth != 24 && depth != 32) -+ depth = 24; -+ XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &visualInfo); -+ -+#if CONFIG_VAAPI_GLX -+ if (gl_enabled) { -+ vi = glXChooseVisual(mDisplay, mScreen, gl_visual_attr); -+ if (!vi) -+ return -1; -+ cmap = XCreateColormap(mDisplay, mRootWin, vi->visual, AllocNone); -+ if (cmap == None) -+ return -1; -+ } -+ else -+#endif -+ { -+ vi = &visualInfo; -+ XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, vi); -+ cmap = CopyFromParent; -+ } -+ -+ vo_x11_create_vo_window(vi, -+ vo_dx, vo_dy, display_width, display_height, -+ flags, cmap, "vaapi", title); -+ -+ if (vi != &visualInfo) -+ XFree(vi); -+ -+ xswa_mask = CWBorderPixel | CWBackPixel; -+ xswa.border_pixel = 0; -+ xswa.background_pixel = 0; -+ XChangeWindowAttributes(mDisplay, vo_window, xswa_mask, &xswa); -+ -+#ifdef CONFIG_XF86VM -+ if (flags & VOFLAG_MODESWITCHING) { -+ /* Grab the mouse pointer in our window */ -+ if (vo_grabpointer) -+ XGrabPointer(mDisplay, vo_window, True, 0, -+ GrabModeAsync, GrabModeAsync, -+ vo_window, None, CurrentTime); -+ XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); -+ } -+#endif -+ } -+ -+ if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) -+ vo_fs = VO_TRUE; -+ return 0; -+} -+ -+#if CONFIG_VAAPI_GLX -+static int config_glx(unsigned int width, unsigned int height) -+{ -+ if (setGlWindow(&gl_visual_info, &gl_context, vo_window) < 0) -+ return -1; -+ -+ glDisable(GL_DEPTH_TEST); -+ glDepthMask(GL_FALSE); -+ glDisable(GL_CULL_FACE); -+ glEnable(GL_TEXTURE_2D); -+ glDrawBuffer(vo_doublebuffering ? GL_BACK : GL_FRONT); -+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); -+ glEnable(GL_BLEND); -+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -+ -+ /* Create OpenGL texture */ -+ /* XXX: assume GL_ARB_texture_non_power_of_two is available */ -+ glEnable(GL_TEXTURE_2D); -+ glGenTextures(1, &gl_texture); -+ BindTexture(GL_TEXTURE_2D, gl_texture); -+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); -+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4); -+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, -+ GL_BGRA, GL_UNSIGNED_BYTE, NULL); -+ BindTexture(GL_TEXTURE_2D, 0); -+ glDisable(GL_TEXTURE_2D); -+ -+ glClearColor(0.0, 0.0, 0.0, 1.0); -+ glClear(GL_COLOR_BUFFER_BIT); -+ return 0; -+} -+#endif -+ -+static int config_vaapi(uint32_t width, uint32_t height, uint32_t format) -+{ -+ VAConfigAttrib attrib; -+ VAStatus status; -+ int i, profile, entrypoint, max_entrypoints; -+ -+ /* Check profile */ -+ profile = VAProfile_from_imgfmt(format); -+ if (profile < 0) -+ return -1; -+ -+ /* Check entry-point (only VLD for now) */ -+ max_entrypoints = vaMaxNumEntrypoints(va_context->display); -+ va_entrypoints = calloc(max_entrypoints, sizeof(*va_entrypoints)); -+ if (!va_entrypoints) -+ return -1; -+ -+ status = vaQueryConfigEntrypoints(va_context->display, profile, -+ va_entrypoints, &va_num_entrypoints); -+ if (!check_status(status, "vaQueryConfigEntrypoints()")) -+ return -1; -+ -+ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] config_vaapi(%s): %d entrypoints available\n", -+ string_of_VAProfile(profile), va_num_entrypoints); -+ for (i = 0; i < va_num_entrypoints; i++) -+ mp_msg(MSGT_VO, MSGL_DBG2, " %s\n", string_of_VAEntrypoint(va_entrypoints[i])); -+ -+ entrypoint = VAEntrypoint_from_imgfmt(format); -+ if (entrypoint != VAEntrypointVLD) -+ return -1; -+ -+ /* Check chroma format (only 4:2:0 for now) */ -+ attrib.type = VAConfigAttribRTFormat; -+ status = vaGetConfigAttributes(va_context->display, profile, entrypoint, &attrib, 1); -+ if (!check_status(status, "vaGetConfigAttributes()")) -+ return -1; -+ if ((attrib.value & VA_RT_FORMAT_YUV420) == 0) -+ return -1; -+ -+ /* Create a configuration for the decode pipeline */ -+ status = vaCreateConfig(va_context->display, profile, entrypoint, &attrib, 1, &va_context->config_id); -+ if (!check_status(status, "vaCreateConfig()")) -+ return -1; -+ -+ /* Create video surfaces */ -+ switch (IMGFMT_VAAPI_CODEC(format)) { -+ case IMGFMT_VAAPI_CODEC_MPEG2: -+ va_num_surfaces = NUM_VIDEO_SURFACES_MPEG2; -+ break; -+ case IMGFMT_VAAPI_CODEC_MPEG4: -+ va_num_surfaces = NUM_VIDEO_SURFACES_MPEG4; -+ break; -+ case IMGFMT_VAAPI_CODEC_H264: -+ va_num_surfaces = NUM_VIDEO_SURFACES_H264; -+ break; -+ case IMGFMT_VAAPI_CODEC_VC1: -+ va_num_surfaces = NUM_VIDEO_SURFACES_VC1; -+ break; -+ default: -+ va_num_surfaces = 0; -+ break; -+ } -+ if (va_num_surfaces == 0) -+ return -1; -+ if (!is_direct_mapping()) -+ va_num_surfaces = FFMIN(2 * va_num_surfaces, MAX_VIDEO_SURFACES); -+ -+ va_surface_ids = calloc(va_num_surfaces, sizeof(*va_surface_ids)); -+ if (!va_surface_ids) -+ return -1; -+ -+ status = vaCreateSurfaces(va_context->display, width, height, VA_RT_FORMAT_YUV420, -+ va_num_surfaces, va_surface_ids); -+ if (!check_status(status, "vaCreateSurfaces()")) -+ return -1; -+ -+ va_free_surfaces = calloc(va_num_surfaces, sizeof(*va_free_surfaces)); -+ if (!va_free_surfaces) -+ return -1; -+ for (i = 0; i < va_num_surfaces; i++) -+ va_free_surfaces[i] = &va_surface_ids[i]; -+ -+#if CONFIG_VAAPI_GLX -+ /* Create GLX surfaces */ -+ if (gl_enabled) { -+ status = vaCreateSurfaceGLX(va_context->display, -+ GL_TEXTURE_2D, gl_texture, -+ &gl_surface); -+ if (!check_status(status, "vaCreateSurfaceGLX()")) -+ return -1; -+ } -+#endif -+ -+ /* Create a context for the decode pipeline */ -+ status = vaCreateContext(va_context->display, va_context->config_id, -+ width, height, VA_PROGRESSIVE, -+ va_surface_ids, va_num_surfaces, -+ &va_context->context_id); -+ if (!check_status(status, "vaCreateContext()")) -+ return -1; -+ -+ g_output_surface = 0; -+ for (i = 0; i < MAX_OUTPUT_SURFACES; i++) -+ g_output_surfaces[i] = VA_INVALID_SURFACE; -+ return 0; -+} -+ -+static int config(uint32_t width, uint32_t height, -+ uint32_t display_width, uint32_t display_height, -+ uint32_t flags, char *title, uint32_t format) -+{ -+ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] config(): size %dx%d, display size %dx%d, flags %x, title '%s', format %x (%s)\n", -+ width, height, display_width, display_height, flags, title, format, vo_format_name(format)); -+ -+ free_video_specific(); -+ -+ if (config_x11(width, height, display_width, display_height, flags, title) < 0) -+ return -1; -+ -+#if CONFIG_VAAPI_GLX -+ if (gl_enabled && config_glx(width, height) < 0) -+ return -1; -+#endif -+ -+ if (config_vaapi(width, height, format) < 0) -+ return -1; -+ -+ g_is_paused = 0; -+ g_image_width = width; -+ g_image_height = height; -+ g_image_format = format; -+ resize(); -+ return 0; -+} -+ -+static int query_format(uint32_t format) -+{ -+ const int default_caps = (VFCAP_CSP_SUPPORTED | -+ VFCAP_CSP_SUPPORTED_BY_HW | -+ VFCAP_HWSCALE_UP | -+ VFCAP_HWSCALE_DOWN); -+ -+ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] query_format(): format %x (%s)\n", -+ format, vo_format_name(format)); -+ -+ switch (format) { -+ case IMGFMT_VAAPI_MPEG2: -+ case IMGFMT_VAAPI_MPEG4: -+ case IMGFMT_VAAPI_H263: -+ case IMGFMT_VAAPI_H264: -+ case IMGFMT_VAAPI_WMV3: -+ case IMGFMT_VAAPI_VC1: -+ return default_caps | VOCAP_NOSLICES; -+ } -+ return 0; -+} -+ -+static void put_surface_x11(VASurfaceID surface) -+{ -+ VAStatus status; -+ -+ status = vaPutSurface(va_context->display, -+ surface, -+ vo_window, -+ 0, 0, g_image_width, g_image_height, -+ g_output_rect.left, -+ g_output_rect.top, -+ g_output_rect.width, -+ g_output_rect.height, -+ NULL, 0, -+ VA_FRAME_PICTURE); -+ if (!check_status(status, "vaPutSurface()")) -+ return; -+} -+ -+#if CONFIG_VAAPI_GLX -+static void put_surface_glx(VASurfaceID surface) -+{ -+ VAStatus status; -+ -+ if (surface == VA_INVALID_SURFACE) -+ return; -+ -+ if (gl_binding) { -+ status = vaAssociateSurfaceGLX(va_context->display, -+ gl_surface, -+ surface, -+ VA_FRAME_PICTURE); -+ if (!check_status(status, "vaAssociateSurfaceGLX()")) -+ return; -+ } -+ else { -+ status = vaCopySurfaceGLX(va_context->display, -+ gl_surface, -+ surface, -+ VA_FRAME_PICTURE); -+ if (status == VA_STATUS_ERROR_UNIMPLEMENTED) { -+ mp_msg(MSGT_VO, MSGL_WARN, -+ "[vaapi] vaCopySurfaceGLX() is not implemented\n"); -+ gl_binding = 1; -+ } -+ else { -+ if (!check_status(status, "vaCopySurfaceGLX()")) -+ return; -+ } -+ } -+ g_output_surfaces[g_output_surface] = surface; -+} -+ -+static int glx_bind_texture(void) -+{ -+ VAStatus status; -+ -+ glEnable(GL_TEXTURE_2D); -+ BindTexture(GL_TEXTURE_2D, gl_texture); -+ -+ if (gl_binding) { -+ status = vaBeginRenderSurfaceGLX(va_context->display, gl_surface); -+ if (!check_status(status, "vaBeginRenderSurfaceGLX()")) -+ return -1; -+ } -+ return 0; -+} -+ -+static int glx_unbind_texture(void) -+{ -+ VAStatus status; -+ -+ if (gl_binding) { -+ status = vaEndRenderSurfaceGLX(va_context->display, gl_surface); -+ if (!check_status(status, "vaEndRenderSurfaceGLX()")) -+ return -1; -+ } -+ -+ BindTexture(GL_TEXTURE_2D, 0); -+ glDisable(GL_TEXTURE_2D); -+ return 0; -+} -+ -+static void render_background(void) -+{ -+ /* Original code from Mirco Muller (MacSlow): -+ */ -+ GLfloat fStartX = 0.0f; -+ GLfloat fStartY = 0.0f; -+ GLfloat fWidth = (GLfloat)vo_dwidth; -+ GLfloat fHeight = (GLfloat)vo_dheight; -+ -+ glBegin(GL_QUADS); -+ { -+ /* top third, darker grey to white */ -+ glColor3f(0.85f, 0.85f, 0.85f); -+ glVertex3f(fStartX, fStartY, 0.0f); -+ glColor3f(0.85f, 0.85f, 0.85f); -+ glVertex3f(fStartX + fWidth, fStartY, 0.0f); -+ glColor3f(1.0f, 1.0f, 1.0f); -+ glVertex3f(fStartX + fWidth, fStartY + fHeight / 3.0f, 0.0f); -+ glColor3f(1.0f, 1.0f, 1.0f); -+ glVertex3f(fStartX, fStartY + fHeight / 3.0f, 0.0f); -+ -+ /* middle third, just plain white */ -+ glColor3f(1.0f, 1.0f, 1.0f); -+ glVertex3f(fStartX, fStartY + fHeight / 3.0f, 0.0f); -+ glVertex3f(fStartX + fWidth, fStartY + fHeight / 3.0f, 0.0f); -+ glVertex3f(fStartX + fWidth, fStartY + 2.0f * fHeight / 3.0f, 0.0f); -+ glVertex3f(fStartX, fStartY + 2.0f * fHeight / 3.0f, 0.0f); -+ -+ /* bottom third, white to lighter grey */ -+ glColor3f(1.0f, 1.0f, 1.0f); -+ glVertex3f(fStartX, fStartY + 2.0f * fHeight / 3.0f, 0.0f); -+ glColor3f(1.0f, 1.0f, 1.0f); -+ glVertex3f(fStartX + fWidth, fStartY + 2.0f * fHeight / 3.0f, 0.0f); -+ glColor3f(0.62f, 0.66f, 0.69f); -+ glVertex3f(fStartX + fWidth, fStartY + fHeight, 0.0f); -+ glColor3f(0.62f, 0.66f, 0.69f); -+ glVertex3f(fStartX, fStartY + fHeight, 0.0f); -+ } -+ glEnd(); -+} -+ -+static void render_frame(void) -+{ -+ struct vo_rect * const r = &g_output_rect; -+ -+ if (glx_bind_texture() < 0) -+ return; -+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f); -+ glBegin(GL_QUADS); -+ { -+ glTexCoord2f(0.0f, 0.0f); glVertex2i(r->left, r->top); -+ glTexCoord2f(0.0f, 1.0f); glVertex2i(r->left, r->bottom); -+ glTexCoord2f(1.0f, 1.0f); glVertex2i(r->right, r->bottom); -+ glTexCoord2f(1.0f, 0.0f); glVertex2i(r->right, r->top); -+ } -+ glEnd(); -+ if (glx_unbind_texture() < 0) -+ return; -+} -+ -+static void render_reflection(void) -+{ -+ struct vo_rect * const r = &g_output_rect; -+ const unsigned int rh = g_output_rect.height / 5; -+ GLfloat ry = 1.0f - (GLfloat)rh / (GLfloat)r->height; -+ -+ if (glx_bind_texture() < 0) -+ return; -+ glBegin(GL_QUADS); -+ { -+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f); -+ glTexCoord2f(0.0f, 1.0f); glVertex2i(r->left, r->top); -+ glTexCoord2f(1.0f, 1.0f); glVertex2i(r->right, r->top); -+ -+ glColor4f(1.0f, 1.0f, 1.0f, 0.0f); -+ glTexCoord2f(1.0f, ry); glVertex2i(r->right, r->top + rh); -+ glTexCoord2f(0.0f, ry); glVertex2i(r->left, r->top + rh); -+ } -+ glEnd(); -+ if (glx_unbind_texture() < 0) -+ return; -+} -+ -+static void flip_page_glx(void) -+{ -+ VAStatus status; -+ -+ glClear(GL_COLOR_BUFFER_BIT); -+ -+ if (gl_reflect) { -+ render_background(); -+ -+ glPushMatrix(); -+ glRotatef(20.0f, 0.0f, 1.0f, 0.0f); -+ glTranslatef(50.0f, 0.0f, 0.0f); -+ } -+ -+ render_frame(); -+ -+ if (gl_reflect) { -+ glPushMatrix(); -+ glTranslatef(0.0, (GLfloat)g_output_rect.height + 5.0f, 0.0f); -+ render_reflection(); -+ glPopMatrix(); -+ glPopMatrix(); -+ } -+ -+ swapGlBuffers(); -+ -+ if (vo_fs) /* avoid flickering borders in fullscreen mode */ -+ glClear(GL_COLOR_BUFFER_BIT); -+} -+#endif -+ -+static void put_surface(VASurfaceID surface) -+{ -+ if (surface == VA_INVALID_SURFACE) -+ return; -+ -+#if CONFIG_VAAPI_GLX -+ if (gl_enabled) -+ put_surface_glx(surface); -+ else -+#endif -+ put_surface_x11(surface); -+} -+ -+static inline int sync_surface(VASurfaceID surface) -+{ -+ VAStatus status; -+ -+ status = vaSyncSurface(va_context->display, -+#if !VA_CHECK_VERSION(0,31,0) -+ va_context->context_id, -+#endif -+ surface); -+ if (!check_status(status, "vaSyncSurface()")) -+ return -1; -+ return 0; -+} -+ -+static int draw_slice(uint8_t * image[], int stride[], -+ int w, int h, int x, int y) -+{ -+ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] draw_slice(): location (%d,%d), size %dx%d\n", x, y, w, h); -+ -+ return VO_TRUE; -+} -+ -+static int draw_frame(uint8_t * src[]) -+{ -+ mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_X11_DrawFrameCalled); -+ -+ return -1; -+} -+ -+static void draw_osd(void) -+{ -+ // XXX: not implemented -+} -+ -+static void flip_page(void) -+{ -+ VASurfaceID surface; -+ -+ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] flip_page()\n"); -+ -+ surface = g_output_surfaces[g_output_surface]; -+ if (surface != VA_INVALID_SURFACE) -+ put_surface(surface); -+ -+ surface = g_output_surfaces[(g_output_surface - 1) % MAX_OUTPUT_SURFACES]; -+ if (surface != VA_INVALID_SURFACE) -+ sync_surface(surface); -+ g_output_surface = (g_output_surface + 1) % MAX_OUTPUT_SURFACES; -+ -+#if CONFIG_VAAPI_GLX -+ if (gl_enabled && surface != VA_INVALID_SURFACE) -+ flip_page_glx(); -+#endif -+} -+ -+static VASurfaceID *get_surface(mp_image_t *mpi) -+{ -+ VASurfaceID *surface; -+ -+ if (is_direct_mapping()) { -+ assert(mpi->number < va_num_surfaces); -+ surface = va_free_surfaces[mpi->number]; -+ return surface; -+ } -+ -+ /* Push current surface to a free slot */ -+ if (mpi->priv) { -+ assert(!va_free_surfaces[va_free_surfaces_tail_index]); -+ va_free_surfaces[va_free_surfaces_tail_index] = mpi->priv; -+ va_free_surfaces_tail_index = (va_free_surfaces_tail_index + 1) % va_num_surfaces; -+ } -+ -+ /* Pop the least recently used free surface */ -+ assert(va_free_surfaces[va_free_surfaces_head_index]); -+ surface = va_free_surfaces[va_free_surfaces_head_index]; -+ va_free_surfaces[va_free_surfaces_head_index] = NULL; -+ va_free_surfaces_head_index = (va_free_surfaces_head_index + 1) % va_num_surfaces; -+ return surface; -+} -+ -+static uint32_t get_image(mp_image_t *mpi) -+{ -+ VASurfaceID *surface; -+ -+ if (mpi->type != MP_IMGTYPE_NUMBERED) -+ return VO_FALSE; -+ -+ if (!IMGFMT_IS_VAAPI(g_image_format)) -+ return VO_FALSE; -+ -+ surface = get_surface(mpi); -+ if (!surface) -+ return VO_FALSE; -+ -+ mpi->flags |= MP_IMGFLAG_DIRECT; -+ mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = mpi->stride[3] = 0; -+ mpi->planes[0] = mpi->planes[1] = mpi->planes[2] = mpi->planes[3] = NULL; -+ mpi->planes[0] = mpi->planes[3] = (char *)(uintptr_t)*surface; -+ mpi->num_planes = 1; -+ mpi->priv = surface; -+ -+ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] get_image(): surface 0x%08x\n", *surface); -+ -+ return VO_TRUE; -+} -+ -+static uint32_t draw_image(mp_image_t *mpi) -+{ -+ VASurfaceID surface = (uintptr_t)mpi->planes[3]; -+ -+ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] draw_image(): surface 0x%08x\n", surface); -+ -+ g_output_surfaces[g_output_surface] = surface; -+ return VO_TRUE; -+} -+ -+static void check_events(void) -+{ -+ int events = vo_x11_check_events(mDisplay); -+ -+ if (events & VO_EVENT_RESIZE) -+ resize(); -+ -+ if ((events & (VO_EVENT_EXPOSE|VO_EVENT_RESIZE)) && g_is_paused) { -+ VASurfaceID surface = g_output_surfaces[g_output_surface]; -+ if (surface != VA_INVALID_SURFACE) -+ put_surface(surface); -+ } -+} -+ -+static int control(uint32_t request, void *data, ...) -+{ -+ switch (request) { -+ case VOCTRL_PAUSE: -+ return (g_is_paused = 1); -+ case VOCTRL_RESUME: -+ return (g_is_paused = 0); -+ case VOCTRL_QUERY_FORMAT: -+ return query_format(*((uint32_t *)data)); -+ case VOCTRL_GET_IMAGE: -+ return get_image(data); -+ case VOCTRL_DRAW_IMAGE: -+ return draw_image(data); -+ case VOCTRL_GUISUPPORT: -+ return VO_TRUE; -+ case VOCTRL_BORDER: -+ vo_x11_border(); -+ resize(); -+ return VO_TRUE; -+ case VOCTRL_FULLSCREEN: -+ vo_x11_fullscreen(); -+ resize(); -+ return VO_TRUE; -+ case VOCTRL_ONTOP: -+ vo_x11_ontop(); -+ return VO_TRUE; -+ case VOCTRL_GET_PANSCAN: -+ return VO_TRUE; -+ case VOCTRL_SET_PANSCAN: -+ resize(); -+ return VO_TRUE; -+ case VOCTRL_GET_HWACCEL_CONTEXT: -+ *((void **)data) = va_context; -+ return VO_TRUE; -+ } -+ return VO_NOTIMPL; -+} -diff -Naur mplayer-29746/Makefile mplayer-29746.patch/Makefile ---- mplayer-29746/Makefile 2009-10-01 21:52:59.000000000 +0200 -+++ mplayer-29746.patch/Makefile 2009-10-11 01:06:44.394658083 +0200 -@@ -621,6 +621,7 @@ - SRCS_MPLAYER-$(TGA) += libvo/vo_tga.c - SRCS_MPLAYER-$(V4L2) += libvo/vo_v4l2.c - SRCS_MPLAYER-$(V4L2) += libao2/ao_v4l2.c -+SRCS_MPLAYER-$(VAAPI) += libvo/vo_vaapi.c - SRCS_MPLAYER-$(VDPAU) += libvo/vo_vdpau.c - SRCS_MPLAYER-$(VESA) += libvo/gtf.c libvo/vo_vesa.c libvo/vesa_lvo.c - SRCS_MPLAYER-$(VIDIX) += libvo/vo_cvidix.c \ -diff -Naur mplayer-29746/libmpcodecs/vf.h mplayer-29746.patch/libmpcodecs/vf.h ---- mplayer-29746/libmpcodecs/vf.h 2009-10-01 21:53:00.000000000 +0200 -+++ mplayer-29746.patch/libmpcodecs/vf.h 2009-10-11 01:07:49.157658679 +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 */ -+#define VFCTRL_GET_HWACCEL_CONTEXT 21 /* Get HW accelerator context */ - - #include "vfcap.h" - diff --git a/packages/multimedia/mplayer/url b/packages/multimedia/mplayer/url deleted file mode 100644 index 14adb3c278..0000000000 --- a/packages/multimedia/mplayer/url +++ /dev/null @@ -1 +0,0 @@ -http://sources.openelec.tv/svn/mplayer-29746.tar.bz2