From d1cda1a5dd08b9017d0f099c9c79678fcab6cb4b Mon Sep 17 00:00:00 2001 From: Olivier Huber Date: Tue, 30 Nov 2010 20:28:54 +0100 Subject: update mplayer --- media-video/mplayer/Manifest | 18 +- .../mplayer/files/vaapi/01-mplayer-vaapi.patch | 1203 +++++++++++++++----- .../files/vaapi/03-mplayer-vaapi-0.29.patch | 42 +- .../mplayer/files/vaapi/04-mplayer-vdpau.patch | 301 ++--- .../mplayer/mplayer-1.0_rc4_p20100612-r50.ebuild | 755 ++++++++++++ 5 files changed, 1846 insertions(+), 473 deletions(-) create mode 100644 media-video/mplayer/mplayer-1.0_rc4_p20100612-r50.ebuild diff --git a/media-video/mplayer/Manifest b/media-video/mplayer/Manifest index 9e2858c..89c9677 100644 --- a/media-video/mplayer/Manifest +++ b/media-video/mplayer/Manifest @@ -1,12 +1,24 @@ -AUX vaapi/01-mplayer-vaapi.patch 108582 RMD160 b3303e75660ac6ed77ee6f849cc572a88d76322c SHA1 8525c1f682cc98db3f8cdeeeaf8030e7212d17f9 SHA256 800f9e83c9249f69ebf7ba328a5dcfc295af4c7b355a49763a4d7f0d28642699 +AUX vaapi-old/01-mplayer-vaapi.patch 112412 RMD160 4bfaffa4d41f01a66d724c4aa88a4a32d5c7825d SHA1 1096ec30d1ec67ebbccc82ea0071c03af9db9c4f SHA256 67c05f672a89897fb5f671be1e73ed2b2342043207d53e262ed732975038082b +AUX vaapi-old/01-mplayer-vaapi.patch~ 112412 RMD160 4bfaffa4d41f01a66d724c4aa88a4a32d5c7825d SHA1 1096ec30d1ec67ebbccc82ea0071c03af9db9c4f SHA256 67c05f672a89897fb5f671be1e73ed2b2342043207d53e262ed732975038082b +AUX vaapi-old/02-mplayer-vaapi-gma500-workaround.patch 2994 RMD160 cc3911d951c42ec1468eae4b8976697f47df050a SHA1 408c6783aae243fdb60fa7ea851cb5ec6184d4f4 SHA256 c145b2f8523bc99340d097f17c57538197b9c49175fce0b38d6eced3e06828a5 +AUX vaapi-old/03-mplayer-vaapi-0.29.patch 46211 RMD160 1dcb01ab1fb9aa087d7bb6e5129ba0850ec7e4b3 SHA1 ba7ebacaa9fcf10a2a5632b6747c9865b4055d0a SHA256 27551bf98613f71ebfb33858ee3bc17f8e64dfad6fca8a8c4a8f5c08afc98a56 +AUX vaapi-old/03-mplayer-vaapi-0.29.patch~ 46206 RMD160 b9be877adc135d1c27145849d61088b1395dc18d SHA1 790b536e1b3caf639196ecae4bc2f7bc1b41b0c0 SHA256 771f5ea8aee5406d5cc51ce2323601c158989eded56c05ab2295b65d9023956b +AUX vaapi-old/04-mplayer-vdpau.patch 44872 RMD160 8807b74ff2878d08ddde9d616119d8639a0fdee2 SHA1 bbde6ed420f7f4cf4cc6a0cc22726f5c1de36b8c SHA256 0bc0305a012fcfd40a49569d67ce20225ff64425cad8ad6b7c02c26f286cbcad +AUX vaapi/01-mplayer-vaapi.patch 125634 RMD160 add288326843d97fc33d0d1eba9e3818a5a778bd SHA1 6821081a03627715223d7a55044ce04e02c07350 SHA256 0373141e6d662ba65a3a37f8d7808b073f7e740746a897a81cb40ea36450f670 +AUX vaapi/01-mplayer-vaapi.patch~ 125627 RMD160 3d0240c1c789057649562587040e38300761f87e SHA1 c9416a60cd82a54be39f3b60912fb89827b38674 SHA256 c74df2ab647634d520cfa717ff083d942e84918f1f0a39fc525efff4c239f4c1 AUX vaapi/02-mplayer-vaapi-gma500-workaround.patch 2994 RMD160 cc3911d951c42ec1468eae4b8976697f47df050a SHA1 408c6783aae243fdb60fa7ea851cb5ec6184d4f4 SHA256 c145b2f8523bc99340d097f17c57538197b9c49175fce0b38d6eced3e06828a5 -AUX vaapi/03-mplayer-vaapi-0.29.patch 46225 RMD160 0b8ee4f9eddc9114ebc913e0e15034582bb530cb SHA1 ae12d2f93ba22c5a31145c2a06961837bdaca753 SHA256 2dbcfb4b8d83f2901a879176d82a7bcb494974d50505c701019365e17da9b307 -AUX vaapi/04-mplayer-vdpau.patch 42951 RMD160 4345ce35262156f4fd1f50164bfff7fe8856d87d SHA1 f1726ec589f50bc1d9055cd4414dc5a475ac495c SHA256 98aa3f7e5cc094b74cbcfc03104cfee4fb1b347f163a9ceca81c44f83fa0ee3f +AUX vaapi/03-mplayer-vaapi-0.29.patch 46210 RMD160 1d90e15164aac446d29450265890048c2e2bbca8 SHA1 f0553b65bf90178d4aac8f14f977b74e282b67d2 SHA256 f87d5c7e1a4fa084c5b07e19a92496ad1ffa0dd866196669af5cb4469600efdd +AUX vaapi/03-mplayer-vaapi-0.29.patch~ 46205 RMD160 c1129381a0b2e663b006b86036603fe91b43971a SHA1 4c36de3f40ac8e8cdd7f6f822c091d27f922ab94 SHA256 a8ca469ef3c47b27eb47ed1436409e6dfe21460cb47a5272a0a9ff94fd610d1b +AUX vaapi/04-mplayer-vdpau.patch 44724 RMD160 9c5a3162bbe5b5a3ec137f1c48d82a63f2c15bec SHA1 34e471df2348f849dc3835896c81166871a698ea SHA256 61be856ec47cdd3dc91481776d38b1fdb858b5c32a347f270856672c072a028c +AUX vaapi/04-mplayer-vdpau.patch~ 44726 RMD160 23e4af95dc7764eadd72ee37f92f065c7c5d8b9a SHA1 81b46426854736f41e97fb3e9e9e3e0f2e515de5 SHA256 b38a319570b2dbce0c885f1f9281183472a555931155f84aafb1558f0b706700 DIST Blue-1.7.tar.bz2 222567 RMD160 1f8c539ccadc54eea5e6678839bcc8ae1e16e6eb SHA1 45e5ee7a5541a5f1cfd2678a6c9b5911ca473cb9 SHA256 8bcd39a5755c44df778ebca3119c922347abfdadb101dcef011ce2566c1fb1d8 DIST font-arial-cp1250.tar.bz2 249705 RMD160 a2fc7ae07b0d80936ea58e168e1047efccb9eb91 SHA1 ccf11dce5d0fb72fd3af97f788b7471cd0cd0b68 SHA256 423a07e780bb130cd8e4730715545c5d919c248dda595aab7a0a01de3c83fd12 DIST font-arial-iso-8859-1.tar.bz2 234242 RMD160 666697cd5efd9387057a898c714175e7c2aacbcd SHA1 152c40bf20de34aa8802d7f80d34d673b0b67212 SHA256 9730f481764f367c9089d0166fb6ccf9148808ffbbfeca635cf0e6db75765d29 DIST font-arial-iso-8859-2.tar.bz2 222208 RMD160 562d4d92c4f5f3d537340fde3ad8d1495ac41acb SHA1 7b99bbe0e9ba89a57eccbea8f93c453c4f268181 SHA256 71debfc960007c2f6242dfc91e8b1c005b30a99e129aeb00ab8c03f4371b41c1 DIST mplayer-1.0_rc4_p20100213.tbz2 8811960 RMD160 b6991ef2dde9497bcffa32687f484598956db983 SHA1 350d39f2b42f5c5065abe7d64a4d759a9efa56f4 SHA256 59c09f6388ad15d12f74ae18ebe07945392e40d9096d5598bd496f857722bcb0 +DIST mplayer-1.0_rc4_p20100612.tbz2 8968316 RMD160 4179808dc9b99404affa2c95189fba3bb6fe5ad8 SHA1 a8d758dca9473006f66a947fb9019c35c66baa6b SHA256 098e16793baea2a9c4cf24ebcc8bc41c639c9806347b08724168e17e367b5d74 DIST svgalib_helper-1.9.17-mplayer.tar.gz 7583 RMD160 927ff34f187e4fa9528e2e48208173d98b3d1d1b SHA1 bf789706d1d79c695f781644c7ea6d57c3eed4c3 SHA256 a6f803f3df4cd4544751d3a3ee936a8bf0e20e32a452639b3f7c7d9e73e65938 EBUILD mplayer-1.0_rc4_p20100213-r50.ebuild 19997 RMD160 62eb81a0e2d191ea8f9b1885c41713dccfab64d9 SHA1 dccd864a627578c99771854b3e2658cbf051ff8d SHA256 33b92a21393826a39e4438af0df8a3153cd03b84ba5c3571425a43c7b454b185 +EBUILD mplayer-1.0_rc4_p20100612-r50.ebuild 20354 RMD160 5e0a18409cfb24e6dbaeb1c3a51d8fb98f18b953 SHA1 053978376a1ec7c3836197539296a4fb23ee3f38 SHA256 a05791c258d16c6dba09f1dc2a782afa0f1d03cb316bd3b6871621b6712ecd17 MISC metadata.xml 3591 RMD160 883e9161526d98f546d5b790a76da78ae6b03b94 SHA1 bf3ab6509cfa4a72a088ba005c9a92e44bac6df1 SHA256 956383713923533a4caa6e39fbe8067b2afa7c7aecc3e52c9dd0715435226ef8 +MISC mplayer-1.0_rc4_p20100612.ebuild~ 20314 RMD160 f3151c8a5bf6dc7d95be146439a3f5f8df1c19af SHA1 a6fef1f38d337a23c5fb4693cecacbd9fc5cd93d SHA256 0a06a6a65bcae2f5e5f2d43a5dc07c0d194d6617092ee7776ee59550e6fec176 diff --git a/media-video/mplayer/files/vaapi/01-mplayer-vaapi.patch b/media-video/mplayer/files/vaapi/01-mplayer-vaapi.patch index f75e945..6ae6c6e 100644 --- a/media-video/mplayer/files/vaapi/01-mplayer-vaapi.patch +++ b/media-video/mplayer/files/vaapi/01-mplayer-vaapi.patch @@ -1,8 +1,8 @@ diff --git a/Makefile b/Makefile -index 49de59b..da1a2a4 100644 +index 9d1bca1..c593ba2 100644 --- a/Makefile +++ b/Makefile -@@ -631,6 +631,7 @@ SRCS_MPLAYER-$(TDFXVID) += libvo/vo_tdfx_vid.c +@@ -624,6 +624,7 @@ SRCS_MPLAYER-$(TDFXVID) += libvo/vo_tdfx_vid.c SRCS_MPLAYER-$(TGA) += libvo/vo_tga.c SRCS_MPLAYER-$(V4L2) += libvo/vo_v4l2.c SRCS_MPLAYER-$(V4L2) += libao2/ao_v4l2.c @@ -10,7 +10,7 @@ index 49de59b..da1a2a4 100644 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 \ -@@ -684,6 +685,7 @@ SRCS_MPLAYER = command.c \ +@@ -677,6 +678,7 @@ SRCS_MPLAYER = command.c \ libvo/aspect.c \ libvo/geometry.c \ libvo/spuenc.c \ @@ -18,61 +18,69 @@ index 49de59b..da1a2a4 100644 libvo/video_out.c \ libvo/vo_mpegpes.c \ libvo/vo_null.c \ -diff --git a/cfg-common-opts.h b/cfg-common-opts.h -index dd9b691..2e30132 100644 +diff --git a/cfg-common.h b/cfg-common.h +index 4f8c7ba..c2cbbf1 100644 --- a/cfg-common-opts.h +++ b/cfg-common-opts.h -@@ -246,6 +246,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}, +@@ -244,6 +244,7 @@ const m_option_t common_opts[] = { + {"vfm", &video_fm_list, CONF_TYPE_STRING_LIST, 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: + // postprocessing: #ifdef CONFIG_LIBAVCODEC diff --git a/codec-cfg.c b/codec-cfg.c -index 5d79627..692258e 100644 +index b8ca998..6a75293 100644 --- a/codec-cfg.c +++ b/codec-cfg.c -@@ -214,6 +214,13 @@ static int add_to_format(char *s, char *alias,unsigned int *fourcc, unsigned int - {"IDCT_MPEG2",IMGFMT_XVMC_IDCT_MPEG2}, - {"MOCO_MPEG2",IMGFMT_XVMC_MOCO_MPEG2}, +@@ -224,6 +224,13 @@ static const struct { + {"VDPAU_VC1",IMGFMT_VDPAU_VC1}, + {"VDPAU_MPEG4",IMGFMT_VDPAU_MPEG4}, + ++ {"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}, ++ + {NULL, 0} + }; -+ {"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 --git a/configure b/configure -index ab3a347..8a3c7ba 100755 +index 55ff660..89a0a9a 100755 --- a/configure +++ b/configure -@@ -357,6 +357,9 @@ Codecs: +@@ -385,6 +385,9 @@ Codecs: --disable-muxer=MUXER disable specified FFmpeg muxer --enable-muxer=MUXER enable specified FFmpeg muxer +Hardware acceleration: -+ --enable-vaapi enable VA API acceleration [disable] ++ --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 -@@ -556,8 +559,7 @@ _libavparsers=$_libavparsers_all +@@ -414,6 +417,7 @@ Video output: + --enable-dvb enable DVB video output [autodetect] + --enable-mga enable mga_vid video output [autodetect] + --enable-xmga enable mga_vid X11 video output [autodetect] ++ --enable-xrender enable Xrender video output [autodetect] + --enable-xv enable Xv video output [autodetect] + --enable-xvmc enable XvMC acceleration [disable] + --enable-vdpau enable VDPAU acceleration [autodetect] +@@ -582,8 +586,7 @@ _libavparsers=$libavparsers_all _libavbsfs_all=$(sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') - _libavbsfs=$_libavbsfs_all + _libavbsfs=$libavbsfs_all _libavhwaccels_all=$(sed -n 's/^[^#]*HWACCEL.*(.*, *\(.*\)).*/\1_hwaccel/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') -# Disable all hardware accelerators for now. -_libavhwaccels= -+_libavhwaccels=$(for h in $_libavhwaccels_all; do case $h in (*_VAAPI_HWACCEL) echo $h;; esac; done) ++_libavhwaccels=$(for h in $libavhwaccels_all; do case $h in (*_VAAPI_HWACCEL) echo $h;; esac; done) _libavdemuxers_all=$(sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' libavformat/allformats.c | tr '[a-z]' '[A-Z]') - _libavdemuxers=$(echo $_libavdemuxers_all | sed -e 's/ LIB[A-Z0-9_]*_DEMUXER//g' -e s/REDIR_DEMUXER// -e s/AVISYNTH_DEMUXER//) + _libavdemuxers=$(echo $libavdemuxers_all | sed -e 's/ LIB[A-Z0-9_]*_DEMUXER//g' -e s/REDIR_DEMUXER// -e s/AVISYNTH_DEMUXER//) _libavmuxers_all=$(sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' libavformat/allformats.c | tr '[a-z]' '[A-Z]') -@@ -574,6 +576,9 @@ _libswscale_so=auto +@@ -600,11 +603,15 @@ _libswscale_so=auto _libavcodec_mpegaudio_hp=yes _mencoder=yes _mplayer=yes @@ -82,7 +90,19 @@ index ab3a347..8a3c7ba 100755 _x11=auto _xshape=auto _xss=auto -@@ -932,6 +937,8 @@ for ac_option do + _dga1=auto + _dga2=auto ++_xrender=auto + _xv=auto + _xvmc=no #auto when complete + _vdpau=auto +@@ -944,10 +951,14 @@ for ac_option do + --disable-xshape) _xshape=no ;; + --enable-xss) _xss=yes ;; + --disable-xss) _xss=no ;; ++ --enable-xrender) _xrender=yes ;; ++ --disable-xrender) _xrender=no ;; + --enable-xv) _xv=yes ;; --disable-xv) _xv=no ;; --enable-xvmc) _xvmc=yes ;; --disable-xvmc) _xvmc=no ;; @@ -91,7 +111,7 @@ index ab3a347..8a3c7ba 100755 --enable-vdpau) _vdpau=yes ;; --disable-vdpau) _vdpau=no ;; --enable-sdl) _sdl=yes ;; -@@ -4012,6 +4019,28 @@ fi +@@ -3966,6 +3977,28 @@ fi echores "$_gettimeofday" @@ -120,25 +140,88 @@ index ab3a347..8a3c7ba 100755 echocheck "glob()" cat > $TMPC << EOF #include -@@ -4440,7 +4469,7 @@ else - _novomodules="x11 $_novomodules" - _res_comment="check if the dev(el) packages are installed" +@@ -4405,7 +4438,7 @@ else + 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" -@@ -4571,7 +4600,7 @@ if test "$_vdpau" = yes ; then +@@ -4462,6 +4495,30 @@ else + fi + + ++echocheck "Xrender" ++if test "$_xrender" = auto ; then ++ cat > $TMPC < ++#include ++int main(void) { ++ (void) XRenderCreatePicture(0, 0, 0, 0, 0); ++ return 0; } ++EOF ++ _xrender=no ++ cc_check -lXrender && _xrender=yes ++fi ++ ++if test "$_xrender" = yes ; then ++ def_xrender='#define CONFIG_XRENDER 1' ++ libs_mplayer="$libs_mplayer -lXrender" ++ vomodules="xrender $vomodules" ++else ++ def_xrender='#undef CONFIG_XRENDER' ++ novomodules="xrender $novomodules" ++fi ++echores "$_xrender" ++ ++ + echocheck "Xv" + if test "$_xv" = auto ; then + cat > $TMPC < $TMPC << EOF ++#include ++#include ++int main(void) { return 0; } ++EOF ++cc_check $($_pkg_config --libs --cflags libgtop-2.0) && tmp_run && _libgtop=yes ++ ++ fi ++fi ++echores "$_libgtop" ++ ++if test "$_libgtop" = yes ; then ++ def_libgtop='#define CONFIG_LIBGTOP 1' ++ libs_mplayer="$libs_mplayer $($_pkg_config --libs libgtop-2.0)" ++ extra_cflags="$extra_cflags $($_pkg_config --cflags libgtop-2.0)" ++else ++ def_libgtop='#define CONFIG_LIBGTOP 0' ++fi ++ ++ + echocheck "PNG support" + if test "$_png" = auto ; then + _png=no +@@ -5375,6 +5457,23 @@ else fi echores "$_gl" @@ -159,8 +242,18 @@ index ab3a347..8a3c7ba 100755 +fi +echores "$_glu" + + + echocheck "MatrixView" + if test "$_gl" = no ; then +@@ -5995,6 +6094,52 @@ echores "$_dart" + fi #if os2 + + ++######################### ++# HARDWARE ACCELERATORS # ++######################### + -+echocheck "VA API" ++echocheck "VA-API" +if test "$_vaapi" = yes -o "$_vaapi" = auto; then + _vaapi=no + cat > $TMPC < $TMPC << EOF -+#include -+#include -+int main(void) { return 0; } -+EOF -+cc_check $($_pkg_config --libs --cflags libgtop-2.0) && tmp_run && _libgtop=yes -+ -+ fi -+fi -+echores "$_libgtop" -+ -+if test "$_libgtop" = yes ; then -+ def_libgtop='#define CONFIG_LIBGTOP 1' -+ libs_mplayer="$libs_mplayer $($_pkg_config --libs libgtop-2.0)" -+ extra_cflags="$extra_cflags $($_pkg_config --cflags libgtop-2.0)" -+else -+ def_libgtop='#define CONFIG_LIBGTOP 0' -+fi + + - echocheck "PNG support" - if test "$_png" = auto ; then - _png=no -@@ -8676,6 +8789,7 @@ TV_V4L2 = $_tv_v4l2 + # set default CD/DVD devices + if win32 || os2 ; then + default_cdrom_device="D:" +@@ -8677,6 +8822,7 @@ TV_V4L2 = $_tv_v4l2 TWOLAME=$_twolame UNRAR_EXEC = $_unrar_exec V4L2 = $_v4l2 @@ -244,23 +306,17 @@ index ab3a347..8a3c7ba 100755 VCD = $_vcd VDPAU = $_vdpau VESA = $_vesa -@@ -8761,6 +8875,7 @@ CONFIG_GPL=yes - CONFIG_LIBDIRAC_DECODER=$_libdirac_lavc - CONFIG_LIBDIRAC_ENCODER=$_libdirac_lavc - CONFIG_LIBFAAC_ENCODER=$_faac_lavc -+CONFIG_LIBGTOP=$_libgtop - CONFIG_LIBMP3LAME_ENCODER=$_mp3lame_lavc - CONFIG_LIBOPENCORE_AMRNB_DECODER=$_libopencore_amrnb - CONFIG_LIBOPENCORE_AMRNB_ENCODER=$_libopencore_amrnb -@@ -8777,6 +8892,7 @@ CONFIG_MUXERS=$_mencoder +@@ -8774,7 +8920,9 @@ CONFIG_GPL = yes + CONFIG_MLIB = $_mlib + CONFIG_MUXERS = $_mencoder 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 -@@ -8893,6 +9009,7 @@ $def_winsock2_h ++CONFIG_VAAPI = $_vaapi + CONFIG_VDPAU = $_vdpau ++CONFIG_XRENDER = $_xrender + CONFIG_XVMC = $_xvmc + CONFIG_ZLIB = $_zlib + +@@ -8893,6 +9041,7 @@ $def_winsock2_h /* system functions */ @@ -268,7 +324,7 @@ index ab3a347..8a3c7ba 100755 $def_gethostbyname2 $def_gettimeofday $def_glob -@@ -8923,6 +9040,7 @@ $def_extern_asm +@@ -8924,6 +9073,7 @@ $def_extern_asm $def_extern_prefix $def_iconv $def_kstat @@ -276,7 +332,7 @@ index ab3a347..8a3c7ba 100755 $def_macosx_bundle $def_macosx_finder $def_maemo -@@ -9153,6 +9271,8 @@ $def_tdfxfb +@@ -9155,6 +9305,8 @@ $def_tdfxfb $def_tdfxvid $def_tga $def_v4l2 @@ -285,11 +341,19 @@ index ab3a347..8a3c7ba 100755 $def_vdpau $def_vesa $def_vidix +@@ -9180,6 +9332,7 @@ $def_xf86keysym + $def_xinerama + $def_xmga + $def_xss ++$def_xrender + $def_xv + $def_xvmc + $def_xvr100 diff --git a/etc/codecs.conf b/etc/codecs.conf -index 26a0529..615f069 100644 +index a8d2ae0..8eece64 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf -@@ -190,6 +190,7 @@ videocodec ffmpeg2 +@@ -172,6 +172,7 @@ videocodec ffmpeg2 fourcc slif ; SoftLab MPEG-2 I-frames Codec driver ffmpeg dll "mpeg2video" @@ -297,7 +361,7 @@ index 26a0529..615f069 100644 out YV12,I420,IYUV out 422P,444P -@@ -888,6 +889,7 @@ videocodec ffwmv3 +@@ -901,6 +902,7 @@ videocodec ffwmv3 fourcc WMV3,wmv3 driver ffmpeg dll wmv3 @@ -305,7 +369,7 @@ index 26a0529..615f069 100644 out YV12,I420,IYUV videocodec ffwmv3vdpau -@@ -905,6 +907,7 @@ videocodec ffvc1 +@@ -918,6 +920,7 @@ videocodec ffvc1 fourcc vc-1,VC-1 driver ffmpeg dll vc1 @@ -313,7 +377,7 @@ index 26a0529..615f069 100644 out YV12,I420,IYUV videocodec ffvc1vdpau -@@ -926,6 +929,7 @@ videocodec ffh264 +@@ -939,6 +942,7 @@ videocodec ffh264 format 0x10000005 driver ffmpeg dll h264 @@ -321,15 +385,15 @@ index 26a0529..615f069 100644 out YV12,I420,IYUV videocodec ffh264vdpau -@@ -994,6 +998,7 @@ videocodec ffodivx - fourcc uldx,ULDX,VSPX +@@ -1008,6 +1012,7 @@ videocodec ffodivx + fourcc SIPP ; Samsung SHR-6040 driver ffmpeg dll mpeg4 ;opendivx + out VAAPI_MPEG4 out YV12,I420,IYUV videocodec ffodivxvdpau -@@ -1561,6 +1566,7 @@ videocodec ffh263 +@@ -1577,6 +1582,7 @@ videocodec ffh263 fourcc VX1K ; Agora Labs VX1000S H263 driver ffmpeg dll h263 @@ -338,7 +402,7 @@ index 26a0529..615f069 100644 videocodec ffzygo diff --git a/fmt-conversion.c b/fmt-conversion.c -index 013e3fe..f053dc8 100644 +index 9e88100..bd32ce8 100644 --- a/fmt-conversion.c +++ b/fmt-conversion.c @@ -18,12 +18,14 @@ @@ -356,12 +420,12 @@ index 013e3fe..f053dc8 100644 } conversion_map[] = { {IMGFMT_ARGB, PIX_FMT_ARGB}, {IMGFMT_BGRA, PIX_FMT_BGRA}, -@@ -91,6 +93,17 @@ static const struct { +@@ -95,6 +97,17 @@ static const struct { {IMGFMT_VDPAU_WMV3, PIX_FMT_VDPAU_WMV3}, {IMGFMT_VDPAU_VC1, PIX_FMT_VDPAU_VC1}, {IMGFMT_VDPAU_MPEG4, PIX_FMT_VDPAU_MPEG4}, + -+ /* VA API formats */ ++ /* 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}, @@ -374,7 +438,7 @@ index 013e3fe..f053dc8 100644 {0, PIX_FMT_NONE} }; -@@ -107,12 +120,14 @@ enum PixelFormat imgfmt2pixfmt(int fmt) +@@ -111,12 +124,14 @@ enum PixelFormat imgfmt2pixfmt(int fmt) return pix_fmt; } @@ -404,10 +468,10 @@ index 9e133a8..962ca4e 100644 #endif /* MPLAYER_FMT_CONVERSION_H */ diff --git a/gui/mplayer/gtk/opts.c b/gui/mplayer/gtk/opts.c -index f086819..3a02a9f 100644 +index 0a26245..e66e263 100644 --- a/gui/mplayer/gtk/opts.c +++ b/gui/mplayer/gtk/opts.c -@@ -64,9 +64,11 @@ static GtkWidget * CLVDrivers; +@@ -66,9 +66,11 @@ static GtkWidget * CLVDrivers; GtkWidget * prEFontName; GtkWidget * prEDVDDevice; GtkWidget * prECDRomDevice; @@ -486,10 +550,10 @@ index f086819..3a02a9f 100644 CBVFM=gtk_combo_new(); diff --git a/help/help_mp-en.h b/help/help_mp-en.h -index 3b8cbd8..162d6cb 100644 +index a112418..121eac9 100644 --- a/help/help_mp-en.h +++ b/help/help_mp-en.h -@@ -719,6 +719,7 @@ static const char help_text[]= +@@ -717,6 +717,7 @@ static const char help_text[]= #define MSGTR_PREFERENCES_IDX "Rebuild index table, if needed" #define MSGTR_PREFERENCES_VideoCodecFamily "Video codec family:" #define MSGTR_PREFERENCES_AudioCodecFamily "Audio codec family:" @@ -497,7 +561,7 @@ index 3b8cbd8..162d6cb 100644 #define MSGTR_PREFERENCES_FRAME_OSD_Level "OSD level" #define MSGTR_PREFERENCES_FRAME_Subtitle "Subtitle" #define MSGTR_PREFERENCES_FRAME_Font "Font" -@@ -1659,6 +1660,7 @@ static const char help_text[]= +@@ -1653,6 +1654,7 @@ static const char help_text[]= #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" @@ -506,16 +570,16 @@ index 3b8cbd8..162d6cb 100644 // libmpcodecs/ve_lavc.c #define MSGTR_MPCODECS_HighQualityEncodingSelected "[VE_LAVC] High quality encoding selected (non-realtime)!\n" diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c -index 3572565..aef04d2 100644 +index 1dd6e42..ce9facc 100644 --- a/libmpcodecs/dec_video.c +++ b/libmpcodecs/dec_video.c @@ -56,9 +56,47 @@ extern double vout_time_usage; - int field_dominance=-1; + int field_dominance = -1; - int divx_quality=0; + int divx_quality = 0; +char *video_hwaccel_name=NULL; - vd_functions_t* mpvdec=NULL; + const vd_functions_t *mpvdec = NULL; +int get_video_hwaccel(void) +{ @@ -554,11 +618,11 @@ index 3572565..aef04d2 100644 + return NULL; +} + - int get_video_quality_max(sh_video_t *sh_video){ - vf_instance_t* vf=sh_video->vfilter; - if(vf){ + int get_video_quality_max(sh_video_t *sh_video) + { + vf_instance_t *vf = sh_video->vfilter; diff --git a/libmpcodecs/dec_video.h b/libmpcodecs/dec_video.h -index 8b28202..bf727cd 100644 +index 04fc8f4..a9bedb0 100644 --- a/libmpcodecs/dec_video.h +++ b/libmpcodecs/dec_video.h @@ -21,6 +21,14 @@ @@ -575,8 +639,8 @@ index 8b28202..bf727cd 100644 + // dec_video.c: void vfm_help(void); - -@@ -39,6 +47,11 @@ int set_rectangle(sh_video_t *sh_video, int param, int value); + +@@ -41,6 +49,11 @@ int set_rectangle(sh_video_t *sh_video, int param, int value); void resync_video_stream(sh_video_t *sh_video); int get_current_video_decoder_lag(sh_video_t *sh_video); @@ -589,33 +653,33 @@ index 8b28202..bf727cd 100644 #endif /* MPLAYER_DEC_VIDEO_H */ diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c -index 5b858fa..d3b158b 100644 +index bdf4d2f..65f0bd1 100644 --- a/libmpcodecs/img_format.c +++ b/libmpcodecs/img_format.c -@@ -94,6 +94,14 @@ const char *vo_format_name(int format) +@@ -96,6 +96,14 @@ const char *vo_format_name(int format) 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_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 --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h -index 2c4db36..37b0132 100644 +index e580082..d0aaa45 100644 --- a/libmpcodecs/img_format.h +++ b/libmpcodecs/img_format.h -@@ -172,6 +172,26 @@ +@@ -182,6 +182,26 @@ #define IMGFMT_XVMC_MOCO_MPEG2 (IMGFMT_XVMC|0x02) #define IMGFMT_XVMC_IDCT_MPEG2 (IMGFMT_XVMC|0x82) -+/* VA API Formats */ ++/* VA-API Formats */ + +#define IMGFMT_VAAPI 0x56410000 /* 'VA'00 */ +#define IMGFMT_VAAPI_MASK 0xFFFF0000 @@ -638,11 +702,11 @@ index 2c4db36..37b0132 100644 // VDPAU specific format. #define IMGFMT_VDPAU 0x1DC80000 #define IMGFMT_VDPAU_MASK 0xFFFF0000 -diff --git a/libmpcodecs/mp_image.h b/libmpcodecs/mp_image.h -index ba69e72..86ace62 100644 ---- a/libmpcodecs/mp_image.h -+++ b/libmpcodecs/mp_image.h -@@ -129,6 +129,7 @@ static inline void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ +diff --git a/libmpcodecs/mp_image.c b/libmpcodecs/mp_image.c +index f239181..35438c9 100644 +--- a/libmpcodecs/mp_image.c ++++ b/libmpcodecs/mp_image.c +@@ -101,6 +101,7 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ // compressed formats if(out_fmt == IMGFMT_MPEGPES || out_fmt == IMGFMT_ZRMJPEGNI || out_fmt == IMGFMT_ZRMJPEGIT || out_fmt == IMGFMT_ZRMJPEGIB || @@ -651,27 +715,27 @@ index ba69e72..86ace62 100644 mpi->bpp=0; return; diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c -index 6f18ed3..4bbd3cd 100644 +index ea6b6b2..dad5eb6 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c -@@ -373,3 +373,12 @@ void mpcodecs_draw_slice(sh_video_t *sh, unsigned char** src, int* stride, int w - if(vf->draw_slice) - vf->draw_slice(vf,src,stride,w,h,x,y); +@@ -403,3 +403,12 @@ void mpcodecs_draw_slice(sh_video_t *sh, unsigned char **src, int *stride, + 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; ++ struct vf_instance *vf = sh->vfilter; + if (vf->control(vf, VFCTRL_GET_HWACCEL_CONTEXT, &ctx) == CONTROL_TRUE) + return ctx; + return NULL; +} diff --git a/libmpcodecs/vd.h b/libmpcodecs/vd.h -index 33d9ec5..63e0b8a 100644 +index 8f7c238..e655d60 100644 --- a/libmpcodecs/vd.h +++ b/libmpcodecs/vd.h -@@ -53,6 +53,7 @@ extern float movie_aspect; +@@ -64,6 +64,7 @@ extern const m_option_t xvid_dec_opts[]; 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); @@ -680,7 +744,7 @@ index 33d9ec5..63e0b8a 100644 #define VDFLAGS_DROPFRAME 3 diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c -index 8c1e9ae..7a42160 100644 +index 38f1fbd..5b003fa 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -32,6 +32,7 @@ @@ -691,7 +755,7 @@ index 8c1e9ae..7a42160 100644 static const vd_info_t info = { "FFmpeg's libavcodec codec family", -@@ -227,8 +228,8 @@ static void set_format_params(struct AVCodecContext *avctx, enum PixelFormat fmt +@@ -228,8 +229,8 @@ static void set_format_params(struct AVCodecContext *avctx, enum PixelFormat fmt int imgfmt; if (fmt == PIX_FMT_NONE) return; @@ -702,7 +766,7 @@ index 8c1e9ae..7a42160 100644 sh_video_t *sh = avctx->opaque; vd_ffmpeg_ctx *ctx = sh->context; ctx->do_dr1 = 1; -@@ -285,6 +286,12 @@ static int init(sh_video_t *sh){ +@@ -286,6 +287,12 @@ static int init(sh_video_t *sh){ avctx->codec_type = CODEC_TYPE_VIDEO; avctx->codec_id = lavc_codec->id; @@ -715,16 +779,16 @@ index 8c1e9ae..7a42160 100644 #if CONFIG_VDPAU if(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU){ avctx->get_format = get_format; -@@ -478,7 +485,7 @@ static void draw_slice(struct AVCodecContext *s, +@@ -479,7 +486,7 @@ static void draw_slice(struct AVCodecContext *s, const 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]}; + int strides[MP_MAX_PLANES] = {src->linesize[0], src->linesize[1], src->linesize[2]}; #if 0 int start=0, i; - int width= s->width; -@@ -544,9 +551,10 @@ static int init_vo(sh_video_t *sh, enum PixelFormat pix_fmt){ +@@ -558,9 +565,10 @@ static int init_vo(sh_video_t *sh, enum PixelFormat pix_fmt){ sh->disp_w = width; sh->disp_h = height; ctx->pix_fmt = pix_fmt; @@ -736,7 +800,7 @@ index 8c1e9ae..7a42160 100644 ctx->vo_initialized = 1; } return 0; -@@ -597,7 +605,9 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ +@@ -611,7 +619,9 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ return avctx->get_buffer(avctx, pic); } @@ -747,7 +811,7 @@ index 8c1e9ae..7a42160 100644 type = MP_IMGTYPE_NUMBERED | (0xffff << 16); } else if (!pic->buffer_hints) { -@@ -629,6 +639,11 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ +@@ -643,6 +653,11 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ avctx->draw_horiz_band= draw_slice; } else avctx->draw_horiz_band= NULL; @@ -759,7 +823,7 @@ index 8c1e9ae..7a42160 100644 if(IMGFMT_IS_VDPAU(mpi->imgfmt)) { avctx->draw_horiz_band= draw_slice; } -@@ -940,24 +955,62 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){ +@@ -955,24 +970,62 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){ return mpi; } @@ -836,10 +900,10 @@ index 8c1e9ae..7a42160 100644 -#endif /* CONFIG_XVMC || CONFIG_VDPAU */ +#endif /* CONFIG_XVMC || CONFIG_VAAPI || CONFIG_VDPAU */ diff --git a/libmpcodecs/vf.h b/libmpcodecs/vf.h -index 91a57f2..00de007 100644 +index 945fbc1..44e308a 100644 --- a/libmpcodecs/vf.h +++ b/libmpcodecs/vf.h -@@ -107,6 +107,7 @@ typedef struct vf_seteq_s +@@ -111,6 +111,7 @@ typedef struct vf_seteq_s #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 */ @@ -848,10 +912,10 @@ index 91a57f2..00de007 100644 #include "vfcap.h" diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c -index fafdc1b..c75cace 100644 +index 061a34b..a11c2b7 100644 --- a/libmpcodecs/vf_vo.c +++ b/libmpcodecs/vf_vo.c -@@ -173,6 +173,12 @@ static int control(struct vf_instance_s* vf, int request, void* data) +@@ -170,6 +170,12 @@ static int control(struct vf_instance *vf, int request, void* data) *(double *)data = vf->priv->pts; return CONTROL_TRUE; } @@ -864,7 +928,7 @@ index fafdc1b..c75cace 100644 } // return video_out->control(request,data); return CONTROL_UNKNOWN; -@@ -192,6 +198,7 @@ static void get_image(struct vf_instance_s* vf, +@@ -189,6 +195,7 @@ static void get_image(struct vf_instance *vf, if(!vo_config_count) return; // GET_IMAGE is required for hardware-accelerated formats if(vo_directrendering || @@ -872,6 +936,47 @@ index fafdc1b..c75cace 100644 IMGFMT_IS_XVMC(mpi->imgfmt) || IMGFMT_IS_VDPAU(mpi->imgfmt)) video_out->control(VOCTRL_GET_IMAGE,mpi); } +diff --git a/libvo/gl_common.c b/libvo/gl_common.c +index 9862dd9..638bd78 100644 +--- a/libvo/gl_common.c ++++ b/libvo/gl_common.c +@@ -140,6 +140,11 @@ void* (GLAPIENTRY *mpglAllocateMemoryMESA)(void *, int, size_t, float, float, fl + void (GLAPIENTRY *mpglFreeMemoryMESA)(void *, int, void *); + /** \} */ // end of glextfunctions group + ++void (GLAPIENTRY *mpglXBindTexImage)(Display *, GLXDrawable, int, const int *); ++void (GLAPIENTRY *mpglXReleaseTexImage)(Display *, GLXDrawable, int); ++GLXPixmap (GLAPIENTRY *mpglXCreatePixmap)(Display *, GLXFBConfig, Pixmap, const int *); ++void (GLAPIENTRY *mpglXDestroyPixmap)(Display *, GLXPixmap); ++ + //! \defgroup glgeneral OpenGL general helper functions + + //! \defgroup glcontext OpenGL context management helper functions +@@ -469,6 +474,10 @@ static const extfunc_desc_t extfuncs[] = { + {&mpglTexImage3D, NULL, {"glTexImage3D", NULL}}, + {&mpglAllocateMemoryMESA, "GLX_MESA_allocate_memory", {"glXAllocateMemoryMESA", NULL}}, + {&mpglFreeMemoryMESA, "GLX_MESA_allocate_memory", {"glXFreeMemoryMESA", NULL}}, ++ {&mpglXBindTexImage, "GLX_EXT_texture_from_pixmap", {"glXBindTexImageEXT", NULL}}, ++ {&mpglXReleaseTexImage, "GLX_EXT_texture_from_pixmap", {"glXReleaseTexImageEXT", NULL}}, ++ {&mpglXCreatePixmap, "GLX_EXT_texture_from_pixmap", {"glXCreatePixmap", NULL}}, ++ {&mpglXDestroyPixmap, "GLX_EXT_texture_from_pixmap", {"glXDestroyPixmap", NULL}}, + {NULL} + }; + +diff --git a/libvo/gl_common.h b/libvo/gl_common.h +index c4fb9bd..5614ac7 100644 +--- a/libvo/gl_common.h ++++ b/libvo/gl_common.h +@@ -507,4 +507,9 @@ extern void (GLAPIENTRY *mpglTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei + extern void* (GLAPIENTRY *mpglAllocateMemoryMESA)(void *, int, size_t, float, float, float); + extern void (GLAPIENTRY *mpglFreeMemoryMESA)(void *, int, void *); + ++extern void (GLAPIENTRY *mpglXBindTexImage)(Display *, GLXDrawable, int, const int *); ++extern void (GLAPIENTRY *mpglXReleaseTexImage)(Display *, GLXDrawable, int); ++extern GLXPixmap (GLAPIENTRY *mpglXCreatePixmap)(Display *, GLXFBConfig, Pixmap, const int *); ++extern void (GLAPIENTRY *mpglXDestroyPixmap)(Display *, GLXPixmap); ++ + #endif /* MPLAYER_GL_COMMON_H */ diff --git a/libvo/stats.c b/libvo/stats.c new file mode 100644 index 0000000..c4ff0ca @@ -1123,18 +1228,18 @@ index 0000000..62e7412 + +#endif /* MPLAYER_STATS_H */ diff --git a/libvo/video_out.c b/libvo/video_out.c -index 6db664a..8259927 100644 +index 0318867..3373475 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c -@@ -138,6 +138,7 @@ extern vo_functions_t video_out_corevideo; - 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[] = - { -@@ -283,6 +284,9 @@ const vo_functions_t* const video_out_drivers[] = +@@ -95,6 +95,7 @@ extern const vo_functions_t video_out_xmga; + extern const vo_functions_t video_out_x11; + extern vo_functions_t video_out_xover; + extern const vo_functions_t video_out_xvmc; ++extern const vo_functions_t video_out_vaapi; + extern const vo_functions_t video_out_vdpau; + extern const vo_functions_t video_out_xv; + extern const vo_functions_t video_out_gl_nosw; +@@ -290,6 +291,9 @@ const vo_functions_t* const video_out_drivers[] = #ifdef CONFIG_MD5SUM &video_out_md5sum, #endif @@ -1145,10 +1250,10 @@ index 6db664a..8259927 100644 }; diff --git a/libvo/video_out.h b/libvo/video_out.h -index 1fce2c2..0d3f00a 100644 +index 5e64b0e..785c6d2 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h -@@ -98,6 +98,10 @@ typedef struct { +@@ -99,6 +99,10 @@ typedef struct { int w,h; } mp_win_t; @@ -1161,10 +1266,10 @@ index 1fce2c2..0d3f00a 100644 #define VO_ERROR -1 diff --git a/libvo/vo_vaapi.c b/libvo/vo_vaapi.c new file mode 100644 -index 0000000..ddc9eac +index 0000000..c888656 --- /dev/null +++ b/libvo/vo_vaapi.c -@@ -0,0 +1,2201 @@ +@@ -0,0 +1,2667 @@ +/* + * VA API output module + * @@ -1217,6 +1322,10 @@ index 0000000..ddc9eac +#include +#endif + ++#if CONFIG_XRENDER ++#include ++#endif ++ +/* Compatibility glue with VA-API >= 0.30 */ +#ifndef VA_INVALID_ID +#define VA_INVALID_ID 0xffffffff @@ -1234,6 +1343,10 @@ index 0000000..ddc9eac +#define USE_VAAPI_COLORSPACE 0 +#endif + ++/* Defined to 1 if IA44/AI44 subpicture formats are allowed */ ++/* XXX: they are not visually attractive... */ ++#define USE_VAAPI_IA44_FORMATS 0 ++ +/* Defined to 1 if VA/GLX 'bind' API is available */ +#define USE_VAAPI_GLX_BIND \ + (VA_MAJOR_VERSION == 0 && \ @@ -1257,7 +1370,7 @@ index 0000000..ddc9eac + "" +}; + -+LIBVO_EXTERN(vaapi) ++const LIBVO_EXTERN(vaapi) + +/* Numbers of video surfaces */ +#define MAX_OUTPUT_SURFACES 2 /* Maintain synchronisation points in flip_page() */ @@ -1267,6 +1380,9 @@ index 0000000..ddc9eac +#define NUM_VIDEO_SURFACES_H264 21 /* 1 decode frame, up to 20 references */ +#define NUM_VIDEO_SURFACES_VC1 3 /* 1 decode frame, up to 2 references */ + ++static void ensure_osd(void); ++static int reset_xrender_specific(void); ++ +typedef void (*draw_alpha_func)(int x0, int y0, int w, int h, + unsigned char *src, unsigned char *srca, + int stride); @@ -1279,6 +1395,7 @@ index 0000000..ddc9eac +struct vaapi_surface { + VASurfaceID id; + VAImage image; ++ int is_bound; /* Flag: image bound to the surface? */ +}; + +struct vaapi_equalizer { @@ -1288,28 +1405,30 @@ index 0000000..ddc9eac + VADisplayAttribute saturation; +}; + ++static int g_is_visible; +static int g_is_paused; +static uint32_t g_image_width; +static uint32_t g_image_height; +static uint32_t g_image_format; ++static uint32_t g_image_fields; ++static Pixmap g_image_pixmap; +static struct vo_rect g_output_rect; +static struct vaapi_surface *g_output_surfaces[MAX_OUTPUT_SURFACES]; +static unsigned int g_output_surface; -+static int g_top_field_first; +static int g_deint; +static int g_deint_type; +static int g_colorspace; + ++static int gl_enabled; ++static int gl_use_tfp; +#if CONFIG_GL +static MPGLContext gl_context; -+static int gl_enabled; +static int gl_binding; +static int gl_reflect; ++static int gl_finish; +static GLuint gl_texture; +static GLuint gl_font_base; -+#endif -+ -+#if CONFIG_VAAPI_GLX ++static Pixmap gl_pixmap; +static int gl_visual_attr[] = { + GLX_RGBA, + GLX_RED_SIZE, 1, @@ -1318,9 +1437,19 @@ index 0000000..ddc9eac + GLX_DOUBLEBUFFER, + GL_NONE +}; ++#endif ++ ++#if CONFIG_VAAPI_GLX +static void *gl_surface; +#endif + ++static int xr_enabled; ++#if CONFIG_XRENDER ++static Pixmap g_image_pixmap; ++static Picture xr_video_picture; ++static Picture xr_window_picture; ++#endif ++ +static struct vaapi_context *va_context; +static VAProfile *va_profiles; +static int va_num_profiles; @@ -1338,7 +1467,6 @@ index 0000000..ddc9eac +static int va_num_subpic_formats; +static VAImage va_osd_image; +static uint8_t *va_osd_image_data; -+static struct vo_rect va_osd_image_dirty_rect; +static VASubpictureID va_osd_subpicture; +static int va_osd_associated; +static draw_alpha_func va_osd_draw_alpha; @@ -1358,6 +1486,28 @@ index 0000000..ddc9eac +static unsigned int cpu_frequency; +static float cpu_usage; + ++// X error trap ++static int x11_error_code = 0; ++static int (*old_error_handler)(Display *, XErrorEvent *); ++ ++static int error_handler(Display *dpy, XErrorEvent *error) ++{ ++ x11_error_code = error->error_code; ++ return 0; ++} ++ ++static void x11_trap_errors(void) ++{ ++ x11_error_code = 0; ++ old_error_handler = XSetErrorHandler(error_handler); ++} ++ ++static int x11_untrap_errors(void) ++{ ++ XSetErrorHandler(old_error_handler); ++ return x11_error_code; ++} ++ +static int check_status(VAStatus status, const char *msg) +{ + if (status != VA_STATUS_SUCCESS) { @@ -1547,7 +1697,7 @@ index 0000000..ddc9eac + VASurfaceID *surface_ids; + VAStatus status; + -+ surface = malloc(sizeof(*surface)); ++ surface = calloc(1, sizeof(*surface)); + if (!surface) + goto error; + @@ -1586,6 +1736,8 @@ index 0000000..ddc9eac + calc_src_dst_rects(g_image_width, g_image_height, + &src, &g_output_rect, NULL, NULL); + ++ ensure_osd(); ++ + vo_x11_clearwindow(mDisplay, vo_window); + +#if CONFIG_GL @@ -1611,7 +1763,13 @@ index 0000000..ddc9eac + } +#endif + -+ flip_page(); ++#if CONFIG_XRENDER ++ if (xr_enabled) ++ reset_xrender_specific(); ++#endif ++ ++ if (g_is_visible) ++ flip_page(); +} + +#if CONFIG_GL @@ -1677,34 +1835,25 @@ index 0000000..ddc9eac +} +#endif + -+static inline unsigned char *get_osd_image_data(int x0, int y0) ++#if CONFIG_XRENDER ++static int init_xrender(void) +{ -+ return (va_osd_image_data + -+ va_osd_image.offsets[0] + -+ va_osd_image.pitches[0] * y0 + -+ x0 * ((va_osd_image.format.bits_per_pixel + 7) / 8)); ++ int dummy; ++ ++ return XRenderQueryExtension(mDisplay, &dummy, &dummy); +} + -+static inline void set_osd_image_dirty_rect(int x, int y, int w, int h) ++static void uninit_xrender(void) +{ -+ struct vo_rect * const dirty_rect = &va_osd_image_dirty_rect; -+ dirty_rect->left = x + w; -+ dirty_rect->top = y + h; -+ dirty_rect->right = x; -+ dirty_rect->bottom = y; -+ dirty_rect->width = w; -+ dirty_rect->height = h; +} ++#endif + -+static inline void update_osd_image_dirty_rect(int x, int y, int w, int h) ++static inline unsigned char *get_osd_image_data(int x0, int y0) +{ -+ struct vo_rect * const dirty_rect = &va_osd_image_dirty_rect; -+ dirty_rect->left = FFMIN(dirty_rect->left, x); -+ dirty_rect->top = FFMIN(dirty_rect->top, y); -+ dirty_rect->right = FFMAX(dirty_rect->right, x + w); -+ dirty_rect->bottom = FFMAX(dirty_rect->bottom, y + h); -+ dirty_rect->width = dirty_rect->right - dirty_rect->left; -+ dirty_rect->height = dirty_rect->bottom - dirty_rect->top; ++ return (va_osd_image_data + ++ va_osd_image.offsets[0] + ++ va_osd_image.pitches[0] * y0 + ++ x0 * ((va_osd_image.format.bits_per_pixel + 7) / 8)); +} + +static void draw_alpha_rgb32(int x0, int y0, int w, int h, @@ -1715,8 +1864,6 @@ index 0000000..ddc9eac + const unsigned int dststride = va_osd_image.pitches[0]; + unsigned char *dst = get_osd_image_data(x0, y0); + -+ update_osd_image_dirty_rect(x0, y0, w, h); -+ + for (y = 0; y < h; y++, dst += dststride, src += stride, srca += stride) + for (x = 0; x < w; x++) { + const unsigned char c = src[x]; @@ -1727,6 +1874,7 @@ index 0000000..ddc9eac + } +} + ++#if USE_VAAPI_IA44_FORMATS +static void draw_alpha_IA44(int x0, int y0, int w, int h, + unsigned char *src, unsigned char *srca, + int stride) @@ -1735,8 +1883,6 @@ index 0000000..ddc9eac + const unsigned int dststride = va_osd_image.pitches[0]; + unsigned char *dst = get_osd_image_data(x0, y0); + -+ update_osd_image_dirty_rect(x0, y0, w, h); -+ + for (y = 0; y < h; y++, dst += dststride) + for (x = 0; x < w; x++) + dst[x] = (src[y*stride + x] & 0xf0) | (-srca[y*stride + x] >> 4); @@ -1750,12 +1896,11 @@ index 0000000..ddc9eac + const unsigned int dststride = va_osd_image.pitches[0]; + unsigned char *dst = get_osd_image_data(x0, y0); + -+ update_osd_image_dirty_rect(x0, y0, w, h); -+ + for (y = 0; y < h; y++, dst += dststride) + for (x = 0; x < w; x++) + dst[x] = (src[y*stride + x] >> 4) | (-srca[y*stride + x] & 0xf0); +} ++#endif + +static void draw_alpha_IA88(int x0, int y0, int w, int h, + unsigned char *src, unsigned char *srca, @@ -1765,8 +1910,6 @@ index 0000000..ddc9eac + const unsigned int dststride = va_osd_image.pitches[0]; + unsigned char *dst = get_osd_image_data(x0, y0); + -+ update_osd_image_dirty_rect(x0, y0, w, h); -+ + for (y = 0; y < h; y++, dst += dststride) + for (x = 0; x < w; x++) { + dst[2*x + 0] = src [y*stride + x]; @@ -1782,8 +1925,6 @@ index 0000000..ddc9eac + const unsigned int dststride = va_osd_image.pitches[0]; + unsigned char *dst = get_osd_image_data(x0, y0); + -+ update_osd_image_dirty_rect(x0, y0, w, h); -+ + for (y = 0; y < h; y++, dst += dststride) + for (x = 0; x < w; x++) { + dst[2*x + 0] = -srca[y*stride + x]; @@ -1797,8 +1938,10 @@ index 0000000..ddc9eac + draw_alpha_func draw_alpha; +} +va_osd_info[] = { ++#if USE_VAAPI_IA44_FORMATS + { VA_FOURCC('I','A','4','4'), draw_alpha_IA44 }, + { VA_FOURCC('A','I','4','4'), draw_alpha_AI44 }, ++#endif + { VA_FOURCC('I','A','8','8'), draw_alpha_IA88 }, + { VA_FOURCC('A','I','8','8'), draw_alpha_AI88 }, + { VA_FOURCC('B','G','R','A'), draw_alpha_rgb32 }, @@ -1879,8 +2022,7 @@ index 0000000..ddc9eac + va_osd_associated = 0; +} + -+static int enable_osd(const struct vo_rect *src_rect, -+ const struct vo_rect *dst_rect) ++static int enable_osd(void) +{ + VAStatus status; + @@ -1889,14 +2031,10 @@ index 0000000..ddc9eac + status = vaAssociateSubpicture2(va_context->display, + va_osd_subpicture, + va_surface_ids, va_num_surfaces, -+ src_rect->left, -+ src_rect->top, -+ src_rect->right - src_rect->left, -+ src_rect->bottom - src_rect->top, -+ dst_rect->left, -+ dst_rect->top, -+ dst_rect->right - dst_rect->left, -+ dst_rect->bottom - dst_rect->top, ++ 0, 0, ++ va_osd_image.width, va_osd_image.height, ++ 0, 0, ++ g_image_width, g_image_height, + 0); + if (!check_status(status, "vaAssociateSubpicture()")) + return -1; @@ -1905,6 +2043,68 @@ index 0000000..ddc9eac + return 0; +} + ++static void destroy_osd(void) ++{ ++ disable_osd(); ++ ++ if (va_osd_subpicture != VA_INVALID_ID) { ++ vaDestroySubpicture(va_context->display, va_osd_subpicture); ++ va_osd_subpicture = VA_INVALID_ID; ++ } ++ ++ if (va_osd_image.image_id != VA_INVALID_ID) { ++ vaDestroyImage(va_context->display, va_osd_image.image_id); ++ va_osd_image.image_id = VA_INVALID_ID; ++ va_osd_image.width = 0; ++ va_osd_image.height = 0; ++ } ++} ++ ++static void create_osd(void) ++{ ++ VAStatus status; ++ int i, j; ++ ++ for (i = 0; va_osd_info[i].format; i++) { ++ for (j = 0; j < va_num_subpic_formats; j++) ++ if (va_subpic_formats[j].fourcc == va_osd_info[i].format) ++ break; ++ if (j < va_num_subpic_formats && ++ vaCreateImage(va_context->display, &va_subpic_formats[j], ++ g_output_rect.width, g_output_rect.height, ++ &va_osd_image) == VA_STATUS_SUCCESS) { ++ va_osd_palette = gen_osd_palette(&va_osd_image); ++ if (((!va_osd_image.num_palette_entries) ^ (!va_osd_palette)) == 0) ++ break; ++ vaDestroyImage(va_context->display, va_osd_image.image_id); ++ va_osd_image.image_id = VA_INVALID_ID; ++ } ++ } ++ ++ if (va_osd_info[i].format && ++ vaCreateSubpicture(va_context->display, va_osd_image.image_id, ++ &va_osd_subpicture) == VA_STATUS_SUCCESS) { ++ va_osd_draw_alpha = va_osd_info[i].draw_alpha; ++ if (va_osd_palette) { ++ status = vaSetImagePalette(va_context->display, ++ va_osd_image.image_id, va_osd_palette); ++ check_status(status, "vaSetImagePalette()"); ++ } ++ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] Using %s surface for OSD\n", ++ string_of_VAImageFormat(&va_osd_image.format)); ++ } ++} ++ ++static void ensure_osd(void) ++{ ++ if (g_output_rect.width == va_osd_image.width && ++ g_output_rect.height == va_osd_image.height) ++ return; ++ ++ destroy_osd(); ++ create_osd(); ++} ++ +static inline unsigned char *get_eosd_image_data(int x0, int y0) +{ + return (va_eosd_image_data + @@ -2050,10 +2250,15 @@ index 0000000..ddc9eac +#endif +#if CONFIG_GL + { "gl", OPT_ARG_BOOL, &gl_enabled, NULL }, ++ { "glfinish", OPT_ARG_BOOL, &gl_finish, NULL }, +#if USE_VAAPI_GLX_BIND + { "bind", OPT_ARG_BOOL, &gl_binding, NULL }, +#endif + { "reflect", OPT_ARG_BOOL, &gl_reflect, NULL }, ++ { "tfp", OPT_ARG_BOOL, &gl_use_tfp, NULL }, ++#endif ++#if CONFIG_XRENDER ++ { "xrender", OPT_ARG_BOOL, &xr_enabled, NULL }, +#endif + { NULL, } +}; @@ -2090,6 +2295,10 @@ index 0000000..ddc9eac +#if CONFIG_GL + " gl\n" + " Enable OpenGL rendering\n" ++ " glfinish\n" ++ " Call glFinish() before swapping buffers\n" ++ " tfp\n" ++ " Use GLX texture-from-pixmap instead of VA/GLX extensions\n" +#if USE_VAAPI_GLX_BIND + " bind\n" + " Use VA surface binding instead of copy\n" @@ -2097,9 +2306,17 @@ index 0000000..ddc9eac + " reflect\n" + " Enable OpenGL reflection effects\n" +#endif ++#if CONFIG_XRENDER ++ " xrender\n" ++ " Enable Xrender rendering, thus vaPutSurface() to a Pixmap\n" ++#endif + "\n" ); + return -1; + } ++ if (gl_enabled && xr_enabled) { ++ mp_msg(MSGT_VO, MSGL_ERR, "[vo_vaapi] User requested both Xrender and OpenGL rendering\n"); ++ return -1; ++ } + if (g_deint) + g_deint_type = g_deint; +#if CONFIG_GL @@ -2107,6 +2324,10 @@ index 0000000..ddc9eac + mp_msg(MSGT_VO, MSGL_INFO, "[vo_vaapi] Using OpenGL rendering%s\n", + gl_reflect ? ", with reflection effects" : ""); +#endif ++#if CONFIG_XRENDER ++ if (xr_enabled) ++ mp_msg(MSGT_VO, MSGL_INFO, "[vo_vaapi] Using Xrender rendering\n"); ++#endif + + stats_init(); + @@ -2117,6 +2338,10 @@ index 0000000..ddc9eac +#endif + if (!vo_init()) + return -1; ++#if CONFIG_XRENDER ++ if (xr_enabled && !init_xrender()) ++ return -1; ++#endif + + va_context = calloc(1, sizeof(*va_context)); + if (!va_context) @@ -2274,15 +2499,7 @@ index 0000000..ddc9eac + va_eosd_image.image_id = VA_INVALID_ID; + } + -+ if (va_osd_subpicture != VA_INVALID_ID) { -+ vaDestroySubpicture(va_context->display, va_osd_subpicture); -+ va_osd_subpicture = VA_INVALID_ID; -+ } -+ -+ if (va_osd_image.image_id != VA_INVALID_ID) { -+ vaDestroyImage(va_context->display, va_osd_image.image_id); -+ va_osd_image.image_id = VA_INVALID_ID; -+ } ++ destroy_osd(); + + if (va_surface_ids) { + vaDestroySurfaces(va_context->display, va_surface_ids, va_num_surfaces); @@ -2302,11 +2519,33 @@ index 0000000..ddc9eac + } + +#if CONFIG_GL ++ if (gl_pixmap) { ++ x11_trap_errors(); ++ mpglXDestroyPixmap(mDisplay, gl_pixmap); ++ XSync(mDisplay, False); ++ x11_untrap_errors(); ++ gl_pixmap = None; ++ } ++ ++ if (g_image_pixmap) { ++ XFreePixmap(mDisplay, g_image_pixmap); ++ g_image_pixmap = None; ++ } ++ + if (gl_texture) { + glDeleteTextures(1, &gl_texture); + gl_texture = GL_NONE; + } +#endif ++ ++#if CONFIG_XRENDER ++ if (xr_window_picture) { ++ XRenderFreePicture(mDisplay, xr_window_picture); ++ xr_window_picture = None; ++ } ++#endif ++ ++ g_is_visible = 0; +} + +static void uninit(void) @@ -2349,6 +2588,10 @@ index 0000000..ddc9eac +#ifdef CONFIG_XF86VM + vo_vm_close(); +#endif ++#if CONFIG_XRENDER ++ if (xr_enabled) ++ uninit_xrender(); ++#endif +#if CONFIG_GL + if (gl_enabled) + uninit_mpglcontext(&gl_context); @@ -2387,7 +2630,7 @@ index 0000000..ddc9eac + depth = 24; + XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &visualInfo); + -+#if CONFIG_VAAPI_GLX ++#if CONFIG_GL + if (gl_enabled) { + vi = glXChooseVisual(mDisplay, mScreen, gl_visual_attr); + if (!vi) @@ -2427,13 +2670,141 @@ index 0000000..ddc9eac + } +#endif + } ++ return 0; ++} ++ ++#if CONFIG_GL ++static GLXFBConfig *get_fbconfig_for_depth(int depth) ++{ ++ GLXFBConfig *fbconfigs, *ret = NULL; ++ int n_elements, i, found; ++ int db, stencil, alpha, mipmap, rgba, value; ++ ++ static GLXFBConfig *cached_config = NULL; ++ static int have_cached_config = 0; ++ ++ if (have_cached_config) ++ return cached_config; ++ ++ fbconfigs = glXGetFBConfigs(mDisplay, mScreen, &n_elements); ++ ++ db = SHRT_MAX; ++ stencil = SHRT_MAX; ++ mipmap = 0; ++ rgba = 0; ++ ++ found = n_elements; ++ ++ for (i = 0; i < n_elements; i++) { ++ XVisualInfo *vi; ++ int visual_depth; ++ ++ vi = glXGetVisualFromFBConfig(mDisplay, fbconfigs[i]); ++ if (!vi) ++ continue; ++ ++ visual_depth = vi->depth; ++ XFree(vi); ++ ++ if (visual_depth != depth) ++ continue; ++ ++ glXGetFBConfigAttrib(mDisplay, fbconfigs[i], GLX_ALPHA_SIZE, &alpha); ++ glXGetFBConfigAttrib(mDisplay, fbconfigs[i], GLX_BUFFER_SIZE, &value); ++ if (value != depth && (value - alpha) != depth) ++ continue; ++ ++ value = 0; ++ if (depth == 32) { ++ glXGetFBConfigAttrib(mDisplay, fbconfigs[i], ++ GLX_BIND_TO_TEXTURE_RGBA_EXT, &value); ++ if (value) ++ rgba = 1; ++ } ++ ++ if (!value) { ++ if (rgba) ++ continue; ++ ++ glXGetFBConfigAttrib(mDisplay, fbconfigs[i], ++ GLX_BIND_TO_TEXTURE_RGB_EXT, &value); ++ if (!value) ++ continue; ++ } ++ ++ glXGetFBConfigAttrib(mDisplay, fbconfigs[i], GLX_DOUBLEBUFFER, &value); ++ if (value > db) ++ continue; ++ db = value; ++ ++ glXGetFBConfigAttrib(mDisplay, fbconfigs[i], GLX_STENCIL_SIZE, &value); ++ if (value > stencil) ++ continue; ++ stencil = value; ++ ++ found = i; ++ } ++ ++ if (found != n_elements) { ++ ret = malloc(sizeof(*ret)); ++ *ret = fbconfigs[found]; ++ } ++ ++ if (n_elements) ++ XFree(fbconfigs); ++ ++ have_cached_config = 1; ++ cached_config = ret; ++ return ret; ++} ++ ++static int config_tfp(unsigned int width, unsigned int height) ++{ ++ GLXFBConfig *fbconfig; ++ int attribs[7], i = 0; ++ const int depth = 24; + -+ if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) -+ vo_fs = VO_TRUE; ++ if (!mpglXBindTexImage || !mpglXReleaseTexImage) { ++ mp_msg(MSGT_VO, MSGL_ERR, "[vo_vaapi] No GLX texture-from-pixmap extension available\n"); ++ return -1; ++ } ++ ++ if (depth != 24 && depth != 32) ++ return -1; ++ ++ g_image_pixmap = XCreatePixmap(mDisplay, vo_window, width, height, depth); ++ if (!g_image_pixmap) { ++ mp_msg(MSGT_VO, MSGL_ERR, "[vo_vaapi] Could not create X11 pixmap\n"); ++ return -1; ++ } ++ ++ fbconfig = get_fbconfig_for_depth(depth); ++ if (!fbconfig) { ++ mp_msg(MSGT_VO, MSGL_ERR, "[vo_vaapi] Could not find an FBConfig for 32-bit pixmap\n"); ++ return -1; ++ } ++ ++ attribs[i++] = GLX_TEXTURE_TARGET_EXT; ++ attribs[i++] = GLX_TEXTURE_2D_EXT; ++ attribs[i++] = GLX_TEXTURE_FORMAT_EXT; ++ if (depth == 24) ++ attribs[i++] = GLX_TEXTURE_FORMAT_RGB_EXT; ++ else if (depth == 32) ++ attribs[i++] = GLX_TEXTURE_FORMAT_RGBA_EXT; ++ attribs[i++] = GLX_MIPMAP_TEXTURE_EXT; ++ attribs[i++] = GL_FALSE; ++ attribs[i++] = None; ++ ++ x11_trap_errors(); ++ gl_pixmap = mpglXCreatePixmap(mDisplay, *fbconfig, g_image_pixmap, attribs); ++ XSync(mDisplay, False); ++ if (x11_untrap_errors()) { ++ mp_msg(MSGT_VO, MSGL_ERR, "[vo_vaapi] Could not create GLX pixmap\n"); ++ return -1; ++ } + return 0; +} + -+#if CONFIG_VAAPI_GLX +static int config_glx(unsigned int width, unsigned int height) +{ + if (gl_context.setGlWindow(&gl_context) == SET_WINDOW_FAILED) @@ -2448,19 +2819,27 @@ index 0000000..ddc9eac + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + ++ /* Create TFP resources */ ++ if (gl_use_tfp && config_tfp(width, height) == 0) ++ mp_msg(MSGT_VO, MSGL_INFO, "[vo_vaapi] Using GLX texture-from-pixmap extension\n"); ++ else ++ gl_use_tfp = 0; ++ + /* 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); ++ mpglBindTexture(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); ++ if (!gl_use_tfp) { ++ 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); ++ } ++ mpglBindTexture(GL_TEXTURE_2D, 0); + glDisable(GL_TEXTURE_2D); + + glClearColor(0.0, 0.0, 0.0, 1.0); @@ -2472,6 +2851,119 @@ index 0000000..ddc9eac +} +#endif + ++#if CONFIG_XRENDER ++static XRenderPictFormat *get_xrender_argb32_format(void) ++{ ++ static XRenderPictFormat *pictformat = NULL; ++ XRenderPictFormat templ; ++ ++ const unsigned long mask = ++ PictFormatType | ++ PictFormatDepth | ++ PictFormatRed | ++ PictFormatRedMask | ++ PictFormatGreen | ++ PictFormatGreenMask | ++ PictFormatBlue | ++ PictFormatBlueMask | ++ PictFormatAlphaMask; ++ ++ if (pictformat) ++ return pictformat; ++ ++ /* First, look for a 32-bit format which ignores the alpha component */ ++ templ.depth = 32; ++ templ.type = PictTypeDirect; ++ templ.direct.red = 16; ++ templ.direct.green = 8; ++ templ.direct.blue = 0; ++ templ.direct.redMask = 0xff; ++ templ.direct.greenMask = 0xff; ++ templ.direct.blueMask = 0xff; ++ templ.direct.alphaMask = 0; ++ ++ pictformat = XRenderFindFormat(mDisplay, mask, &templ, 0); ++ ++ if (!pictformat) { ++ /* Not all X servers support xRGB32 formats. However, the ++ * XRENDER spec says that they must support an ARGB32 format, ++ * so we can always return that. ++ */ ++ pictformat = XRenderFindStandardFormat(mDisplay, PictStandardARGB32); ++ if (!pictformat) ++ mp_msg(MSGT_VO, MSGL_ERR, "XRENDER ARGB32 format not supported\n"); ++ } ++ return pictformat; ++} ++ ++static int create_xrender_specific(void) ++{ ++ XRenderPictFormat *pictformat; ++ ++ if (g_output_rect.width == 0 && g_output_rect.height == 0) ++ return 0; ++ ++ g_image_pixmap = XCreatePixmap(mDisplay, vo_window, g_output_rect.width, ++ g_output_rect.height, 32); ++ if (!g_image_pixmap) { ++ mp_msg(MSGT_VO, MSGL_ERR, "Could not create video pixmap\n"); ++ return -1; ++ } ++ ++ pictformat = get_xrender_argb32_format(); ++ if (!pictformat) ++ return -1; ++ xr_video_picture = XRenderCreatePicture(mDisplay, g_image_pixmap, ++ pictformat, 0, NULL); ++ if (!xr_video_picture) { ++ mp_msg(MSGT_VO, MSGL_ERR, "Could not create XRENDER backing picture for Pixmap\n"); ++ return -1; ++ } ++ return 0; ++} ++ ++static void free_xrender_specific(void) ++{ ++ if (xr_video_picture) { ++ XRenderFreePicture(mDisplay, xr_video_picture); ++ xr_video_picture = None; ++ } ++ ++ if (g_image_pixmap) { ++ XFreePixmap(mDisplay, g_image_pixmap); ++ g_image_pixmap = None; ++ } ++} ++ ++static int reset_xrender_specific(void) ++{ ++ free_xrender_specific(); ++ return create_xrender_specific(); ++} ++ ++/* XXX: create a Pixmap as large as the display rect */ ++static int config_xrender(unsigned int width, unsigned int height) ++{ ++ XWindowAttributes wattr; ++ XRenderPictFormat *pictformat; ++ ++ XGetWindowAttributes(mDisplay, vo_window, &wattr); ++ pictformat = XRenderFindVisualFormat(mDisplay, wattr.visual); ++ if (!pictformat) { ++ mp_msg(MSGT_VO, MSGL_ERR, "XRENDER does not support Window visual\n"); ++ return -1; ++ } ++ ++ xr_window_picture = XRenderCreatePicture(mDisplay, vo_window, pictformat, ++ 0, NULL); ++ if (!xr_window_picture) { ++ mp_msg(MSGT_VO, MSGL_ERR, "Could not create XRENDER backing picture for Window\n"); ++ return -1; ++ } ++ return reset_xrender_specific(); ++} ++#endif ++ +static int config_vaapi(uint32_t width, uint32_t height, uint32_t format) +{ + VAConfigAttrib attrib; @@ -2514,7 +3006,7 @@ index 0000000..ddc9eac + +#if CONFIG_VAAPI_GLX + /* Create GLX surfaces */ -+ if (gl_enabled) { ++ if (gl_enabled && !gl_use_tfp) { + status = vaCreateSurfaceGLX(va_context->display, + GL_TEXTURE_2D, gl_texture, + &gl_surface); @@ -2528,30 +3020,7 @@ index 0000000..ddc9eac + va_osd_image.image_id = VA_INVALID_ID; + va_osd_image.buf = VA_INVALID_ID; + va_osd_subpicture = VA_INVALID_ID; -+ for (i = 0; va_osd_info[i].format; i++) { -+ for (j = 0; j < va_num_subpic_formats; j++) -+ if (va_subpic_formats[j].fourcc == va_osd_info[i].format) -+ break; -+ if (j < va_num_subpic_formats && -+ vaCreateImage(va_context->display, &va_subpic_formats[j], -+ width, height, &va_osd_image) == VA_STATUS_SUCCESS) { -+ va_osd_palette = gen_osd_palette(&va_osd_image); -+ if (((!va_osd_image.num_palette_entries) ^ (!va_osd_palette)) == 0) -+ break; -+ } -+ } -+ if (va_osd_info[i].format && -+ vaCreateSubpicture(va_context->display, va_osd_image.image_id, -+ &va_osd_subpicture) == VA_STATUS_SUCCESS) { -+ va_osd_draw_alpha = va_osd_info[i].draw_alpha; -+ if (va_osd_palette) { -+ status = vaSetImagePalette(va_context->display, -+ va_osd_image.image_id, va_osd_palette); -+ check_status(status, "vaSetImagePalette()"); -+ } -+ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] Using %s surface for OSD\n", -+ string_of_VAImageFormat(&va_osd_image.format)); -+ } ++ ensure_osd(); + + /* Create EOSD data */ + va_eosd_draw_alpha = NULL; @@ -2581,10 +3050,31 @@ index 0000000..ddc9eac + if (!image_format) + return -1; + for (i = 0; i < va_num_surfaces; i++) { -+ status = vaCreateImage(va_context->display, image_format, -+ width, height, &va_free_surfaces[i]->image); -+ if (!check_status(status, "vaCreateImage()")) -+ return -1; ++ struct vaapi_surface * const s = va_free_surfaces[i]; ++ s->is_bound = 0; ++ status = vaDeriveImage(va_context->display, s->id, &s->image); ++ if (status == VA_STATUS_SUCCESS) { ++ /* vaDeriveImage() is supported, check format */ ++ if (s->image.format.fourcc != image_format->fourcc) { ++ vaDestroyImage(va_context->display, s->image.image_id); ++ return -1; ++ } ++ if (s->image.width == width && s->image.height == height) { ++ s->is_bound = 1; ++ mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] Using vaDeriveImage()\n"); ++ } ++ else { ++ vaDestroyImage(va_context->display, s->image.image_id); ++ status = VA_STATUS_ERROR_OPERATION_FAILED; ++ } ++ ++ } ++ if (status != VA_STATUS_SUCCESS) { ++ status = vaCreateImage(va_context->display, image_format, ++ width, height, &s->image); ++ if (!check_status(status, "vaCreateImage()")) ++ return -1; ++ } + } + return 0; + } @@ -2649,14 +3139,20 @@ index 0000000..ddc9eac + if (config_x11(width, height, display_width, display_height, flags, title) < 0) + return -1; + -+#if CONFIG_VAAPI_GLX ++#if CONFIG_GL + if (gl_enabled && config_glx(width, height) < 0) + return -1; +#endif + ++#if CONFIG_XRENDER ++ if (xr_enabled && config_xrender(width, height) < 0) ++ return -1; ++#endif ++ + if (config_vaapi(width, height, format) < 0) + return -1; + ++ g_is_visible = 0; + g_is_paused = 0; + g_image_width = width; + g_image_height = height; @@ -2698,8 +3194,8 @@ index 0000000..ddc9eac + +static inline int get_field_flags(int i) +{ -+ return (g_deint ? -+ ((g_top_field_first ^ i) == 0 ? ++ return (g_deint && (g_image_fields & MP_IMGFIELD_INTERLACED) ? ++ (((!!(g_image_fields & MP_IMGFIELD_TOP_FIRST)) ^ i) == 0 ? + VA_BOTTOM_FIELD : VA_TOP_FIELD) : VA_FRAME_PICTURE); +} + @@ -2747,12 +3243,29 @@ index 0000000..ddc9eac + } +} + -+#if CONFIG_VAAPI_GLX ++#if CONFIG_GL +static void put_surface_glx(struct vaapi_surface *surface) +{ + VAStatus status; + int i; + ++ if (gl_use_tfp) { ++ for (i = 0; i <= !!(g_deint > 1); i++) { ++ status = vaPutSurface(va_context->display, ++ surface->id, ++ g_image_pixmap, ++ 0, 0, g_image_width, g_image_height, ++ 0, 0, g_image_width, g_image_height, ++ NULL, 0, ++ get_field_flags(i) | get_colorspace_flags()); ++ if (!check_status(status, "vaPutSurface()")) ++ return; ++ } ++ g_output_surfaces[g_output_surface] = surface; ++ return; ++ } ++ ++#if CONFIG_VAAPI_GLX + if (gl_binding) { +#if USE_VAAPI_GLX_BIND + for (i = 0; i <= !!(g_deint > 1); i++) { @@ -2787,18 +3300,26 @@ index 0000000..ddc9eac + } + } + } ++#endif + 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); ++ mpglBindTexture(GL_TEXTURE_2D, gl_texture); ++ ++ if (gl_use_tfp) { ++ x11_trap_errors(); ++ mpglXBindTexImage(mDisplay, gl_pixmap, GLX_FRONT_LEFT_EXT, NULL); ++ XSync(mDisplay, False); ++ if (x11_untrap_errors()) ++ mp_msg(MSGT_VO, MSGL_WARN, "[vo_vaapi] Update bind_tex_image failed\n"); ++ } + +#if USE_VAAPI_GLX_BIND + if (gl_binding) { ++ VAStatus status; + status = vaBeginRenderSurfaceGLX(va_context->display, gl_surface); + if (!check_status(status, "vaBeginRenderSurfaceGLX()")) + return -1; @@ -2809,17 +3330,23 @@ index 0000000..ddc9eac + +static int glx_unbind_texture(void) +{ -+ VAStatus status; ++ if (gl_use_tfp) { ++ x11_trap_errors(); ++ mpglXReleaseTexImage(mDisplay, gl_pixmap, GLX_FRONT_LEFT_EXT); ++ if (x11_untrap_errors()) ++ mp_msg(MSGT_VO, MSGL_WARN, "[vo_vaapi] Failed to release?\n"); ++ } + +#if USE_VAAPI_GLX_BIND + if (gl_binding) { ++ VAStatus status; + status = vaEndRenderSurfaceGLX(va_context->display, gl_surface); + if (!check_status(status, "vaEndRenderSurfaceGLX()")) + return -1; + } +#endif + -+ BindTexture(GL_TEXTURE_2D, 0); ++ mpglBindTexture(GL_TEXTURE_2D, 0); + glDisable(GL_TEXTURE_2D); + return 0; +} @@ -2936,6 +3463,8 @@ index 0000000..ddc9eac + gl_printf("MPlayer: %.1f%% of CPU @ %u MHz", cpu_usage, cpu_frequency); + } + ++ if (gl_finish) ++ mpglFinish(); + gl_context.swapGlBuffers(&gl_context); + + if (vo_fs) /* avoid flickering borders in fullscreen mode */ @@ -2943,16 +3472,47 @@ index 0000000..ddc9eac +} +#endif + ++#if CONFIG_XRENDER ++static void put_surface_xrender(struct vaapi_surface *surface) ++{ ++ VAStatus status; ++ int i; ++ ++ for (i = 0; i <= !!(g_deint > 1); i++) { ++ status = vaPutSurface(va_context->display, ++ surface->id, ++ g_image_pixmap, ++ 0, 0, g_image_width, g_image_height, ++ 0, 0, g_output_rect.width, g_output_rect.height, ++ NULL, 0, ++ get_field_flags(i) | get_colorspace_flags()); ++ if (!check_status(status, "vaPutSurface()")) ++ return; ++ XRenderComposite(mDisplay, ++ PictOpSrc, xr_video_picture, 0, xr_window_picture, ++ 0, 0, ++ 0, 0, ++ g_output_rect.left, g_output_rect.top, ++ g_output_rect.width, g_output_rect.height); ++ } ++} ++#endif ++ +static void put_surface(struct vaapi_surface *surface) +{ + if (!surface || surface->id == VA_INVALID_SURFACE) + return; + -+#if CONFIG_VAAPI_GLX ++#if CONFIG_GL + if (gl_enabled) + put_surface_glx(surface); + else +#endif ++#if CONFIG_XRENDER ++ if (xr_enabled) ++ put_surface_xrender(surface); ++ else ++#endif + put_surface_x11(surface); +} + @@ -2968,7 +3528,8 @@ index 0000000..ddc9eac + + mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] draw_slice(): location (%d,%d), size %dx%d\n", x, y, w, h); + -+ status = vaMapBuffer(va_context->display, va_image->buf, &image_data); ++ status = vaMapBuffer(va_context->display, va_image->buf, ++ (void *)&image_data); + if (!check_status(status, "vaMapBuffer()")) + return VO_FALSE; + @@ -3023,34 +3584,39 @@ index 0000000..ddc9eac +static void draw_osd(void) +{ + VAStatus status; ++ const int osd_width = va_osd_image.width; ++ const int osd_height = va_osd_image.height; + -+ if (!va_osd_draw_alpha) ++ ensure_osd(); ++ if (va_osd_image.image_id == VA_INVALID_ID) + return; + -+ if (!vo_update_osd(g_image_width, g_image_height)) ++ if (!va_osd_draw_alpha) + return; + -+ if (!vo_osd_check_range_update(0, 0, g_image_width, g_image_height)) { ++ if (!vo_update_osd(osd_width, osd_height)) ++ return; ++ ++ if (!vo_osd_check_range_update(0, 0, osd_width, osd_height)) { + disable_osd(); + return; + } + + status = vaMapBuffer(va_context->display, va_osd_image.buf, -+ &va_osd_image_data); ++ (void *)&va_osd_image_data); + if (!check_status(status, "vaMapBuffer()")) + return; + + memset(va_osd_image_data, 0, va_osd_image.data_size); + -+ set_osd_image_dirty_rect(0, 0, g_image_width, g_image_height); -+ vo_draw_text(g_image_width, g_image_height, va_osd_draw_alpha); ++ vo_draw_text(osd_width, osd_height, va_osd_draw_alpha); + + status = vaUnmapBuffer(va_context->display, va_osd_image.buf); + if (!check_status(status, "vaUnmapBuffer()")) + return; + va_osd_image_data = NULL; + -+ enable_osd(&va_osd_image_dirty_rect, &va_osd_image_dirty_rect); ++ enable_osd(); +} + +static void draw_eosd(mp_eosd_images_t *imgs) @@ -3076,7 +3642,7 @@ index 0000000..ddc9eac + goto eosd_skip_upload; + + status = vaMapBuffer(va_context->display, va_eosd_image.buf, -+ &va_eosd_image_data); ++ (void *)&va_eosd_image_data); + if (!check_status(status, "vaMapBuffer()")) + return; + @@ -3102,12 +3668,15 @@ index 0000000..ddc9eac + mp_msg(MSGT_VO, MSGL_DBG2, "[vo_vaapi] flip_page()\n"); + + surface = g_output_surfaces[g_output_surface]; -+ if (surface) -+ put_surface(surface); ++ if (!surface) ++ return; ++ ++ put_surface(surface); + g_output_surface = (g_output_surface + 1) % MAX_OUTPUT_SURFACES; ++ g_is_visible = 1; + -+#if CONFIG_VAAPI_GLX -+ if (gl_enabled && surface) ++#if CONFIG_GL ++ if (gl_enabled) + flip_page_glx(); +#endif +} @@ -3176,13 +3745,15 @@ index 0000000..ddc9eac + return VO_FALSE; + } + -+ status = vaPutImage2(va_context->display, -+ surface->id, -+ surface->image.image_id, -+ mpi->x, mpi->y, mpi->w, mpi->h, -+ mpi->x, mpi->y, mpi->w, mpi->h); -+ if (!check_status(status, "vaPutImage()")) -+ return VO_FALSE; ++ if (!surface->is_bound) { ++ status = vaPutImage2(va_context->display, ++ surface->id, ++ surface->image.image_id, ++ mpi->x, mpi->y, mpi->w, mpi->h, ++ mpi->x, mpi->y, mpi->w, mpi->h); ++ if (!check_status(status, "vaPutImage()")) ++ return VO_FALSE; ++ } + + return VO_TRUE; +} @@ -3191,6 +3762,8 @@ index 0000000..ddc9eac +{ + struct vaapi_surface *surface = (struct vaapi_surface *)mpi->priv; + ++ g_image_fields = mpi->fields; ++ + if (!IMGFMT_IS_VAAPI(mpi->imgfmt)) { + /* XXX: no direct rendering in non-accelerated mode */ + surface = va_free_surfaces[g_output_surface]; @@ -3202,11 +3775,6 @@ index 0000000..ddc9eac + + g_output_surfaces[g_output_surface] = surface; + -+ if (mpi->fields & MP_IMGFIELD_ORDERED) -+ g_top_field_first = !!(mpi->fields & MP_IMGFIELD_TOP_FIRST); -+ else -+ g_top_field_first = 1; -+ + if (cpu_stats) { + static uint64_t ticks; + if ((ticks++ % 30) == 0) { @@ -3225,9 +3793,12 @@ index 0000000..ddc9eac + resize(); + + if ((events & (VO_EVENT_EXPOSE|VO_EVENT_RESIZE)) && g_is_paused) { -+ struct vaapi_surface *surface = g_output_surfaces[g_output_surface]; -+ if (surface) -+ put_surface(surface); ++ /* Redraw the last visible buffer */ ++ if (g_is_visible) { ++ struct vaapi_surface *surface = g_output_surfaces[g_output_surface]; ++ if (surface) ++ put_surface(surface); ++ } + } +} + diff --git a/media-video/mplayer/files/vaapi/03-mplayer-vaapi-0.29.patch b/media-video/mplayer/files/vaapi/03-mplayer-vaapi-0.29.patch index d2f7bba..ec483af 100644 --- a/media-video/mplayer/files/vaapi/03-mplayer-vaapi-0.29.patch +++ b/media-video/mplayer/files/vaapi/03-mplayer-vaapi-0.29.patch @@ -1,15 +1,15 @@ -commit ea392cb5fb1265c433b530535108ad8a441b61f6 +commit 5fbfa3b77f6b3f55cc61df16533324ebcf8e0b70 Author: Gwenole Beauchesne Date: Fri Feb 12 11:03:00 2010 +0000 Add compatibility with original VA-API 0.29. diff --git a/configure b/configure -index 39fef26..f2f9f2e 100755 +index 8011680..f7ce215 100755 --- a/configure +++ b/configure -@@ -5109,20 +5109,35 @@ echores "$_glu" - echocheck "VA API" +@@ -6167,20 +6167,35 @@ fi #if os2 + echocheck "VA-API" if test "$_vaapi" = yes -o "$_vaapi" = auto; then _vaapi=no + _vaapi_old=no @@ -30,7 +30,7 @@ index 39fef26..f2f9f2e 100755 if test "$_vaapi" = yes ; then def_vaapi='#define CONFIG_VAAPI 1' - libs_mencoder="$libs_mencoder -lva" -- libs_mplayer="$libs_mplayer -lva-x11" +- libs_mplayer="$libs_mplayer -lva-x11 -lva" + if test "$_vaapi_old" = no ; then + def_vaapi_old='#define CONFIG_VAAPI_OLD 0' + libs_mencoder="$libs_mencoder -lva" @@ -40,22 +40,22 @@ index 39fef26..f2f9f2e 100755 + _mencoder="no" + libs_mplayer="$libs_mplayer -lva" + fi - _vomodules="vaapi $_vomodules" + vomodules="vaapi $vomodules" else def_vaapi='#define CONFIG_VAAPI 0' + def_vaapi_old='#define CONFIG_VAAPI_OLD 0' - _novomodules="vaapi $_novomodules" + novomodules="vaapi $novomodules" _libavhwaccels=`echo $_libavhwaccels | sed -e "s/\(MPEG[124]\|H26[34]\|WMV3\|VC1\)_VAAPI_HWACCEL//g"` fi -@@ -8759,6 +8774,7 @@ CONFIG_POSTPROC = yes - # Prevent building libavcodec/imgresample.c with conflicting symbols - CONFIG_SWSCALE=yes - CONFIG_VAAPI=$_vaapi -+CONFIG_VAAPI_OLD=$_vaapi_old - CONFIG_VDPAU=$_vdpau - CONFIG_XVMC=$_xvmc - CONFIG_ZLIB=$_zlib -@@ -9143,6 +9159,7 @@ $def_tdfxvid +@@ -8862,6 +8877,7 @@ CONFIG_MLIB = $_mlib + CONFIG_MUXERS = $_mencoder + CONFIG_POSTPROC = yes + CONFIG_VAAPI = $_vaapi ++CONFIG_VAAPI_OLD= $_vaapi_old + CONFIG_VDPAU = $_vdpau + CONFIG_XVMC = $_xvmc + CONFIG_ZLIB = $_zlib +@@ -9241,6 +9257,7 @@ $def_tdfxvid $def_tga $def_v4l2 $def_vaapi @@ -162,7 +162,7 @@ index 0000000..f463118 + +#endif /* AVCODEC_VAAPI_COMPAT_H */ diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c -index a365428..efe92b8 100644 +index b61a9ca..cab6e41 100644 --- a/libavcodec/vaapi_h264.c +++ b/libavcodec/vaapi_h264.c @@ -123,8 +123,8 @@ static void fill_vaapi_pic(VAPictureH264 *va_pic, @@ -275,7 +275,7 @@ index 2c0fdf9..ff83b96 100644 #include "mpegvideo.h" diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c -index 21bc778..8961e9e 100644 +index 2e870dc..637546a 100644 --- a/libavcodec/vaapi_mpeg2.c +++ b/libavcodec/vaapi_mpeg2.c @@ -52,24 +52,24 @@ static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_ @@ -331,7 +331,7 @@ index 21bc778..8961e9e 100644 slice_param->quantiser_scale_code = quantiser_scale_code; slice_param->intra_slice_flag = intra_slice_flag; diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c -index 4e606f0..5a9a48e 100644 +index 466ce2f..ea306a4 100644 --- a/libavcodec/vaapi_mpeg4.c +++ b/libavcodec/vaapi_mpeg4.c @@ -54,42 +54,42 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ @@ -421,7 +421,7 @@ index 4e606f0..5a9a48e 100644 if (!iq_matrix) return -1; diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c -index 50a4ba2..6e319fc 100644 +index 992e1da..8264dd9 100644 --- a/libavcodec/vaapi_vc1.c +++ b/libavcodec/vaapi_vc1.c @@ -146,100 +146,100 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t @@ -658,7 +658,7 @@ index 50a4ba2..6e319fc 100644 default: ff_bp[0] = NULL; diff --git a/libvo/vo_vaapi.c b/libvo/vo_vaapi.c -index 3fe563a..d653b53 100644 +index 5f75b09..bbc95ff 100644 --- a/libvo/vo_vaapi.c +++ b/libvo/vo_vaapi.c @@ -45,7 +45,11 @@ diff --git a/media-video/mplayer/files/vaapi/04-mplayer-vdpau.patch b/media-video/mplayer/files/vaapi/04-mplayer-vdpau.patch index c721609..083ca3b 100644 --- a/media-video/mplayer/files/vaapi/04-mplayer-vdpau.patch +++ b/media-video/mplayer/files/vaapi/04-mplayer-vdpau.patch @@ -1,30 +1,30 @@ diff --git a/configure b/configure -index 39fef26..3a97c6e 100755 +index 89a0a9a..c325521 100755 --- a/configure +++ b/configure -@@ -549,7 +549,7 @@ _libopencore_amrnb=auto +@@ -586,7 +586,7 @@ _libavparsers=$libavparsers_all _libavbsfs_all=$(sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') - _libavbsfs=$_libavbsfs_all + _libavbsfs=$libavbsfs_all _libavhwaccels_all=$(sed -n 's/^[^#]*HWACCEL.*(.*, *\(.*\)).*/\1_hwaccel/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') --_libavhwaccels=$(for h in $_libavhwaccels_all; do case $h in (*_VAAPI_HWACCEL) echo $h;; esac; done) -+_libavhwaccels=$(for h in $_libavhwaccels_all; do case $h in (*_VDPAU_HWACCEL|*_VAAPI_HWACCEL) echo $h;; esac; done) +-_libavhwaccels=$(for h in $libavhwaccels_all; do case $h in (*_VAAPI_HWACCEL) echo $h;; esac; done) ++_libavhwaccels=$(for h in $libavhwaccels_all; do case $h in (*_VAAPI_HWACCEL|*_VDPAU_HWACCEL) echo $h;; esac; done) _libavdemuxers_all=$(sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' libavformat/allformats.c | tr '[a-z]' '[A-Z]') - _libavdemuxers=$(echo $_libavdemuxers_all | sed -e 's/ LIB[A-Z0-9_]*_DEMUXER//g' -e s/REDIR_DEMUXER// -e s/AVISYNTH_DEMUXER//) + _libavdemuxers=$(echo $libavdemuxers_all | sed -e 's/ LIB[A-Z0-9_]*_DEMUXER//g' -e s/REDIR_DEMUXER// -e s/AVISYNTH_DEMUXER//) _libavmuxers_all=$(sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' libavformat/allformats.c | tr '[a-z]' '[A-Z]') -@@ -4500,7 +4500,7 @@ if test "$_vdpau" = yes ; then +@@ -4593,7 +4593,7 @@ if test "$_vdpau" = yes ; then else def_vdpau='#define CONFIG_VDPAU 0' - _novomodules="vdpau $_novomodules" + novomodules="vdpau $novomodules" - _libavdecoders=$(echo $_libavdecoders | sed -e "s/\(MPEG\|MPEG[124]\|H26[34]\|WMV3\|VC1\)_VDPAU_DECODER//g") + _libavhwaccels=$(echo $_libavhwaccels | sed -e "s/\(MPEG[124]\|H26[34]\|WMV3\|VC1\)_VDPAU_HWACCEL//g") fi echores "$_vdpau" diff --git a/etc/codecs.conf b/etc/codecs.conf -index 15c6e8d..8f6a122 100644 +index 8eece64..2db98e4 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf -@@ -146,6 +146,7 @@ videocodec ffmpeg1 +@@ -136,6 +136,7 @@ videocodec ffmpeg1 fourcc m1v1 driver ffmpeg dll "mpeg1video" @@ -32,7 +32,7 @@ index 15c6e8d..8f6a122 100644 out YV12,I420,IYUV videocodec ffmpeg2 -@@ -182,6 +183,7 @@ videocodec ffmpeg2 +@@ -173,6 +174,7 @@ videocodec ffmpeg2 driver ffmpeg dll "mpeg2video" out VAAPI_MPEG2 @@ -40,7 +40,7 @@ index 15c6e8d..8f6a122 100644 out YV12,I420,IYUV out 422P,444P -@@ -221,6 +223,7 @@ videocodec ffmpeg12 +@@ -213,6 +215,7 @@ videocodec ffmpeg12 fourcc slif ; SoftLab MPEG-2 I-frames Codec driver ffmpeg dll "mpegvideo" @@ -48,7 +48,7 @@ index 15c6e8d..8f6a122 100644 out YV12,I420,IYUV out 422P,444P -@@ -307,44 +310,6 @@ videocodec ffmpeg12mc +@@ -292,41 +295,6 @@ videocodec ffmpeg12mc out IDCT_MPEG2 out MOCO_MPEG2 @@ -67,7 +67,6 @@ index 15c6e8d..8f6a122 100644 - fourcc hdv3 ; HDV 1080i50 - fourcc hdv5 ; HDV 720p25 - fourcc mx5p ; MPEG IMX 625/50 (50 Mb/s) -- fourcc MMES,mmes ; matrox mpeg2 in avi - fourcc hdv6,hdv7,hdv8 - fourcc xdv1,xdv2,xdv3 - fourcc xdv4,xdv5,xdv6 @@ -88,12 +87,10 @@ index 15c6e8d..8f6a122 100644 - out VDPAU_MPEG1 - out VDPAU_MPEG2 - --; we have only native open source codecs for these: -- + ; we have only native open source codecs for these: + videocodec ffnuv - info "NuppelVideo" - status working -@@ -883,15 +849,8 @@ videocodec ffwmv3 +@@ -903,15 +871,8 @@ videocodec ffwmv3 driver ffmpeg dll wmv3 out VAAPI_WMV3 @@ -110,7 +107,7 @@ index 15c6e8d..8f6a122 100644 videocodec ffvc1 info "FFmpeg WVC1" -@@ -901,16 +860,8 @@ videocodec ffvc1 +@@ -921,16 +882,8 @@ videocodec ffvc1 driver ffmpeg dll vc1 out VAAPI_VC1 @@ -128,7 +125,7 @@ index 15c6e8d..8f6a122 100644 videocodec ffh264 info "FFmpeg H.264" -@@ -923,19 +874,8 @@ videocodec ffh264 +@@ -943,19 +896,8 @@ videocodec ffh264 driver ffmpeg dll h264 out VAAPI_H264 @@ -149,7 +146,7 @@ index 15c6e8d..8f6a122 100644 videocodec coreavcwindows info "CoreAVC H.264 for x86 - http://corecodec.org/" -@@ -994,39 +933,8 @@ videocodec ffodivx +@@ -1013,40 +955,8 @@ videocodec ffodivx driver ffmpeg dll mpeg4 ;opendivx out VAAPI_MPEG4 @@ -183,6 +180,7 @@ index 15c6e8d..8f6a122 100644 - fourcc M4T3,DMK2,DIGI,INMC - fourcc EPHV,SN40 - fourcc uldx,ULDX,VSPX +- fourcc SIPP ; Samsung SHR-6040 - driver ffmpeg - dll mpeg4_vdpau out VDPAU_MPEG4 @@ -191,10 +189,10 @@ index 15c6e8d..8f6a122 100644 videocodec ffwv1f info "WV1F MPEG-4" diff --git a/fmt-conversion.c b/fmt-conversion.c -index a9ba43d..cf5566d 100644 +index bd32ce8..8994caa 100644 --- a/fmt-conversion.c +++ b/fmt-conversion.c -@@ -81,12 +81,6 @@ static const struct { +@@ -91,12 +91,6 @@ static const struct { {IMGFMT_XVMC_MOCO_MPEG2, PIX_FMT_XVMC_MPEG2_MC}, {IMGFMT_XVMC_IDCT_MPEG2, PIX_FMT_XVMC_MPEG2_IDCT}, @@ -205,9 +203,9 @@ index a9ba43d..cf5566d 100644 - {IMGFMT_VDPAU_VC1, PIX_FMT_VDPAU_VC1}, - {IMGFMT_VDPAU_MPEG4, PIX_FMT_VDPAU_MPEG4}, - /* VA API formats */ + /* VA-API formats */ {IMGFMT_VAAPI_MPEG2, PIX_FMT_VAAPI_VLD, CODEC_ID_MPEG2VIDEO}, -@@ -98,6 +92,14 @@ static const struct { +@@ -108,6 +102,14 @@ static const struct { {IMGFMT_VAAPI_WMV3, PIX_FMT_VAAPI_VLD, CODEC_ID_WMV3}, {IMGFMT_VAAPI_VC1, PIX_FMT_VAAPI_VLD, CODEC_ID_VC1}, @@ -223,11 +221,11 @@ index a9ba43d..cf5566d 100644 }; diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c -index 43e49d1..646c590 100644 +index f17d03a..185541e 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c -@@ -61,6 +61,13 @@ void avcodec_register_all(void) - REGISTER_HWACCEL (VC1_VAAPI, vc1_vaapi); +@@ -65,6 +65,13 @@ void avcodec_register_all(void) + REGISTER_HWACCEL (WMV3_DXVA2, wmv3_dxva2); REGISTER_HWACCEL (WMV3_VAAPI, wmv3_vaapi); + REGISTER_HWACCEL (H264_VDPAU, h264_vdpau); @@ -240,15 +238,15 @@ index 43e49d1..646c590 100644 /* video codecs */ REGISTER_DECODER (AASC, aasc); REGISTER_DECODER (AMV, amv); -@@ -108,7 +115,6 @@ void avcodec_register_all(void) +@@ -113,7 +120,6 @@ void avcodec_register_all(void) REGISTER_DECODER (H263I, h263i); REGISTER_ENCODER (H263P, h263p); REGISTER_DECODER (H264, h264); - REGISTER_DECODER (H264_VDPAU, h264_vdpau); REGISTER_ENCDEC (HUFFYUV, huffyuv); REGISTER_DECODER (IDCIN, idcin); - REGISTER_DECODER (INDEO2, indeo2); -@@ -128,10 +134,7 @@ void avcodec_register_all(void) + REGISTER_DECODER (IFF_BYTERUN1, iff_byterun1); +@@ -137,10 +143,7 @@ void avcodec_register_all(void) REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video); REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video); REGISTER_ENCDEC (MPEG4, mpeg4); @@ -259,7 +257,7 @@ index 43e49d1..646c590 100644 REGISTER_ENCDEC (MSMPEG4V1, msmpeg4v1); REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2); REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3); -@@ -182,7 +185,6 @@ void avcodec_register_all(void) +@@ -192,7 +195,6 @@ void avcodec_register_all(void) REGISTER_DECODER (V210X, v210x); REGISTER_DECODER (VB, vb); REGISTER_DECODER (VC1, vc1); @@ -267,7 +265,7 @@ index 43e49d1..646c590 100644 REGISTER_DECODER (VCR1, vcr1); REGISTER_DECODER (VMDVIDEO, vmdvideo); REGISTER_DECODER (VMNC, vmnc); -@@ -195,7 +197,6 @@ void avcodec_register_all(void) +@@ -206,7 +208,6 @@ void avcodec_register_all(void) REGISTER_ENCDEC (WMV1, wmv1); REGISTER_ENCDEC (WMV2, wmv2); REGISTER_DECODER (WMV3, wmv3); @@ -276,10 +274,10 @@ index 43e49d1..646c590 100644 REGISTER_DECODER (XAN_WC3, xan_wc3); REGISTER_DECODER (XL, xl); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -index 81f9d98..d63f5f3 100644 +index 48666f9..7635cf8 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h -@@ -614,10 +614,6 @@ typedef struct RcOverride{ +@@ -643,10 +643,6 @@ typedef struct RcOverride{ */ #define CODEC_CAP_SMALL_LAST_FRAME 0x0040 /** @@ -288,13 +286,13 @@ index 81f9d98..d63f5f3 100644 -#define CODEC_CAP_HWACCEL_VDPAU 0x0080 -/** * Codec can output multiple frames per AVPacket - */ - #define CODEC_CAP_SUBFRAMES 0x0100 + * Normally demuxers return one frame at a time, demuxers which do not do + * are connected to a parser to split what they return into proper frames. diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c -index 8c6ac9d..2f08ddb 100644 +index dc015b9..a36f7ac 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c -@@ -684,7 +684,6 @@ void ff_er_frame_end(MpegEncContext *s){ +@@ -759,7 +759,6 @@ void ff_er_frame_end(MpegEncContext *s){ if(!s->error_recognition || s->error_count==0 || s->avctx->lowres || s->avctx->hwaccel || @@ -303,7 +301,7 @@ index 8c6ac9d..2f08ddb 100644 s->error_count==3*s->mb_width*(s->avctx->skip_top + s->avctx->skip_bottom)) return; diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c -index a4d9532..d35bd26 100644 +index d9d6f7e..f7a21ed 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -33,7 +33,6 @@ @@ -314,20 +312,20 @@ index a4d9532..d35bd26 100644 #include "flv.h" #include "mpeg4video.h" -@@ -617,11 +616,6 @@ retry: +@@ -619,11 +618,6 @@ retry: if(MPV_frame_start(s, avctx) < 0) return -1; - if (CONFIG_MPEG4_VDPAU_DECODER && (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)) { -- ff_vdpau_mpeg4_decode_picture(s, buf, buf_size); +- ff_vdpau_mpeg4_decode_picture(s, s->gb.buffer, s->gb.buffer_end - s->gb.buffer); - goto frame_end; - } - if (avctx->hwaccel) { - if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0) + if (avctx->hwaccel->start_frame(avctx, s->gb.buffer, s->gb.buffer_end - s->gb.buffer) < 0) return -1; diff --git a/libavcodec/h264.c b/libavcodec/h264.c -index 6056497..493bdf5 100644 +index d1662fc..72e00b6 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -36,7 +36,6 @@ @@ -337,8 +335,8 @@ index 6056497..493bdf5 100644 -#include "vdpau_internal.h" #include "cabac.h" - #if ARCH_X86 -@@ -1626,9 +1625,6 @@ static void field_end(H264Context *h){ + +@@ -1650,9 +1649,6 @@ static void field_end(H264Context *h){ s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_H264; s->current_picture_ptr->pict_type= s->pict_type; @@ -348,7 +346,7 @@ index 6056497..493bdf5 100644 if(!s->dropable) { ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index); h->prev_poc_msb= h->poc_msb; -@@ -1642,9 +1638,6 @@ static void field_end(H264Context *h){ +@@ -1666,9 +1662,6 @@ static void field_end(H264Context *h){ av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n"); } @@ -358,7 +356,7 @@ index 6056497..493bdf5 100644 /* * FIXME: Error handling code does not seem to support interlaced * when slices span multiple rows -@@ -2355,8 +2348,6 @@ static void execute_decode_slices(H264Context *h, int context_count){ +@@ -2710,8 +2703,6 @@ static void execute_decode_slices(H264Context *h, int context_count){ if (s->avctx->hwaccel) return; @@ -367,7 +365,16 @@ index 6056497..493bdf5 100644 if(context_count == 1) { decode_slice(avctx, &h); } else { -@@ -2499,11 +2490,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ +@@ -2847,8 +2838,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ + if (h->current_slice == 1) { + if (s->avctx->hwaccel && s->avctx->hwaccel->start_frame(s->avctx, NULL, 0) < 0) + return -1; +- if(CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) +- ff_vdpau_h264_picture_start(s); + } + + s->current_picture_ptr->key_frame |= +@@ -2863,11 +2852,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ if (avctx->hwaccel->decode_slice(avctx, &buf[buf_index - consumed], consumed) < 0) return -1; }else @@ -379,15 +386,15 @@ index 6056497..493bdf5 100644 context_count++; } break; -@@ -3080,20 +3066,3 @@ AVCodec h264_decoder = { +@@ -3396,20 +3380,3 @@ AVCodec h264_decoder = { + .flush= flush_dpb, .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), - .pix_fmts= ff_hwaccel_pixfmt_list_420, }; - -#if CONFIG_H264_VDPAU_DECODER -AVCodec h264_vdpau_decoder = { - "h264_vdpau", -- CODEC_TYPE_VIDEO, +- AVMEDIA_TYPE_VIDEO, - CODEC_ID_H264, - sizeof(H264Context), - ff_h264_decode_init, @@ -401,7 +408,7 @@ index 6056497..493bdf5 100644 -}; -#endif diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c -index 636ae06..be32e8d 100644 +index 0af24ad..8a2e93c 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -35,7 +35,6 @@ @@ -437,7 +444,7 @@ index 636ae06..be32e8d 100644 if( avctx->idct_algo == FF_IDCT_AUTO ) avctx->idct_algo = FF_IDCT_SIMPLE; -@@ -2063,8 +2055,7 @@ static int vcr2_init_sequence(AVCodecContext *avctx) +@@ -2065,8 +2057,7 @@ static int vcr2_init_sequence(AVCodecContext *avctx) avctx->pix_fmt = mpeg_get_pixelformat(avctx); avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); @@ -447,7 +454,7 @@ index 636ae06..be32e8d 100644 if( avctx->idct_algo == FF_IDCT_AUTO ) avctx->idct_algo = FF_IDCT_SIMPLE; -@@ -2292,9 +2283,6 @@ static int decode_chunks(AVCodecContext *avctx, +@@ -2297,9 +2288,6 @@ static int decode_chunks(AVCodecContext *avctx, s2->error_count += s2->thread_context[i]->error_count; } @@ -457,7 +464,7 @@ index 636ae06..be32e8d 100644 if (slice_end(avctx, picture)) { if(s2->last_picture_ptr || s2->low_delay) //FIXME merge with the stuff in mpeg_decode_slice *data_size = sizeof(AVPicture); -@@ -2441,11 +2429,6 @@ static int decode_chunks(AVCodecContext *avctx, +@@ -2446,11 +2434,6 @@ static int decode_chunks(AVCodecContext *avctx, return -1; } @@ -469,7 +476,7 @@ index 636ae06..be32e8d 100644 if(avctx->thread_count > 1){ int threshold= (s2->mb_height*s->slice_count + avctx->thread_count/2) / avctx->thread_count; if(threshold <= mb_y){ -@@ -2570,36 +2553,3 @@ AVCodec mpeg_xvmc_decoder = { +@@ -2578,36 +2561,3 @@ AVCodec mpeg_xvmc_decoder = { }; #endif @@ -477,7 +484,7 @@ index 636ae06..be32e8d 100644 -#if CONFIG_MPEG_VDPAU_DECODER -AVCodec mpeg_vdpau_decoder = { - "mpegvideo_vdpau", -- CODEC_TYPE_VIDEO, +- AVMEDIA_TYPE_VIDEO, - CODEC_ID_MPEG2VIDEO, - sizeof(Mpeg1Context), - mpeg_decode_init, @@ -493,7 +500,7 @@ index 636ae06..be32e8d 100644 -#if CONFIG_MPEG1_VDPAU_DECODER -AVCodec mpeg1_vdpau_decoder = { - "mpeg1video_vdpau", -- CODEC_TYPE_VIDEO, +- AVMEDIA_TYPE_VIDEO, - CODEC_ID_MPEG1VIDEO, - sizeof(Mpeg1Context), - mpeg_decode_init, @@ -507,10 +514,10 @@ index 636ae06..be32e8d 100644 -#endif - diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c -index a1786e8..757df3d 100644 +index b339f78..1928d03 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c -@@ -2243,20 +2243,3 @@ AVCodec mpeg4_decoder = { +@@ -2249,20 +2249,3 @@ AVCodec mpeg4_decoder = { .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"), .pix_fmts= ff_hwaccel_pixfmt_list_420, }; @@ -519,7 +526,7 @@ index a1786e8..757df3d 100644 -#if CONFIG_MPEG4_VDPAU_DECODER -AVCodec mpeg4_vdpau_decoder = { - "mpeg4_vdpau", -- CODEC_TYPE_VIDEO, +- AVMEDIA_TYPE_VIDEO, - CODEC_ID_MPEG4, - sizeof(MpegEncContext), - decode_init, @@ -532,18 +539,18 @@ index a1786e8..757df3d 100644 -}; -#endif diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c -index ea96cbe..8dd5ac1 100644 +index 684bdfe..1bd9d5c 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c -@@ -82,6 +82,7 @@ const enum PixelFormat ff_pixfmt_list_420[] = { - +@@ -116,6 +116,7 @@ const enum PixelFormat ff_pixfmt_list_420[] = { const enum PixelFormat ff_hwaccel_pixfmt_list_420[] = { + PIX_FMT_DXVA2_VLD, PIX_FMT_VAAPI_VLD, + PIX_FMT_VDPAU, PIX_FMT_YUV420P, PIX_FMT_NONE }; -@@ -1018,7 +1019,6 @@ void MPV_frame_end(MpegEncContext *s) +@@ -1056,7 +1057,6 @@ void MPV_frame_end(MpegEncContext *s) if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){ ff_xvmc_field_end(s); }else if(!s->avctx->hwaccel @@ -552,10 +559,10 @@ index ea96cbe..8dd5ac1 100644 && s->current_picture.reference && !s->intra_only diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c -index d2a50a3..8770756 100644 +index 8c9cbcd..dbf2ded 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c -@@ -36,7 +36,6 @@ +@@ -37,7 +37,6 @@ #include "unary.h" #include "simple_idct.h" #include "mathops.h" @@ -563,7 +570,7 @@ index d2a50a3..8770756 100644 #undef NDEBUG #include -@@ -3140,13 +3139,6 @@ static int vc1_decode_frame(AVCodecContext *avctx, +@@ -3167,13 +3166,6 @@ static int vc1_decode_frame(AVCodecContext *avctx, s->current_picture_ptr= &s->picture[i]; } @@ -577,7 +584,7 @@ index d2a50a3..8770756 100644 //for advanced profile we may need to parse and unescape data if (avctx->codec_id == CODEC_ID_VC1) { int buf_size2 = 0; -@@ -3163,8 +3155,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, +@@ -3190,8 +3182,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, if(size <= 0) continue; switch(AV_RB32(start)){ case VC1_CODE_FRAME: @@ -587,7 +594,7 @@ index d2a50a3..8770756 100644 buf_start = start; buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); break; -@@ -3256,10 +3247,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, +@@ -3278,10 +3269,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, s->me.qpel_put= s->dsp.put_qpel_pixels_tab; s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab; @@ -599,7 +606,7 @@ index d2a50a3..8770756 100644 if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0) return -1; if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0) -@@ -3349,37 +3337,3 @@ AVCodec wmv3_decoder = { +@@ -3371,37 +3359,3 @@ AVCodec wmv3_decoder = { .pix_fmts = ff_hwaccel_pixfmt_list_420 }; #endif @@ -607,7 +614,7 @@ index d2a50a3..8770756 100644 -#if CONFIG_WMV3_VDPAU_DECODER -AVCodec wmv3_vdpau_decoder = { - "wmv3_vdpau", -- CODEC_TYPE_VIDEO, +- AVMEDIA_TYPE_VIDEO, - CODEC_ID_WMV3, - sizeof(VC1Context), - vc1_decode_init, @@ -624,7 +631,7 @@ index d2a50a3..8770756 100644 -#if CONFIG_VC1_VDPAU_DECODER -AVCodec vc1_vdpau_decoder = { - "vc1_vdpau", -- CODEC_TYPE_VIDEO, +- AVMEDIA_TYPE_VIDEO, - CODEC_ID_VC1, - sizeof(VC1Context), - vc1_decode_init, @@ -638,7 +645,7 @@ index d2a50a3..8770756 100644 -}; -#endif diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c -index 7cc8ad1..c60b1e7 100644 +index bd721e8..09ca45e 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -30,7 +30,6 @@ @@ -719,7 +726,7 @@ index 7cc8ad1..c60b1e7 100644 assert(render_ref); rf2 = &render->info.h264.referenceFrames[0]; -@@ -84,70 +125,92 @@ void ff_vdpau_h264_set_reference_frames(MpegEncContext *s) +@@ -84,81 +125,93 @@ void ff_vdpau_h264_set_reference_frames(MpegEncContext *s) if (rf >= &render->info.h264.referenceFrames[H264_RF_COUNT]) continue; @@ -764,20 +771,33 @@ index 7cc8ad1..c60b1e7 100644 sizeof(*render->bitstream_buffers)*(render->bitstream_buffers_used + 1) ); +- render->bitstream_buffers[render->bitstream_buffers_used].struct_version = VDP_BITSTREAM_BUFFER_VERSION; +- render->bitstream_buffers[render->bitstream_buffers_used].bitstream = buf; +- render->bitstream_buffers[render->bitstream_buffers_used].bitstream_bytes = buf_size; +- render->bitstream_buffers_used++; + if (!render->bitstream_buffers) + return -1; + + return 0; -+} -+ + } + +-void ff_vdpau_h264_picture_start(MpegEncContext *s) +static int vdpau_common_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) -+{ + { +- H264Context *h = s->avctx->priv_data; + MpegEncContext * const s = avctx->priv_data; -+ struct vdpau_render_state *render; -+ + struct vdpau_render_state *render; +- int i; + +- render = (struct vdpau_render_state *)s->current_picture_ptr->data[0]; + render = (struct vdpau_render_state *)s->current_picture_ptr->data[3]; -+ assert(render); -+ + assert(render); + +- for (i = 0; i < 2; ++i) { +- int foc = s->current_picture_ptr->field_poc[i]; +- if (foc == INT_MAX) +- foc = 0; +- render->info.h264.field_order_cnt[i] = foc; + render->bitstream_buffers_used = 0; + return 0; +} @@ -793,10 +813,11 @@ index 7cc8ad1..c60b1e7 100644 + if (render->bitstream_buffers_used) { + ff_draw_horiz_band(s, 0, s->avctx->height); + render->bitstream_buffers_used = 0; -+ } + } + return 0; +} -+ + +- render->info.h264.frame_num = h->frame_num; +static int vdpau_common_decode_slice(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size) +{ + MpegEncContext * const s = avctx->priv_data; @@ -808,10 +829,10 @@ index 7cc8ad1..c60b1e7 100644 + if (vdpau_ensure_bitstream_buffers(render) < 0) + return -1; + - render->bitstream_buffers[render->bitstream_buffers_used].struct_version = VDP_BITSTREAM_BUFFER_VERSION; - render->bitstream_buffers[render->bitstream_buffers_used].bitstream = buf; - render->bitstream_buffers[render->bitstream_buffers_used].bitstream_bytes = buf_size; - render->bitstream_buffers_used++; ++ render->bitstream_buffers[render->bitstream_buffers_used].struct_version = VDP_BITSTREAM_BUFFER_VERSION; ++ render->bitstream_buffers[render->bitstream_buffers_used].bitstream = buf; ++ render->bitstream_buffers[render->bitstream_buffers_used].bitstream_bytes = buf_size; ++ render->bitstream_buffers_used++; + return 0; } @@ -822,7 +843,6 @@ index 7cc8ad1..c60b1e7 100644 + H264Context * const h = avctx->priv_data; + MpegEncContext * const s = &h->s; struct vdpau_render_state *render; -- int i; - render = (struct vdpau_render_state *)s->current_picture_ptr->data[0]; + render = (struct vdpau_render_state *)s->current_picture_ptr->data[3]; @@ -833,23 +853,18 @@ index 7cc8ad1..c60b1e7 100644 - return; + vdpau_h264_set_reference_frames(h); -- for (i = 0; i < 2; ++i) { -- int foc = s->current_picture_ptr->field_poc[i]; -- if (foc == INT_MAX) -- foc = 0; -- render->info.h264.field_order_cnt[i] = foc; -- } +- render->info.h264.is_reference = (s->current_picture_ptr->reference & 3) ? VDP_TRUE : VDP_FALSE; + vdpau_h264_fill_field_order_cnt(render->info.h264.field_order_cnt, + s->current_picture_ptr, + s->picture_structure); - -- render->info.h264.is_reference = (s->current_picture_ptr->reference & 3) ? VDP_TRUE : VDP_FALSE; ++ + /* fill VdpPictureInfoH264 struct */ + render->info.h264.is_reference = h->nal_ref_idc != 0; - render->info.h264.frame_num = h->frame_num; ++ render->info.h264.frame_num = h->frame_num; render->info.h264.field_pic_flag = s->picture_structure != PICT_FRAME; render->info.h264.bottom_field_flag = s->picture_structure == PICT_BOTTOM_FIELD; -@@ -175,19 +238,44 @@ void ff_vdpau_h264_picture_complete(MpegEncContext *s) + render->info.h264.num_ref_frames = h->sps.ref_frame_count; +@@ -185,19 +238,44 @@ void ff_vdpau_h264_picture_complete(MpegEncContext *s) memcpy(render->info.h264.scaling_lists_4x4, h->pps.scaling_matrix4, sizeof(render->info.h264.scaling_lists_4x4)); memcpy(render->info.h264.scaling_lists_8x8, h->pps.scaling_matrix8, sizeof(render->info.h264.scaling_lists_8x8)); @@ -858,10 +873,12 @@ index 7cc8ad1..c60b1e7 100644 + render->info.h264.slice_count = 0; + + return vdpau_common_start_frame(avctx, buffer, size); -+} -+ + } + +-void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, +- int buf_size, int slice_count) +static int vdpau_h264_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) -+{ + { + MpegEncContext * const s = avctx->priv_data; + struct vdpau_render_state *render; + static const uint8_t start_code_prefix_one_3byte[3] = { 0x00, 0x00, 0x01 }; @@ -882,12 +899,10 @@ index 7cc8ad1..c60b1e7 100644 + + ++render->info.h264.slice_count; + return 0; - } - --void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, -- int buf_size, int slice_count) ++} ++ +static int vdpau_mpeg2_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) - { ++{ + MpegEncContext * const s = avctx->priv_data; struct vdpau_render_state *render, *last, *next; int i; @@ -900,7 +915,7 @@ index 7cc8ad1..c60b1e7 100644 assert(render); /* fill VdpPictureInfoMPEG1Or2 struct */ -@@ -216,36 +304,47 @@ void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, +@@ -226,36 +304,47 @@ void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, switch(s->pict_type){ case FF_B_TYPE: @@ -960,7 +975,7 @@ index 7cc8ad1..c60b1e7 100644 render->info.vc1.frame_coding_mode = v->fcm; render->info.vc1.postprocflag = v->postprocflag; render->info.vc1.pulldown = v->broadcast; -@@ -286,34 +385,47 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf, +@@ -296,34 +385,47 @@ void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf, switch(s->pict_type){ case FF_B_TYPE: @@ -1004,7 +1019,7 @@ index 7cc8ad1..c60b1e7 100644 -void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf, - int buf_size) -+static int vdpau_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) ++static int vdpau_mpeg4_decode_picture(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { + MpegEncContext * const s = avctx->priv_data; struct vdpau_render_state *render, *last, *next; @@ -1018,7 +1033,7 @@ index 7cc8ad1..c60b1e7 100644 assert(render); /* fill VdpPictureInfoMPEG4Part2 struct */ -@@ -338,21 +450,104 @@ void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf, +@@ -352,21 +454,122 @@ void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf, switch (s->pict_type) { case FF_B_TYPE: @@ -1041,11 +1056,29 @@ index 7cc8ad1..c60b1e7 100644 - ff_draw_horiz_band(s, 0, s->avctx->height); - render->bitstream_buffers_used = 0; -+ return vdpau_common_decode_slice(avctx, buffer, size); ++ if (vdpau_common_decode_slice(avctx, buffer, size) < 0) ++ return -1; ++ ++ return vdpau_common_end_frame(avctx); ++} ++ ++static int vdpau_mpeg4_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) ++{ ++ /* The `buffer' can be modified beyond this point so we pass the ++ * whole picture now to the decoder and let user-applications catch ++ * up immediately */ ++ return vdpau_mpeg4_decode_picture(avctx, buffer, size); } +static int vdpau_mpeg4_decode_slice(av_unused AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) +{ ++ /* SKIP: everything is done in vdpau_mpeg4_start_frame() */ ++ return 0; ++} ++ ++static int vdpau_mpeg4_end_frame(av_unused AVCodecContext *avctx) ++{ ++ /* SKIP: everything is done in vdpau_mpeg4_start_frame() */ + return 0; +} + @@ -1122,46 +1155,48 @@ index 7cc8ad1..c60b1e7 100644 + .pix_fmt = PIX_FMT_VDPAU, + .capabilities = 0, + .start_frame = vdpau_mpeg4_start_frame, -+ .end_frame = vdpau_common_end_frame, ++ .end_frame = vdpau_mpeg4_end_frame, + .decode_slice = vdpau_mpeg4_decode_slice, +}; +#endif + /* @}*/ diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c -index b689519..217c49f 100644 +index e2bc649..1c2b773 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c -@@ -646,6 +646,12 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { - }, - .flags = PIX_FMT_BE, - }, +@@ -787,7 +787,13 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { + .comp = { + {0,1,1,0,7}, /* Y */ + {0,1,2,0,7}, /* A */ +- }, ++ } ++ }, + [PIX_FMT_VDPAU] = { + .name = "vdpau", + .log2_chroma_w = 1, + .log2_chroma_h = 1, + .flags = PIX_FMT_HWACCEL, -+ }, + }, }; - int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc) diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h -index ddd17fb..1f17073 100644 +index 8ec91c8..2386a81 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h -@@ -127,6 +127,7 @@ enum PixelFormat { - PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian - PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers - PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer -+ PIX_FMT_VDPAU, ///< HW decoding with VDPAU, Picture.data[3] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +@@ -133,6 +133,7 @@ enum PixelFormat { + PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 + PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1 + PIX_FMT_Y400A, ///< 8bit gray, 8bit alpha ++ PIX_FMT_VDPAU, ///< HW decoding with VDPAU, Picture.data[3] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c -index 1e8e71f..d49d009 100644 +index 5b003fa..150e82c 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c -@@ -275,7 +275,7 @@ static int init(sh_video_t *sh){ +@@ -294,7 +294,7 @@ static int init(sh_video_t *sh){ } #endif /* CONFIG_VAAPI */ #if CONFIG_VDPAU @@ -1171,10 +1206,10 @@ index 1e8e71f..d49d009 100644 } #endif /* CONFIG_VDPAU */ diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c -index 2ee7ccc..e728aff 100644 +index 490644d..31c8064 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c -@@ -977,7 +977,7 @@ static int draw_slice(uint8_t *image[], int stride[], int w, int h, +@@ -971,7 +971,7 @@ static int draw_slice(uint8_t *image[], int stride[], int w, int h, int x, int y) { VdpStatus vdp_st; @@ -1183,7 +1218,7 @@ index 2ee7ccc..e728aff 100644 int max_refs = image_format == IMGFMT_VDPAU_H264 ? rndr->info.h264.num_ref_frames : 2; if (handle_preemption() < 0) -@@ -1080,10 +1080,10 @@ static uint32_t get_image(mp_image_t *mpi) +@@ -1074,10 +1074,10 @@ static uint32_t get_image(mp_image_t *mpi) return VO_FALSE; } mpi->flags |= MP_IMGFLAG_DIRECT; diff --git a/media-video/mplayer/mplayer-1.0_rc4_p20100612-r50.ebuild b/media-video/mplayer/mplayer-1.0_rc4_p20100612-r50.ebuild new file mode 100644 index 0000000..60885b4 --- /dev/null +++ b/media-video/mplayer/mplayer-1.0_rc4_p20100612-r50.ebuild @@ -0,0 +1,755 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-video/mplayer/mplayer-1.0_rc4_p20100612.ebuild,v 1.7 2010/11/07 19:37:38 anarchy Exp $ + +EAPI="2" + +ESVN_REPO_URI="svn://svn.mplayerhq.hu/mplayer/trunk" +[[ ${PV} = *9999* ]] && SVN_ECLASS="subversion" || SVN_ECLASS="" + +inherit toolchain-funcs eutils flag-o-matic multilib base ${SVN_ECLASS} + +[[ ${PV} != *9999* ]] && MPLAYER_REVISION=SVN-r30554 + +IUSE="3dnow 3dnowext +a52 aalib +alsa altivec +ass bidi bindist bl bs2b ++cddb +cdio cdparanoia cpudetection custom-cpuopts debug dga +dirac directfb +doc +dts +dv dvb +dvd +dvdnav dxr3 +enca +encode esd +faac +faad fbcon ftp +gif ggi -gmplayer +iconv ipv6 jack joystick jpeg jpeg2k kernel_linux ladspa +libcaca lirc +live lzo mad md5sum +mmx mmxext mng +mp3 nas +network nut openal +amr +opengl +osdmenu oss png pnm pulseaudio pvr +quicktime radio +rar +real +rtc +samba +shm +schroedinger sdl +speex sse sse2 ssse3 svga tga +theora +tremor ++truetype +toolame +twolame +unicode v4l v4l2 vaapi vdpau vidix +vorbis vpx +win32codecs +X +x264 xanim xinerama +xscreensaver +xv +xvid xvmc zoran" +[[ ${PV} == *9999* ]] && IUSE+=" external-ffmpeg" + +VIDEO_CARDS="s3virge mga tdfx vesa" +for x in ${VIDEO_CARDS}; do + IUSE+=" video_cards_${x}" +done + +BLUV="1.7" +SVGV="1.9.17" +AMR_URI="http://www.3gpp.org/ftp/Specs/archive" +FONT_URI=" + mirror://mplayer/releases/fonts/font-arial-iso-8859-1.tar.bz2 + mirror://mplayer/releases/fonts/font-arial-iso-8859-2.tar.bz2 + mirror://mplayer/releases/fonts/font-arial-cp1250.tar.bz2 +" +if [[ ${PV} == *9999* ]]; then + RELEASE_URI="" +else + RELEASE_URI="mirror://gentoo/${P}.tbz2" +fi +SRC_URI="${RELEASE_URI} + !truetype? ( ${FONT_URI} ) + gmplayer? ( mirror://mplayer/skins/Blue-${BLUV}.tar.bz2 ) + svga? ( mirror://gentoo/svgalib_helper-${SVGV}-mplayer.tar.gz )" + +DESCRIPTION="Media Player for Linux" +HOMEPAGE="http://www.mplayerhq.hu/" + +FONT_RDEPS=" + virtual/ttf-fonts + media-libs/fontconfig + >=media-libs/freetype-2.2.1:2 +" +X_RDEPS=" + x11-libs/libXext + x11-libs/libXxf86vm +" +[[ ${PV} == *9999* ]] && RDEPEND+=" external-ffmpeg? ( media-video/ffmpeg )" +# Rar: althrought -gpl version is nice, it cant do most functions normal rars can +# nemesi? ( net-libs/libnemesi ) +RDEPEND+=" + sys-libs/ncurses + app-arch/bzip2 + sys-libs/zlib + !bindist? ( + x86? ( + win32codecs? ( media-libs/win32codecs ) + ) + ) + X? ( + ${X_RDEPS} + dga? ( x11-libs/libXxf86dga ) + ggi? ( + media-libs/libggi + media-libs/libggiwmh + ) + gmplayer? ( + media-libs/libpng + x11-libs/gtk+:2 + x11-libs/libXi + ) + opengl? ( virtual/opengl ) + vdpau? ( || ( x11-libs/libvdpau >=x11-drivers/nvidia-drivers-180.51 ) ) + xinerama? ( x11-libs/libXinerama ) + xscreensaver? ( x11-libs/libXScrnSaver ) + xv? ( + x11-libs/libXv + xvmc? ( x11-libs/libXvMC ) + ) + ) + a52? ( media-libs/a52dec ) + aalib? ( media-libs/aalib ) + alsa? ( media-libs/alsa-lib ) + amr? ( !bindist? ( media-libs/opencore-amr ) ) + ass? ( ${FONT_RDEPS} media-libs/libass ) + bidi? ( dev-libs/fribidi ) + bs2b? ( media-libs/libbs2b ) + cdio? ( dev-libs/libcdio ) + cdparanoia? ( !cdio? ( media-sound/cdparanoia ) ) + dirac? ( media-video/dirac ) + directfb? ( dev-libs/DirectFB ) + dts? ( media-libs/libdca ) + dv? ( media-libs/libdv ) + dvb? ( media-tv/linuxtv-dvb-headers ) + encode? ( + !twolame? ( toolame? ( media-sound/toolame ) ) + twolame? ( media-sound/twolame ) + faac? ( media-libs/faac ) + mp3? ( media-sound/lame ) + x264? ( >=media-libs/x264-0.0.20100423 ) + xvid? ( media-libs/xvid ) + ) + esd? ( media-sound/esound ) + enca? ( app-i18n/enca ) + faad? ( media-libs/faad2 ) + gif? ( media-libs/giflib ) + iconv? ( virtual/libiconv ) + jack? ( media-sound/jack-audio-connection-kit ) + jpeg? ( virtual/jpeg ) + jpeg2k? ( media-libs/openjpeg ) + ladspa? ( media-libs/ladspa-sdk ) + libcaca? ( media-libs/libcaca ) + lirc? ( app-misc/lirc ) + live? ( media-plugins/live ) + lzo? ( >=dev-libs/lzo-2 ) + mad? ( media-libs/libmad ) + mng? ( media-libs/libmng ) + nas? ( media-libs/nas ) + nut? ( >=media-libs/libnut-661 ) + openal? ( media-libs/openal ) + png? ( media-libs/libpng ) + pnm? ( media-libs/netpbm ) + pulseaudio? ( media-sound/pulseaudio ) + rar? ( + || ( + app-arch/unrar + app-arch/rar + ) + ) + samba? ( net-fs/samba ) + schroedinger? ( media-libs/schroedinger ) + sdl? ( media-libs/libsdl ) + speex? ( media-libs/speex ) + svga? ( media-libs/svgalib ) + theora? ( media-libs/libtheora[encode?] ) + truetype? ( ${FONT_RDEPS} ) + vaapi? ( x11-libs/libva ) + vorbis? ( media-libs/libvorbis ) + vpx? ( media-libs/libvpx ) + xanim? ( media-video/xanim ) +" + +X_DEPS=" + x11-proto/videoproto + x11-proto/xf86vidmodeproto +" +ASM_DEP="dev-lang/yasm" +DEPEND="${RDEPEND} + dev-util/pkgconfig + X? ( + ${X_DEPS} + dga? ( x11-proto/xf86dgaproto ) + dxr3? ( media-video/em8300-libraries ) + gmplayer? ( x11-proto/xextproto ) + xinerama? ( x11-proto/xineramaproto ) + xscreensaver? ( x11-proto/scrnsaverproto ) + ) + amd64? ( ${ASM_DEP} ) + doc? ( + dev-libs/libxslt app-text/docbook-xml-dtd + app-text/docbook-xsl-stylesheets + ) + x86? ( ${ASM_DEP} ) + x86-fbsd? ( ${ASM_DEP} ) +" + +SLOT="0" +LICENSE="GPL-2" +if [[ ${PV} != *9999* ]]; then + KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~sparc ~x86" +else + KEYWORDS="" +fi + +PATCHES=( "${FILESDIR}"/vaapi/*.patch) + +pkg_setup() { + if [[ ${PV} == *9999* ]]; then + elog "" + elog "This is a live ebuild which installs the latest from upstream's" + elog "subversion repository, and is unsupported by Gentoo." + elog "Everything but bugs in the ebuild itself will be ignored." + elog "" + fi + + if use gmplayer; then + ewarn "" + ewarn "GMPlayer is no longer actively developed upstream" + ewarn "and is not supported by Gentoo. There are alternatives" + ewarn "for a GUI frontend: smplayer, gnome-mplayer or kmplayer." + fi + + if use cpudetection; then + ewarn "" + ewarn "You've enabled the cpudetection flag. This feature is" + ewarn "included mainly for people who want to use the same" + ewarn "binary on another system with a different CPU architecture." + ewarn "MPlayer will already detect your CPU settings by default at" + ewarn "buildtime; this flag is used for runtime detection." + ewarn "You won't need this turned on if you are only building" + ewarn "mplayer for this system. Also, if your compile fails, try" + ewarn "disabling this use flag." + fi + + if use custom-cpuopts; then + ewarn "" + ewarn "You are using the custom-cpuopts flag which will" + ewarn "specifically allow you to enable / disable certain" + ewarn "CPU optimizations." + ewarn "" + ewarn "Most desktop users won't need this functionality, but it" + ewarn "is included for corner cases like cross-compiling and" + ewarn "certain profiles. If unsure, disable this flag and MPlayer" + ewarn "will automatically detect and use your available CPU" + ewarn "optimizations." + ewarn "" + ewarn "Using this flag means your build is unsupported, so" + ewarn "please make sure your CPU optimization use flags (3dnow" + ewarn "3dnowext mmx mmxext sse sse2 ssse3) are properly set." + fi +} + +src_unpack() { + if [[ ${PV} = *9999* ]]; then + subversion_src_unpack + + cd "${WORKDIR}" + else + unpack ${A} + fi + + if ! use truetype; then + unpack font-arial-iso-8859-1.tar.bz2 \ + font-arial-iso-8859-2.tar.bz2 \ + font-arial-cp1250.tar.bz2 + fi + + use gmplayer && unpack "Blue-${BLUV}.tar.bz2" + use svga && unpack "svgalib_helper-${SVGV}-mplayer.tar.gz" +} + +src_prepare() { + if [[ ${PV} = *9999* ]]; then + # Set SVN version manually + subversion_wc_info + sed -i -e "s/UNKNOWN/${ESVN_WC_REVISION}/" "${S}/version.sh" || die + else + # Set version # + sed -i -e "s/UNKNOWN/${MPLAYER_REVISION}/" "${S}/version.sh" || die + fi + + if use svga; then + echo + einfo "Enabling vidix non-root mode." + einfo "(You need a proper svgalib_helper.o module for your kernel" + einfo "to actually use this)" + echo + + mv "${WORKDIR}/svgalib_helper" "${S}/libdha" + fi + + base_src_prepare +} + +src_configure() { + local myconf="" + local uses i + + # set LINGUAS + [[ -n $LINGUAS ]] && LINGUAS="${LINGUAS/da/dk}" + + # mplayer ebuild uses "use foo || --disable-foo" to forcibly disable + # compilation in almost every situation. The reason for this is + # because if --enable is used, it will force the build of that option, + # regardless of whether the dependency is available or not. + + ################### + #Optional features# + ################### + myconf+=" + --disable-arts + --disable-kai + $(use_enable network) + $(use_enable joystick) + " + uses="ass bl enca ftp rtc" # nemesi <- not working with in-tree ebuild + myconf+=" --disable-nemesi" # nemesi automagic disable + myconf+=" --disable-ass-internal" # always use system libass + for i in ${uses}; do + use ${i} || myconf+=" --disable-${i}" + done + use bidi || myconf+=" --disable-fribidi" + use ipv6 || myconf+=" --disable-inet6" + use nut || myconf+=" --disable-libnut" + use rar || myconf+=" --disable-unrarexec" + use samba || myconf+=" --disable-smb" + use svga || myconf+=" --disable-svga --disable-svgalib_helper" + if ! use lirc; then + myconf+=" + --disable-lirc + --disable-lircc + --disable-apple-ir + " + fi + + # libcdio support: prefer libcdio over cdparanoia + # don't check for cddb w/cdio + if use cdio; then + myconf+=" --disable-cdparanoia" + else + myconf+=" --disable-libcdio" + use cdparanoia || myconf+=" --disable-cdparanoia" + use cddb || myconf+=" --disable-cddb" + fi + + ################################ + # DVD read, navigation support # + ################################ + # + # dvdread - accessing a DVD + # dvdnav - navigation of menus + # + # internal dvdread and dvdnav use flags enable internal + # versions of the libraries, which are snapshots of the fork. + + if use dvd; then + use dvdnav || myconf+=" --disable-dvdnav" + else + myconf+=" + --disable-dvdnav + --disable-dvdread + --disable-dvdread-internal + --disable-libdvdcss-internal + " + fi + + ############# + # Subtitles # + ############# + # + # SRT/ASS/SSA (subtitles) requires freetype support + # freetype support requires iconv + # iconv optionally can use unicode + + if ! use ass; then + if ! use truetype; then + myconf+=" --disable-freetype" + if ! use iconv; then + myconf+=" + --disable-iconv + --charset=noconv + " + fi + fi + fi + use iconv && use unicode && myconf+=" --charset=UTF-8" + + ##################################### + # DVB / Video4Linux / Radio support # + ##################################### + myconf+=" --disable-tv-bsdbt848" + # broken upstream, won't work with recent kernels + myconf+=" --disable-ivtv" + if { use dvb || use v4l || use v4l2 || use pvr || use radio; }; then + use dvb || myconf+=" --disable-dvb" + use pvr || myconf+=" --disable-pvr" + use v4l || myconf+=" --disable-tv-v4l1" + use v4l2 || myconf+=" --disable-tv-v4l2" + if use radio && { use dvb || use v4l || use v4l2; }; then + myconf+=" + --enable-radio + $(use_enable encode radio-capture) + " + else + myconf+=" + --disable-radio-v4l2 + --disable-radio-bsdbt848 + " + fi + else + myconf+=" + --disable-tv + --disable-tv-v4l1 + --disable-tv-v4l2 + --disable-radio + --disable-radio-v4l2 + --disable-radio-bsdbt848 + --disable-dvb + --disable-v4l2 + --disable-pvr" + fi + + ########## + # Codecs # + ########## + myconf+=" --disable-musepack" # Use internal musepack codecs for SV7 and SV8 support + myconf+=" --disable-faad-internal" # always use system media-libs/faad2 + use dirac || myconf+=" --disable-libdirac-lavc" + use dts || myconf+=" --disable-libdca" + if ! use mp3; then + myconf+=" + --disable-mp3lame + --disable-mp3lame-lavc + --disable-mp3lib + " + fi + uses="a52 bs2b dv lzo" + for i in ${uses}; do + use ${i} || myconf+=" --disable-lib${i}" + done + use schroedinger || myconf+=" --disable-libschroedinger-lavc" + # Disable opencore-amr with bindist + # https://bugs.gentoo.org/show_bug.cgi?id=299405#c6 + { use amr && use !bindist ; } || myconf+=" --disable-libopencore_amrnb --disable-libopencore_amrwb" + if ! use png && ! use gmplayer; then + myconf+=" --disable-png" + fi + + uses="faad gif jpeg live mad mng pnm speex tga theora xanim" + for i in ${uses}; do + use ${i} || myconf+=" --disable-${i}" + done + use jpeg2k || myconf+=" --disable-libopenjpeg" + if use vorbis || use tremor; then + use tremor || myconf+=" --disable-tremor-internal" + use vorbis || myconf+=" --disable-libvorbis" + else + myconf+=" + --disable-tremor-internal + --disable-tremor + --disable-libvorbis + " + fi + use vaapi && myconf+=" --enable-vaapi" + use vpx || myconf+=" --disable-libvpx-lavc" + # Encoding + uses="faac x264 xvid toolame twolame" + if use encode; then + for i in ${uses}; do + use ${i} || myconf+=" --disable-${i}" + done + use faac || myconf+=" --disable-faac-lavc" + else + myconf+=" --disable-mencoder" + myconf+=" --disable-faac-lavc" + for i in ${uses}; do + myconf+=" --disable-${i}" + use ${i} && elog "Useflag \"${i}\" require \"encode\" useflag enabled to work." + done + fi + + ################# + # Binary codecs # + ################# + # bug 213836 + if ! use x86 || ! use win32codecs; then + use quicktime || myconf+=" --disable-qtx" + fi + + ###################### + # RealPlayer support # + ###################### + # Realplayer support shows up in four places: + # - libavcodec (internal) + # - win32codecs + # - realcodecs (win32codecs libs) + # - realcodecs (realplayer libs) + + # internal + use real || myconf+=" --disable-real" + + # Real binary codec support only available on x86, amd64 + if use real; then + use x86 && myconf+=" --codecsdir=/opt/RealPlayer/codecs" + use amd64 && myconf+=" --codecsdir=/usr/$(get_libdir)/codecs" + elif ! use bindist; then + myconf+=" $(use_enable win32codecs win32dll)" + fi + + ################ + # Video Output # + ################ + uses="directfb md5sum sdl" + for i in ${uses}; do + use ${i} || myconf+=" --disable-${i}" + done + use aalib || myconf+=" --disable-aa" + use fbcon || myconf+=" --disable-fbdev" + use fbcon && use video_cards_s3virge && myconf+=" --enable-s3fb" + use libcaca || myconf+=" --disable-caca" + use zoran || myconf+=" --disable-zr" + + if ! use kernel_linux && ! use video_cards_mga; then + myconf+=" --disable-mga --disable-xmga" + fi + + if use video_cards_tdfx; then + myconf+=" + $(use_enable video_cards_tdfx tdfxvid) + $(use_enable fbcon tdfxfb) + " + else + myconf+=" + --disable-3dfx + --disable-tdfxvid + --disable-tdfxfb + " + fi + + ################ + # Audio Output # + ################ + uses="alsa esd jack ladspa nas openal" + for i in ${uses}; do + use ${i} || myconf+=" --disable-${i}" + done + use pulseaudio || myconf+=" --disable-pulse" + if ! use radio; then + use oss || myconf+=" --disable-ossaudio" + fi + + #################### + # Advanced Options # + #################### + # Platform specific flags, hardcoded on amd64 (see below) + if use cpudetection; then + myconf+=" --enable-runtime-cpudetection" + fi + + # Turning off CPU optimizations usually will break the build. + # However, this use flag, if enabled, will allow users to completely + # specify which ones to use. If disabled, mplayer will automatically + # enable all CPU optimizations that the host build supports. + if use custom-cpuopts; then + uses="3dnow 3dnowext altivec mmx mmxext shm sse sse2 ssse3" + for i in ${uses}; do + myconf+=" $(use_enable ${i})" + done + fi + + use debug && myconf+=" --enable-debug=3" + + if use x86 && gcc-specs-pie; then + filter-flags -fPIC -fPIE + append-ldflags -nopie + fi + + is-flag -O? || append-flags -O2 + if use x86 || use x86-fbsd; then + use debug || append-flags -fomit-frame-pointer + fi + + ########################### + # X enabled configuration # + ########################### + if use X; then + uses="dxr3 ggi xinerama" + for i in ${uses}; do + use ${i} || myconf+=" --disable-${i}" + done + use dga || myconf+=" --disable-dga1 --disable-dga2" + use opengl || myconf+=" --disable-gl" + use osdmenu && myconf+=" --enable-menu" + use vdpau || myconf+=" --disable-vdpau" + use video_cards_vesa || myconf+=" --disable-vesa" + use vidix || myconf+=" --disable-vidix --disable-vidix-pcidb" + use xscreensaver || myconf+=" --disable-xss" + + # GTK gmplayer gui + # Unsupported by Gentoo, upstream has dropped development + myconf+=" $(use_enable gmplayer gui)" + + if use xv; then + if use xvmc; then + myconf+=" --enable-xvmc --with-xvmclib=XvMCW" + else + myconf+=" --disable-xvmc" + fi + else + myconf+=" + --disable-xv + --disable-xvmc + " + use xvmc && elog "Disabling xvmc because it requires \"xv\" useflag enabled." + fi + else + myconf+=" + --disable-dga1 + --disable-dga2 + --disable-dxr3 + --disable-ggi + --disable-gl + --disable-vdpau + --disable-vidix + --disable-vidix-pcidb + --disable-xinerama + --disable-xss + --disable-xv + --disable-xvmc + --disable-x11 + " + uses="dga dxr3 ggi opengl osdmenu vdpau vidix xinerama xscreensaver xv" + for i in ${uses}; do + use ${i} && elog "Useflag \"${i}\" require \"X\" useflag enabled to work." + done + fi + + if [[ ${PV} == *9999* ]]; then + ################### + # External FFmpeg # + ################### + use external-ffmpeg && myconf+=" --disable-libavutil_a --disable-libavcodec_a --disable-libavformat_a --disable-libpostproc_a --disable-libswscale_a" + fi + + myconf="--cc=$(tc-getCC) \ + --host-cc=$(tc-getBUILD_CC) \ + --prefix=/usr \ + --confdir=/etc/mplayer \ + --datadir=/usr/share/mplayer \ + --libdir=/usr/$(get_libdir) \ + ${myconf}" + + CFLAGS="${CFLAGS}" ./configure ${myconf} || die "configure died" +} + +src_compile() { + base_src_compile + # Build only user-requested docs if they're available. + if use doc ; then + # select available languages from $LINGUAS + LINGUAS=${LINGUAS/zh/zh_CN} + local ALLOWED_LINGUAS="cs de en es fr hu it pl ru zh_CN" + local BUILT_DOCS="" + for i in ${LINGUAS} ; do + hasq ${i} ${ALLOWED_LINGUAS} && BUILT_DOCS+=" ${i}" + done + if [[ -z $BUILT_DOCS ]] + then + emake -j1 -C DOCS/xml html-chunked || die "Failed to generate html docs" + else + for i in ${BUILT_DOCS} ; do + emake -j1 -C DOCS/xml html-chunked-${i} || die "Failed to generate html docs for ${i}" + done + fi + fi +} + +src_install() { + local i + + emake prefix="${D}/usr" \ + BINDIR="${D}/usr/bin" \ + LIBDIR="${D}/usr/$(get_libdir)" \ + CONFDIR="${D}/etc/mplayer" \ + DATADIR="${D}/usr/share/mplayer" \ + MANDIR="${D}/usr/share/man" \ + INSTALLSTRIP="" \ + install || die "emake install failed" + + dodoc AUTHORS Changelog Copyright README etc/codecs.conf || die + + docinto tech/ + dodoc DOCS/tech/{*.txt,MAINTAINERS,mpsub.sub,playtree,TODO,wishlist} || die + docinto TOOLS/ + dodoc TOOLS/* || die + if use real; then + docinto tech/realcodecs/ + dodoc DOCS/tech/realcodecs/* || die + docinto TOOLS/realcodecs/ + dodoc TOOLS/realcodecs/* || die + fi + docinto tech/mirrors/ + dodoc DOCS/tech/mirrors/* || die + + if use doc; then + docinto html/ + dohtml -r "${S}"/DOCS/HTML/* || die + fi + + # Install the default Skin and Gnome menu entry + if use gmplayer; then + dodir /usr/share/mplayer/skins + cp -r "${WORKDIR}/Blue" \ + "${D}/usr/share/mplayer/skins/default" || die "cp skins died" + + # Fix the symlink + rm -rf "${D}/usr/bin/gmplayer" + dosym mplayer /usr/bin/gmplayer + fi + + if ! use ass && ! use truetype; then + dodir /usr/share/mplayer/fonts + # Do this generic, as the mplayer people like to change the structure + # of their zips ... + for i in $(find "${WORKDIR}/" -type d -name 'font-arial-*'); do + cp -pPR "${i}" "${D}/usr/share/mplayer/fonts" + done + # Fix the font symlink ... + rm -rf "${D}/usr/share/mplayer/font" + dosym fonts/font-arial-14-iso-8859-1 /usr/share/mplayer/font + fi + + insinto /etc/mplayer + newins "${S}/etc/example.conf" mplayer.conf || die + doins "${S}/etc/input.conf" || die + if use osdmenu; then + doins "${S}/etc/menu.conf" || die + fi + + if use ass || use truetype; then + cat >> "${D}/etc/mplayer/mplayer.conf" << _EOF_ +fontconfig=1 +subfont-osd-scale=4 +subfont-text-scale=3 +_EOF_ + fi + + # bug 256203 + if use rar; then + cat >> "${D}/etc/mplayer/mplayer.conf" << _EOF_ +unrarexec=/usr/bin/unrar +_EOF_ + fi + + dosym ../../../etc/mplayer/mplayer.conf /usr/share/mplayer/mplayer.conf + newbin "${S}/TOOLS/midentify.sh" midentify || die +} + +pkg_preinst() { + [[ -d ${ROOT}/usr/share/mplayer/Skin/default ]] && \ + rm -rf "${ROOT}/usr/share/mplayer/Skin/default" +} + +pkg_postrm() { + # Cleanup stale symlinks + [ -L "${ROOT}/usr/share/mplayer/font" -a \ + ! -e "${ROOT}/usr/share/mplayer/font" ] && \ + rm -f "${ROOT}/usr/share/mplayer/font" + + [ -L "${ROOT}/usr/share/mplayer/subfont.ttf" -a \ + ! -e "${ROOT}/usr/share/mplayer/subfont.ttf" ] && \ + rm -f "${ROOT}/usr/share/mplayer/subfont.ttf" +} -- cgit v1.2.3-65-gdbad