summaryrefslogtreecommitdiff
path: root/media-tv
diff options
context:
space:
mode:
Diffstat (limited to 'media-tv')
-rw-r--r--media-tv/sopcast-player/Manifest2
-rw-r--r--media-tv/sopcast-player/sopcast-player-0.8.5.ebuild40
-rw-r--r--media-tv/sp-auth/Manifest1
-rw-r--r--media-tv/sp-auth/sp-auth-3.2.6.ebuild33
-rw-r--r--media-tv/xbmc/Manifest26
-rw-r--r--media-tv/xbmc/files/xbmc-10.0-python-2.7.patch768
-rw-r--r--media-tv/xbmc/files/xbmc-10.1-gcc-4.6.patch100
-rw-r--r--media-tv/xbmc/files/xbmc-10.1-headers.patch10
-rw-r--r--media-tv/xbmc/files/xbmc-10.1-libpng-1.5.patch596
-rw-r--r--media-tv/xbmc/files/xbmc-11.0-libpng-1.5.patch605
-rw-r--r--media-tv/xbmc/files/xbmc-11.0-no-exec-stack.patch30
-rw-r--r--media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-fix-plt-trn-get.patch51
-rw-r--r--media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-headers.patch12
-rw-r--r--media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5.patch596
-rw-r--r--media-tv/xbmc/files/xbmc-9.11-TexturePacker-parallel-build.patch13
-rw-r--r--media-tv/xbmc/files/xbmc-9.11-jpeg-speedup.patch18
-rw-r--r--media-tv/xbmc/files/xbmc-9.11-libpng14.patch92
-rw-r--r--media-tv/xbmc/files/xbmc-9.11-shader-upscalers.patch887
-rw-r--r--media-tv/xbmc/files/xbmc-9.11-use-cdio-system-headers-on-non-win32.patch129
-rw-r--r--media-tv/xbmc/files/xbmc-9.11-wavpack.patch44
-rw-r--r--media-tv/xbmc/files/xbmc-9999-arm-kill-softfp.patch15
-rw-r--r--media-tv/xbmc/files/xbmc-9999-libpng-1.5-fix-plt-trn-get.patch47
-rw-r--r--media-tv/xbmc/files/xbmc-9999-no-arm-flags.patch16
-rw-r--r--media-tv/xbmc/files/xbmc-9999-no-exec-stack.patch28
-rw-r--r--media-tv/xbmc/files/xbmc-9999-nomythtv.patch206
-rw-r--r--media-tv/xbmc/xbmc-10.1.ebuild225
-rw-r--r--media-tv/xbmc/xbmc-11.0.ebuild232
-rw-r--r--media-tv/xbmc/xbmc-12.0.ebuild237
28 files changed, 5059 insertions, 0 deletions
diff --git a/media-tv/sopcast-player/Manifest b/media-tv/sopcast-player/Manifest
new file mode 100644
index 00000000..8a2effbb
--- /dev/null
+++ b/media-tv/sopcast-player/Manifest
@@ -0,0 +1,2 @@
+DIST sopcast-player-0.8.5.tar.gz 406992 SHA256 a7205b0104073362eec37bb865161dbe0e8d997718ae45710e19093fda8dd50a SHA512 956eb93705366daca9e10ad14c0dec0586df402ebe4d0787666cb85901c798b8029ec8ff09ec908d14439a819c600c59589f6f6346287dc959161f09a79c3c68 WHIRLPOOL 69df619d8891cafb6571d54a2e712e5e8aa9a3587d3585b052f399cbcebd90954fe7c759bfc00559f43e1abea76a6ecb9ab2e71a556da6409be99afd119d93a8
+EBUILD sopcast-player-0.8.5.ebuild 902 SHA256 748dd974a8833b92eda8226416a23d64548a319d5e8ef64afaee5fe75babe0df SHA512 23b087cb3006cf625a712d372194d60b9c3f2698b886c6bccee79c7a135ee62224b2a0b8a3ecddd2d0b635a85fd217fac609629281f29fb9623c1d6b344977f0 WHIRLPOOL bc4e7f422569a5cc740ba4fc30f391034286a3873e61108e6594262e148b35c4db81cb159926d719c549bf4e41bf8590e35959df867d980b05f5ffd3bff6a0d7
diff --git a/media-tv/sopcast-player/sopcast-player-0.8.5.ebuild b/media-tv/sopcast-player/sopcast-player-0.8.5.ebuild
new file mode 100644
index 00000000..4afbf688
--- /dev/null
+++ b/media-tv/sopcast-player/sopcast-player-0.8.5.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+DESCRIPTION="A GTK+ front-end for the SopCast P2P TV player."
+HOMEPAGE="http://www.sopcast.com/"
+SRC_URI="https://sopcast-player.googlecode.com/files/sopcast-player-0.8.5.tar.gz"
+
+LICENSE=""
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="dev-util/debhelper
+ sys-devel/gettext
+ dev-lang/python
+ dev-python/pygtk
+ dev-python/pygobject
+ dev-python/setuptools
+ dev-util/desktop-file-utils
+ x11-themes/hicolor-icon-theme
+ dev-util/wxglade
+ dev-python/pygtk
+ dev-python/pyglet
+ dev-python/pyvlc
+ sys-libs/libstdc++-v3
+ virtual/libstdc++
+ media-video/vlc"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_install() {
+ exeinto /opt/${PN}
+ newexe sopcast-player ${PN} || die "newexe failed"
+ dosym /opt/${PN}/${PN} /usr/bin/${PN}
+ dodoc Readme || die "dodoc failed"
+}
diff --git a/media-tv/sp-auth/Manifest b/media-tv/sp-auth/Manifest
new file mode 100644
index 00000000..6d8d8af8
--- /dev/null
+++ b/media-tv/sp-auth/Manifest
@@ -0,0 +1 @@
+DIST sp-auth-3.2.6.tar.gz 345856 SHA256 6ea333b51898ee61f37903f20503358e8ee328cbd8b49d910fa7e0f23bf8a4a0 SHA512 9d9c547df24b30ffe7ee33d0783005eff3f8b90d0955f58faa8380102e10de8f9ab6098ff53ecacaa3c275bf7b206b98f6ae9a365abb362531a3d28888e666af WHIRLPOOL 21b7269c41e43ec292302bca97bf9d65f506649aaed751fe2777199cf866e94cdd324294d60a1c24202eb2e973214406f167b50cfb55282289b301ca3d9c4e0b
diff --git a/media-tv/sp-auth/sp-auth-3.2.6.ebuild b/media-tv/sp-auth/sp-auth-3.2.6.ebuild
new file mode 100644
index 00000000..e2d411dc
--- /dev/null
+++ b/media-tv/sp-auth/sp-auth-3.2.6.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit eutils
+
+MY_P="sp-sc-auth"
+
+DESCRIPTION="SopCast free P2P Internet TV binary"
+LICENSE="SopCast-unknown-license"
+HOMEPAGE="http://www.sopcast.com/"
+SRC_URI="http://sopcast-player.googlecode.com/files/${PN}-${PV}.tar.gz"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RESTRICT="strip"
+
+# All dependencies might not be listed, since the binary blob's homepage only lists libstdc
+RDEPEND="amd64? ( app-emulation/emul-linux-x86-compat )
+ x86? ( >=virtual/libstdc-3.3 )"
+
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${PN}
+
+src_install() {
+ exeinto /usr/bin/
+ newexe sp-sc-auth ${MY_P} || die "newexe failed"
+ dodoc Readme || die "dodoc failed"
+}
diff --git a/media-tv/xbmc/Manifest b/media-tv/xbmc/Manifest
new file mode 100644
index 00000000..57e32828
--- /dev/null
+++ b/media-tv/xbmc/Manifest
@@ -0,0 +1,26 @@
+AUX xbmc-10.0-python-2.7.patch 30308 SHA256 8f6b2a0a962ad250fc317542d0fa180585d3c9e630ca98f99299b6f750555085 SHA512 dca28d98f89f22e11fcae10253b4bb5aa41a663e0d963449e27c0c9996630f64ee027f70edd41e6adc040567ccb8a12ec8a5e4b18d7d10ab56e081da9c392009 WHIRLPOOL e8de7861b41dd183469f66cae542d0ba8bfcb2a34f57ad2d3bb05b568469da32588efbf67ec0666fc5a9d01f3a51779d9929b969eb14d8cda162b16f7d0ba3c7
+AUX xbmc-10.1-gcc-4.6.patch 4295 SHA256 cef1154bc3352b215bfece1a749d901d43ec7aa0c6d050921ae8745c553e84c9 SHA512 aca5c7ca5aaaceaa376e357b987dcdfc08e5772819778f8cc173711b54f2539fca19f4ba7c5251f374515f4ed7080c3a926259867115dd4984943bcfffbdd14c WHIRLPOOL 2f6742addc4d59f5c10c510fdc39d04ed4bb96a185e3cf05d6313236b28ca011cd821791f6775c7c30d808f2558fd174af92e2ce6bb09e4c2f05a562d1f03714
+AUX xbmc-10.1-headers.patch 294 SHA256 8b8e86cf7edef227e8267c52d60545b753eea11261f078131ee30f9eac8bb002 SHA512 3a355ed831dea0c2ec85ff25c7abd57003dfe74eb892bf4776dadc4b27e046358632fe61adf9afc4e6b27bb44abc859970a3c14c648a2ae28b58d11c4d0a46fa WHIRLPOOL f9894204a8e0850438d4bc0dcd7daea0e9c4e64780f3478f8b304832caf1cda52080d89b5c3503e50a8289a934134d21e77f8afd0c7da8550ea85fb4122810d7
+AUX xbmc-10.1-libpng-1.5.patch 19253 SHA256 1a0985b91ee9862a538a43689d005dc88d49bf5a70d917896fb69ee416369ff7 SHA512 40ce41d6b27e5cd6df82f6d6ba24ee7bc39f13a735cbb9746cf9818dafa9ae16526b38e84be98bd69eb57b52e2201317529b1546e5bf694b10dfe671303a4614 WHIRLPOOL 6f17fc198204b0ff97be0294c2400ac41cce16a4cec55dfe0657b69da9a57f6c36beefc7f6a7c499aab79e8d6eacd715e09f4d35e00d657e2b0d10f397bba15e
+AUX xbmc-11.0-libpng-1.5.patch 18833 SHA256 83b49d44b7855dcb2f7d34e2e9628f4c1f8e06ae8f9e94ac06a6036620705daa SHA512 b014e37abb3e8b5c4c2fc0a4070fb71d562b3b40c6a844dad85cff3cea442c42bb78f88004d4f7b3767fdb12c530ac660162247fd44ca3e1ac42592b004b06c0 WHIRLPOOL 16b24676f7ac06a59a534e79c981c34c105bed68f9ab4b465e3fa51372ed2025ea9706a988df8d47f18677d36f6dedd8ff47aa34f0e74c89015c746bdea1953e
+AUX xbmc-11.0-no-exec-stack.patch 807 SHA256 e36c83746838dd362512a046dc066c0f3fdc1252289b2761be381f84262cab78 SHA512 d0d4c2d4bb257c722ec40470fb6c8da59033009152598e69133b6184b25da36debf42f86859389c878a072603f3d583e28a52519e8dca47d9bdf7edd5f9e44c5 WHIRLPOOL d18dd387fe55b18be78fdad08b0a4319c2a5ccd161f1dfc0d5ab8015d88c5842780415c903a098a4683524658fc31c07e285e61fcff04ad6e4777c77e5691f38
+AUX xbmc-11.0_beta1-libpng-1.5-fix-plt-trn-get.patch 1659 SHA256 fed3ba39de959c46bc43431b229347c187690848ccd3bdc823bb7291bc425e84 SHA512 b4cbbdaa54a098d6b98d686966ecbf566fa86905d184b2bb4a3b97c51f3b2171249dfd0451a31971f137bc7ec8602e1859abf757d4ef5a5c1563cbb3726a4574 WHIRLPOOL e6c31d89fa1d214d5e0d2f866a5f6fd321791057c9bfdf05e36509fb60e8578a598203f7f121ad9025a71c1de31fd3693af68a8bedca92bf7f2ff7138c307e5d
+AUX xbmc-11.0_beta1-libpng-1.5-headers.patch 450 SHA256 28765af28836502ce2df92c00b0df27733137111f7fbb11a5cd0b5b7c47b0713 SHA512 494e85af4b87db1cb476d6158fc4412016ee3b385cb55beadf4ac176d9be55d637faac43c35b97ec7856ff48b230f0ab2080265b4e9997b27198a02ace9071ac WHIRLPOOL 5e57311cd42e5689b4b8ab5e42019e115c2f2962eccfc3a0c6453c52926580a2e0905d216b82e71b546f536f625918627084cbc30ac8d188d346fa27e6a2cf82
+AUX xbmc-11.0_beta1-libpng-1.5.patch 18687 SHA256 359cc4893cc6922b86269770c11c5e80fd5b33e711ebf1645b232e4f3fc91c28 SHA512 c20e7d04773f66353856df5ce38b1d695df26d235921d01311460789f3215f49a1421616f4f98b33786a7aac09526d720ae442a637c378ee081aa19be706cf44 WHIRLPOOL cd4945e373cbb7f6ab501b13a0ab35fece28bb97cec2f3d85b700961fbd8d78202a531c89bcbca81020834a28756e4a18c4abb5e53465be34af77d6d2f3134b1
+AUX xbmc-9.11-TexturePacker-parallel-build.patch 357 SHA256 a9b990cdd5473e72cc83cda36cc9faaf67e97649cec45af9c529455464b12d43 SHA512 b6f4f4b8c30643e7b5333782cb9ba1a524e85bdefb5ae2fed373d37d1281eeb2835265bc20f99916a7c2dda79069463d1abcfd40870d3264b26192c3ba5332f2 WHIRLPOOL 68ec8b9168960564af5d2fbe93e8eaf91978f8b0c476cee2f52f1209c567b2a77e9193264226d172fa7c1dee24d5405e5dcfc0e79d8f7257e92227fc40662198
+AUX xbmc-9.11-jpeg-speedup.patch 804 SHA256 3115b8668b60e307536a9314fc02c837d4f94f89571d403761b614a22447e2d8 SHA512 6ad4468f0be722070d27b339de062aea85efff2bf1217767c86f2e8249145ba4fbded635a577ae2e30233d86834cb8a8067f14e349cbbb557b48b02037516ba6 WHIRLPOOL 2621a243e8b49a9608a3736319cf101bc00e48fcbc60ca53264af7e4cf666ae49ae82803225d955ba83fedb4df416cad0ea97e4e8e568c2af55a0cbf8366c659
+AUX xbmc-9.11-libpng14.patch 4263 SHA256 0516a466f2646867478781251d665e87f6f0697fcd9ce29b91c87194fafc7da6 SHA512 fe07dbb7ad2ef7a511d00e63f697f018f2af06b601f0bc1cd70a6e1d1232026c206539a893da02992510232e7e194d6a23ad4e32dad529796e232cd07743647d WHIRLPOOL 39e2303850b732a2e4f4c5254cdd152162995c9d34140c0f9312951f4b19e54d626d7b976fc1472b1fa9bd8c11849acb0bc917a8abec657e74b185b883562eb7
+AUX xbmc-9.11-shader-upscalers.patch 29024 SHA256 965099c217920d5db259944adc4250ed73e4b08ddcd7b0d88d843c9a9a41d396 SHA512 0f6628a667178672519bc6ea6aa594825d2443df5ec3fbedb99f1abb4aa935670824f46792057b467e9f250722ae0ba41f9071f17afedf23e9908bb9f7db9bf2 WHIRLPOOL d80b9b2c8d9e9761c74a3f3ea8007f4835d057da8a9612785939c59edca90234d26ac41a21fc93a66b0fd02612380e3aa36111004ec5e90f2cd5b475f2790bdb
+AUX xbmc-9.11-use-cdio-system-headers-on-non-win32.patch 3623 SHA256 ceb6952025c8baf5bb4eed18380c9bf6022893407f22a3e587eebd657863ab83 SHA512 1889fdf1199066cd3fac1bf11179e49c1841b85a9c654ffefb9e67966debecec276ae5cfa2c4b07dd3334e362bbc4742da29204308ff7dea12b650022da7c71a WHIRLPOOL cd05c51666472c741e3d321fa689f9b58c952d81b2c81d3636d474b81bed59c4401017580cd83880be72cf0aba37e41c5ef73bc9295538a37c626ee61468c3f6
+AUX xbmc-9.11-wavpack.patch 2637 SHA256 b09e9072f0a2d4451588c40b0b300611944ba7d4cefbae0c400389ed9f8485dc SHA512 00ac9886e0cd03481672629ddd94f7a92996aa577daa24d71bc7abc5becdc6c1272ee1ff198ea3333f03cd206a25b2194b7f076232cec3b833cd042eb8a4867a WHIRLPOOL 9d03ae7488c5ffa9f9a3ceadc80626d57f807ac25da3efd37e57471e3c7b93afb3781c11486e97ab9634206642516513f1babc4b69435385a8ce57075e586541
+AUX xbmc-9999-arm-kill-softfp.patch 638 SHA256 40e70e18a658e839ef0b73644a4dda2a6acb30710f04ff049e38780d80ac58ad SHA512 0f99ad8437d140109d4c78b3986ce5ef3449ceea1150844e65ccc526a8ef49c6457c9a99a7ea48d3d8e55c82f683a35b139dae7c08e906f2d77331722260b2db WHIRLPOOL 0a1369d463bf7eb72a4505c16718cb176bca986b7803a5f424504e16e1bfbf51392d0c0f889c75da362ebebc9a3ccecbafa90ac7ff1ced3914675b6f280d139d
+AUX xbmc-9999-libpng-1.5-fix-plt-trn-get.patch 1545 SHA256 cea0af47be10345a98fb262c4d5b75d0fd789741d60673288445e1afae80e73b SHA512 e8d071706f8975b9ee72ded98a4d2921b92cf18b3bce10ff745fce482b01d1eab7244eb9a10cb2c22eca1ec3492dba2510c6471966266a81e2728ea095603562 WHIRLPOOL 59c59b822b25fabacbd8a999844d83636a9821fd00f8cfe1a0710dc743f3ab37ed617921c3c98a3521dce12190aeb3bb51123eb8bfb00b9300873d773573be65
+AUX xbmc-9999-no-arm-flags.patch 542 SHA256 72164a8b91f3209cff06ea1a103580f827135951a7a798eefabc04ee1a6d3e84 SHA512 7d40be4bdef2a2b1e53f8b96c489a87ec67975ae486fb44e619d66c1b5333ad33f896f64cca4e1c8050c3d92cd6537a9ca776e743c88fc2c8cabea1eae62b4b5 WHIRLPOOL 7c6666198b7d987028925e0f578d71796f6541995aa87964de3275f6a087610ef69d630ac349500a7c534de213b8fbff4cca6c25c3d0e6f1b1d8cd89f27d3d9d
+AUX xbmc-9999-no-exec-stack.patch 782 SHA256 0d3085458ff9c8c22f4dd406ee611d74909bb1dc2de4788b67e30cb5967c819f SHA512 2b7391955dfd5b987b5872ad1956b994f6387809d69281ff246755fb0fb85a7fed4216faa5f862a633ce9a7847013d813f23d31546126c8d0616b7217eb513e4 WHIRLPOOL 4da69df4a62d136e8a5a6e3e11102e2584e4fbcabed47bb5cc8bafc300ea4b979b996e469f6e59536370e27bbf9309eb9c5afc9f7bd4710fb950d5227bb38c94
+AUX xbmc-9999-nomythtv.patch 6190 SHA256 ffb1eb49f94b4ae41e5d79172499671915122a58af248b0585ee276e4aa2c87e SHA512 4a9ff4b4f5cb56c92932f05b5b812bee0fdce37ed9f568a6e0dc0cd62335e2131361a63d8026b64f9c7078fa9c4ef0e439b52234c722b1b854aeeed1cc2764c7 WHIRLPOOL ce457b509c6fd222ae6002420db7cc438e1352114f38790b623f04e6834eb5508d4609a1bf71628bfafde3bcef830e84b42448619c19227d5729d6d8a824a13c
+DIST xbmc-10.1.tar.gz 130187822 SHA256 3403195b7eb1d076523f2394793b7f050df00743892b031f6fea86b998559d8a
+DIST xbmc-11.0.tar.gz 63012044 SHA256 1fe5d310c16138f26e2b13bc545604e95f48ace6c8636f23e77da402cd7b0b19
+DIST xbmc-12.0.tar.gz 67176825 SHA256 53018cd014b5203df5e5ef4080931ef499d3740815f32d17dce92ef7d050c16f SHA512 37da579b055d4ea72cd18cf92541b47e6c42682091ef123baccdbce740b23842ac7c28eea032ada9a9c2232be034c7c4113ee8107ac3c7287834d08d4bcb67d6 WHIRLPOOL 6282dd7a728696c9a4577725d949d54992996d18a7b3c054c7d318b070fcad33efc4292afb83aa934c586cf718de67e294b2c498e491311b896e6a632cfa5b73
+EBUILD xbmc-10.1.ebuild 6173 SHA256 b2f407fec89fd9483763e996f8ff2c4c1560a43a567deb286864733eee1de9e0 SHA512 cf52a66cf74cdfe325392575cc8572c04158b162e3680708d6d4ec543a81d5711797a57052db4d308f0acc3e26bb4cf03cc6e9339136bf7b44f40e1753f042d3 WHIRLPOOL 74daaeba7dc990a45c58dce5c03fb0d6a649270b7a728b74f7c1a6ef4063aacb8bf774c7d521fecd702c2b7047619bb10af46baaeab64d5ddba1696f23bd36ad
+EBUILD xbmc-11.0.ebuild 6033 SHA256 173fe31166bb69cf1b416c2ea2c5702652909cdeb3a6b41319be8b5705860c5c SHA512 acc46cc5f5cbc3a7c75c03f50a02b3fdb0824b9f0dce55db8dc15b8801d1540a867a5fc8056de1b82a54410575c685ead1d0d07f6e620947f80ec0880b5a5706 WHIRLPOOL 092b112933213f031b1ca45911dd0795855ca8181359ef7398119ec6cfab2f7d669cf68082ddae5330f875a7ed3c6df8003992ff1cc0be000df7bbab48f775cc
+EBUILD xbmc-12.0.ebuild 6481 SHA256 b232410feb0c2715dc2b2e9ad9204f1e1f09a9237c0cc57b9a2f23f8a9e2b8d3 SHA512 65a1cac4a88b806ecc327cfec1ac3ef90dc73868a82c8ace3a47fcf5eb2b61f125d317646c096b671bc88f7814e08231ace11312e74e595a8c421696bd1982c3 WHIRLPOOL da70651c655c64ca82895236d11e1ae4462cce62809ab0338364b142bcd03c42c6d244c75591df381cc93bc9809d44b6f5f6a9a518fd52e150d4c520a21d2622
diff --git a/media-tv/xbmc/files/xbmc-10.0-python-2.7.patch b/media-tv/xbmc/files/xbmc-10.0-python-2.7.patch
new file mode 100644
index 00000000..e3d17a5e
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-10.0-python-2.7.patch
@@ -0,0 +1,768 @@
+patch from upstream
+
+https://bugs.gentoo.org/350098
+
+From ab0f816c6307f38d7248d0469379c981f94b816d Mon Sep 17 00:00:00 2001
+From: ceros7 <ceros7@568bbfeb-2a22-0410-94d2-cc84cf5bfa90>
+Date: Mon, 30 Aug 2010 16:46:50 +0000
+Subject: [PATCH] Support external python2.7.
+
+git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/python2.7@33342 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
+---
+ configure.in | 10 ++++++-
+ xbmc/lib/libPython/XBPyThread.cpp | 5 +++-
+ xbmc/lib/libPython/XBPyThread.h | 4 ++-
+ xbmc/lib/libPython/XBPython.cpp | 24 +++++++++++++++-----
+ xbmc/lib/libPython/XBPythonDll.cpp | 4 ++-
+ xbmc/lib/libPython/XBPythonDllFuncs.S | 4 ++-
+ xbmc/lib/libPython/linux/Makefile.in | 5 +++-
+ xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/PythonAddon.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/PythonPlayer.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/action.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/control.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlbutton.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlgroup.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlimage.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/controllabel.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/controllist.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlprogress.cpp | 4 ++-
+ .../libPython/xbmcmodule/controlradiobutton.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlslider.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlspin.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/controltextbox.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/dialog.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/dialog.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/infotagmusic.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/infotagvideo.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/keyboard.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/listitem.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/listitem.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/player.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/pyplaylist.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/pyutil.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/window.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/winxml.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/winxml.h | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp | 4 ++-
+ xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp | 5 +++-
+ xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp | 4 ++-
+ 42 files changed, 149 insertions(+), 48 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index 4c0b1b7..cd3429e 100644
+--- a/configure.in
++++ b/configure.in
+@@ -901,7 +901,11 @@ fi
+
+ # External Python
+ if test "$use_external_python" = "yes"; then
+- AC_CHECK_LIB([python2.6], [main],
++ AC_CHECK_LIB([python2.7], [main],
++ [AC_DEFINE([HAVE_LIBPYTHON2_7], [1],
++ [Define to 1 if you have the 'python2.7' library.])
++ USE_PYTHON2_7=1],
++ [AC_CHECK_LIB([python2.6], [main],
+ [AC_DEFINE([HAVE_LIBPYTHON2_6], [1],
+ [Define to 1 if you have the 'python2.6' library.])
+ USE_PYTHON2_6=1],
+@@ -913,9 +917,10 @@ if test "$use_external_python" = "yes"; then
+ [AC_DEFINE([HAVE_LIBPYTHON2_4], [1],
+ [Define to 1 if you have the 'python2.4' library.])
+ USE_PYTHON2_4=1],
+- [AC_MSG_ERROR($missing_library)] )] )] )
++ [AC_MSG_ERROR($missing_library)] )] )] )] )
+
+ AC_MSG_NOTICE($external_python_enabled)
++ test "$USE_PYTHON2_7" && AC_MSG_NOTICE([Using Python 2.7])
+ test "$USE_PYTHON2_6" && AC_MSG_NOTICE([Using Python 2.6])
+ test "$USE_PYTHON2_5" && AC_MSG_NOTICE([Using Python 2.5])
+ test "$USE_PYTHON2_4" && AC_MSG_NOTICE([Using Python 2.4])
+@@ -1471,6 +1476,7 @@ AC_SUBST(USE_INTERNAL_LIBDTS)
+ AC_SUBST(USE_EXTERNAL_LIBMPEG2)
+ AC_SUBST(USE_EXTERNAL_LIBWAVPACK)
+ AC_SUBST(USE_EXTERNAL_PYTHON)
++AC_SUBST(USE_PYTHON2_7)
+ AC_SUBST(USE_PYTHON2_6)
+ AC_SUBST(USE_PYTHON2_5)
+ AC_SUBST(USE_PYTHON2_4)
+diff --git a/xbmc/lib/libPython/XBPyThread.cpp b/xbmc/lib/libPython/XBPyThread.cpp
+index 3a6f34e..71b4b9a 100644
+--- a/xbmc/lib/libPython/XBPyThread.cpp
++++ b/xbmc/lib/libPython/XBPyThread.cpp
+@@ -24,7 +24,10 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #include <python2.7/osdefs.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #include <python2.6/osdefs.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+diff --git a/xbmc/lib/libPython/XBPyThread.h b/xbmc/lib/libPython/XBPyThread.h
+index c3da337..eea7fea 100644
+--- a/xbmc/lib/libPython/XBPyThread.h
++++ b/xbmc/lib/libPython/XBPyThread.h
+@@ -26,7 +26,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/XBPython.cpp b/xbmc/lib/libPython/XBPython.cpp
+index e52cdfb..defcf14 100644
+--- a/xbmc/lib/libPython/XBPython.cpp
++++ b/xbmc/lib/libPython/XBPython.cpp
+@@ -24,7 +24,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+@@ -61,7 +63,9 @@ XBPython g_pythonParser;
+ #define PYTHON_DLL "special://xbmcbin/system/python/python24-x86-osx.so"
+ #endif
+ #elif defined(__x86_64__)
+-#if (defined HAVE_LIBPYTHON2_6)
++#if (defined HAVE_LIBPYTHON2_7)
++#define PYTHON_DLL "special://xbmcbin/system/python/python27-x86_64-linux.so"
++#elif (defined HAVE_LIBPYTHON2_6)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python26-x86_64-linux.so"
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python25-x86_64-linux.so"
+@@ -69,7 +73,9 @@ XBPython g_pythonParser;
+ #define PYTHON_DLL "special://xbmcbin/system/python/python24-x86_64-linux.so"
+ #endif
+ #elif defined(_POWERPC)
+-#if (defined HAVE_LIBPYTHON2_6)
++#if (defined HAVE_LIBPYTHON2_7)
++#define PYTHON_DLL "special://xbmcbin/system/python/python27-powerpc-linux.so"
++#elif (defined HAVE_LIBPYTHON2_6)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python26-powerpc-linux.so"
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python25-powerpc-linux.so"
+@@ -77,7 +83,9 @@ XBPython g_pythonParser;
+ #define PYTHON_DLL "special://xbmcbin/system/python/python24-powerpc-linux.so"
+ #endif
+ #elif defined(_POWERPC64)
+-#if (defined HAVE_LIBPYTHON2_6)
++#if (defined HAVE_LIBPYTHON2_7)
++#define PYTHON_DLL "special://xbmcbin/system/python/python27-powerpc64-linux.so"
++#elif (defined HAVE_LIBPYTHON2_6)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python26-powerpc64-linux.so"
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python25-powerpc64-linux.so"
+@@ -85,7 +93,9 @@ XBPython g_pythonParser;
+ #define PYTHON_DLL "special://xbmcbin/system/python/python24-powerpc64-linux.so"
+ #endif
+ #elif defined(_ARMEL)
+-#if (defined HAVE_LIBPYTHON2_6)
++#if (defined HAVE_LIBPYTHON2_7)
++#define PYTHON_DLL "special://xbmc/system/python/python27-arm.so"
++#elif (defined HAVE_LIBPYTHON2_6)
+ #define PYTHON_DLL "special://xbmc/system/python/python26-arm.so"
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #define PYTHON_DLL "special://xbmc/system/python/python25-arm.so"
+@@ -93,7 +103,9 @@ XBPython g_pythonParser;
+ #define PYTHON_DLL "special://xbmc/system/python/python24-arm.so"
+ #endif
+ #else /* !__x86_64__ && !__powerpc__ */
+-#if (defined HAVE_LIBPYTHON2_6)
++#if (defined HAVE_LIBPYTHON2_7)
++#define PYTHON_DLL "special://xbmcbin/system/python/python27-i486-linux.so"
++#elif (defined HAVE_LIBPYTHON2_6)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python26-i486-linux.so"
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python25-i486-linux.so"
+diff --git a/xbmc/lib/libPython/XBPythonDll.cpp b/xbmc/lib/libPython/XBPythonDll.cpp
+index bc9d827..87ac7d7 100644
+--- a/xbmc/lib/libPython/XBPythonDll.cpp
++++ b/xbmc/lib/libPython/XBPythonDll.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/pyconfig.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/pyconfig.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/pyconfig.h>
+diff --git a/xbmc/lib/libPython/XBPythonDllFuncs.S b/xbmc/lib/libPython/XBPythonDllFuncs.S
+index 6b7a6c3..f59b192 100644
+--- a/xbmc/lib/libPython/XBPythonDllFuncs.S
++++ b/xbmc/lib/libPython/XBPythonDllFuncs.S
+@@ -2,7 +2,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/pyconfig.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/pyconfig.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/pyconfig.h>
+diff --git a/xbmc/lib/libPython/linux/Makefile.in b/xbmc/lib/libPython/linux/Makefile.in
+index 7011434..0786937 100644
+--- a/xbmc/lib/libPython/linux/Makefile.in
++++ b/xbmc/lib/libPython/linux/Makefile.in
+@@ -5,7 +5,10 @@ LDFLAGS=@LDFLAGS@
+ SHELL=/bin/bash
+ SYSDIR=../../../../system/python
+
+-ifeq (@USE_PYTHON2_6@,1)
++ifeq (@USE_PYTHON2_7@,1)
++ PYVERSION=python2.7
++ SO=python27-$(ARCH).so
++else ifeq (@USE_PYTHON2_6@,1)
+ PYVERSION=python2.6
+ SO=python26-$(ARCH).so
+ else ifeq (@USE_PYTHON2_5@,1)
+diff --git a/xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h b/xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h
+index 620d9bd..06fa146 100644
+--- a/xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h
++++ b/xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h
+@@ -26,7 +26,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/PythonAddon.h b/xbmc/lib/libPython/xbmcmodule/PythonAddon.h
+index ec7ed28..41eb8ea 100644
+--- a/xbmc/lib/libPython/xbmcmodule/PythonAddon.h
++++ b/xbmc/lib/libPython/xbmcmodule/PythonAddon.h
+@@ -25,7 +25,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/PythonPlayer.h b/xbmc/lib/libPython/xbmcmodule/PythonPlayer.h
+index ecee993..24a1c87 100644
+--- a/xbmc/lib/libPython/xbmcmodule/PythonPlayer.h
++++ b/xbmc/lib/libPython/xbmcmodule/PythonPlayer.h
+@@ -25,7 +25,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/action.h b/xbmc/lib/libPython/xbmcmodule/action.h
+index 0e20000..7f8b1bc 100644
+--- a/xbmc/lib/libPython/xbmcmodule/action.h
++++ b/xbmc/lib/libPython/xbmcmodule/action.h
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/control.h b/xbmc/lib/libPython/xbmcmodule/control.h
+index c76b37c..a9ec63d 100644
+--- a/xbmc/lib/libPython/xbmcmodule/control.h
++++ b/xbmc/lib/libPython/xbmcmodule/control.h
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlbutton.cpp b/xbmc/lib/libPython/xbmcmodule/controlbutton.cpp
+index b24ccce..7455ca7 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlbutton.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlbutton.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp b/xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp
+index 96e4743..86a7d8b 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp b/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp
+index 68442d8..c6eb052 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlgroup.cpp b/xbmc/lib/libPython/xbmcmodule/controlgroup.cpp
+index aadfc17..8275324 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlgroup.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlgroup.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlimage.cpp b/xbmc/lib/libPython/xbmcmodule/controlimage.cpp
+index 79835d6..f106e90 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlimage.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlimage.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controllabel.cpp b/xbmc/lib/libPython/xbmcmodule/controllabel.cpp
+index aca22e4..38a9c07 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controllabel.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controllabel.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controllist.cpp b/xbmc/lib/libPython/xbmcmodule/controllist.cpp
+index 0c67b5c..bb57776 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controllist.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controllist.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlprogress.cpp b/xbmc/lib/libPython/xbmcmodule/controlprogress.cpp
+index a21e462..b460a2a 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlprogress.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlprogress.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlradiobutton.cpp b/xbmc/lib/libPython/xbmcmodule/controlradiobutton.cpp
+index ec54efd..b966a17 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlradiobutton.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlradiobutton.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlslider.cpp b/xbmc/lib/libPython/xbmcmodule/controlslider.cpp
+index 21ea5e7..c5f65b3 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlslider.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlslider.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlspin.cpp b/xbmc/lib/libPython/xbmcmodule/controlspin.cpp
+index 4e24e14..feead3c 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlspin.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlspin.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controltextbox.cpp b/xbmc/lib/libPython/xbmcmodule/controltextbox.cpp
+index b4c44d5..4a7c688 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controltextbox.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controltextbox.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/dialog.cpp b/xbmc/lib/libPython/xbmcmodule/dialog.cpp
+index caa8986..cffe485 100644
+--- a/xbmc/lib/libPython/xbmcmodule/dialog.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/dialog.cpp
+@@ -24,7 +24,9 @@
+ #endif
+ #include "dialog.h"
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/dialog.h b/xbmc/lib/libPython/xbmcmodule/dialog.h
+index edcae41..a61c4b1 100644
+--- a/xbmc/lib/libPython/xbmcmodule/dialog.h
++++ b/xbmc/lib/libPython/xbmcmodule/dialog.h
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/infotagmusic.h b/xbmc/lib/libPython/xbmcmodule/infotagmusic.h
+index d202e48..590b858 100644
+--- a/xbmc/lib/libPython/xbmcmodule/infotagmusic.h
++++ b/xbmc/lib/libPython/xbmcmodule/infotagmusic.h
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/infotagvideo.h b/xbmc/lib/libPython/xbmcmodule/infotagvideo.h
+index f2bb300..e808573 100644
+--- a/xbmc/lib/libPython/xbmcmodule/infotagvideo.h
++++ b/xbmc/lib/libPython/xbmcmodule/infotagvideo.h
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/keyboard.h b/xbmc/lib/libPython/xbmcmodule/keyboard.h
+index e5c817f..0f069e3 100644
+--- a/xbmc/lib/libPython/xbmcmodule/keyboard.h
++++ b/xbmc/lib/libPython/xbmcmodule/keyboard.h
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/listitem.cpp b/xbmc/lib/libPython/xbmcmodule/listitem.cpp
+index 137436e..20105ef 100644
+--- a/xbmc/lib/libPython/xbmcmodule/listitem.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/listitem.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/listitem.h b/xbmc/lib/libPython/xbmcmodule/listitem.h
+index 7ebcd6c..3d4a6c8 100644
+--- a/xbmc/lib/libPython/xbmcmodule/listitem.h
++++ b/xbmc/lib/libPython/xbmcmodule/listitem.h
+@@ -25,7 +25,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/player.h b/xbmc/lib/libPython/xbmcmodule/player.h
+index 48dc9c7..34a102d 100644
+--- a/xbmc/lib/libPython/xbmcmodule/player.h
++++ b/xbmc/lib/libPython/xbmcmodule/player.h
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp b/xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp
+index c7e7f62..6df8548 100644
+--- a/xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp
+@@ -26,7 +26,9 @@
+ #include "Util.h"
+ #include "pyplaylist.h"
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/pyplaylist.h b/xbmc/lib/libPython/xbmcmodule/pyplaylist.h
+index f2334bb..2410314 100644
+--- a/xbmc/lib/libPython/xbmcmodule/pyplaylist.h
++++ b/xbmc/lib/libPython/xbmcmodule/pyplaylist.h
+@@ -25,7 +25,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/pyutil.h b/xbmc/lib/libPython/xbmcmodule/pyutil.h
+index 4acf6e5..1a156f8 100644
+--- a/xbmc/lib/libPython/xbmcmodule/pyutil.h
++++ b/xbmc/lib/libPython/xbmcmodule/pyutil.h
+@@ -25,7 +25,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/window.h b/xbmc/lib/libPython/xbmcmodule/window.h
+index 6ce8e72..40304ff 100644
+--- a/xbmc/lib/libPython/xbmcmodule/window.h
++++ b/xbmc/lib/libPython/xbmcmodule/window.h
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/winxml.cpp b/xbmc/lib/libPython/xbmcmodule/winxml.cpp
+index d3b703f..3e1b3c8 100644
+--- a/xbmc/lib/libPython/xbmcmodule/winxml.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/winxml.cpp
+@@ -24,7 +24,9 @@
+ #endif
+ #include "winxml.h"
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/winxml.h b/xbmc/lib/libPython/xbmcmodule/winxml.h
+index 6e6489e..f3a8dd8 100644
+--- a/xbmc/lib/libPython/xbmcmodule/winxml.h
++++ b/xbmc/lib/libPython/xbmcmodule/winxml.h
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp b/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp
+index b021501..92d9903 100644
+--- a/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp
+@@ -24,7 +24,9 @@
+ #endif
+ #include "winxml.h"
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp b/xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp
+index b8bc0a3..c65aded 100644
+--- a/xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp b/xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp
+index 87c0ead..9941769 100644
+--- a/xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp
+@@ -23,7 +23,10 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #include <python2.7/structmember.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #include <python2.6/structmember.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+diff --git a/xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp b/xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp
+index 3bab5a9..1e2c480 100644
+--- a/xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp
+@@ -23,7 +23,9 @@
+ #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+- #if (defined HAVE_LIBPYTHON2_6)
++ #if (defined HAVE_LIBPYTHON2_7)
++ #include <python2.7/Python.h>
++ #elif (defined HAVE_LIBPYTHON2_6)
+ #include <python2.6/Python.h>
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #include <python2.5/Python.h>
+--
+1.7.3.1
+
diff --git a/media-tv/xbmc/files/xbmc-10.1-gcc-4.6.patch b/media-tv/xbmc/files/xbmc-10.1-gcc-4.6.patch
new file mode 100644
index 00000000..b3e8c7c2
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-10.1-gcc-4.6.patch
@@ -0,0 +1,100 @@
+http://trac.xbmc.org/ticket/11383
+http://bugs.gentoo.org/367261
+
+From c66099c4d8e6b2d748ca3ddc31ee90b731d0f620 Mon Sep 17 00:00:00 2001
+From: Stephan Raue <stephan@openelec.tv>
+Date: Wed, 30 Mar 2011 14:57:28 +0200
+Subject: [PATCH] dvdplayer: fix build with gcc-4.6. Flags to the Linker must be passed via -Wl,. This fixes ticket #11383
+
+Signed-off-by: Stephan Raue <stephan@openelec.tv>
+---
+ xbmc/cores/dvdplayer/Codecs/Makefile.in | 18 +++++++++---------
+ xbmc/cores/dvdplayer/Codecs/libdvd/Makefile.in | 4 ++--
+ 2 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/xbmc/cores/dvdplayer/Codecs/Makefile.in b/xbmc/cores/dvdplayer/Codecs/Makefile.in
+index a7ef1a0..308664a 100644
+--- a/xbmc/cores/dvdplayer/Codecs/Makefile.in
++++ b/xbmc/cores/dvdplayer/Codecs/Makefile.in
+@@ -148,32 +148,32 @@ liba52:
+ else
+
+ $(SYSDIR)/avutil-50-$(ARCH).so: ffmpeg/libavutil/libavutil.so
+- $(CC) -o $@ $(LDFLAGS) --soname,$@ -Wl,-Bsymbolic \
++ $(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ -Wl,-Bsymbolic \
+ ffmpeg/libavutil/*.o `cat $(WRAPPER:.o=.def)` $(WRAPPER)
+
+ $(SYSDIR)/avcodec-52-$(ARCH).so: $(WRAPPER) ffmpeg/libavcodec/libavcodec.so
+- $(CC) -o $@ $(LDFLAGS) --soname,$@ -Wl,-Bsymbolic \
++ $(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ -Wl,-Bsymbolic \
+ ffmpeg/libavcodec/*.o ffmpeg/libavcodec/$(ARCH_DIR)/*.o \
+ `cat $(WRAPPER:.o=.def)` $(WRAPPER)
+
+ $(SYSDIR)/avformat-52-$(ARCH).so: $(WRAPPER) ffmpeg/libavformat/libavformat.so
+- $(CC) -o $@ $(LDFLAGS) --soname,$@ -Wl,-Bsymbolic \
++ $(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ -Wl,-Bsymbolic \
+ ffmpeg/libavformat/*.o `cat $(WRAPPER:.o=.def)` $(WRAPPER)
+
+ ifneq ($(ARCH), arm)
+ $(SYSDIR)/swscale-0.6.1-$(ARCH).so: $(WRAPPER) ffmpeg/libswscale/libswscale.so
+- $(CC) -o $@ $(LDFLAGS) --soname,$@ -Wl,-Bsymbolic \
++ $(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ -Wl,-Bsymbolic \
+ ffmpeg/libswscale/*.o ffmpeg/libswscale/$(ARCH_DIR)/*.o \
+ `cat $(WRAPPER:.o=.def)` $(WRAPPER)
+ else # No ARM version of swscale available yet.
+ $(SYSDIR)/swscale-0.6.1-$(ARCH).so: $(WRAPPER) ffmpeg/libswscale/libswscale.so
+- $(CC) -o $@ $(LDFLAGS) --soname,$@ -Wl,-Bsymbolic \
++ $(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ -Wl,-Bsymbolic \
+ ffmpeg/libswscale/*.o \
+ `cat $(WRAPPER:.o=.def)` $(WRAPPER)
+ endif
+
+ $(SYSDIR)/postproc-51-$(ARCH).so: $(WRAPPER) ffmpeg/libpostproc/libpostproc.so
+- $(CC) -o $@ $(LDFLAGS) --soname,$@ -Wl,-Bsymbolic \
++ $(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ -Wl,-Bsymbolic \
+ ffmpeg/libpostproc/*.o `cat $(WRAPPER:.o=.def)` $(WRAPPER)
+
+ ffmpeg/libavutil/libavutil.so : ffmpeg;
+@@ -185,17 +185,17 @@ ffmpeg:
+ $(MAKE) -C $@
+
+ $(SYSDIR)/libdts-$(ARCH).so: $(WRAPPER) libdts/libdts/libdts.a
+- $(CC) -o $@ $(LDFLAGS) --soname,$@ \
++ $(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ \
+ libdts/libdts/bitstream.o \
+ libdts/libdts/downmix.o libdts/libdts/parse.o \
+ `cat $(WRAPPER:.o=.def)` $(WRAPPER)
+
+ $(SYSDIR)/liba52-$(ARCH).so: $(WRAPPER) liba52/liba52/liba52.la
+- $(CC) -o $@ $(LDFLAGS) --soname,$@ liba52/liba52/.libs/*.o \
++ $(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ liba52/liba52/.libs/*.o \
+ -Wl`cat $(WRAPPER:.o=.def)` $(WRAPPER)
+
+ $(SYSDIR)/libao-$(ARCH).so: $(WRAPPER) liba52/libao/libao.a
+- $(CC) -o $@ $(LDFLAGS) --soname,$@ liba52/libao/libao.a \
++ $(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ liba52/libao/libao.a \
+ -Wl`cat $(WRAPPER:.o=.def)` $(WRAPPER)
+
+ libdts/libdts/libdts.a : libdts;
+diff --git a/xbmc/cores/dvdplayer/Codecs/libdvd/Makefile.in b/xbmc/cores/dvdplayer/Codecs/libdvd/Makefile.in
+index 3c487e9..6d4abd4 100644
+--- a/xbmc/cores/dvdplayer/Codecs/libdvd/Makefile.in
++++ b/xbmc/cores/dvdplayer/Codecs/libdvd/Makefile.in
+@@ -49,12 +49,12 @@ $(SYSDIR)/libdvdnav-$(ARCH).so: $(WRAPPER_OSX) $(DVDCSS_A) libdvdread/obj/libdvd
+ else
+
+ $(SYSDIR)/libdvdcss-$(ARCH).so: $(WRAPPER) libdvdcss/src/.libs/libdvdcss.a
+- $(CC) -o $@ $(LDFLAGS) --soname,$@ \
++ $(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ \
+ libdvdcss/src/*.o \
+ `cat $(WRAPPER:.o=.def)` $(WRAPPER)
+
+ $(SYSDIR)/libdvdnav-$(ARCH).so: $(WRAPPER) $(DVDCSS_A) libdvdread/obj/libdvdread.a libdvdnav/obj/libdvdnav.a
+- $(CC) -o $@ $(LDFLAGS) --soname,$@ $(DVDCSS_O) libdvdread/obj/*.o libdvdnav/obj/*.o \
++ $(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ $(DVDCSS_O) libdvdread/obj/*.o libdvdnav/obj/*.o \
+ `cat $(WRAPPER:.o=.def)` $(WRAPPER)
+
+ endif
+--
+1.7.0.2
+
diff --git a/media-tv/xbmc/files/xbmc-10.1-headers.patch b/media-tv/xbmc/files/xbmc-10.1-headers.patch
new file mode 100644
index 00000000..8c23db86
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-10.1-headers.patch
@@ -0,0 +1,10 @@
+--- a/tools/TexturePacker/XBTFWriter.cpp
++++ b/tools/TexturePacker/XBTFWriter.cpp
+@@ -28,6 +28,7 @@
+ #include "EndianSwap.h"
+ #define __STDC_FORMAT_MACROS
+ #include <inttypes.h>
++#include <unistd.h> /* for unlink() prototype */
+
+ #define TEMP_FILE "temp.xbt"
+ #define TEMP_SIZE (10*1024*1024)
diff --git a/media-tv/xbmc/files/xbmc-10.1-libpng-1.5.patch b/media-tv/xbmc/files/xbmc-10.1-libpng-1.5.patch
new file mode 100644
index 00000000..4d992275
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-10.1-libpng-1.5.patch
@@ -0,0 +1,596 @@
+fix building with newer libpng. patch by Ian Stakenvicius.
+
+https://bugs.gentoo.org/380127
+
+--- a/xbmc/lib/cximage-6.0/CxImage/ximapng.h
++++ b/xbmc/lib/cximage-6.0/CxImage/ximapng.h
+@@ -69,8 +69,13 @@
+
+ static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg)
+ {
++#if PNG_LIBPNG_VER > 10399
++ strncpy((char*)png_get_error_ptr(png_ptr),error_msg,255);
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ strncpy((char*)png_ptr->error_ptr,error_msg,255);
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+ };
+
+--- a/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
++++ b/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
+@@ -15,7 +15,11 @@
+ void CxImagePNG::ima_png_error(png_struct *png_ptr, char *message)
+ {
+ strcpy(info.szLastError,message);
++#if PNG_LIBPNG_VER > 10399
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+ ////////////////////////////////////////////////////////////////////////////////
+ #if CXIMAGE_SUPPORT_DECODE
+@@ -62,7 +66,11 @@
+ /* Set error handling if you are using the setjmp/longjmp method (this is
+ * the normal method of doing things with libpng). REQUIRED unless you
+ * set up your own error handlers in the png_create_read_struct() earlier. */
++#if PNG_LIBPNG_VER > 10399
++ if (setjmp(png_jmpbuf(png_ptr))) {
++#else
+ if (setjmp(png_ptr->jmpbuf)) {
++#endif
+ /* Free all of the memory associated with the png_ptr and info_ptr */
+ delete [] row_pointers;
+ png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
+@@ -70,16 +78,35 @@
+ /* read the file information */
+ png_read_info(png_ptr, info_ptr);
+
++ png_uint_32 _width,_height;
++ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
++#if PNG_LIBPNG_VER > 10399
++ png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type,
++ &_interlace_type,&_compression_type,&_filter_type);
++#else
++ _width=info_ptr->width;
++ _height=info_ptr->height;
++ _bit_depth=info_ptr->bit_depth;
++ _color_type=info_ptr->color_type;
++ _interlace_type=info_ptr->interlace_type;
++ _compression_type=info_ptr->compression_type;
++ _filter_type=info_ptr->filter_type;
++#endif
++
+ if (info.nEscape == -1){
+- head.biWidth = info_ptr->width;
+- head.biHeight= info_ptr->height;
++ head.biWidth = _width;
++ head.biHeight= _height;
+ info.dwType = CXIMAGE_FORMAT_PNG;
++#if PNG_LIBPNG_VER > 10399
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+
+ /* calculate new number of channels */
+ int channels=0;
+- switch(info_ptr->color_type){
++ switch(_color_type){
+ case PNG_COLOR_TYPE_GRAY:
+ case PNG_COLOR_TYPE_PALETTE:
+ channels = 1;
+@@ -101,71 +128,108 @@
+ break;
+ default:
+ strcpy(info.szLastError,"unknown PNG color type");
++#if PNG_LIBPNG_VER > 10399
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+
+ //find the right pixel depth used for cximage
++#if PNG_LIBPNG_VER > 10399
++ int pixel_depth = _bit_depth * png_get_channels(png_ptr,info_ptr);
++#else
+ int pixel_depth = info_ptr->pixel_depth;
++#endif
+ if (channels == 1 && pixel_depth>8) pixel_depth=8;
+ if (channels == 2) pixel_depth=8;
+ if (channels >= 3) pixel_depth=24;
+
+- if (!Create(info_ptr->width, info_ptr->height, pixel_depth, CXIMAGE_FORMAT_PNG)){
++ if (!Create(_width, _height, pixel_depth, CXIMAGE_FORMAT_PNG)){
++#if PNG_LIBPNG_VER > 10399
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+
+ /* get metrics */
+- switch (info_ptr->phys_unit_type)
++ png_uint_32 _x_pixels_per_unit,_y_pixels_per_unit;
++ int _phys_unit_type;
++#if PNG_LIBPNG_VER > 10399
++ png_get_pHYs(png_ptr,info_ptr,&_x_pixels_per_unit,&_y_pixels_per_unit,&_phys_unit_type);
++#else
++ _x_pixels_per_unit=info_ptr->x_pixels_per_unit;
++ _y_pixels_per_unit=info_ptr->y_pixels_per_unit;
++ _phys_unit_type=info_ptr->phys_unit_type;
++#endif
++ switch (_phys_unit_type)
+ {
+ case PNG_RESOLUTION_UNKNOWN:
+- SetXDPI(info_ptr->x_pixels_per_unit);
+- SetYDPI(info_ptr->y_pixels_per_unit);
++ SetXDPI(_x_pixels_per_unit);
++ SetYDPI(_y_pixels_per_unit);
+ break;
+ case PNG_RESOLUTION_METER:
+- SetXDPI((long)floor(info_ptr->x_pixels_per_unit * 254.0 / 10000.0 + 0.5));
+- SetYDPI((long)floor(info_ptr->y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
++ SetXDPI((long)floor(_x_pixels_per_unit * 254.0 / 10000.0 + 0.5));
++ SetYDPI((long)floor(_y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
+ break;
+ }
+
+- if (info_ptr->num_palette>0){
+- SetPalette((rgb_color*)info_ptr->palette,info_ptr->num_palette);
+- SetClrImportant(info_ptr->num_palette);
+- } else if (info_ptr->bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
++ int _num_palette;
++ png_colorp _palette;
++#if PNG_LIBPNG_VER > 10399
++ png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++#else
++ _num_palette=info_ptr->num_palette;
++ _palette=info_ptr->palette;
++#endif
++ if (_num_palette>0){
++ SetPalette((rgb_color*)_palette,_num_palette);
++ SetClrImportant(_num_palette);
++ } else if (_bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
+ SetPaletteColor(0,0,0,0);
+ SetPaletteColor(1,85,85,85);
+ SetPaletteColor(2,170,170,170);
+ SetPaletteColor(3,255,255,255);
+ } else SetGrayPalette(); //<DP> needed for grayscale PNGs
+
+- int nshift = max(0,(info_ptr->bit_depth>>3)-1)<<3;
++ int nshift = max(0,(_bit_depth>>3)-1)<<3;
+
+- if (info_ptr->num_trans!=0){ //palette transparency
+- if (info_ptr->num_trans==1){
+- if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){
++ png_bytep _trans_alpha;
++ int _num_trans;
++ png_color_16p _trans_color;
++#if PNG_LIBPNG_VER > 10399
++ png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++#else
++ _num_trans=info_ptr->num_trans;
++#endif
++ if (_num_trans!=0){ //palette transparency
++ if (_num_trans==1){
++ if (_color_type == PNG_COLOR_TYPE_PALETTE){
+ #if PNG_LIBPNG_VER > 10399
+- info.nBkgndIndex = info_ptr->trans_color.index;
++ info.nBkgndIndex = _trans_color->index;
+ #else
+ info.nBkgndIndex = info_ptr->trans_values.index;
+ #endif
+ } else{
+ #if PNG_LIBPNG_VER > 10399
+- info.nBkgndIndex = info_ptr->trans_color.gray>>nshift;
++ info.nBkgndIndex = _trans_color->gray>>nshift;
+ #else
+ info.nBkgndIndex = info_ptr->trans_values.gray>>nshift;
+ #endif
+ }
+ }
+- if (info_ptr->num_trans>1){
++ if (_num_trans>1){
+ RGBQUAD* pal=GetPalette();
+ if (pal){
+ DWORD ip;
+- for (ip=0;ip<min(head.biClrUsed,(unsigned long)info_ptr->num_trans);ip++)
++ for (ip=0;ip<min(head.biClrUsed,(unsigned long)_num_trans);ip++)
+ #if PNG_LIBPNG_VER > 10399
+- pal[ip].rgbReserved=info_ptr->trans_alpha[ip];
++ pal[ip].rgbReserved=_trans_alpha[ip];
+ #else
+ pal[ip].rgbReserved=info_ptr->trans[ip];
+ #endif
+- for (ip=info_ptr->num_trans;ip<head.biClrUsed;ip++){
++ for (ip=_num_trans;ip<head.biClrUsed;ip++){
+ pal[ip].rgbReserved=255;
+ }
+ info.bAlphaPaletteEnabled=true;
+@@ -174,14 +238,12 @@
+ }
+
+ if (channels == 3){ //check RGB binary transparency
+- png_bytep trans;
+- int num_trans;
+- png_color_16 *image_background;
+- if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &image_background)){
+-#if PNG_LIBPNG_VER > 10399
+- info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_color.red>>nshift);
+- info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift);
+- info.nBkgndColor.rgbBlue = (BYTE)(info_ptr->trans_color.blue>>nshift);
++ /* seems unnecessary to call again, but the conditional must be important so... */
++ if (png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color)){
++#if PNG_LIBPNG_VER > 10399
++ info.nBkgndColor.rgbRed = (BYTE)(_trans_color->red>>nshift);
++ info.nBkgndColor.rgbGreen = (BYTE)(_trans_color->green>>nshift);
++ info.nBkgndColor.rgbBlue = (BYTE)(_trans_color->blue>>nshift);
+ #else
+ info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_values.red>>nshift);
+ info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift);
+@@ -202,15 +264,24 @@
+ }
+
+ // <vho> - flip the RGB pixels to BGR (or RGBA to BGRA)
+- if (info_ptr->color_type & PNG_COLOR_MASK_COLOR){
++ if (_color_type & PNG_COLOR_MASK_COLOR){
+ png_set_bgr(png_ptr);
+ }
+
+ // <vho> - handle cancel
+- if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
++ if (info.nEscape)
++#if PNG_LIBPNG_VER > 10399
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
++ longjmp(png_ptr->jmpbuf, 1);
++#endif
+
+ // row_bytes is the width x number of channels x (bit-depth / 8)
++#if PNG_LIBPNG_VER > 10399
++ row_pointers = new BYTE[png_get_rowbytes(png_ptr,info_ptr) + 8];
++#else
+ row_pointers = new BYTE[info_ptr->rowbytes + 8];
++#endif
+
+ // turn on interlace handling
+ int number_passes = png_set_interlace_handling(png_ptr);
+@@ -221,8 +292,12 @@
+ SetCodecOption(0);
+ }
+
+- int chan_offset = info_ptr->bit_depth >> 3;
++ int chan_offset = _bit_depth >> 3;
++#if PNG_LIBPNG_VER > 10399
++ int pixel_offset = (_bit_depth * png_get_channels(png_ptr,info_ptr)) >> 3;
++#else
+ int pixel_offset = info_ptr->pixel_depth >> 3;
++#endif
+
+ for (int pass=0; pass < number_passes; pass++) {
+ iter.Upset();
+@@ -230,7 +305,12 @@
+ do {
+
+ // <vho> - handle cancel
+- if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
++ if (info.nEscape)
++#if PNG_LIBPNG_VER > 10399
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
++ longjmp(png_ptr->jmpbuf, 1);
++#endif
+
+ #if CXIMAGE_SUPPORT_ALPHA // <vho>
+ if (AlphaIsValid()) {
+@@ -241,7 +321,7 @@
+ BYTE* prow= iter.GetRow(ay);
+
+ //recover data from previous scan
+- if (info_ptr->interlace_type && pass>0 && pass!=7){
++ if (_interlace_type && pass>0 && pass!=7){
+ for(ax=0;ax<head.biWidth;ax++){
+ long px = ax * pixel_offset;
+ if (channels == 2){
+@@ -278,10 +358,14 @@
+ #endif // CXIMAGE_SUPPORT_ALPHA // vho
+ {
+ //recover data from previous scan
+- if (info_ptr->interlace_type && pass>0){
++ if (_interlace_type && pass>0){
++#if PNG_LIBPNG_VER > 10399
++ iter.GetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
++#else
+ iter.GetRow(row_pointers, info_ptr->rowbytes);
++#endif
+ //re-expand buffer for images with bit depth > 8
+- if (info_ptr->bit_depth > 8){
++ if (_bit_depth > 8){
+ for(long ax=(head.biWidth*channels-1);ax>=0;ax--)
+ row_pointers[ax*chan_offset] = row_pointers[ax];
+ }
+@@ -291,15 +375,19 @@
+ png_read_row(png_ptr, row_pointers, NULL);
+
+ //shrink 16 bit depth images down to 8 bits
+- if (info_ptr->bit_depth > 8){
++ if (_bit_depth > 8){
+ for(long ax=0;ax<(head.biWidth*channels);ax++)
+ row_pointers[ax] = row_pointers[ax*chan_offset];
+ }
+
+ //copy the pixels
++#if PNG_LIBPNG_VER > 10399
++ iter.SetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
++#else
+ iter.SetRow(row_pointers, info_ptr->rowbytes);
++#endif
+ //<DP> expand 2 bpp images only in the last pass
+- if (info_ptr->bit_depth==2 && pass==(number_passes-1))
++ if (_bit_depth==2 && pass==(number_passes-1))
+ expand2to4bpp(iter.GetRow());
+
+ //go on
+@@ -361,9 +449,13 @@
+ /* Set error handling. REQUIRED if you aren't supplying your own
+ * error hadnling functions in the png_create_write_struct() call.
+ */
++#if PNG_LIBPNG_VER > 10399
++ if (setjmp(png_jmpbuf(png_ptr))){
++#else
+ if (setjmp(png_ptr->jmpbuf)){
+ /* If we get here, we had a problem reading the file */
+ if (info_ptr->palette) free(info_ptr->palette);
++#endif
+ png_destroy_write_struct(&png_ptr, (png_infopp)&info_ptr);
+ cx_throw("Error saving PNG file");
+ }
+@@ -372,9 +464,23 @@
+ //png_init_io(png_ptr, hFile);
+
+ // use custom I/O functions
+- png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
++ png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
+
+ /* set the file information here */
++#if PNG_LIBPNG_VER > 10399
++ /* use variables to hold the values so it isnt necessary to png_get them later */
++ png_uint_32 _width,_height;
++ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
++ png_byte _channels,_pixel_depth;
++
++ _width = GetWidth();
++ _height = GetHeight();
++ _pixel_depth = (BYTE)GetBpp();
++ _channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1;
++ _bit_depth = (BYTE)(GetBpp()/_channels);
++ _compression_type = PNG_COMPRESSION_TYPE_DEFAULT;
++ _filter_type = PNG_FILTER_TYPE_DEFAULT;
++#else
+ info_ptr->width = GetWidth();
+ info_ptr->height = GetHeight();
+ info_ptr->pixel_depth = (BYTE)GetBpp();
+@@ -382,13 +488,22 @@
+ info_ptr->bit_depth = (BYTE)(GetBpp()/info_ptr->channels);
+ info_ptr->compression_type = info_ptr->filter_type = 0;
+ info_ptr->valid = 0;
++#endif
+
+ switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){
+ case 1:
++#if PNG_LIBPNG_VER > 10399
++ _interlace_type = PNG_INTERLACE_ADAM7;
++#else
+ info_ptr->interlace_type = PNG_INTERLACE_ADAM7;
++#endif
+ break;
+ default:
++#if PNG_LIBPNG_VER > 10399
++ _interlace_type = PNG_INTERLACE_NONE;
++#else
+ info_ptr->interlace_type = PNG_INTERLACE_NONE;
++#endif
+ }
+
+ /* set compression level */
+@@ -398,22 +513,47 @@
+
+ if (GetNumColors()){
+ if (bGrayScale){
++#if PNG_LIBPNG_VER > 10399
++ _color_type = PNG_COLOR_TYPE_GRAY;
++#else
+ info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
++#endif
+ } else {
++#if PNG_LIBPNG_VER > 10399
++ _color_type = PNG_COLOR_TYPE_PALETTE;
++#else
+ info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
++#endif
+ }
+ } else {
++#if PNG_LIBPNG_VER > 10399
++ _color_type = PNG_COLOR_TYPE_RGB;
++#else
+ info_ptr->color_type = PNG_COLOR_TYPE_RGB;
++#endif
+ }
+ #if CXIMAGE_SUPPORT_ALPHA
+ if (AlphaIsValid()){
++#if PNG_LIBPNG_VER > 10399
++ _color_type |= PNG_COLOR_MASK_ALPHA;
++ _channels++;
++ _bit_depth = 8;
++ _pixel_depth += 8;
++#else
+ info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
+ info_ptr->channels++;
+ info_ptr->bit_depth = 8;
+ info_ptr->pixel_depth += 8;
++#endif
+ }
+ #endif
+
++#if PNG_LIBPNG_VER > 10399
++ /* set the header here, since we're done modifying these values */
++ png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type,_interlace_type,
++ _compression_type,_filter_type);
++#endif
++
+ /* set background */
+ png_color_16 image_background={ 0, 255, 255, 255, 0 };
+ RGBQUAD tc = GetTransColor();
+@@ -427,22 +567,24 @@
+ /* set metrics */
+ png_set_pHYs(png_ptr, info_ptr, head.biXPelsPerMeter, head.biYPelsPerMeter, PNG_RESOLUTION_METER);
+
++#if PNG_LIBPNG_VER <= 10399
+ png_set_IHDR(png_ptr, info_ptr, info_ptr->width, info_ptr->height, info_ptr->bit_depth,
+ info_ptr->color_type, info_ptr->interlace_type,
+ PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
++#endif
+
+ //<DP> simple transparency
+ if (info.nBkgndIndex >= 0){
+- info_ptr->num_trans = 1;
+- info_ptr->valid |= PNG_INFO_tRNS;
+ #if PNG_LIBPNG_VER > 10399
+- info_ptr->trans_alpha = trans;
+- info_ptr->trans_color.index = (BYTE)info.nBkgndIndex;
+- info_ptr->trans_color.red = tc.rgbRed;
+- info_ptr->trans_color.green = tc.rgbGreen;
+- info_ptr->trans_color.blue = tc.rgbBlue;
+- info_ptr->trans_color.gray = info_ptr->trans_color.index;
++ png_color_16 _trans_color;
++ _trans_color.index = (BYTE)info.nBkgndIndex;
++ _trans_color.red = tc.rgbRed;
++ _trans_color.green = tc.rgbGreen;
++ _trans_color.blue = tc.rgbBlue;
++ _trans_color.gray = _trans_color.index;
+ #else
++ info_ptr->num_trans = 1;
++ info_ptr->valid |= PNG_INFO_tRNS;
+ info_ptr->trans = trans;
+ info_ptr->trans_values.index = (BYTE)info.nBkgndIndex;
+ info_ptr->trans_values.red = tc.rgbRed;
+@@ -454,34 +596,53 @@
+ // the transparency indexes start from 0 for non grayscale palette
+ if (!bGrayScale && head.biClrUsed && info.nBkgndIndex)
+ SwapIndex(0,(BYTE)info.nBkgndIndex);
++
++#if PNG_LIBPNG_VER > 10399
++ png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,1,&_trans_color);
++#endif
+ }
+
+ /* set the palette if there is one */
++#if PNG_LIBPNG_VER > 10399
++ png_colorp _palette;
++#endif
+ if (GetPalette()){
++#if PNG_LIBPNG_VER <= 10399
+ if (!bGrayScale){
+ info_ptr->valid |= PNG_INFO_PLTE;
+ }
++#endif
+
+ int nc = GetClrImportant();
+ if (nc==0) nc = GetNumColors();
+
++ // copy the palette colors
++#if PNG_LIBPNG_VER > 10399
++ _palette = new png_color[nc];
++#else
++ info_ptr->palette = new png_color[nc];
++ info_ptr->num_palette = (png_uint_16) nc;
++#endif
++ for (int i=0; i<nc; i++)
++#if PNG_LIBPNG_VER > 10399
++ GetPaletteColor(i, &_palette[i].red, &_palette[i].green, &_palette[i].blue);
++
++ png_set_PLTE(png_ptr,info_ptr,_palette,nc);
++#else
++ GetPaletteColor(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
++#endif
++
+ if (info.bAlphaPaletteEnabled){
+ for(WORD ip=0; ip<nc;ip++)
+ trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved;
+- info_ptr->num_trans = (WORD)nc;
+- info_ptr->valid |= PNG_INFO_tRNS;
+ #if PNG_LIBPNG_VER > 10399
+- info_ptr->trans_alpha = trans;
++ png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,nc,NULL);
+ #else
++ info_ptr->num_trans = (WORD)nc;
++ info_ptr->valid |= PNG_INFO_tRNS;
+ info_ptr->trans = trans;
+ #endif
+ }
+-
+- // copy the palette colors
+- info_ptr->palette = new png_color[nc];
+- info_ptr->num_palette = (png_uint_16) nc;
+- for (int i=0; i<nc; i++)
+- GetPaletteColor(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
+ }
+
+ #if CXIMAGE_SUPPORT_ALPHA // <vho>
+@@ -495,8 +656,12 @@
+ } } }
+ #endif // CXIMAGE_SUPPORT_ALPHA // <vho>
+
++#if PNG_LIBPNG_VER > 10399
++ int row_size = max(info.dwEffWidth, (_width * _channels * _bit_depth / 8));
++#else
+ int row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8));
+ info_ptr->rowbytes = row_size;
++#endif
+ BYTE *row_pointers = new BYTE[row_size];
+
+ /* write the file information */
+@@ -514,7 +679,11 @@
+ if (AlphaIsValid()){
+ for (long ax=head.biWidth-1; ax>=0;ax--){
+ c = BlindGetPixelColor(ax,ay);
++#if PNG_LIBPNG_VER > 10399
++ int px = ax * _channels;
++#else
+ int px = ax * info_ptr->channels;
++#endif
+ if (!bGrayScale){
+ row_pointers[px++]=c.rgbRed;
+ row_pointers[px++]=c.rgbGreen;
+@@ -529,7 +698,11 @@
+ #endif //CXIMAGE_SUPPORT_ALPHA // <vho>
+ {
+ iter.GetRow(row_pointers, row_size);
++#if PNG_LIBPNG_VER > 10399
++ if (_color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
++#else
+ if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
++#endif
+ RGBtoBGR(row_pointers, row_size);
+ png_write_row(png_ptr, row_pointers);
+ }
+@@ -546,9 +719,14 @@
+ png_write_end(png_ptr, info_ptr);
+
+ /* if you malloced the palette, free it here */
++#if PNG_LIBPNG_VER > 10399
++ if (_palette){
++ delete [] (_palette);
++#else
+ if (info_ptr->palette){
+ delete [] (info_ptr->palette);
+ info_ptr->palette = NULL;
++#endif
+ }
+
+ /* clean up after the write, and free any memory allocated */
diff --git a/media-tv/xbmc/files/xbmc-11.0-libpng-1.5.patch b/media-tv/xbmc/files/xbmc-11.0-libpng-1.5.patch
new file mode 100644
index 00000000..18c589a1
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-11.0-libpng-1.5.patch
@@ -0,0 +1,605 @@
+fix building with newer libpng. patch by Ian Stakenvicius.
+
+https://bugs.gentoo.org/380127
+
+--- a/lib/cximage-6.0/CxImage/ximapng.cpp
++++ b/lib/cximage-6.0/CxImage/ximapng.cpp
+@@ -15,7 +15,11 @@
+ void CxImagePNG::ima_png_error(png_struct *png_ptr, char *message)
+ {
+ strcpy(info.szLastError,message);
++#if PNG_LIBPNG_VER > 10499
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+ ////////////////////////////////////////////////////////////////////////////////
+ #if CXIMAGE_SUPPORT_DECODE
+@@ -62,7 +66,11 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ /* Set error handling if you are using the setjmp/longjmp method (this is
+ * the normal method of doing things with libpng). REQUIRED unless you
+ * set up your own error handlers in the png_create_read_struct() earlier. */
++#if PNG_LIBPNG_VER > 10499
++ if (setjmp(png_jmpbuf(png_ptr))) {
++#else
+ if (setjmp(png_ptr->jmpbuf)) {
++#endif
+ /* Free all of the memory associated with the png_ptr and info_ptr */
+ delete [] row_pointers;
+ png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
+@@ -76,16 +84,34 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ /* read the file information */
+ png_read_info(png_ptr, info_ptr);
+
++#if PNG_LIBPNG_VER > 10499
++ png_uint_32 _width,_height;
++ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
++ png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type,
++ &_interlace_type,&_compression_type,&_filter_type);
++
++ if (info.nEscape == -1){
++ head.biWidth = _width;
++ head.biHeight= _height;
++ info.dwType = CXIMAGE_FORMAT_PNG;
++ longjmp(png_jmpbuf(png_ptr), 1);
++ }
++#else
+ if (info.nEscape == -1){
+ head.biWidth = info_ptr->width;
+ head.biHeight= info_ptr->height;
+ info.dwType = CXIMAGE_FORMAT_PNG;
+ longjmp(png_ptr->jmpbuf, 1);
+ }
++#endif
+
+ /* calculate new number of channels */
+ int channels=0;
++#if PNG_LIBPNG_VER > 10499
++ switch(_color_type){
++#else
+ switch(info_ptr->color_type){
++#endif
+ case PNG_COLOR_TYPE_GRAY:
+ case PNG_COLOR_TYPE_PALETTE:
+ channels = 1;
+@@ -101,20 +127,49 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ break;
+ default:
+ strcpy(info.szLastError,"unknown PNG color type");
++#if PNG_LIBPNG_VER > 10499
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+
+ //find the right pixel depth used for cximage
++#if PNG_LIBPNG_VER > 10499
++ int pixel_depth = _bit_depth * png_get_channels(png_ptr,info_ptr);
++#else
+ int pixel_depth = info_ptr->pixel_depth;
++#endif
+ if (channels == 1 && pixel_depth>8) pixel_depth=8;
+ if (channels == 2) pixel_depth=8;
+ if (channels >= 3) pixel_depth=24;
+
++#if PNG_LIBPNG_VER > 10499
++ if (!Create(_width, _height, pixel_depth, CXIMAGE_FORMAT_PNG)){
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ if (!Create(info_ptr->width, info_ptr->height, pixel_depth, CXIMAGE_FORMAT_PNG)){
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+
+ /* get metrics */
++#if PNG_LIBPNG_VER > 10499
++ png_uint_32 _x_pixels_per_unit,_y_pixels_per_unit;
++ int _phys_unit_type;
++ png_get_pHYs(png_ptr,info_ptr,&_x_pixels_per_unit,&_y_pixels_per_unit,&_phys_unit_type);
++ switch (_phys_unit_type)
++ {
++ case PNG_RESOLUTION_UNKNOWN:
++ SetXDPI(_x_pixels_per_unit);
++ SetYDPI(_y_pixels_per_unit);
++ break;
++ case PNG_RESOLUTION_METER:
++ SetXDPI((long)floor(_x_pixels_per_unit * 254.0 / 10000.0 + 0.5));
++ SetYDPI((long)floor(_y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
++ break;
++ }
++#else
+ switch (info_ptr->phys_unit_type)
+ {
+ case PNG_RESOLUTION_UNKNOWN:
+@@ -126,46 +181,94 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ SetYDPI((long)floor(info_ptr->y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
+ break;
+ }
++#endif
+
++#if PNG_LIBPNG_VER > 10499
++ int _num_palette;
++ png_colorp _palette;
++ png_uint_32 _palette_ret;
++ _palette_ret = png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++ if (_palette_ret && _num_palette>0){
++ SetPalette((rgb_color*)_palette,_num_palette);
++ SetClrImportant(_num_palette);
++ } else if (_bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
++#else
+ if (info_ptr->num_palette>0){
+ SetPalette((rgb_color*)info_ptr->palette,info_ptr->num_palette);
+ SetClrImportant(info_ptr->num_palette);
+ } else if (info_ptr->bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
++#endif
+ SetPaletteColor(0,0,0,0);
+ SetPaletteColor(1,85,85,85);
+ SetPaletteColor(2,170,170,170);
+ SetPaletteColor(3,255,255,255);
+ } else SetGrayPalette(); //<DP> needed for grayscale PNGs
+
++#if PNG_LIBPNG_VER > 10499
++ int nshift = max(0,(_bit_depth>>3)-1)<<3;
++#else
+ int nshift = max(0,(info_ptr->bit_depth>>3)-1)<<3;
++#endif
+
++#if PNG_LIBPNG_VER > 10499
++ png_bytep _trans_alpha;
++ int _num_trans;
++ png_color_16p _trans_color;
++ png_uint_32 _trans_ret;
++ _trans_ret = png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++ if (_trans_ret && _num_trans!=0){ //palette transparency
++ if (_num_trans==1){
++ if (_color_type == PNG_COLOR_TYPE_PALETTE){
++#else
+ if (info_ptr->num_trans!=0){ //palette transparency
+ if (info_ptr->num_trans==1){
+ if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){
++#endif
++#if PNG_LIBPNG_VER > 10499
++ info.nBkgndIndex = _trans_color->index;
++#else
+ #if PNG_LIBPNG_VER > 10399
+ info.nBkgndIndex = info_ptr->trans_color.index;
+ #else
+ info.nBkgndIndex = info_ptr->trans_values.index;
+ #endif
++#endif
+ } else{
++#if PNG_LIBPNG_VER > 10499
++ info.nBkgndIndex = _trans_color->gray>>nshift;
++#else
+ #if PNG_LIBPNG_VER > 10399
+ info.nBkgndIndex = info_ptr->trans_color.gray>>nshift;
+ #else
+ info.nBkgndIndex = info_ptr->trans_values.gray>>nshift;
+ #endif
++#endif
+ }
+ }
++#if PNG_LIBPNG_VER > 10499
++ if (_num_trans>1 && _trans_alpha!=NULL){
++#else
+ if (info_ptr->num_trans>1){
++#endif
+ RGBQUAD* pal=GetPalette();
+ if (pal){
+ DWORD ip;
++#if PNG_LIBPNG_VER > 10499
++ for (ip=0;ip<min(head.biClrUsed,(unsigned long)_num_trans);ip++)
++ pal[ip].rgbReserved=_trans_alpha[ip];
++#else
+ for (ip=0;ip<min(head.biClrUsed,(unsigned long)info_ptr->num_trans);ip++)
+ #if PNG_LIBPNG_VER > 10399
+ pal[ip].rgbReserved=info_ptr->trans_alpha[ip];
+ #else
+ pal[ip].rgbReserved=info_ptr->trans[ip];
+ #endif
++#endif
++#if PNG_LIBPNG_VER > 10499
++ for (ip=_num_trans;ip<head.biClrUsed;ip++){
++#else
+ for (ip=info_ptr->num_trans;ip<head.biClrUsed;ip++){
++#endif
+ pal[ip].rgbReserved=255;
+ }
+ info.bAlphaPaletteEnabled=true;
+@@ -178,6 +281,11 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ int num_trans;
+ png_color_16 *image_background;
+ if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &image_background)){
++#if PNG_LIBPNG_VER > 10499
++ info.nBkgndColor.rgbRed = (BYTE)(_trans_color->red>>nshift);
++ info.nBkgndColor.rgbGreen = (BYTE)(_trans_color->green>>nshift);
++ info.nBkgndColor.rgbBlue = (BYTE)(_trans_color->blue>>nshift);
++#else
+ #if PNG_LIBPNG_VER > 10399
+ info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_color.red>>nshift);
+ info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift);
+@@ -187,6 +295,7 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift);
+ info.nBkgndColor.rgbBlue = (BYTE)(info_ptr->trans_values.blue>>nshift);
+ #endif
++#endif
+ info.nBkgndColor.rgbReserved = 0;
+ info.nBkgndIndex = 0;
+ }
+@@ -202,15 +311,27 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ }
+
+ // <vho> - flip the RGB pixels to BGR (or RGBA to BGRA)
++#if PNG_LIBPNG_VER > 10499
++ if (_color_type & PNG_COLOR_MASK_COLOR){
++#else
+ if (info_ptr->color_type & PNG_COLOR_MASK_COLOR){
++#endif
+ png_set_bgr(png_ptr);
+ }
+
+ // <vho> - handle cancel
++#if PNG_LIBPNG_VER > 10499
++ if (info.nEscape) longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
++#endif
+
+ // row_bytes is the width x number of channels x (bit-depth / 8)
++#if PNG_LIBPNG_VER > 10499
++ row_pointers = new BYTE[png_get_rowbytes(png_ptr,info_ptr) + 8];
++#else
+ row_pointers = new BYTE[info_ptr->rowbytes + 8];
++#endif
+
+ // turn on interlace handling
+ int number_passes = png_set_interlace_handling(png_ptr);
+@@ -221,8 +342,16 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ SetCodecOption(0);
+ }
+
++#if PNG_LIBPNG_VER > 10499
++ int chan_offset = _bit_depth >> 3;
++#else
+ int chan_offset = info_ptr->bit_depth >> 3;
++#endif
++#if PNG_LIBPNG_VER > 10499
++ int pixel_offset = (_bit_depth * png_get_channels(png_ptr,info_ptr)) >> 3;
++#else
+ int pixel_offset = info_ptr->pixel_depth >> 3;
++#endif
+
+ for (int pass=0; pass < number_passes; pass++) {
+ iter.Upset();
+@@ -230,7 +359,11 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ do {
+
+ // <vho> - handle cancel
++#if PNG_LIBPNG_VER > 10499
++ if (info.nEscape) longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
++#endif
+
+ #if CXIMAGE_SUPPORT_ALPHA // <vho>
+ if (AlphaIsValid()) {
+@@ -241,7 +374,11 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ BYTE* prow= iter.GetRow(ay);
+
+ //recover data from previous scan
++#if PNG_LIBPNG_VER > 10499
++ if (_interlace_type && pass>0 && pass!=7){
++#else
+ if (info_ptr->interlace_type && pass>0 && pass!=7){
++#endif
+ for(ax=0;ax<head.biWidth;ax++){
+ long px = ax * pixel_offset;
+ if (channels == 2){
+@@ -278,10 +415,17 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ #endif // CXIMAGE_SUPPORT_ALPHA // vho
+ {
+ //recover data from previous scan
++#if PNG_LIBPNG_VER > 10499
++ if (_interlace_type && pass>0){
++ iter.GetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
++ //re-expand buffer for images with bit depth > 8
++ if (_bit_depth > 8){
++#else
+ if (info_ptr->interlace_type && pass>0){
+ iter.GetRow(row_pointers, info_ptr->rowbytes);
+ //re-expand buffer for images with bit depth > 8
+ if (info_ptr->bit_depth > 8){
++#endif
+ for(long ax=(head.biWidth*channels-1);ax>=0;ax--)
+ row_pointers[ax*chan_offset] = row_pointers[ax];
+ }
+@@ -291,15 +435,27 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ png_read_row(png_ptr, row_pointers, NULL);
+
+ //shrink 16 bit depth images down to 8 bits
++#if PNG_LIBPNG_VER > 10499
++ if (_bit_depth > 8){
++#else
+ if (info_ptr->bit_depth > 8){
++#endif
+ for(long ax=0;ax<(head.biWidth*channels);ax++)
+ row_pointers[ax] = row_pointers[ax*chan_offset];
+ }
+
+ //copy the pixels
++#if PNG_LIBPNG_VER > 10499
++ iter.SetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
++#else
+ iter.SetRow(row_pointers, info_ptr->rowbytes);
++#endif
+ //<DP> expand 2 bpp images only in the last pass
++#if PNG_LIBPNG_VER > 10499
++ if (_bit_depth==2 && pass==(number_passes-1))
++#else
+ if (info_ptr->bit_depth==2 && pass==(number_passes-1))
++#endif
+ expand2to4bpp(iter.GetRow());
+
+ //go on
+@@ -361,9 +517,13 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ /* Set error handling. REQUIRED if you aren't supplying your own
+ * error hadnling functions in the png_create_write_struct() call.
+ */
++#if PNG_LIBPNG_VER > 10499
++ if (setjmp(png_jmpbuf(png_ptr))){
++#else
+ if (setjmp(png_ptr->jmpbuf)){
+ /* If we get here, we had a problem reading the file */
+ if (info_ptr->palette) free(info_ptr->palette);
++#endif
+ png_destroy_write_struct(&png_ptr, (png_infopp)&info_ptr);
+ cx_throw("Error saving PNG file");
+ }
+@@ -372,9 +532,23 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ //png_init_io(png_ptr, hFile);
+
+ // use custom I/O functions
+- png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
++ png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
+
+ /* set the file information here */
++#if PNG_LIBPNG_VER > 10499
++ /* use variables to hold the values so it isnt necessary to png_get them later */
++ png_uint_32 _width,_height;
++ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
++ png_byte _channels,_pixel_depth;
++
++ _width = GetWidth();
++ _height = GetHeight();
++ _pixel_depth = (BYTE)GetBpp();
++ _channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1;
++ _bit_depth = (BYTE)(GetBpp()/_channels);
++ _compression_type = PNG_COMPRESSION_TYPE_DEFAULT;
++ _filter_type = PNG_FILTER_TYPE_DEFAULT;
++#else
+ info_ptr->width = GetWidth();
+ info_ptr->height = GetHeight();
+ info_ptr->pixel_depth = (BYTE)GetBpp();
+@@ -382,13 +556,22 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ info_ptr->bit_depth = (BYTE)(GetBpp()/info_ptr->channels);
+ info_ptr->compression_type = info_ptr->filter_type = 0;
+ info_ptr->valid = 0;
++#endif
+
+ switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){
+ case 1:
++#if PNG_LIBPNG_VER > 10499
++ _interlace_type = PNG_INTERLACE_ADAM7;
++#else
+ info_ptr->interlace_type = PNG_INTERLACE_ADAM7;
++#endif
+ break;
+ default:
++#if PNG_LIBPNG_VER > 10499
++ _interlace_type = PNG_INTERLACE_NONE;
++#else
+ info_ptr->interlace_type = PNG_INTERLACE_NONE;
++#endif
+ }
+
+ /* set compression level */
+@@ -398,19 +581,38 @@ bool CxImagePNG::Encode(CxFile *hFile)
+
+ if (GetNumColors()){
+ if (bGrayScale){
++#if PNG_LIBPNG_VER > 10499
++ _color_type = PNG_COLOR_TYPE_GRAY;
++#else
+ info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
++#endif
+ } else {
++#if PNG_LIBPNG_VER > 10499
++ _color_type = PNG_COLOR_TYPE_PALETTE;
++#else
+ info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
++#endif
+ }
+ } else {
++#if PNG_LIBPNG_VER > 10499
++ _color_type = PNG_COLOR_TYPE_RGB;
++#else
+ info_ptr->color_type = PNG_COLOR_TYPE_RGB;
++#endif
+ }
+ #if CXIMAGE_SUPPORT_ALPHA
+ if (AlphaIsValid()){
++#if PNG_LIBPNG_VER > 10499
++ _color_type |= PNG_COLOR_MASK_ALPHA;
++ _channels++;
++ _bit_depth = 8;
++ _pixel_depth += 8;
++#else
+ info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
+ info_ptr->channels++;
+ info_ptr->bit_depth = 8;
+ info_ptr->pixel_depth += 8;
++#endif
+ }
+ #endif
+
+@@ -427,14 +629,30 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ /* set metrics */
+ png_set_pHYs(png_ptr, info_ptr, head.biXPelsPerMeter, head.biYPelsPerMeter, PNG_RESOLUTION_METER);
+
++#if PNG_LIBPNG_VER > 10499
++ png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type,_interlace_type,
++ _compression_type,_filter_type);
++#else
+ png_set_IHDR(png_ptr, info_ptr, info_ptr->width, info_ptr->height, info_ptr->bit_depth,
+ info_ptr->color_type, info_ptr->interlace_type,
+ PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
++#endif
+
+ //<DP> simple transparency
+ if (info.nBkgndIndex >= 0){
++#if PNG_LIBPNG_VER <= 10499
+ info_ptr->num_trans = 1;
+ info_ptr->valid |= PNG_INFO_tRNS;
++#endif
++#if PNG_LIBPNG_VER > 10499
++ png_color_16 _trans_color;
++ _trans_color.index = (BYTE)info.nBkgndIndex;
++ _trans_color.red = tc.rgbRed;
++ _trans_color.green = tc.rgbGreen;
++ _trans_color.blue = tc.rgbBlue;
++ _trans_color.gray = _trans_color.index;
++ png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,1,&_trans_color);
++#else
+ #if PNG_LIBPNG_VER > 10399
+ info_ptr->trans_alpha = trans;
+ info_ptr->trans_color.index = (BYTE)info.nBkgndIndex;
+@@ -450,6 +668,7 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ info_ptr->trans_values.blue = tc.rgbBlue;
+ info_ptr->trans_values.gray = info_ptr->trans_values.index;
+ #endif
++#endif
+
+ // the transparency indexes start from 0 for non grayscale palette
+ if (!bGrayScale && head.biClrUsed && info.nBkgndIndex)
+@@ -457,10 +676,16 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ }
+
+ /* set the palette if there is one */
++#if PNG_LIBPNG_VER > 10499
++ png_colorp _palette = NULL;
++ if (GetPalette()){
++ /* png_set_PLTE() will be called once the palette is ready */
++#else
+ if (GetPalette()){
+ if (!bGrayScale){
+ info_ptr->valid |= PNG_INFO_PLTE;
+ }
++#endif
+
+ int nc = GetClrImportant();
+ if (nc==0) nc = GetNumColors();
+@@ -468,20 +693,34 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ if (info.bAlphaPaletteEnabled){
+ for(WORD ip=0; ip<nc;ip++)
+ trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved;
++#if PNG_LIBPNG_VER <= 10499
+ info_ptr->num_trans = (WORD)nc;
+ info_ptr->valid |= PNG_INFO_tRNS;
++#endif
++#if PNG_LIBPNG_VER > 10499
++ png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,nc,NULL);
++#else
+ #if PNG_LIBPNG_VER > 10399
+ info_ptr->trans_alpha = trans;
+ #else
+ info_ptr->trans = trans;
+ #endif
++#endif
+ }
+
+ // copy the palette colors
++#if PNG_LIBPNG_VER > 10499
++ _palette = new png_color[nc];
++ for (int i=0; i<nc; i++)
++ GetPaletteColor(i, &_palette[i].red, &_palette[i].green, &_palette[i].blue);
++
++ png_set_PLTE(png_ptr,info_ptr,_palette,nc);
++#else
+ info_ptr->palette = new png_color[nc];
+ info_ptr->num_palette = (png_uint_16) nc;
+ for (int i=0; i<nc; i++)
+ GetPaletteColor(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
++#endif
+ }
+
+ #if CXIMAGE_SUPPORT_ALPHA // <vho>
+@@ -495,8 +734,12 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ } } }
+ #endif // CXIMAGE_SUPPORT_ALPHA // <vho>
+
++#if PNG_LIBPNG_VER > 10499
++ int row_size = max(info.dwEffWidth, (_width * _channels * _bit_depth / 8));
++#else
+ int row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8));
+ info_ptr->rowbytes = row_size;
++#endif
+ BYTE *row_pointers = new BYTE[row_size];
+
+ /* write the file information */
+@@ -514,7 +757,11 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ if (AlphaIsValid()){
+ for (long ax=head.biWidth-1; ax>=0;ax--){
+ c = BlindGetPixelColor(ax,ay);
++#if PNG_LIBPNG_VER > 10499
++ int px = ax * _channels;
++#else
+ int px = ax * info_ptr->channels;
++#endif
+ if (!bGrayScale){
+ row_pointers[px++]=c.rgbRed;
+ row_pointers[px++]=c.rgbGreen;
+@@ -529,7 +776,11 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ #endif //CXIMAGE_SUPPORT_ALPHA // <vho>
+ {
+ iter.GetRow(row_pointers, row_size);
++#if PNG_LIBPNG_VER > 10499
++ if (_color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
++#else
+ if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
++#endif
+ RGBtoBGR(row_pointers, row_size);
+ png_write_row(png_ptr, row_pointers);
+ }
+@@ -546,9 +797,14 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ png_write_end(png_ptr, info_ptr);
+
+ /* if you malloced the palette, free it here */
++#if PNG_LIBPNG_VER > 10499
++ if (_palette){
++ delete [] (_palette);
++#else
+ if (info_ptr->palette){
+ delete [] (info_ptr->palette);
+ info_ptr->palette = NULL;
++#endif
+ }
+
+ /* clean up after the write, and free any memory allocated */
+--- a/lib/cximage-6.0/CxImage/ximapng.h
++++ b/lib/cximage-6.0/CxImage/ximapng.h
+@@ -69,8 +69,13 @@ class CxImagePNG: public CxImage
+
+ static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg)
+ {
++#if PNG_LIBPNG_VER > 10499
++ strncpy((char*)png_get_error_ptr(png_ptr),error_msg,255);
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ strncpy((char*)png_ptr->error_ptr,error_msg,255);
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+ };
+
diff --git a/media-tv/xbmc/files/xbmc-11.0-no-exec-stack.patch b/media-tv/xbmc/files/xbmc-11.0-no-exec-stack.patch
new file mode 100644
index 00000000..35ff747d
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-11.0-no-exec-stack.patch
@@ -0,0 +1,30 @@
+http://trac.xbmc.org/ticket/12735
+
+merged upstream already
+
+From f0e33eefa4b5d46f26811db2f5e943dcd7f2870e Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 1 Mar 2012 00:04:49 -0500
+Subject: [PATCH] mark stack as non-executable
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ xbmc/utils/fastmemcpy-arm.S | 5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/xbmc/utils/fastmemcpy-arm.S b/xbmc/utils/fastmemcpy-arm.S
+index 0e810a7..3d77c68 100644
+--- a/xbmc/utils/fastmemcpy-arm.S
++++ b/xbmc/utils/fastmemcpy-arm.S
+@@ -527,3 +527,8 @@ copy_last_3_and_return:
+
+ #endif /* __ARM_ARCH__ < 7 */
+ #endif
++
++#if defined(__linux__) && defined(__ELF__)
++/* we don't need an executable stack */
++.section .note.GNU-stack,"",%progbits
++#endif
+--
+1.7.8.4
+
diff --git a/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-fix-plt-trn-get.patch b/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-fix-plt-trn-get.patch
new file mode 100644
index 00000000..7e6ce676
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-fix-plt-trn-get.patch
@@ -0,0 +1,51 @@
+
+Update libpng 1.5 patch: check return values of png_get_PLTE() and
+png_get_tRNS() before using the values to avoid using uninitialized values.
+
+--- a/lib/cximage-6.0/CxImage/ximapng.cpp
++++ b/lib/cximage-6.0/CxImage/ximapng.cpp
+@@ -178,12 +178,14 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ int _num_palette;
+ png_colorp _palette;
+ #if PNG_LIBPNG_VER > 10399
+- png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++ png_uint_32 _palette_ret;
++ _palette_ret = png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++ if (_palette_ret && _num_palette>0){
+ #else
+ _num_palette=info_ptr->num_palette;
+ _palette=info_ptr->palette;
+-#endif
+ if (_num_palette>0){
++#endif
+ SetPalette((rgb_color*)_palette,_num_palette);
+ SetClrImportant(_num_palette);
+ } else if (_bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
+@@ -199,11 +201,13 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ int _num_trans;
+ png_color_16p _trans_color;
+ #if PNG_LIBPNG_VER > 10399
+- png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++ png_uint_32 _trans_ret;
++ _trans_ret = png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++ if (_trans_ret && _num_trans!=0){ //palette transparency
+ #else
+ _num_trans=info_ptr->num_trans;
+-#endif
+ if (_num_trans!=0){ //palette transparency
++#endif
+ if (_num_trans==1){
+ if (_color_type == PNG_COLOR_TYPE_PALETTE){
+ #if PNG_LIBPNG_VER > 10399
+@@ -219,7 +223,11 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ #endif
+ }
+ }
++#if PNG_LIBPNG_VER > 10399
++ if (_num_trans>1 && _trans_alpha!=NULL){
++#else
+ if (_num_trans>1){
++#endif
+ RGBQUAD* pal=GetPalette();
+ if (pal){
+ DWORD ip;
diff --git a/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-headers.patch b/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-headers.patch
new file mode 100644
index 00000000..4648f9fd
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-headers.patch
@@ -0,0 +1,12 @@
+diff --git a/tools/TexturePacker/XBTFWriter.cpp b/tools/TexturePacker/XBTFWriter.cpp
+index 78b47fe..2e75d96 100644
+--- a/tools/TexturePacker/XBTFWriter.cpp
++++ b/tools/TexturePacker/XBTFWriter.cpp
+@@ -22,6 +22,7 @@
+ #include "XBTFWriter.h"
+ #define __STDC_FORMAT_MACROS
+ #include <inttypes.h>
++#include <unistd.h> /* for unlink() prototype */
+ #include "guilib/XBTF.h"
+ #include "utils/EndianSwap.h"
+ #if !defined(__APPLE__) && !defined(__FreeBSD__)
diff --git a/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5.patch b/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5.patch
new file mode 100644
index 00000000..da331d2b
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5.patch
@@ -0,0 +1,596 @@
+fix building with newer libpng. patch by Ian Stakenvicius.
+
+https://bugs.gentoo.org/380127
+
+--- a/xbmc/lib/cximage-6.0/CxImage/ximapng.h
++++ b/xbmc/lib/cximage-6.0/CxImage/ximapng.h
+@@ -69,8 +69,13 @@
+
+ static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg)
+ {
++#if PNG_LIBPNG_VER > 10399
++ strncpy((char*)png_get_error_ptr(png_ptr),error_msg,255);
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ strncpy((char*)png_ptr->error_ptr,error_msg,255);
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+ };
+
+--- a/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
++++ b/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
+@@ -15,7 +15,11 @@
+ void CxImagePNG::ima_png_error(png_struct *png_ptr, char *message)
+ {
+ strcpy(info.szLastError,message);
++#if PNG_LIBPNG_VER > 10399
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+ ////////////////////////////////////////////////////////////////////////////////
+ #if CXIMAGE_SUPPORT_DECODE
+@@ -62,7 +66,11 @@
+ /* Set error handling if you are using the setjmp/longjmp method (this is
+ * the normal method of doing things with libpng). REQUIRED unless you
+ * set up your own error handlers in the png_create_read_struct() earlier. */
++#if PNG_LIBPNG_VER > 10399
++ if (setjmp(png_jmpbuf(png_ptr))) {
++#else
+ if (setjmp(png_ptr->jmpbuf)) {
++#endif
+ /* Free all of the memory associated with the png_ptr and info_ptr */
+ delete [] row_pointers;
+ png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
+@@ -70,16 +78,35 @@
+ /* read the file information */
+ png_read_info(png_ptr, info_ptr);
+
++ png_uint_32 _width,_height;
++ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
++#if PNG_LIBPNG_VER > 10399
++ png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type,
++ &_interlace_type,&_compression_type,&_filter_type);
++#else
++ _width=info_ptr->width;
++ _height=info_ptr->height;
++ _bit_depth=info_ptr->bit_depth;
++ _color_type=info_ptr->color_type;
++ _interlace_type=info_ptr->interlace_type;
++ _compression_type=info_ptr->compression_type;
++ _filter_type=info_ptr->filter_type;
++#endif
++
+ if (info.nEscape == -1){
+- head.biWidth = info_ptr->width;
+- head.biHeight= info_ptr->height;
++ head.biWidth = _width;
++ head.biHeight= _height;
+ info.dwType = CXIMAGE_FORMAT_PNG;
++#if PNG_LIBPNG_VER > 10399
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+
+ /* calculate new number of channels */
+ int channels=0;
+- switch(info_ptr->color_type){
++ switch(_color_type){
+ case PNG_COLOR_TYPE_GRAY:
+ case PNG_COLOR_TYPE_PALETTE:
+ channels = 1;
+@@ -101,71 +128,108 @@
+ break;
+ default:
+ strcpy(info.szLastError,"unknown PNG color type");
++#if PNG_LIBPNG_VER > 10399
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+
+ //find the right pixel depth used for cximage
++#if PNG_LIBPNG_VER > 10399
++ int pixel_depth = _bit_depth * png_get_channels(png_ptr,info_ptr);
++#else
+ int pixel_depth = info_ptr->pixel_depth;
++#endif
+ if (channels == 1 && pixel_depth>8) pixel_depth=8;
+ if (channels == 2) pixel_depth=8;
+ if (channels >= 3) pixel_depth=24;
+
+- if (!Create(info_ptr->width, info_ptr->height, pixel_depth, CXIMAGE_FORMAT_PNG)){
++ if (!Create(_width, _height, pixel_depth, CXIMAGE_FORMAT_PNG)){
++#if PNG_LIBPNG_VER > 10399
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+
+ /* get metrics */
+- switch (info_ptr->phys_unit_type)
++ png_uint_32 _x_pixels_per_unit,_y_pixels_per_unit;
++ int _phys_unit_type;
++#if PNG_LIBPNG_VER > 10399
++ png_get_pHYs(png_ptr,info_ptr,&_x_pixels_per_unit,&_y_pixels_per_unit,&_phys_unit_type);
++#else
++ _x_pixels_per_unit=info_ptr->x_pixels_per_unit;
++ _y_pixels_per_unit=info_ptr->y_pixels_per_unit;
++ _phys_unit_type=info_ptr->phys_unit_type;
++#endif
++ switch (_phys_unit_type)
+ {
+ case PNG_RESOLUTION_UNKNOWN:
+- SetXDPI(info_ptr->x_pixels_per_unit);
+- SetYDPI(info_ptr->y_pixels_per_unit);
++ SetXDPI(_x_pixels_per_unit);
++ SetYDPI(_y_pixels_per_unit);
+ break;
+ case PNG_RESOLUTION_METER:
+- SetXDPI((long)floor(info_ptr->x_pixels_per_unit * 254.0 / 10000.0 + 0.5));
+- SetYDPI((long)floor(info_ptr->y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
++ SetXDPI((long)floor(_x_pixels_per_unit * 254.0 / 10000.0 + 0.5));
++ SetYDPI((long)floor(_y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
+ break;
+ }
+
+- if (info_ptr->num_palette>0){
+- SetPalette((rgb_color*)info_ptr->palette,info_ptr->num_palette);
+- SetClrImportant(info_ptr->num_palette);
+- } else if (info_ptr->bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
++ int _num_palette;
++ png_colorp _palette;
++#if PNG_LIBPNG_VER > 10399
++ png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++#else
++ _num_palette=info_ptr->num_palette;
++ _palette=info_ptr->palette;
++#endif
++ if (_num_palette>0){
++ SetPalette((rgb_color*)_palette,_num_palette);
++ SetClrImportant(_num_palette);
++ } else if (_bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
+ SetPaletteColor(0,0,0,0);
+ SetPaletteColor(1,85,85,85);
+ SetPaletteColor(2,170,170,170);
+ SetPaletteColor(3,255,255,255);
+ } else SetGrayPalette(); //<DP> needed for grayscale PNGs
+
+- int nshift = max(0,(info_ptr->bit_depth>>3)-1)<<3;
++ int nshift = max(0,(_bit_depth>>3)-1)<<3;
+
+- if (info_ptr->num_trans!=0){ //palette transparency
+- if (info_ptr->num_trans==1){
+- if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){
++ png_bytep _trans_alpha;
++ int _num_trans;
++ png_color_16p _trans_color;
++#if PNG_LIBPNG_VER > 10399
++ png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++#else
++ _num_trans=info_ptr->num_trans;
++#endif
++ if (_num_trans!=0){ //palette transparency
++ if (_num_trans==1){
++ if (_color_type == PNG_COLOR_TYPE_PALETTE){
+ #if PNG_LIBPNG_VER > 10399
+- info.nBkgndIndex = info_ptr->trans_color.index;
++ info.nBkgndIndex = _trans_color->index;
+ #else
+ info.nBkgndIndex = info_ptr->trans_values.index;
+ #endif
+ } else{
+ #if PNG_LIBPNG_VER > 10399
+- info.nBkgndIndex = info_ptr->trans_color.gray>>nshift;
++ info.nBkgndIndex = _trans_color->gray>>nshift;
+ #else
+ info.nBkgndIndex = info_ptr->trans_values.gray>>nshift;
+ #endif
+ }
+ }
+- if (info_ptr->num_trans>1){
++ if (_num_trans>1){
+ RGBQUAD* pal=GetPalette();
+ if (pal){
+ DWORD ip;
+- for (ip=0;ip<min(head.biClrUsed,(unsigned long)info_ptr->num_trans);ip++)
++ for (ip=0;ip<min(head.biClrUsed,(unsigned long)_num_trans);ip++)
+ #if PNG_LIBPNG_VER > 10399
+- pal[ip].rgbReserved=info_ptr->trans_alpha[ip];
++ pal[ip].rgbReserved=_trans_alpha[ip];
+ #else
+ pal[ip].rgbReserved=info_ptr->trans[ip];
+ #endif
+- for (ip=info_ptr->num_trans;ip<head.biClrUsed;ip++){
++ for (ip=_num_trans;ip<head.biClrUsed;ip++){
+ pal[ip].rgbReserved=255;
+ }
+ info.bAlphaPaletteEnabled=true;
+@@ -174,14 +238,12 @@
+ }
+
+ if (channels == 3){ //check RGB binary transparency
+- png_bytep trans;
+- int num_trans;
+- png_color_16 *image_background;
+- if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &image_background)){
+-#if PNG_LIBPNG_VER > 10399
+- info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_color.red>>nshift);
+- info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift);
+- info.nBkgndColor.rgbBlue = (BYTE)(info_ptr->trans_color.blue>>nshift);
++ /* seems unnecessary to call again, but the conditional must be important so... */
++ if (png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color)){
++#if PNG_LIBPNG_VER > 10399
++ info.nBkgndColor.rgbRed = (BYTE)(_trans_color->red>>nshift);
++ info.nBkgndColor.rgbGreen = (BYTE)(_trans_color->green>>nshift);
++ info.nBkgndColor.rgbBlue = (BYTE)(_trans_color->blue>>nshift);
+ #else
+ info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_values.red>>nshift);
+ info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift);
+@@ -202,15 +264,24 @@
+ }
+
+ // <vho> - flip the RGB pixels to BGR (or RGBA to BGRA)
+- if (info_ptr->color_type & PNG_COLOR_MASK_COLOR){
++ if (_color_type & PNG_COLOR_MASK_COLOR){
+ png_set_bgr(png_ptr);
+ }
+
+ // <vho> - handle cancel
+- if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
++ if (info.nEscape)
++#if PNG_LIBPNG_VER > 10399
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
++ longjmp(png_ptr->jmpbuf, 1);
++#endif
+
+ // row_bytes is the width x number of channels x (bit-depth / 8)
++#if PNG_LIBPNG_VER > 10399
++ row_pointers = new BYTE[png_get_rowbytes(png_ptr,info_ptr) + 8];
++#else
+ row_pointers = new BYTE[info_ptr->rowbytes + 8];
++#endif
+
+ // turn on interlace handling
+ int number_passes = png_set_interlace_handling(png_ptr);
+@@ -221,8 +292,12 @@
+ SetCodecOption(0);
+ }
+
+- int chan_offset = info_ptr->bit_depth >> 3;
++ int chan_offset = _bit_depth >> 3;
++#if PNG_LIBPNG_VER > 10399
++ int pixel_offset = (_bit_depth * png_get_channels(png_ptr,info_ptr)) >> 3;
++#else
+ int pixel_offset = info_ptr->pixel_depth >> 3;
++#endif
+
+ for (int pass=0; pass < number_passes; pass++) {
+ iter.Upset();
+@@ -230,7 +305,12 @@
+ do {
+
+ // <vho> - handle cancel
+- if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
++ if (info.nEscape)
++#if PNG_LIBPNG_VER > 10399
++ longjmp(png_jmpbuf(png_ptr), 1);
++#else
++ longjmp(png_ptr->jmpbuf, 1);
++#endif
+
+ #if CXIMAGE_SUPPORT_ALPHA // <vho>
+ if (AlphaIsValid()) {
+@@ -241,7 +321,7 @@
+ BYTE* prow= iter.GetRow(ay);
+
+ //recover data from previous scan
+- if (info_ptr->interlace_type && pass>0 && pass!=7){
++ if (_interlace_type && pass>0 && pass!=7){
+ for(ax=0;ax<head.biWidth;ax++){
+ long px = ax * pixel_offset;
+ if (channels == 2){
+@@ -278,10 +358,14 @@
+ #endif // CXIMAGE_SUPPORT_ALPHA // vho
+ {
+ //recover data from previous scan
+- if (info_ptr->interlace_type && pass>0){
++ if (_interlace_type && pass>0){
++#if PNG_LIBPNG_VER > 10399
++ iter.GetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
++#else
+ iter.GetRow(row_pointers, info_ptr->rowbytes);
++#endif
+ //re-expand buffer for images with bit depth > 8
+- if (info_ptr->bit_depth > 8){
++ if (_bit_depth > 8){
+ for(long ax=(head.biWidth*channels-1);ax>=0;ax--)
+ row_pointers[ax*chan_offset] = row_pointers[ax];
+ }
+@@ -291,15 +375,19 @@
+ png_read_row(png_ptr, row_pointers, NULL);
+
+ //shrink 16 bit depth images down to 8 bits
+- if (info_ptr->bit_depth > 8){
++ if (_bit_depth > 8){
+ for(long ax=0;ax<(head.biWidth*channels);ax++)
+ row_pointers[ax] = row_pointers[ax*chan_offset];
+ }
+
+ //copy the pixels
++#if PNG_LIBPNG_VER > 10399
++ iter.SetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
++#else
+ iter.SetRow(row_pointers, info_ptr->rowbytes);
++#endif
+ //<DP> expand 2 bpp images only in the last pass
+- if (info_ptr->bit_depth==2 && pass==(number_passes-1))
++ if (_bit_depth==2 && pass==(number_passes-1))
+ expand2to4bpp(iter.GetRow());
+
+ //go on
+@@ -361,9 +449,13 @@
+ /* Set error handling. REQUIRED if you aren't supplying your own
+ * error hadnling functions in the png_create_write_struct() call.
+ */
++#if PNG_LIBPNG_VER > 10399
++ if (setjmp(png_jmpbuf(png_ptr))){
++#else
+ if (setjmp(png_ptr->jmpbuf)){
+ /* If we get here, we had a problem reading the file */
+ if (info_ptr->palette) free(info_ptr->palette);
++#endif
+ png_destroy_write_struct(&png_ptr, (png_infopp)&info_ptr);
+ cx_throw("Error saving PNG file");
+ }
+@@ -372,9 +464,23 @@
+ //png_init_io(png_ptr, hFile);
+
+ // use custom I/O functions
+- png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
++ png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
+
+ /* set the file information here */
++#if PNG_LIBPNG_VER > 10399
++ /* use variables to hold the values so it isnt necessary to png_get them later */
++ png_uint_32 _width,_height;
++ int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
++ png_byte _channels,_pixel_depth;
++
++ _width = GetWidth();
++ _height = GetHeight();
++ _pixel_depth = (BYTE)GetBpp();
++ _channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1;
++ _bit_depth = (BYTE)(GetBpp()/_channels);
++ _compression_type = PNG_COMPRESSION_TYPE_DEFAULT;
++ _filter_type = PNG_FILTER_TYPE_DEFAULT;
++#else
+ info_ptr->width = GetWidth();
+ info_ptr->height = GetHeight();
+ info_ptr->pixel_depth = (BYTE)GetBpp();
+@@ -382,13 +488,22 @@
+ info_ptr->bit_depth = (BYTE)(GetBpp()/info_ptr->channels);
+ info_ptr->compression_type = info_ptr->filter_type = 0;
+ info_ptr->valid = 0;
++#endif
+
+ switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){
+ case 1:
++#if PNG_LIBPNG_VER > 10399
++ _interlace_type = PNG_INTERLACE_ADAM7;
++#else
+ info_ptr->interlace_type = PNG_INTERLACE_ADAM7;
++#endif
+ break;
+ default:
++#if PNG_LIBPNG_VER > 10399
++ _interlace_type = PNG_INTERLACE_NONE;
++#else
+ info_ptr->interlace_type = PNG_INTERLACE_NONE;
++#endif
+ }
+
+ /* set compression level */
+@@ -398,22 +513,47 @@
+
+ if (GetNumColors()){
+ if (bGrayScale){
++#if PNG_LIBPNG_VER > 10399
++ _color_type = PNG_COLOR_TYPE_GRAY;
++#else
+ info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
++#endif
+ } else {
++#if PNG_LIBPNG_VER > 10399
++ _color_type = PNG_COLOR_TYPE_PALETTE;
++#else
+ info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
++#endif
+ }
+ } else {
++#if PNG_LIBPNG_VER > 10399
++ _color_type = PNG_COLOR_TYPE_RGB;
++#else
+ info_ptr->color_type = PNG_COLOR_TYPE_RGB;
++#endif
+ }
+ #if CXIMAGE_SUPPORT_ALPHA
+ if (AlphaIsValid()){
++#if PNG_LIBPNG_VER > 10399
++ _color_type |= PNG_COLOR_MASK_ALPHA;
++ _channels++;
++ _bit_depth = 8;
++ _pixel_depth += 8;
++#else
+ info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
+ info_ptr->channels++;
+ info_ptr->bit_depth = 8;
+ info_ptr->pixel_depth += 8;
++#endif
+ }
+ #endif
+
++#if PNG_LIBPNG_VER > 10399
++ /* set the header here, since we're done modifying these values */
++ png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type,_interlace_type,
++ _compression_type,_filter_type);
++#endif
++
+ /* set background */
+ png_color_16 image_background={ 0, 255, 255, 255, 0 };
+ RGBQUAD tc = GetTransColor();
+@@ -427,22 +567,24 @@
+ /* set metrics */
+ png_set_pHYs(png_ptr, info_ptr, head.biXPelsPerMeter, head.biYPelsPerMeter, PNG_RESOLUTION_METER);
+
++#if PNG_LIBPNG_VER <= 10399
+ png_set_IHDR(png_ptr, info_ptr, info_ptr->width, info_ptr->height, info_ptr->bit_depth,
+ info_ptr->color_type, info_ptr->interlace_type,
+ PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
++#endif
+
+ //<DP> simple transparency
+ if (info.nBkgndIndex >= 0){
+- info_ptr->num_trans = 1;
+- info_ptr->valid |= PNG_INFO_tRNS;
+ #if PNG_LIBPNG_VER > 10399
+- info_ptr->trans_alpha = trans;
+- info_ptr->trans_color.index = (BYTE)info.nBkgndIndex;
+- info_ptr->trans_color.red = tc.rgbRed;
+- info_ptr->trans_color.green = tc.rgbGreen;
+- info_ptr->trans_color.blue = tc.rgbBlue;
+- info_ptr->trans_color.gray = info_ptr->trans_color.index;
++ png_color_16 _trans_color;
++ _trans_color.index = (BYTE)info.nBkgndIndex;
++ _trans_color.red = tc.rgbRed;
++ _trans_color.green = tc.rgbGreen;
++ _trans_color.blue = tc.rgbBlue;
++ _trans_color.gray = _trans_color.index;
+ #else
++ info_ptr->num_trans = 1;
++ info_ptr->valid |= PNG_INFO_tRNS;
+ info_ptr->trans = trans;
+ info_ptr->trans_values.index = (BYTE)info.nBkgndIndex;
+ info_ptr->trans_values.red = tc.rgbRed;
+@@ -454,34 +596,53 @@
+ // the transparency indexes start from 0 for non grayscale palette
+ if (!bGrayScale && head.biClrUsed && info.nBkgndIndex)
+ SwapIndex(0,(BYTE)info.nBkgndIndex);
++
++#if PNG_LIBPNG_VER > 10399
++ png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,1,&_trans_color);
++#endif
+ }
+
+ /* set the palette if there is one */
++#if PNG_LIBPNG_VER > 10399
++ png_colorp _palette;
++#endif
+ if (GetPalette()){
++#if PNG_LIBPNG_VER <= 10399
+ if (!bGrayScale){
+ info_ptr->valid |= PNG_INFO_PLTE;
+ }
++#endif
+
+ int nc = GetClrImportant();
+ if (nc==0) nc = GetNumColors();
+
++ // copy the palette colors
++#if PNG_LIBPNG_VER > 10399
++ _palette = new png_color[nc];
++#else
++ info_ptr->palette = new png_color[nc];
++ info_ptr->num_palette = (png_uint_16) nc;
++#endif
++ for (int i=0; i<nc; i++)
++#if PNG_LIBPNG_VER > 10399
++ GetPaletteColor(i, &_palette[i].red, &_palette[i].green, &_palette[i].blue);
++
++ png_set_PLTE(png_ptr,info_ptr,_palette,nc);
++#else
++ GetPaletteColor(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
++#endif
++
+ if (info.bAlphaPaletteEnabled){
+ for(WORD ip=0; ip<nc;ip++)
+ trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved;
+- info_ptr->num_trans = (WORD)nc;
+- info_ptr->valid |= PNG_INFO_tRNS;
+ #if PNG_LIBPNG_VER > 10399
+- info_ptr->trans_alpha = trans;
++ png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,nc,NULL);
+ #else
++ info_ptr->num_trans = (WORD)nc;
++ info_ptr->valid |= PNG_INFO_tRNS;
+ info_ptr->trans = trans;
+ #endif
+ }
+-
+- // copy the palette colors
+- info_ptr->palette = new png_color[nc];
+- info_ptr->num_palette = (png_uint_16) nc;
+- for (int i=0; i<nc; i++)
+- GetPaletteColor(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
+ }
+
+ #if CXIMAGE_SUPPORT_ALPHA // <vho>
+@@ -495,8 +656,12 @@
+ } } }
+ #endif // CXIMAGE_SUPPORT_ALPHA // <vho>
+
++#if PNG_LIBPNG_VER > 10399
++ int row_size = max(info.dwEffWidth, (_width * _channels * _bit_depth / 8));
++#else
+ int row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8));
+ info_ptr->rowbytes = row_size;
++#endif
+ BYTE *row_pointers = new BYTE[row_size];
+
+ /* write the file information */
+@@ -514,7 +679,11 @@
+ if (AlphaIsValid()){
+ for (long ax=head.biWidth-1; ax>=0;ax--){
+ c = BlindGetPixelColor(ax,ay);
++#if PNG_LIBPNG_VER > 10399
++ int px = ax * _channels;
++#else
+ int px = ax * info_ptr->channels;
++#endif
+ if (!bGrayScale){
+ row_pointers[px++]=c.rgbRed;
+ row_pointers[px++]=c.rgbGreen;
+@@ -529,7 +698,11 @@
+ #endif //CXIMAGE_SUPPORT_ALPHA // <vho>
+ {
+ iter.GetRow(row_pointers, row_size);
++#if PNG_LIBPNG_VER > 10399
++ if (_color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
++#else
+ if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
++#endif
+ RGBtoBGR(row_pointers, row_size);
+ png_write_row(png_ptr, row_pointers);
+ }
+@@ -546,9 +719,14 @@
+ png_write_end(png_ptr, info_ptr);
+
+ /* if you malloced the palette, free it here */
++#if PNG_LIBPNG_VER > 10399
++ if (_palette){
++ delete [] (_palette);
++#else
+ if (info_ptr->palette){
+ delete [] (info_ptr->palette);
+ info_ptr->palette = NULL;
++#endif
+ }
+
+ /* clean up after the write, and free any memory allocated */
diff --git a/media-tv/xbmc/files/xbmc-9.11-TexturePacker-parallel-build.patch b/media-tv/xbmc/files/xbmc-9.11-TexturePacker-parallel-build.patch
new file mode 100644
index 00000000..f6bc030e
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9.11-TexturePacker-parallel-build.patch
@@ -0,0 +1,13 @@
+http://trac.xbmc.org/ticket/9275
+
+--- xbmc/Makefile.in
++++ xbmc/Makefile.in
+@@ -501,7 +501,7 @@ else
+ $(MAKE) -C tools/XBMCTex/
+ endif
+
+-tools/TexturePacker/TexturePacker:
++tools/TexturePacker/TexturePacker: guilib/guilib.a xbmc/lib/libsquish/libsquish-@ARCH@.a
+ $(MAKE) -C tools/TexturePacker/
+
+ install-bin: xbmc.bin # developement convenience target
diff --git a/media-tv/xbmc/files/xbmc-9.11-jpeg-speedup.patch b/media-tv/xbmc/files/xbmc-9.11-jpeg-speedup.patch
new file mode 100644
index 00000000..63cadbf5
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9.11-jpeg-speedup.patch
@@ -0,0 +1,18 @@
+fix from upstream
+http://bugs.gentoo.org/300909
+
+r26689 | jmarshallnz | 2010-01-11 14:30:08 -0500 (Mon, 11 Jan 2010) | 2 lines
+fixed: Ticket #7810 - high cpu load during loading of images with libjpeg7, thanks to akawaka.
+
+Index: xbmc/lib/cximage-6.0/CxImage/ximajpg.cpp
+===================================================================
+--- xbmc/lib/cximage-6.0/CxImage/ximajpg.cpp (revision 26688)
++++ xbmc/lib/cximage-6.0/CxImage/ximajpg.cpp (revision 26689)
+@@ -220,6 +220,7 @@ bool CxImageJPG::Decode(CxFile * hFile)
+
+ // Set the scale <ignacio>
+ cinfo.scale_denom = GetJpegScale();
++ cinfo.scale_num = 1;
+
+ // Borrowed the idea from GIF implementation <ignacio>
+ if (info.nEscape == -1) {
diff --git a/media-tv/xbmc/files/xbmc-9.11-libpng14.patch b/media-tv/xbmc/files/xbmc-9.11-libpng14.patch
new file mode 100644
index 00000000..b5af087e
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9.11-libpng14.patch
@@ -0,0 +1,92 @@
+http://bugs.gentoo.org/319113
+http://repos.archlinux.org/wsvn/community/xbmc/trunk/libpng14.patch
+
+diff -Nur xbmc-9.11.orig/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp xbmc-9.11/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
+--- xbmc-9.11.orig/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp 2008-07-18 23:40:53.000000000 +0300
++++ xbmc-9.11/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp 2010-01-20 21:55:11.000000000 +0200
+@@ -142,9 +142,9 @@
+ if (info_ptr->num_trans!=0){ //palette transparency
+ if (info_ptr->num_trans==1){
+ if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){
+- info.nBkgndIndex = info_ptr->trans_values.index;
++ info.nBkgndIndex = info_ptr->trans_color.index;
+ } else{
+- info.nBkgndIndex = info_ptr->trans_values.gray>>nshift;
++ info.nBkgndIndex = info_ptr->trans_color.gray>>nshift;
+ }
+ }
+ if (info_ptr->num_trans>1){
+@@ -152,7 +152,7 @@
+ if (pal){
+ DWORD ip;
+ for (ip=0;ip<min(head.biClrUsed,(unsigned long)info_ptr->num_trans);ip++)
+- pal[ip].rgbReserved=info_ptr->trans[ip];
++ pal[ip].rgbReserved=info_ptr->trans_alpha[ip];
+ for (ip=info_ptr->num_trans;ip<head.biClrUsed;ip++){
+ pal[ip].rgbReserved=255;
+ }
+@@ -166,9 +166,9 @@
+ int num_trans;
+ png_color_16 *image_background;
+ if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &image_background)){
+- info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_values.red>>nshift);
+- info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift);
+- info.nBkgndColor.rgbBlue = (BYTE)(info_ptr->trans_values.blue>>nshift);
++ info.nBkgndColor.rgbRed = (BYTE)(info_ptr->trans_color.red>>nshift);
++ info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift);
++ info.nBkgndColor.rgbBlue = (BYTE)(info_ptr->trans_color.blue>>nshift);
+ info.nBkgndColor.rgbReserved = 0;
+ info.nBkgndIndex = 0;
+ }
+@@ -417,12 +417,12 @@
+ if (info.nBkgndIndex >= 0){
+ info_ptr->num_trans = 1;
+ info_ptr->valid |= PNG_INFO_tRNS;
+- info_ptr->trans = trans;
+- info_ptr->trans_values.index = (BYTE)info.nBkgndIndex;
+- info_ptr->trans_values.red = tc.rgbRed;
+- info_ptr->trans_values.green = tc.rgbGreen;
+- info_ptr->trans_values.blue = tc.rgbBlue;
+- info_ptr->trans_values.gray = info_ptr->trans_values.index;
++ info_ptr->trans_alpha = trans;
++ info_ptr->trans_color.index = (BYTE)info.nBkgndIndex;
++ info_ptr->trans_color.red = tc.rgbRed;
++ info_ptr->trans_color.green = tc.rgbGreen;
++ info_ptr->trans_color.blue = tc.rgbBlue;
++ info_ptr->trans_color.gray = info_ptr->trans_color.index;
+
+ // the transparency indexes start from 0 for non grayscale palette
+ if (!bGrayScale && head.biClrUsed && info.nBkgndIndex)
+@@ -443,7 +443,7 @@
+ trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved;
+ info_ptr->num_trans = (WORD)nc;
+ info_ptr->valid |= PNG_INFO_tRNS;
+- info_ptr->trans = trans;
++ info_ptr->trans_alpha = trans;
+ }
+
+ // copy the palette colors
+diff -Nur xbmc-9.11.orig/xbmc/screensavers/rsxs-0.9/src/pngimage.cc xbmc-9.11/xbmc/screensavers/rsxs-0.9/src/pngimage.cc
+--- xbmc-9.11.orig/xbmc/screensavers/rsxs-0.9/src/pngimage.cc 2008-07-30 23:35:38.000000000 +0300
++++ xbmc-9.11/xbmc/screensavers/rsxs-0.9/src/pngimage.cc 2010-01-20 22:21:01.000000000 +0200
+@@ -65,7 +65,7 @@
+ (png_get_color_type(png, pngInfo) == PNG_COLOR_TYPE_GRAY) &&
+ png_get_bit_depth(png, pngInfo) < 8
+ )
+- png_set_gray_1_2_4_to_8(png);
++ png_set_expand_gray_1_2_4_to_8(png);
+ if (png_get_valid(png, pngInfo, PNG_INFO_tRNS))
+ png_set_tRNS_to_alpha(png);
+ if (fullColor)
+diff -Nur xbmc-9.11.orig/xbmc/visualizations/Goom/goom2k4-0/src/pngload.c xbmc-9.11/xbmc/visualizations/Goom/goom2k4-0/src/pngload.c
+--- xbmc-9.11.orig/xbmc/visualizations/Goom/goom2k4-0/src/pngload.c 2008-08-04 05:05:51.000000000 +0300
++++ xbmc-9.11/xbmc/visualizations/Goom/goom2k4-0/src/pngload.c 2010-01-20 22:16:23.000000000 +0200
+@@ -94,7 +94,7 @@
+ png_set_palette_to_rgb (png_ptr);
+
+ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
+- png_set_gray_1_2_4_to_8 (png_ptr);
++ png_set_expand_gray_1_2_4_to_8 (png_ptr);
+ else if (color_type == PNG_COLOR_TYPE_GRAY ||
+ color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ png_set_gray_to_rgb (png_ptr);
diff --git a/media-tv/xbmc/files/xbmc-9.11-shader-upscalers.patch b/media-tv/xbmc/files/xbmc-9.11-shader-upscalers.patch
new file mode 100644
index 00000000..d4feaa47
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9.11-shader-upscalers.patch
@@ -0,0 +1,887 @@
+http://bugs.gentoo.org/306661
+
+backport shader based upscalers from svn trunk
+
+--- language/English/strings.xml
++++ language/English/strings.xml
+@@ -1554,16 +1554,17 @@
+ <string id="16304">Lanczos2</string>
+ <string id="16305">Lanczos3</string>
+ <string id="16306">Sinc8</string>
+-
+ <string id="16307">Bicubic (software)</string>
+ <string id="16308">Lanczos (software)</string>
+ <string id="16309">Sinc (software)</string>
+-
+ <string id="16310">(VDPAU)Temporal</string>
+ <string id="16311">(VDPAU)Temporal/Spatial</string>
+ <string id="16312">(VDPAU)Noise Reduction</string>
+ <string id="16313">(VDPAU)Sharpness</string>
+ <string id="16314">Inverse Telecine</string>
++ <string id="16315">Lanczos3 optimized</string>
++ <string id="16316">Auto</string>
++
+ <string id="17500">Display sleep timeout</string>
+
+ <string id="19000">Switch to channel</string>
+--- system/shaders/convolution-6x6.glsl
++++ system/shaders/convolution-6x6.glsl
+@@ -0,0 +1,69 @@
++uniform sampler2D img;
++uniform float stepx;
++uniform float stepy;
++
++#if (HAS_FLOAT_TEXTURE)
++uniform sampler1D kernelTex;
++
++vec3 weight(float pos)
++{
++ return texture1D(kernelTex, pos).rgb;
++}
++#else
++uniform sampler2D kernelTex;
++
++vec3 weight(float pos)
++{
++ //row 0 contains the high byte, row 1 contains the low byte
++ return ((texture2D(kernelTex, vec2(pos, 0.0)) * 256.0 + texture2D(kernelTex, vec2(pos, 1.0)))).rgb / 128.5 - 1.0;
++}
++#endif
++
++vec3 pixel(float xpos, float ypos)
++{
++ return texture2D(img, vec2(xpos, ypos)).rgb;
++}
++
++vec3 line (float ypos, vec3 xpos1, vec3 xpos2, vec3 linetaps1, vec3 linetaps2)
++{
++ vec3 pixels;
++
++ pixels = pixel(xpos1.r, ypos) * linetaps1.r;
++ pixels += pixel(xpos1.g, ypos) * linetaps2.r;
++ pixels += pixel(xpos1.b, ypos) * linetaps1.g;
++ pixels += pixel(xpos2.r, ypos) * linetaps2.g;
++ pixels += pixel(xpos2.g, ypos) * linetaps1.b;
++ pixels += pixel(xpos2.b, ypos) * linetaps2.b;
++
++ return pixels;
++}
++
++void main()
++{
++ float xf = fract(gl_TexCoord[0].x / stepx);
++ float yf = fract(gl_TexCoord[0].y / stepy);
++
++ vec3 linetaps1 = weight((1.0 - xf) / 2.0);
++ vec3 linetaps2 = weight((1.0 - xf) / 2.0 + 0.5);
++ vec3 columntaps1 = weight((1.0 - yf) / 2.0);
++ vec3 columntaps2 = weight((1.0 - yf) / 2.0 + 0.5);
++
++ vec3 xpos1 = vec3(
++ (-1.5 - xf) * stepx + gl_TexCoord[0].x,
++ (-0.5 - xf) * stepx + gl_TexCoord[0].x,
++ ( 0.5 - xf) * stepx + gl_TexCoord[0].x);
++ vec3 xpos2 = vec3(
++ ( 1.5 - xf) * stepx + gl_TexCoord[0].x,
++ ( 2.5 - xf) * stepx + gl_TexCoord[0].x,
++ ( 3.5 - xf) * stepx + gl_TexCoord[0].x);
++
++ gl_FragColor.rgb = line((-1.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.r;
++ gl_FragColor.rgb += line((-0.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.r;
++ gl_FragColor.rgb += line(( 0.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.g;
++ gl_FragColor.rgb += line(( 1.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.g;
++ gl_FragColor.rgb += line(( 2.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.b;
++ gl_FragColor.rgb += line(( 3.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.b;
++
++ gl_FragColor.a = gl_Color.a;
++}
++
+--- system/shaders/bicubic.glsl
++++ system/shaders/bicubic.glsl
+@@ -0,0 +1,47 @@
++uniform sampler2D img;
++uniform float stepx;
++uniform float stepy;
++uniform sampler2D kernelTex;
++
++vec4 cubicFilter(float xValue, vec4 c0, vec4 c1, vec4 c2, vec4 c3)
++{
++ vec4 h = texture2D(kernelTex, vec2(xValue, 0.5));
++ vec4 r = c0 * h.r;
++ r += c1 * h.g;
++ r += c2 * h.b;
++ r += c3 * h.a;
++ return r;
++}
++
++void main()
++{
++ vec2 f = vec2(gl_TexCoord[0].x / stepx , gl_TexCoord[0].y / stepy);
++ f = fract(f);
++ vec4 t0 = cubicFilter(f.x,
++ texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, -stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(0.0, -stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(stepx, -stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, -stepy)));
++
++ vec4 t1 = cubicFilter(f.x,
++ texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, 0.0)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(0.0, 0.0)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(stepx, 0.0)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, 0.0)));
++
++ vec4 t2 = cubicFilter(f.x,
++ texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(0.0, stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(stepx, stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, stepy)));
++
++ vec4 t3 = cubicFilter(f.x,
++ texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, 2.0*stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(0, 2.0*stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(stepx, 2.0*stepy)),
++ texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, 2.0*stepy)));
++
++ gl_FragColor = cubicFilter(f.y, t0, t1, t2, t3);
++ gl_FragColor.a = gl_Color.a;
++}
++
+--- system/shaders/convolution-4x4.glsl
++++ system/shaders/convolution-4x4.glsl
+@@ -0,0 +1,60 @@
++uniform sampler2D img;
++uniform float stepx;
++uniform float stepy;
++
++#if (HAS_FLOAT_TEXTURE)
++uniform sampler1D kernelTex;
++
++vec4 weight(float pos)
++{
++ return texture1D(kernelTex, pos);
++}
++#else
++uniform sampler2D kernelTex;
++
++vec4 weight(float pos)
++{
++ //row 0 contains the high byte, row 1 contains the low byte
++ return (texture2D(kernelTex, vec2(pos, 0.0)) * 256.0 + texture2D(kernelTex, vec2(pos, 1.0))) / 128.5 - 1.0;
++}
++#endif
++
++vec3 pixel(float xpos, float ypos)
++{
++ return texture2D(img, vec2(xpos, ypos)).rgb;
++}
++
++vec3 line (float ypos, vec4 xpos, vec4 linetaps)
++{
++ vec3 pixels;
++
++ pixels = pixel(xpos.r, ypos) * linetaps.r;
++ pixels += pixel(xpos.g, ypos) * linetaps.g;
++ pixels += pixel(xpos.b, ypos) * linetaps.b;
++ pixels += pixel(xpos.a, ypos) * linetaps.a;
++
++ return pixels;
++}
++
++void main()
++{
++ float xf = fract(gl_TexCoord[0].x / stepx);
++ float yf = fract(gl_TexCoord[0].y / stepy);
++
++ vec4 linetaps = weight(1.0 - xf);
++ vec4 columntaps = weight(1.0 - yf);
++
++ vec4 xpos = vec4(
++ (-0.5 - xf) * stepx + gl_TexCoord[0].x,
++ ( 0.5 - xf) * stepx + gl_TexCoord[0].x,
++ ( 1.5 - xf) * stepx + gl_TexCoord[0].x,
++ ( 2.5 - xf) * stepx + gl_TexCoord[0].x);
++
++ gl_FragColor.rgb = line((-0.5 - yf) * stepy + gl_TexCoord[0].y, xpos, linetaps) * columntaps.r;
++ gl_FragColor.rgb += line(( 0.5 - yf) * stepy + gl_TexCoord[0].y, xpos, linetaps) * columntaps.g;
++ gl_FragColor.rgb += line(( 1.5 - yf) * stepy + gl_TexCoord[0].y, xpos, linetaps) * columntaps.b;
++ gl_FragColor.rgb += line(( 2.5 - yf) * stepy + gl_TexCoord[0].y, xpos, linetaps) * columntaps.a;
++
++ gl_FragColor.a = gl_Color.a;
++}
++
+--- xbmc/settings/VideoSettings.h
++++ xbmc/settings/VideoSettings.h
+@@ -51,9 +51,10 @@
+ {
+ VS_SCALINGMETHOD_NEAREST=0,
+ VS_SCALINGMETHOD_LINEAR,
+-
++
+ VS_SCALINGMETHOD_CUBIC,
+ VS_SCALINGMETHOD_LANCZOS2,
++ VS_SCALINGMETHOD_LANCZOS3_FAST,
+ VS_SCALINGMETHOD_LANCZOS3,
+ VS_SCALINGMETHOD_SINC8,
+ VS_SCALINGMETHOD_NEDI,
+@@ -61,7 +62,9 @@
+ VS_SCALINGMETHOD_BICUBIC_SOFTWARE,
+ VS_SCALINGMETHOD_LANCZOS_SOFTWARE,
+ VS_SCALINGMETHOD_SINC_SOFTWARE,
+- VS_SCALINGMETHOD_VDPAU_HARDWARE
++ VS_SCALINGMETHOD_VDPAU_HARDWARE,
++
++ VS_SCALINGMETHOD_AUTO
+ };
+
+ class CVideoSettings
+--- xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.cpp
++++ xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.cpp
+@@ -21,6 +21,7 @@
+ #include "system.h"
+ #include "VideoFilterShader.h"
+ #include "utils/log.h"
++#include "ConvolutionKernels.h"
+
+ #include <string>
+ #include <math.h>
+@@ -63,60 +64,13 @@
+
+ BicubicFilterShader::BicubicFilterShader(float B, float C)
+ {
+- string shaderf =
+- "uniform sampler2D img;"
+- "uniform float stepx;"
+- "uniform float stepy;"
+- "uniform sampler2D kernelTex;"
+-
+- "vec4 cubicFilter(float xValue, vec4 c0, vec4 c1, vec4 c2, vec4 c3)"
+- "{"
+- " vec4 h = texture2D(kernelTex, vec2(xValue, 0.5));"
+- " vec4 r = c0 * h.r;"
+- " r += c1 * h.g;"
+- " r += c2 * h.b;"
+- " r += c3 * h.a;"
+- " return r;"
+- "}"
+- ""
+- "void main()"
+- "{"
+- "vec2 f = vec2(gl_TexCoord[0].x / stepx , gl_TexCoord[0].y / stepy);"
+- "f = fract(f);"
+- "vec4 t0 = cubicFilter(f.x,"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, -stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(0.0, -stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(stepx, -stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, -stepy)));"
+- ""
+- "vec4 t1 = cubicFilter(f.x,"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, 0.0)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(0.0, 0.0)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(stepx, 0.0)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, 0.0)));"
+- ""
+- "vec4 t2 = cubicFilter(f.x,"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(0.0, stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(stepx, stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, stepy)));"
+- ""
+- "vec4 t3 = cubicFilter(f.x,"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, 2.0*stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(0, 2.0*stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(stepx, 2.0*stepy)),"
+- "texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, 2.0*stepy)));"
+-
+- "gl_FragColor = cubicFilter(f.y, t0, t1, t2, t3) ;"
+- "gl_FragColor.a = gl_Color.a;"
+- "}";
+- PixelShader()->SetSource(shaderf);
++ PixelShader()->LoadSource("bicubic.glsl");
+ m_kernelTex1 = 0;
+ m_B = B;
+ m_C = C;
+- if (B<=0)
++ if (B<0)
+ m_B=1.0f/3.0f;
+- if (C<=0)
++ if (C<0)
+ m_C=1.0f/3.0f;
+ }
+
+@@ -209,8 +163,8 @@
+ glBindTexture(GL_TEXTURE_2D, m_kernelTex1);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, size, 1, 0, GL_RGBA, GL_FLOAT, img);
+
+ glActiveTexture(GL_TEXTURE0);
+@@ -254,4 +208,110 @@
+ return val;
+ }
+
++ConvolutionFilterShader::ConvolutionFilterShader(ESCALINGMETHOD method)
++{
++ m_method = method;
++ m_kernelTex1 = 0;
++
++ string shadername;
++ string defines;
++
++ if (m_method == VS_SCALINGMETHOD_CUBIC ||
++ m_method == VS_SCALINGMETHOD_LANCZOS2 ||
++ m_method == VS_SCALINGMETHOD_LANCZOS3_FAST)
++ shadername = "convolution-4x4.glsl";
++ else if (m_method == VS_SCALINGMETHOD_LANCZOS3)
++ shadername = "convolution-6x6.glsl";
++
++ m_floattex = glewIsSupported("GL_ARB_texture_float");
++
++ if (m_floattex)
++ defines = "#define HAS_FLOAT_TEXTURE 1\n";
++ else
++ defines = "#define HAS_FLOAT_TEXTURE 0\n";
++
++ CLog::Log(LOGDEBUG, "GL: ConvolutionFilterShader: using %s defines: %s", shadername.c_str(), defines.c_str());
++ PixelShader()->LoadSource(shadername, defines);
++}
++
++void ConvolutionFilterShader::OnCompiledAndLinked()
++{
++ // obtain shader attribute handles on successfull compilation
++ m_hSourceTex = glGetUniformLocation(ProgramHandle(), "img");
++ m_hStepX = glGetUniformLocation(ProgramHandle(), "stepx");
++ m_hStepY = glGetUniformLocation(ProgramHandle(), "stepy");
++ m_hKernTex = glGetUniformLocation(ProgramHandle(), "kernelTex");
++
++ CConvolutionKernel kernel(m_method, 256);
++
++ if (m_kernelTex1)
++ {
++ glDeleteTextures(1, &m_kernelTex1);
++ m_kernelTex1 = 0;
++ }
++
++ glGenTextures(1, &m_kernelTex1);
++
++ if ((m_kernelTex1<=0))
++ {
++ CLog::Log(LOGERROR, "GL: ConvolutionFilterShader: Error creating kernel texture");
++ return;
++ }
++
++ glActiveTexture(GL_TEXTURE2);
++
++ //if float textures are supported, we can load the kernel as a 1d float texture
++ //if not, we load it as a 2d texture with 2 rows, where row 0 contains the high byte
++ //and row 1 contains the low byte, which can be converted in the shader
++ if (m_floattex)
++ {
++ glBindTexture(GL_TEXTURE_1D, m_kernelTex1);
++ glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
++ glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
++ glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
++ glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
++ glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA16F_ARB, kernel.GetSize(), 0, GL_RGBA, GL_FLOAT, kernel.GetFloatPixels());
++ }
++ else
++ {
++ glBindTexture(GL_TEXTURE_2D, m_kernelTex1);
++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
++ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kernel.GetSize(), 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, kernel.GetIntFractPixels());
++ }
++
++ glActiveTexture(GL_TEXTURE0);
++
++ VerifyGLState();
++}
++
++bool ConvolutionFilterShader::OnEnabled()
++{
++ // set shader attributes once enabled
++ glActiveTexture(GL_TEXTURE2);
++
++ if (m_floattex)
++ glBindTexture(GL_TEXTURE_1D, m_kernelTex1);
++ else
++ glBindTexture(GL_TEXTURE_2D, m_kernelTex1);
++
++ glActiveTexture(GL_TEXTURE0);
++ glUniform1i(m_hSourceTex, m_sourceTexUnit);
++ glUniform1i(m_hKernTex, 2);
++ glUniform1f(m_hStepX, m_stepX);
++ glUniform1f(m_hStepY, m_stepY);
++ VerifyGLState();
++ return true;
++}
++
++void ConvolutionFilterShader::Free()
++{
++ if (m_kernelTex1)
++ glDeleteTextures(1, &m_kernelTex1);
++ m_kernelTex1 = 0;
++ BaseVideoFilterShader::Free();
++}
++
+ #endif
+--- xbmc/cores/VideoRenderers/VideoShaders/ConvolutionKernels.cpp
++++ xbmc/cores/VideoRenderers/VideoShaders/ConvolutionKernels.cpp
+@@ -0,0 +1,226 @@
++/*
++ * Copyright (C) 2005-2008 Team XBMC
++ * http://www.xbmc.org
++ *
++ * This Program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * This Program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with XBMC; see the file COPYING. If not, write to
++ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
++ * http://www.gnu.org/copyleft/gpl.html
++ *
++ */
++#ifdef _WIN32
++ #define _USE_MATH_DEFINES
++#endif
++
++#include "ConvolutionKernels.h"
++#include "MathUtils.h"
++
++#define SINC(x) (sin(M_PI * (x)) / (M_PI * (x)))
++
++CConvolutionKernel::CConvolutionKernel(ESCALINGMETHOD method, int size)
++{
++ m_size = size;
++ m_floatpixels = new float[m_size * 4];
++
++ if (method == VS_SCALINGMETHOD_LANCZOS2)
++ Lanczos2();
++ else if (method == VS_SCALINGMETHOD_LANCZOS3_FAST)
++ Lanczos3Fast();
++ else if (method == VS_SCALINGMETHOD_LANCZOS3)
++ Lanczos3();
++ else if (method == VS_SCALINGMETHOD_CUBIC)
++ Bicubic(1.0 / 3.0, 1.0 / 3.0);
++
++ ToIntFract();
++}
++
++CConvolutionKernel::~CConvolutionKernel()
++{
++ delete [] m_floatpixels;
++ delete [] m_intfractpixels;
++}
++
++//generate a lanczos2 kernel which can be loaded with RGBA format
++//each value of RGBA has one tap, so a shader can load 4 taps with a single pixel lookup
++void CConvolutionKernel::Lanczos2()
++{
++ for (int i = 0; i < m_size; i++)
++ {
++ double x = (double)i / (double)m_size;
++
++ //generate taps
++ for (int j = 0; j < 4; j++)
++ m_floatpixels[i * 4 + j] = (float)LanczosWeight(x + (double)(j - 2), 2.0);
++
++ //any collection of 4 taps added together needs to be exactly 1.0
++ //for lanczos this is not always the case, so we take each collection of 4 taps
++ //and divide those taps by the sum of the taps
++ float weight = 0.0;
++ for (int j = 0; j < 4; j++)
++ weight += m_floatpixels[i * 4 + j];
++
++ for (int j = 0; j < 4; j++)
++ m_floatpixels[i * 4 + j] /= weight;
++ }
++}
++
++//generate a lanczos3 kernel which can be loaded with RGBA format
++//each value of RGBA has one tap, so a shader can load 4 taps with a single pixel lookup
++//the two outer lobes of the lanczos3 kernel are added to the two lobes one step to the middle
++//this basically looks the same as lanczos3, but the kernel only has 4 taps,
++//so it can use the 4x4 convolution shader which is twice as fast as the 6x6 one
++void CConvolutionKernel::Lanczos3Fast()
++{
++ for (int i = 0; i < m_size; i++)
++ {
++ double a = 3.0;
++ double x = (double)i / (double)m_size;
++
++ //generate taps
++ m_floatpixels[i * 4 + 0] = (float)(LanczosWeight(x - 2.0, a) + LanczosWeight(x - 3.0, a));
++ m_floatpixels[i * 4 + 1] = (float) LanczosWeight(x - 1.0, a);
++ m_floatpixels[i * 4 + 2] = (float) LanczosWeight(x , a);
++ m_floatpixels[i * 4 + 3] = (float)(LanczosWeight(x + 1.0, a) + LanczosWeight(x + 2.0, a));
++
++ //any collection of 4 taps added together needs to be exactly 1.0
++ //for lanczos this is not always the case, so we take each collection of 4 taps
++ //and divide those taps by the sum of the taps
++ float weight = 0.0;
++ for (int j = 0; j < 4; j++)
++ weight += m_floatpixels[i * 4 + j];
++
++ for (int j = 0; j < 4; j++)
++ m_floatpixels[i * 4 + j] /= weight;
++ }
++}
++
++//generate a lanczos3 kernel which can be loaded with RGBA format
++//each value of RGB has one tap, so a shader can load 3 taps with a single pixel lookup
++void CConvolutionKernel::Lanczos3()
++{
++ for (int i = 0; i < m_size; i++)
++ {
++ double x = (double)i / (double)m_size;
++
++ //generate taps
++ for (int j = 0; j < 3; j++)
++ m_floatpixels[i * 4 + j] = (float)LanczosWeight(x * 2.0 + (double)(j * 2 - 3), 3.0);
++
++ m_floatpixels[i * 4 + 3] = 0.0;
++ }
++
++ //any collection of 6 taps added together needs to be exactly 1.0
++ //for lanczos this is not always the case, so we take each collection of 6 taps
++ //and divide those taps by the sum of the taps
++ for (int i = 0; i < m_size / 2; i++)
++ {
++ float weight = 0.0;
++ for (int j = 0; j < 3; j++)
++ {
++ weight += m_floatpixels[i * 4 + j];
++ weight += m_floatpixels[(i + m_size / 2) * 4 + j];
++ }
++ for (int j = 0; j < 3; j++)
++ {
++ m_floatpixels[i * 4 + j] /= weight;
++ m_floatpixels[(i + m_size / 2) * 4 + j] /= weight;
++ }
++ }
++}
++
++//generate a bicubic kernel which can be loaded with RGBA format
++//each value of RGBA has one tap, so a shader can load 4 taps with a single pixel lookup
++void CConvolutionKernel::Bicubic(double B, double C)
++{
++ for (int i = 0; i < m_size; i++)
++ {
++ double x = (double)i / (double)m_size;
++
++ //generate taps
++ for (int j = 0; j < 4; j++)
++ m_floatpixels[i * 4 + j] = (float)BicubicWeight(x + (double)(j - 2), B, C);
++ }
++}
++
++double CConvolutionKernel::LanczosWeight(double x, double radius)
++{
++ double ax = fabs(x);
++
++ if (ax == 0.0)
++ return 1.0;
++ else if (ax < radius)
++ return SINC(ax) * SINC(ax / radius);
++ else
++ return 0.0;
++}
++
++double CConvolutionKernel::BicubicWeight(double x, double B, double C)
++{
++ double ax = fabs(x);
++
++ if (ax<1.0)
++ {
++ return ((12 - 9*B - 6*C) * ax * ax * ax +
++ (-18 + 12*B + 6*C) * ax * ax +
++ (6 - 2*B))/6;
++ }
++ else if (ax<2.0)
++ {
++ return ((-B - 6*C) * ax * ax * ax +
++ (6*B + 30*C) * ax * ax + (-12*B - 48*C) *
++ ax + (8*B + 24*C)) / 6;
++ }
++ else
++ {
++ return 0.0;
++ }
++}
++
++
++//convert float to high byte/low byte, so the kernel can be loaded into an 8 bit texture
++//with height 2 and converted back to real float in the shader
++//it only works when the kernel texture uses nearest neighbour, but there's almost no difference
++//between that and linear interpolation
++void CConvolutionKernel::ToIntFract()
++{
++ m_intfractpixels = new uint8_t[m_size * 8];
++
++ for (int i = 0; i < m_size * 4; i++)
++ {
++ int value = MathUtils::round_int((m_floatpixels[i] + 1.0) / 2.0 * 65535.0);
++ if (value < 0)
++ value = 0;
++ else if (value > 65535)
++ value = 65535;
++
++ int integer = value / 256;
++ int fract = value % 256;
++
++ m_intfractpixels[i] = (uint8_t)integer;
++ m_intfractpixels[i + m_size * 4] = (uint8_t)fract;
++ }
++
++#if 0
++ for (int i = 0; i < 4; i++)
++ {
++ for (int j = 0; j < m_size; j++)
++ {
++ printf("%i %f %f\n",
++ i * m_size + j,
++ ((double)m_intfractpixels[j * 4 + i] + (double)m_intfractpixels[j * 4 + i + m_size * 4] / 255.0) / 255.0 * 2.0 - 1.0,
++ m_floatpixels[j * 4 + i]);
++ }
++ }
++#endif
++}
++
+--- xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h
++++ xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h
+@@ -4,6 +4,7 @@
+ #ifdef HAS_GL
+
+ #include "../../../../guilib/Shader.h"
++#include "../../../settings/VideoSettings.h"
+
+ using namespace Shaders;
+
+@@ -35,7 +36,7 @@
+ class BicubicFilterShader : public BaseVideoFilterShader
+ {
+ public:
+- BicubicFilterShader(float B=0.0f, float C=0.0f);
++ BicubicFilterShader(float B=-1.0f, float C=-1.0f);
+ void OnCompiledAndLinked();
+ bool OnEnabled();
+ void Free();
+@@ -55,6 +56,25 @@
+ float m_C;
+ };
+
++ class ConvolutionFilterShader : public BaseVideoFilterShader
++ {
++ public:
++ ConvolutionFilterShader(ESCALINGMETHOD method);
++ void OnCompiledAndLinked();
++ bool OnEnabled();
++ void Free();
++
++ protected:
++ // kernel textures
++ GLuint m_kernelTex1;
++
++ // shader handles to kernel textures
++ GLint m_hKernTex;
++
++ ESCALINGMETHOD m_method;
++ bool m_floattex; //if float textures are supported
++ };
++
+ } // end namespace
+
+ #endif
+--- xbmc/cores/VideoRenderers/VideoShaders/ConvolutionKernels.h
++++ xbmc/cores/VideoRenderers/VideoShaders/ConvolutionKernels.h
+@@ -0,0 +1,55 @@
++/*
++ * Copyright (C) 2005-2008 Team XBMC
++ * http://www.xbmc.org
++ *
++ * This Program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * This Program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with XBMC; see the file COPYING. If not, write to
++ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
++ * http://www.gnu.org/copyleft/gpl.html
++ *
++ */
++
++#ifndef CONVOLUTIONKERNELS
++#define CONVOLUTIONKERNELS
++
++#include "system.h"
++#include "../../../settings/VideoSettings.h"
++
++class CConvolutionKernel
++{
++ public:
++ CConvolutionKernel(ESCALINGMETHOD method, int size);
++ ~CConvolutionKernel();
++
++ int GetSize() { return m_size; }
++ float* GetFloatPixels() { return m_floatpixels; }
++ uint8_t* GetIntFractPixels() { return m_intfractpixels; }
++
++ private:
++
++ void Lanczos2();
++ void Lanczos3Fast();
++ void Lanczos3();
++ void Bicubic(double B, double C);
++
++ double LanczosWeight(double x, double radius);
++ double BicubicWeight(double x, double B, double C);
++
++ void ToIntFract();
++
++ int m_size;
++ float* m_floatpixels;
++ uint8_t* m_intfractpixels;
++};
++
++#endif //CONVOLUTIONKERNELS
+--- xbmc/cores/VideoRenderers/VideoShaders/Makefile
++++ xbmc/cores/VideoRenderers/VideoShaders/Makefile
+@@ -1,5 +1,5 @@
+ INCLUDES=-I. -I.. -I../../ -I../../../ -I../../../linux -I../../../../guilib
+-SRCS=YUV2RGBShader.cpp VideoFilterShader.cpp
++SRCS=YUV2RGBShader.cpp VideoFilterShader.cpp ConvolutionKernels.cpp
+
+ LIB=VideoShaders.a
+
+--- xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
++++ xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
+@@ -886,6 +886,19 @@
+
+ VerifyGLState();
+
++ if (m_scalingMethod == VS_SCALINGMETHOD_AUTO)
++ {
++ bool scaleSD = (int)m_sourceWidth < m_upscalingWidth && (int)m_sourceHeight < m_upscalingHeight &&
++ m_sourceHeight < 720 && m_sourceWidth < 1280;
++
++ if (Supports(VS_SCALINGMETHOD_VDPAU_HARDWARE))
++ m_scalingMethod = VS_SCALINGMETHOD_VDPAU_HARDWARE;
++ else if (Supports(VS_SCALINGMETHOD_LANCZOS3_FAST) && scaleSD)
++ m_scalingMethod = VS_SCALINGMETHOD_LANCZOS3_FAST;
++ else
++ m_scalingMethod = VS_SCALINGMETHOD_LINEAR;
++ }
++
+ switch (m_scalingMethod)
+ {
+ case VS_SCALINGMETHOD_NEAREST:
+@@ -898,13 +911,10 @@
+ m_renderQuality = RQ_SINGLEPASS;
+ return;
+
++ case VS_SCALINGMETHOD_LANCZOS2:
++ case VS_SCALINGMETHOD_LANCZOS3_FAST:
++ case VS_SCALINGMETHOD_LANCZOS3:
+ case VS_SCALINGMETHOD_CUBIC:
+- if(!glewIsSupported("GL_ARB_texture_float"))
+- {
+- CLog::Log(LOGERROR, "GL: hardware doesn't support GL_ARB_texture_float");
+- break;
+- }
+-
+ if (!m_fbo.Initialize())
+ {
+ CLog::Log(LOGERROR, "GL: Error initializing FBO");
+@@ -917,7 +927,7 @@
+ break;
+ }
+
+- m_pVideoFilterShader = new BicubicFilterShader(0.3f, 0.3f);
++ m_pVideoFilterShader = new ConvolutionFilterShader(m_scalingMethod);
+ if (!m_pVideoFilterShader->CompileAndLink())
+ {
+ CLog::Log(LOGERROR, "GL: Error compiling and linking video filter shader");
+@@ -928,8 +938,6 @@
+ m_renderQuality = RQ_MULTIPASS;
+ return;
+
+- case VS_SCALINGMETHOD_LANCZOS2:
+- case VS_SCALINGMETHOD_LANCZOS3:
+ case VS_SCALINGMETHOD_SINC8:
+ case VS_SCALINGMETHOD_NEDI:
+ CLog::Log(LOGERROR, "GL: TODO: This scaler has not yet been implemented");
+@@ -1895,16 +1903,19 @@
+ bool CLinuxRendererGL::Supports(ESCALINGMETHOD method)
+ {
+ if(method == VS_SCALINGMETHOD_NEAREST
+- || method == VS_SCALINGMETHOD_LINEAR)
++ || method == VS_SCALINGMETHOD_LINEAR
++ || method == VS_SCALINGMETHOD_AUTO)
+ return true;
+
+-
+- if(method == VS_SCALINGMETHOD_CUBIC
+- && glewIsSupported("GL_ARB_texture_float")
+- && glewIsSupported("GL_EXT_framebuffer_object")
+- && m_renderMethod == RENDER_GLSL)
+- return true;
+-
++ if(method == VS_SCALINGMETHOD_CUBIC
++ || method == VS_SCALINGMETHOD_LANCZOS2
++ || method == VS_SCALINGMETHOD_LANCZOS3_FAST
++ || method == VS_SCALINGMETHOD_LANCZOS3)
++ {
++ if (glewIsSupported("GL_EXT_framebuffer_object") && (m_renderMethod & RENDER_GLSL))
++ return true;
++ }
++
+ if (g_advancedSettings.m_videoHighQualityScaling != SOFTWARE_UPSCALING_DISABLED)
+ {
+ if(method == VS_SCALINGMETHOD_BICUBIC_SOFTWARE
+--- xbmc/GUIDialogVideoSettings.cpp
++++ xbmc/GUIDialogVideoSettings.cpp
+@@ -103,6 +103,7 @@
+ entries.push_back(make_pair(VS_SCALINGMETHOD_LINEAR , 16302));
+ entries.push_back(make_pair(VS_SCALINGMETHOD_CUBIC , 16303));
+ entries.push_back(make_pair(VS_SCALINGMETHOD_LANCZOS2 , 16304));
++ entries.push_back(make_pair(VS_SCALINGMETHOD_LANCZOS3_FAST , 16315));
+ entries.push_back(make_pair(VS_SCALINGMETHOD_LANCZOS3 , 16305));
+ entries.push_back(make_pair(VS_SCALINGMETHOD_SINC8 , 16306));
+ // entries.push_back(make_pair(VS_SCALINGMETHOD_NEDI , ?????));
+@@ -110,6 +111,7 @@
+ entries.push_back(make_pair(VS_SCALINGMETHOD_LANCZOS_SOFTWARE , 16308));
+ entries.push_back(make_pair(VS_SCALINGMETHOD_SINC_SOFTWARE , 16309));
+ entries.push_back(make_pair(VS_SCALINGMETHOD_VDPAU_HARDWARE , 13120));
++ entries.push_back(make_pair(VS_SCALINGMETHOD_AUTO , 16316));
+
+ /* remove unsupported methods */
+ for(vector<pair<int, int> >::iterator it = entries.begin(); it != entries.end();)
+--- xbmc/Settings.cpp
++++ xbmc/Settings.cpp
+@@ -772,7 +772,7 @@
+ GetInteger(pElement, "interlacemethod", interlaceMethod, VS_INTERLACEMETHOD_NONE, VS_INTERLACEMETHOD_NONE, VS_INTERLACEMETHOD_INVERSE_TELECINE);
+ m_stSettings.m_defaultVideoSettings.m_InterlaceMethod = (EINTERLACEMETHOD)interlaceMethod;
+ int scalingMethod;
+- GetInteger(pElement, "scalingmethod", scalingMethod, VS_SCALINGMETHOD_LINEAR, VS_SCALINGMETHOD_NEAREST, VS_SCALINGMETHOD_CUBIC);
++ GetInteger(pElement, "scalingmethod", scalingMethod, VS_SCALINGMETHOD_LINEAR, VS_SCALINGMETHOD_NEAREST, VS_SCALINGMETHOD_AUTO);
+ m_stSettings.m_defaultVideoSettings.m_ScalingMethod = (ESCALINGMETHOD)scalingMethod;
+
+ GetInteger(pElement, "viewmode", m_stSettings.m_defaultVideoSettings.m_ViewMode, VIEW_MODE_NORMAL, VIEW_MODE_NORMAL, VIEW_MODE_CUSTOM);
diff --git a/media-tv/xbmc/files/xbmc-9.11-use-cdio-system-headers-on-non-win32.patch b/media-tv/xbmc/files/xbmc-9.11-use-cdio-system-headers-on-non-win32.patch
new file mode 100644
index 00000000..345d9115
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9.11-use-cdio-system-headers-on-non-win32.patch
@@ -0,0 +1,129 @@
+diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
+index 9097519..9b6418d 100644
+--- a/xbmc/Application.cpp
++++ b/xbmc/Application.cpp
+@@ -236,7 +236,11 @@
+ #endif
+
+ #ifdef HAS_DVD_DRIVE
++#ifdef _WIN32
+ #include "lib/libcdio/logging.h"
++#else
++#include <cdio/logging.h>
++#endif
+ #endif
+
+ #ifdef HAS_HAL
+diff --git a/xbmc/FileSystem/Makefile b/xbmc/FileSystem/Makefile
+index 782d57a..1e524ed 100644
+--- a/xbmc/FileSystem/Makefile
++++ b/xbmc/FileSystem/Makefile
+@@ -1,5 +1,4 @@
+ INCLUDES=-I. -I../ -I../cores -I../linux -I../../guilib -I../lib/UnrarXLib -I../utils -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+-INCLUDES+=-I../lib/libcdio/libcdio/include
+
+ CXXFLAGS+=-D__STDC_FORMAT_MACROS \
+
+diff --git a/xbmc/FileSystem/cdioSupport.cpp b/xbmc/FileSystem/cdioSupport.cpp
+index 00e5fdd..21a0b67 100644
+--- a/xbmc/FileSystem/cdioSupport.cpp
++++ b/xbmc/FileSystem/cdioSupport.cpp
+@@ -26,7 +26,7 @@
+ #include "cdioSupport.h"
+ #include "utils/SingleLock.h"
+ #include "utils/log.h"
+-#ifndef _LINUX
++#ifdef _WIN32
+ #include "lib/libcdio/logging.h"
+ #include "lib/libcdio/util.h"
+ #include "lib/libcdio/mmc.h"
+diff --git a/xbmc/FileSystem/iso9660.cpp b/xbmc/FileSystem/iso9660.cpp
+index 6e1633f..58fbc50 100644
+--- a/xbmc/FileSystem/iso9660.cpp
++++ b/xbmc/FileSystem/iso9660.cpp
+@@ -44,7 +44,7 @@ ISO9660
+ #include "utils/CharsetConverter.h"
+
+ #include "DetectDVDType.h" // for MODE2_DATA_SIZE etc.
+-#ifdef _LINUX
++#ifndef _WIN32
+ #include <cdio/bytesex.h>
+ #else
+ #include "lib/libcdio/bytesex.h" // for from_723 & from_733
+diff --git a/xbmc/Makefile b/xbmc/Makefile
+index abfbdcb..f55381a 100644
+--- a/xbmc/Makefile
++++ b/xbmc/Makefile
+@@ -8,8 +8,6 @@ INCLUDES+=-Ilib/libUPnP/Platinum/Source/Core \
+ -Ilib/libUPnP/Neptune/Source/System/Posix \
+ -Ilib/libUPnP/Neptune/Source/Core
+
+-INCLUDES+=-Ilib/libcdio/libcdio/include
+-
+ SRCS=Application.cpp \
+ CueDocument.cpp \
+ GUISettings.cpp \
+diff --git a/xbmc/cdrip/CDDAReader.cpp b/xbmc/cdrip/CDDAReader.cpp
+index c8b37b2..e3e9c0b 100644
+--- a/xbmc/cdrip/CDDAReader.cpp
++++ b/xbmc/cdrip/CDDAReader.cpp
+@@ -24,7 +24,11 @@
+ #ifdef HAS_CDDA_RIPPER
+
+ #include "CDDAReader.h"
++#ifdef _WIN32
+ #include "lib/libcdio/cdio.h"
++#else
++#include <cdio/cdio.h>
++#endif
+ #include "utils/log.h"
+
+ #define SECTOR_COUNT 52
+diff --git a/xbmc/cores/paplayer/AC3CDDACodec.cpp b/xbmc/cores/paplayer/AC3CDDACodec.cpp
+index 20cded7..f2a077a 100644
+--- a/xbmc/cores/paplayer/AC3CDDACodec.cpp
++++ b/xbmc/cores/paplayer/AC3CDDACodec.cpp
+@@ -22,7 +22,11 @@
+ #include "system.h"
+ #include "AC3CDDACodec.h"
+ #ifdef HAS_AC3_CDDA_CODEC
++#ifdef _WIN32
+ #include "lib/libcdio/sector.h"
++#else
++#include <cdio/sector.h>
++#endif
+
+ AC3CDDACodec::AC3CDDACodec() : AC3Codec()
+ {
+diff --git a/xbmc/cores/paplayer/CDDAcodec.cpp b/xbmc/cores/paplayer/CDDAcodec.cpp
+index ca8f1be..42460dc 100644
+--- a/xbmc/cores/paplayer/CDDAcodec.cpp
++++ b/xbmc/cores/paplayer/CDDAcodec.cpp
+@@ -20,7 +20,11 @@
+ */
+
+ #include "CDDAcodec.h"
++#ifdef _WIN32
+ #include "lib/libcdio/sector.h"
++#else
++#include <cdio/sector.h>
++#endif
+
+ #define SECTOR_COUNT 55 // max. sectors that can be read at once
+ #define MAX_BUFFER_SIZE 2*SECTOR_COUNT*CDIO_CD_FRAMESIZE_RAW
+diff --git a/xbmc/cores/paplayer/DTSCDDACodec.cpp b/xbmc/cores/paplayer/DTSCDDACodec.cpp
+index e64cc2e..9bc46c6 100644
+--- a/xbmc/cores/paplayer/DTSCDDACodec.cpp
++++ b/xbmc/cores/paplayer/DTSCDDACodec.cpp
+@@ -22,7 +22,11 @@
+ #include "system.h"
+ #include "DTSCDDACodec.h"
+ #ifdef HAS_DTS_CODEC
++#ifdef _WIN32
+ #include "lib/libcdio/sector.h"
++#else
++#include <cdio/sector.h>
++#endif
+
+ DTSCDDACodec::DTSCDDACodec() : DTSCodec()
+ {
diff --git a/media-tv/xbmc/files/xbmc-9.11-wavpack.patch b/media-tv/xbmc/files/xbmc-9.11-wavpack.patch
new file mode 100644
index 00000000..4ef0d147
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9.11-wavpack.patch
@@ -0,0 +1,44 @@
+fix from upstream trunk
+
+http://xbmc.org/trac/ticket/8185
+
+Index: trunk/xbmc/cores/paplayer/DllWAVPack.h
+===================================================================
+--- trunk/xbmc/cores/paplayer/DllWAVPack.h (revision 22927)
++++ trunk/xbmc/cores/paplayer/DllWAVPack.h (revision 25321)
+@@ -58,7 +58,7 @@
+ virtual int WavpackGetReducedChannels (WavpackContext *wpc)=0;
+ virtual int WavpackGetFloatNormExp (WavpackContext *wpc)=0;
+- virtual int WavpackGetMD5Sum (WavpackContext *wpc, uchar data [16])=0;
++ virtual int WavpackGetMD5Sum (WavpackContext *wpc, unsigned char data [16])=0;
+ virtual uint32_t WavpackGetWrapperBytes (WavpackContext *wpc)=0;
+- virtual uchar *WavpackGetWrapperData (WavpackContext *wpc)=0;
++ virtual unsigned char *WavpackGetWrapperData (WavpackContext *wpc)=0;
+ virtual void WavpackFreeWrapper (WavpackContext *wpc)=0;
+ virtual void WavpackSeekTrailingWrapper (WavpackContext *wpc)=0;
+@@ -77,5 +77,5 @@
+ virtual int WavpackSetConfiguration (WavpackContext *wpc, WavpackConfig *config, uint32_t total_samples)=0;
+ virtual int WavpackAddWrapper (WavpackContext *wpc, void *data, uint32_t bcount)=0;
+- virtual int WavpackStoreMD5Sum (WavpackContext *wpc, uchar data [16])=0;
++ virtual int WavpackStoreMD5Sum (WavpackContext *wpc, unsigned char data [16])=0;
+ virtual int WavpackPackInit (WavpackContext *wpc)=0;
+ virtual int WavpackPackSamples (WavpackContext *wpc, int32_t *sample_buffer, uint32_t sample_count)=0;
+@@ -133,9 +133,9 @@
+ virtual int WavpackGetFloatNormExp (WavpackContext *wpc)
+ { return ::WavpackGetFloatNormExp (wpc); }
+- virtual int WavpackGetMD5Sum (WavpackContext *wpc, uchar data [16])
++ virtual int WavpackGetMD5Sum (WavpackContext *wpc, unsigned char data [16])
+ { return ::WavpackGetMD5Sum (wpc, data); }
+ virtual uint32_t WavpackGetWrapperBytes (WavpackContext *wpc)
+ { return ::WavpackGetWrapperBytes (wpc); }
+- virtual uchar *WavpackGetWrapperData (WavpackContext *wpc)
++ virtual unsigned char *WavpackGetWrapperData (WavpackContext *wpc)
+ { return ::WavpackGetWrapperData (wpc); }
+ virtual void WavpackFreeWrapper (WavpackContext *wpc)
+@@ -171,5 +171,5 @@
+ virtual int WavpackAddWrapper (WavpackContext *wpc, void *data, uint32_t bcount)
+ { return ::WavpackAddWrapper (wpc, data, bcount); }
+- virtual int WavpackStoreMD5Sum (WavpackContext *wpc, uchar data [16])
++ virtual int WavpackStoreMD5Sum (WavpackContext *wpc, unsigned char data [16])
+ { return ::WavpackStoreMD5Sum (wpc, data); }
+ virtual int WavpackPackInit (WavpackContext *wpc)
diff --git a/media-tv/xbmc/files/xbmc-9999-arm-kill-softfp.patch b/media-tv/xbmc/files/xbmc-9999-arm-kill-softfp.patch
new file mode 100644
index 00000000..c50d83e2
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9999-arm-kill-softfp.patch
@@ -0,0 +1,15 @@
+--- xbmc-9999.orig/configure.in
++++ xbmc-9999/configure.in
+@@ -572,9 +572,9 @@ if test "$host_vendor" = "apple" ; then
+ LIBS="$LIBS -framework ApplicationServices"
+ fi
+ elif test "$use_arch" = "arm"; then
+- CFLAGS="$CFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
+- CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
+- FFMPEG_EXTRACFLAGS="-mfloat-abi=softfp"
++ CFLAGS="$CFLAGS -mno-apcs-stack-check"
++ CXXFLAGS="$CXXFLAGS -mno-apcs-stack-check"
++ FFMPEG_EXTRACFLAGS=""
+ if test "$use_tegra" = "yes"; then
+ # Compile for ARMv7a architecture, need to test gcc for vfpv3-d16 support
+ SAVE_CFLAGS="$CFLAGS"
diff --git a/media-tv/xbmc/files/xbmc-9999-libpng-1.5-fix-plt-trn-get.patch b/media-tv/xbmc/files/xbmc-9999-libpng-1.5-fix-plt-trn-get.patch
new file mode 100644
index 00000000..02954e8e
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9999-libpng-1.5-fix-plt-trn-get.patch
@@ -0,0 +1,47 @@
+--- xbmc-10.1.orig/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
++++ xbmc-10.1/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
+@@ -178,12 +178,14 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ int _num_palette;
+ png_colorp _palette;
+ #if PNG_LIBPNG_VER > 10399
+- png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++ png_uint_32 _palette_ret;
++ _palette_ret = png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++ if (_palette_ret && _num_palette>0){
+ #else
+ _num_palette=info_ptr->num_palette;
+ _palette=info_ptr->palette;
+-#endif
+ if (_num_palette>0){
++#endif
+ SetPalette((rgb_color*)_palette,_num_palette);
+ SetClrImportant(_num_palette);
+ } else if (_bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
+@@ -199,11 +201,13 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ int _num_trans;
+ png_color_16p _trans_color;
+ #if PNG_LIBPNG_VER > 10399
+- png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++ png_uint_32 _trans_ret;
++ _trans_ret = png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++ if (_trans_ret && _num_trans!=0){ //palette transparency
+ #else
+ _num_trans=info_ptr->num_trans;
+-#endif
+ if (_num_trans!=0){ //palette transparency
++#endif
+ if (_num_trans==1){
+ if (_color_type == PNG_COLOR_TYPE_PALETTE){
+ #if PNG_LIBPNG_VER > 10399
+@@ -219,7 +223,11 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ #endif
+ }
+ }
++#if PNG_LIBPNG_VER > 10399
++ if (_num_trans>1 && _trans_alpha!=NULL){
++#else
+ if (_num_trans>1){
++#endif
+ RGBQUAD* pal=GetPalette();
+ if (pal){
+ DWORD ip;
diff --git a/media-tv/xbmc/files/xbmc-9999-no-arm-flags.patch b/media-tv/xbmc/files/xbmc-9999-no-arm-flags.patch
new file mode 100644
index 00000000..179697a8
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9999-no-arm-flags.patch
@@ -0,0 +1,16 @@
+http://bugs.gentoo.org/400617
+
+do not force any particular ABI or FPU or SIMD compiler flags for arm
+targets. let the toolchain and user CFLAGS control that.
+
+--- a/configure.in
++++ b/configure.in
+@@ -571,7 +571,7 @@
+ LIBS="$LIBS -framework DiskArbitration"
+ LIBS="$LIBS -framework ApplicationServices"
+ fi
+-elif test "$use_arch" = "arm"; then
++elif false; then
+ CFLAGS="$CFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
+ CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
+ FFMPEG_EXTRACFLAGS="-mfloat-abi=softfp"
diff --git a/media-tv/xbmc/files/xbmc-9999-no-exec-stack.patch b/media-tv/xbmc/files/xbmc-9999-no-exec-stack.patch
new file mode 100644
index 00000000..67b20b7b
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9999-no-exec-stack.patch
@@ -0,0 +1,28 @@
+http://trac.xbmc.org/ticket/12735
+
+From f0e33eefa4b5d46f26811db2f5e943dcd7f2870e Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 1 Mar 2012 00:04:49 -0500
+Subject: [PATCH] mark stack as non-executable
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ xbmc/utils/fastmemcpy-arm.S | 5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/xbmc/utils/fastmemcpy-arm.S b/xbmc/utils/fastmemcpy-arm.S
+index 0e810a7..3d77c68 100644
+--- a/xbmc/utils/fastmemcpy-arm.S
++++ b/xbmc/utils/fastmemcpy-arm.S
+@@ -527,3 +527,8 @@ copy_last_3_and_return:
+
+ #endif /* __ARM_ARCH__ < 7 */
+ #endif
++
++#if defined(__linux__) && defined(__ELF__)
++/* we don't need an executable stack */
++.section .note.GNU-stack,"",%progbits
++#endif
+--
+1.7.8.4
+
diff --git a/media-tv/xbmc/files/xbmc-9999-nomythtv.patch b/media-tv/xbmc/files/xbmc-9999-nomythtv.patch
new file mode 100644
index 00000000..09286dba
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9999-nomythtv.patch
@@ -0,0 +1,206 @@
+http://trac.xbmc.org/ticket/11775
+
+make mysql/mythtv support optional
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -127,13 +127,17 @@ endif
+ LIB_DIRS=\
+ lib/cximage-6.0 \
+ lib/libexif \
+- lib/cmyth \
+ lib/libhdhomerun \
+ lib/libid3tag \
+ lib/libapetag \
+ lib/cpluff \
+ lib/xbmc-dll-symbols
+
++ifeq (@BUILD_MYTHTV@,1)
++LIB_DIRS+=\
++ lib/cmyth
++endif
++
+ SS_DIRS=
+ ifeq (@USE_OPENGL@,1)
+ SS_DIRS+= xbmc/screensavers/rsxs-0.9/xbmc
+@@ -418,7 +422,10 @@ imagelib: dllloader
+ $(MAKE) -C lib/cximage-6.0
+
+ codecs: papcodecs dvdpcodecs
+-libs: cmyth libhdhomerun libid3tag imagelib libexif system/libcpluff-@ARCH@.so
++libs: libhdhomerun libid3tag imagelib libexif system/libcpluff-@ARCH@.so
++ifeq (@BUILD_MYTHTV@,1)
++libs: cmyth
++endif
+ externals: codecs libs visualizations screensavers
+
+ xcode_depends: \
+--- a/configure.in
++++ b/configure.in
+@@ -68,6 +68,9 @@ goom_enabled="== GOOM enabled. =="
+ goom_disabled="== GOOM disabled. =="
+ pulse_not_found="== Could not find libpulse. PulseAudio support disabled. =="
+ pulse_disabled="== PulseAudio support manually disabled. =="
++mysql_not_found="Could not find libmysqlclient. MySQL (and MythTV) support disabled. =="
++mysql_disabled="== MySQL support disabled. =="
++mythtv_disabled="== MythTV support disabled. =="
+ dvdcss_enabled="== DVDCSS support enabled. =="
+ dvdcss_disabled="== DVDCSS support disabled. =="
+ hal_not_found="== Could not find hal. HAL support disabled. =="
+@@ -238,6 +241,18 @@ AC_ARG_ENABLE([ffmpeg_libvorbis],
+ [use_ffmpeg_libvorbis=$enableval],
+ [use_ffmpeg_libvorbis=no])
+
++AC_ARG_ENABLE([mysql],
++ [AS_HELP_STRING([--enable-mysql],
++ [enable MySQL support (default is auto)])],
++ [use_mysql=$enableval],
++ [use_mysql=auto])
++
++AC_ARG_ENABLE([mythtv],
++ [AS_HELP_STRING([--enable-mythtv],
++ [enable MythTV support (default is auto)])],
++ [use_mythtv=$enableval],
++ [use_mythtv=auto])
++
+ AC_ARG_ENABLE([dvdcss],
+ [AS_HELP_STRING([--enable-dvdcss],
+ [enable DVDCSS support (default is yes)])],
+@@ -563,14 +578,31 @@ else
+ fi
+
+ # platform common libraries
+-AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, "yes", "no")
+-if test $MYSQL_CONFIG = "yes"; then
+- INCLUDES="$INCLUDES `mysql_config --include`"
+- MYSQL_LIBS=`mysql_config --libs`
+- LIBS="$LIBS $MYSQL_LIBS"
+- AC_SUBST(MYSQL_LIBS)
+-else
+- AC_MSG_ERROR($missing_program)
++have_mysql=no
++if test "$use_mysql" != "no"; then
++ AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, "yes", "no")
++ if test $MYSQL_CONFIG = "yes"; then
++ INCLUDES="$INCLUDES `mysql_config --include`"
++ MYSQL_LIBS=`mysql_config --libs`
++ LIBS="$LIBS $MYSQL_LIBS"
++ AC_SUBST(MYSQL_LIBS)
++ AC_CHECK_LIB([mysqlclient], [main], have_mysql=yes)
++ fi
++fi
++if test "$have_mysql" = "yes"; then
++ BUILD_MYTHTV=1
++ AC_DEFINE([BUILD_MYSQL], [1], [Define to 1 to build MySQL.])
++ if test "$use_mysql" != "no"; then
++ AC_DEFINE([BUILD_MYTHTV], [1], [Define to 1 to build mythtv.])
++ fi
++elif test "$use_mysql" = "yes" || test "$use_mythtv" = "yes"; then
++ AC_MSG_ERROR([$mysql_not_found])
++else
++ BUILD_MYTHTV=0
++ use_mysql=no
++ AC_MSG_NOTICE($mysql_disabled)
++ use_mythtv=no
++ AC_MSG_NOTICE($mythtv_disabled)
+ fi
+ AC_CHECK_HEADER([ass/ass.h],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_HEADER([mpeg2dec/mpeg2.h],, AC_MSG_ERROR($missing_library))
+@@ -594,7 +625,6 @@ AC_CHECK_LIB([lzo2], [main],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_LIB([z], [main],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_LIB([crypto], [main],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_LIB([ssl], [main],, AC_MSG_ERROR($missing_library))
+-AC_CHECK_LIB([mysqlclient], [main],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_LIB([ssh], [sftp_tell64],, AC_MSG_RESULT([Could not find suitable version of libssh]))
+ AC_CHECK_LIB([smbclient], [main],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_LIB([bluetooth], [hci_devid],, AC_MSG_RESULT([Could not find suitable version of libbluetooth]))
+@@ -1319,6 +1349,18 @@ else
+ final_message="$final_message\n HAL Support:\tNo"
+ fi
+
++if test "$use_mysql" = "yes"; then
++ final_message="$final_message\n MySQL:\tYes"
++else
++ final_message="$final_message\n MySQL:\tNo"
++fi
++
++if test "$use_mythtv" = "yes"; then
++ final_message="$final_message\n MythTV:\tYes"
++else
++ final_message="$final_message\n MythTV:\tNo"
++fi
++
+ # DVDCSS
+ if test "$use_dvdcss" = "yes"; then
+ AC_MSG_NOTICE($dvdcss_enabled)
+@@ -1490,6 +1532,8 @@ AC_SUBST(USE_EXTERNAL_FFMPEG)
+ AC_SUBST(PYTHON_VERSION)
+ AC_SUBST(OUTPUT_FILES)
+ AC_SUBST(HAVE_XBMC_NONFREE)
++AC_SUBST(BUILD_MYSQL)
++AC_SUBST(BUILD_MYTHTV)
+ AC_SUBST(USE_ASAP_CODEC)
+ AC_SUBST(LIBCURL_BASENAME)
+ AC_SUBST(LIBFLAC_BASENAME)
+--- a/xbmc/dbwrappers/Database.cpp
++++ b/xbmc/dbwrappers/Database.cpp
+@@ -29,7 +29,9 @@
+ #include "utils/AutoPtrHandle.h"
+ #include "utils/log.h"
+ #include "utils/URIUtils.h"
++#ifdef BUILD_MYSQL
+ #include "mysqldataset.h"
++#endif /* BUILD_MYSQL */
+ #include "sqlitedataset.h"
+
+
+@@ -266,6 +268,7 @@
+
+ m_sqlite = true;
+
++#ifdef BUILD_MYSQL
+ if ( dbSettings.type.Equals("mysql") )
+ {
+ // check we have all information before we cancel the fallback
+@@ -276,7 +279,8 @@
+ CLog::Log(LOGINFO, "Essential mysql database information is missing. Require at least host, user and pass defined.");
+ }
+ else
++#endif /* BUILD_MYSQL */
+ {
+ dbSettings.type = "sqlite3";
+ dbSettings.host = _P(g_settings.GetDatabaseFolder());
+ dbSettings.name = GetBaseDBName();
+@@ -369,10 +373,12 @@
+ {
+ m_pDB.reset( new SqliteDatabase() ) ;
+ }
++#ifdef BUILD_MYSQL
+ else if (dbSettings.type.Equals("mysql"))
+ {
+ m_pDB.reset( new MysqlDatabase() ) ;
+ }
++#endif /* BUILD_MYSQL */
+ else
+ {
+ CLog::Log(LOGERROR, "Unable to determine database type: %s", dbSettings.type.c_str());
+--- a/xbmc/dbwrappers/mysqldataset.cpp
++++ b/xbmc/dbwrappers/mysqldataset.cpp
+@@ -23,9 +23,11 @@
+ #include <string>
+ #include <set>
+
++#include "system.h" // for GetLastError()
++#ifdef BUILD_MYSQL
++
+ #include "mysqldataset.h"
+ #include "utils/log.h"
+-#include "system.h" // for GetLastError()
+ #include "mysql/errmsg.h"
+ #ifdef _WIN32
+ #pragma comment(lib, "mysqlclient.lib")
+@@ -1562,3 +1564,4 @@
+
+ }//namespace
+
++#endif /* BUILD_MYSQL */
diff --git a/media-tv/xbmc/xbmc-10.1.ebuild b/media-tv/xbmc/xbmc-10.1.ebuild
new file mode 100644
index 00000000..0a0ced48
--- /dev/null
+++ b/media-tv/xbmc/xbmc-10.1.ebuild
@@ -0,0 +1,225 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-tv/xbmc/xbmc-10.1.ebuild,v 1.8 2011/10/12 22:53:27 vapier Exp $
+
+EAPI="2"
+
+inherit eutils python flag-o-matic
+
+# Use XBMC_ESVN_REPO_URI to track a different branch
+ESVN_REPO_URI=${XBMC_ESVN_REPO_URI:-http://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk}
+ESVN_PROJECT=${ESVN_REPO_URI##*/svnroot/}
+ESVN_PROJECT=${ESVN_PROJECT%/*}
+if [[ ${PV} == "9999" ]] ; then
+ inherit subversion autotools
+ KEYWORDS=""
+else
+ inherit autotools
+ SRC_URI="http://mirrors.xbmc.org/releases/source/${P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+fi
+
+DESCRIPTION="XBMC is a free and open source media-player and entertainment hub"
+HOMEPAGE="http://xbmc.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="alsa altivec avahi css debug joystick midi profile pulseaudio rtmp sse sse2 udev vaapi vdpau webserver +xrandr"
+
+COMMON_DEPEND="virtual/opengl
+ app-arch/bzip2
+ app-arch/unzip
+ app-arch/zip
+ app-i18n/enca
+ dev-libs/boost
+ dev-libs/fribidi
+ dev-libs/libcdio[-minimal]
+ dev-libs/libpcre[cxx]
+ >=dev-libs/lzo-2.04
+ >=dev-python/pysqlite-2
+ media-libs/alsa-lib
+ media-libs/faad2
+ media-libs/flac
+ media-libs/fontconfig
+ media-libs/freetype
+ >=media-libs/glew-1.5.6
+ media-libs/jasper
+ media-libs/jbigkit
+ virtual/jpeg
+ >=media-libs/libass-0.9.7
+ css? ( media-libs/libdvdcss )
+ media-libs/libmad
+ media-libs/libmms
+ media-libs/libmodplug
+ media-libs/libmpeg2
+ media-libs/libogg
+ media-libs/libpng
+ media-libs/libsamplerate
+ media-libs/libsdl[audio,opengl,video,X]
+ alsa? ( media-libs/libsdl[alsa] )
+ media-libs/libvorbis
+ media-libs/sdl-gfx
+ >=media-libs/sdl-image-1.2.10[gif,jpeg,png]
+ media-libs/sdl-mixer
+ media-libs/sdl-sound
+ media-libs/tiff
+ pulseaudio? ( media-sound/pulseaudio )
+ media-sound/wavpack
+ >=virtual/ffmpeg-0.6
+ rtmp? ( media-video/rtmpdump )
+ avahi? ( net-dns/avahi )
+ webserver? ( net-libs/libmicrohttpd )
+ net-misc/curl
+ || ( >=net-fs/samba-3.4.6[smbclient] <net-fs/samba-3.3 )
+ sys-apps/dbus
+ sys-libs/zlib
+ virtual/mysql
+ x11-apps/xdpyinfo
+ x11-apps/mesa-progs
+ vaapi? ( x11-libs/libva )
+ vdpau? (
+ || ( x11-libs/libvdpau >=x11-drivers/nvidia-drivers-180.51 )
+ virtual/ffmpeg[vdpau]
+ )
+ x11-libs/libXinerama
+ xrandr? ( x11-libs/libXrandr )
+ x11-libs/libXrender"
+RDEPEND="${COMMON_DEPEND}
+ udev? ( sys-fs/udisks sys-power/upower )"
+DEPEND="${COMMON_DEPEND}
+ app-text/dos2unix
+ dev-util/gperf
+ x11-proto/xineramaproto
+ dev-util/cmake
+ x86? ( dev-lang/nasm )"
+
+pkg_setup() {
+ # nasty runtime things might happen otherwise
+ # /usr/lib64/xbmc/system/players/dvdplayer/avcodec-52-x86_64-linux.so:
+ # undefined symbol: NeAACDecSetConfiguration
+ append-ldflags $(no-as-needed)
+ python_pkg_setup
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ subversion_src_unpack
+ cd "${S}"
+ rm -f configure
+ else
+ unpack ${A}
+ cd "${S}"
+ fi
+
+ # Fix case sensitivity
+ mv media/Fonts/{a,A}rial.ttf || die
+ mv media/{S,s}plash.png || die
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-10.0-python-2.7.patch #350098
+ epatch "${FILESDIR}"/${PN}-10.1-gcc-4.6.patch #367261
+ epatch "${FILESDIR}"/${P}-libpng-1.5.patch #380127
+ epatch "${FILESDIR}"/${PN}-10.1-headers.patch #380127
+ # Fix runtime SEGV, Sabayon bug #2968
+ dos2unix -o "${S}/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp"
+ epatch "${FILESDIR}"/${PN}-9999-libpng-1.5-fix-plt-trn-get.patch
+ unix2dos -o "${S}/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp"
+
+ # some dirs ship generated autotools, some dont
+ local d
+ for d in . xbmc/cores/dvdplayer/Codecs/{libdts,libdvd/lib*/} lib/cpluff ; do
+ [[ -e ${d}/configure ]] && continue
+ pushd ${d} >/dev/null
+ einfo "Generating autotools in ${d}"
+ eautoreconf
+ popd >/dev/null
+ done
+
+ local squish #290564
+ use altivec && squish="-DSQUISH_USE_ALTIVEC=1 -maltivec"
+ use sse && squish="-DSQUISH_USE_SSE=1 -msse"
+ use sse2 && squish="-DSQUISH_USE_SSE=2 -msse2"
+ sed -i \
+ -e '/^CXXFLAGS/{s:-D[^=]*=.::;s:-m[[:alnum:]]*::}' \
+ -e "1iCXXFLAGS += ${squish}" \
+ xbmc/lib/libsquish/Makefile.in || die
+
+ # Fix XBMC's final version string showing as "exported"
+ # instead of the SVN revision number.
+ export SVN_REV=${ESVN_WC_REVISION:-exported}
+
+ # Avoid lsb-release dependency
+ sed -i \
+ -e 's:lsb_release -d:cat /etc/gentoo-release:' \
+ xbmc/utils/SystemInfo.cpp
+
+ # Do not use termcap #262822
+ sed -i 's:-ltermcap::' xbmc/lib/libPython/Python/configure
+
+ # avoid long delays when powerkit isn't running #348580
+ sed -i \
+ -e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \
+ xbmc/linux/*.cpp || die
+
+ epatch_user #293109
+
+ # Tweak autotool timestamps to avoid regeneration
+ find . -type f -print0 | xargs -0 touch -r configure
+}
+
+src_configure() {
+ # Disable documentation generation
+ export ac_cv_path_LATEX=no
+ # Avoid help2man
+ export HELP2MAN=$(type -P help2man || echo true)
+
+ # XBMC python mods only work with internal Python 2.4
+ # ffmpeg is a moving target and newer version may
+ # not work with xbmc, even if API compatible (vdpau in
+ # ffmpeg is the main issue)
+ # a52 support is deprecated
+ # libdts support is deprecated
+ econf \
+ --docdir=/usr/share/doc/${PF} \
+ --disable-ccache \
+ --disable-optimizations \
+ --disable-external-python \
+ --disable-external-ffmpeg \
+ --disable-external-libdts \
+ --disable-external-liba52 \
+ --enable-gl \
+ --disable-liba52 \
+ --disable-libdts \
+ $(use_enable avahi) \
+ $(use_enable css dvdcss) \
+ $(use_enable debug) \
+ --disable-hal \
+ $(use_enable joystick) \
+ $(use_enable midi mid) \
+ $(use_enable profile profiling) \
+ $(use_enable pulseaudio pulse) \
+ $(use_enable rtmp) \
+ $(use_enable vaapi) \
+ $(use_enable vdpau) \
+ $(use_enable webserver) \
+ $(use_enable xrandr)
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+ dodoc keymapping.txt README.linux
+ rm "${D}"/usr/share/doc/${PF}/{copying.txt,LICENSE.GPL} || die
+
+# insinto /usr/share/applications
+# doins tools/Linux/xbmc.desktop
+# doicon tools/Linux/xbmc.png
+
+ insinto "$(python_get_sitedir)" #309885
+ doins tools/EventClients/lib/python/xbmcclient.py || die
+ newbin "tools/EventClients/Clients/XBMC Send/xbmc-send.py" xbmc-send || die
+}
+
+pkg_postinst() {
+ elog "Visit http://wiki.xbmc.org/?title=XBMC_Online_Manual"
+}
diff --git a/media-tv/xbmc/xbmc-11.0.ebuild b/media-tv/xbmc/xbmc-11.0.ebuild
new file mode 100644
index 00000000..5c092077
--- /dev/null
+++ b/media-tv/xbmc/xbmc-11.0.ebuild
@@ -0,0 +1,232 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-tv/xbmc/xbmc-11.0.ebuild,v 1.6 2012/04/05 00:26:27 vapier Exp $
+
+EAPI="4"
+
+# Does not work with py3 here
+# It might work with py:2.5 but I didn't test that
+PYTHON_DEPEND="2:2.6"
+
+inherit eutils python
+
+EGIT_REPO_URI="git://github.com/xbmc/xbmc.git"
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-2 autotools
+else
+ inherit autotools
+ MY_P=${P/_/-*_}
+ SRC_URI="http://mirrors.xbmc.org/releases/source/${MY_P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+ S=${WORKDIR}/${MY_P}
+fi
+
+DESCRIPTION="XBMC is a free and open source media-player and entertainment hub"
+HOMEPAGE="http://xbmc.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="airplay alsa altivec avahi bluetooth bluray cec css debug goom joystick midi mysql profile +projectm pulseaudio pvr +rsxs rtmp +samba sse sse2 udev vaapi vdpau webserver +xrandr"
+REQUIRED_USE="pvr? ( mysql )"
+
+COMMON_DEPEND="virtual/glu
+ virtual/opengl
+ app-arch/bzip2
+ app-arch/unzip
+ app-arch/zip
+ app-i18n/enca
+ airplay? ( app-pda/libplist )
+ >=dev-lang/python-2.4
+ dev-libs/boost
+ dev-libs/fribidi
+ dev-libs/libcdio[-minimal]
+ cec? ( dev-libs/libcec )
+ dev-libs/libpcre[cxx]
+ >=dev-libs/lzo-2.04
+ dev-libs/yajl
+ >=dev-python/pysqlite-2
+ dev-python/simplejson
+ media-libs/alsa-lib
+ media-libs/flac
+ media-libs/fontconfig
+ media-libs/freetype
+ >=media-libs/glew-1.5.6
+ media-libs/jasper
+ media-libs/jbigkit
+ virtual/jpeg
+ >=media-libs/libass-0.9.7
+ bluray? ( media-libs/libbluray )
+ css? ( media-libs/libdvdcss )
+ media-libs/libmad
+ media-libs/libmodplug
+ media-libs/libmpeg2
+ media-libs/libogg
+ media-libs/libpng
+ projectm? ( media-libs/libprojectm )
+ media-libs/libsamplerate
+ media-libs/libsdl[audio,opengl,video,X]
+ alsa? ( media-libs/libsdl[alsa] )
+ media-libs/libvorbis
+ media-libs/sdl-gfx
+ >=media-libs/sdl-image-1.2.10[gif,jpeg,png]
+ media-libs/sdl-mixer
+ media-libs/sdl-sound
+ media-libs/tiff
+ pulseaudio? ( media-sound/pulseaudio )
+ media-sound/wavpack
+ >=virtual/ffmpeg-0.6[encode]
+ rtmp? ( media-video/rtmpdump )
+ avahi? ( net-dns/avahi )
+ webserver? ( net-libs/libmicrohttpd )
+ net-misc/curl
+ samba? ( >=net-fs/samba-3.4.6[smbclient] )
+ bluetooth? ( net-wireless/bluez )
+ sys-apps/dbus
+ sys-libs/zlib
+ mysql? ( virtual/mysql )
+ x11-apps/xdpyinfo
+ x11-apps/mesa-progs
+ vaapi? ( x11-libs/libva[opengl] )
+ vdpau? (
+ || ( x11-libs/libvdpau >=x11-drivers/nvidia-drivers-180.51 )
+ virtual/ffmpeg[vdpau]
+ )
+ x11-libs/libXinerama
+ xrandr? ( x11-libs/libXrandr )
+ x11-libs/libXrender"
+RDEPEND="${COMMON_DEPEND}
+ udev? ( sys-fs/udisks:0 sys-power/upower )"
+DEPEND="${COMMON_DEPEND}
+ dev-util/gperf
+ x11-proto/xineramaproto
+ dev-util/cmake
+ x86? ( dev-lang/nasm )"
+
+pkg_setup() {
+ python_set_active_version 2
+ python_pkg_setup
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ git-2_src_unpack
+ cd "${S}"
+ rm -f configure
+ else
+ unpack ${A}
+ cd "${S}"
+ fi
+
+ # Fix case sensitivity
+ mv media/Fonts/{a,A}rial.ttf || die
+ mv media/{S,s}plash.png || die
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-9999-nomythtv.patch
+ epatch "${FILESDIR}"/${PN}-9999-no-arm-flags.patch #400617
+ epatch "${FILESDIR}"/${PN}-11.0-no-exec-stack.patch
+ # The mythtv patch touches configure.ac, so force a regen
+ rm -f configure
+
+ # some dirs ship generated autotools, some dont
+ local d
+ for d in \
+ . \
+ lib/{libdvd/lib*/,cpluff,libapetag,libid3tag/libid3tag} \
+ xbmc/screensavers/rsxs-* \
+ xbmc/visualizations/Goom/goom2k4-0
+ do
+ [[ -e ${d}/configure ]] && continue
+ pushd ${d} >/dev/null
+ eautoreconf
+ popd >/dev/null
+ done
+
+ local squish #290564
+ use altivec && squish="-DSQUISH_USE_ALTIVEC=1 -maltivec"
+ use sse && squish="-DSQUISH_USE_SSE=1 -msse"
+ use sse2 && squish="-DSQUISH_USE_SSE=2 -msse2"
+ sed -i \
+ -e '/^CXXFLAGS/{s:-D[^=]*=.::;s:-m[[:alnum:]]*::}' \
+ -e "1iCXXFLAGS += ${squish}" \
+ lib/libsquish/Makefile.in || die
+
+ # Disable internal func checks as our USE/DEPEND
+ # stuff handles this just fine already #408395
+ export ac_cv_lib_avcodec_ff_vdpau_vc1_decode_picture=yes
+
+ # Fix XBMC's final version string showing as "exported"
+ # instead of the SVN revision number.
+ export HAVE_GIT=no GIT_REV=${EGIT_VERSION:-exported}
+
+ # Avoid lsb-release dependency
+ sed -i \
+ -e 's:lsb_release -d:cat /etc/gentoo-release:' \
+ xbmc/utils/SystemInfo.cpp || die
+
+ # avoid long delays when powerkit isn't running #348580
+ sed -i \
+ -e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \
+ xbmc/linux/*.cpp || die
+
+ epatch_user #293109
+
+ # Tweak autotool timestamps to avoid regeneration
+ find . -type f -print0 | xargs -0 touch -r configure
+}
+
+src_configure() {
+ # Disable documentation generation
+ export ac_cv_path_LATEX=no
+ # Avoid help2man
+ export HELP2MAN=$(type -P help2man || echo true)
+ # No configure flage for this #403561
+ export ac_cv_lib_bluetooth_hci_devid=$(usex bluetooth)
+
+ econf \
+ --docdir=/usr/share/doc/${PF} \
+ --disable-ccache \
+ --disable-optimizations \
+ --disable-external-libraries \
+ --enable-gl \
+ $(use_enable airplay) \
+ $(use_enable avahi) \
+ $(use_enable bluray libbluray) \
+ $(use_enable cec libcec) \
+ $(use_enable css dvdcss) \
+ $(use_enable debug) \
+ $(use_enable goom) \
+ --disable-hal \
+ $(use_enable joystick) \
+ $(use_enable midi mid) \
+ $(use_enable mysql) \
+ $(use_enable profile profiling) \
+ $(use_enable projectm) \
+ $(use_enable pulseaudio pulse) \
+ $(use_enable pvr mythtv) \
+ $(use_enable rsxs) \
+ $(use_enable rtmp) \
+ $(use_enable samba) \
+ $(use_enable vaapi) \
+ $(use_enable vdpau) \
+ $(use_enable webserver) \
+ $(use_enable xrandr)
+}
+
+src_install() {
+ default
+ rm "${ED}"/usr/share/doc/*/{LICENSE.GPL,copying.txt}*
+
+ insinto /usr/share/applications
+ doins tools/Linux/xbmc.desktop
+ newicon tools/Linux/xbmc-48x48.png xbmc.png
+
+ insinto "$(python_get_sitedir)" #309885
+ doins tools/EventClients/lib/python/xbmcclient.py || die
+ newbin "tools/EventClients/Clients/XBMC Send/xbmc-send.py" xbmc-send || die
+}
+
+pkg_postinst() {
+ elog "Visit http://wiki.xbmc.org/?title=XBMC_Online_Manual"
+}
diff --git a/media-tv/xbmc/xbmc-12.0.ebuild b/media-tv/xbmc/xbmc-12.0.ebuild
new file mode 100644
index 00000000..04eea0d6
--- /dev/null
+++ b/media-tv/xbmc/xbmc-12.0.ebuild
@@ -0,0 +1,237 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-tv/xbmc/xbmc-12.0.ebuild,v 1.1 2013/02/18 06:53:34 vapier Exp $
+
+EAPI="4"
+
+# Does not work with py3 here
+# It might work with py:2.5 but I didn't test that
+PYTHON_DEPEND="2:2.6"
+PYTHON_USE_WITH=sqlite
+
+inherit eutils python multiprocessing autotools
+
+case ${PV} in
+9999)
+ EGIT_REPO_URI="git://github.com/xbmc/xbmc.git"
+ inherit git-2
+ SRC_URI="!java? ( mirror://gentoo/${P}-20121224-generated-addons.tar.xz )"
+ ;;
+*_alpha*|*_beta*|*_rc*)
+ MY_PV="Frodo_${PV#*_}"
+ MY_P="${PN}-${MY_PV}"
+ SRC_URI="https://github.com/xbmc/xbmc/archive/${MY_PV}.tar.gz -> ${P}.tar.gz
+ !java? ( mirror://gentoo/${P}-generated-addons.tar.xz )"
+ KEYWORDS="~amd64 ~x86"
+ ;;
+*)
+ MY_P=${P/_/-*_}
+ SRC_URI="http://mirrors.xbmc.org/releases/source/${MY_P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+ ;;
+esac
+
+DESCRIPTION="XBMC is a free and open source media-player and entertainment hub"
+HOMEPAGE="http://xbmc.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="airplay alsa altivec avahi bluetooth bluray cec css debug goom java joystick midi mysql nfs profile +projectm pulseaudio pvr +rsxs rtmp +samba sse sse2 sftp udev upnp vaapi vdpau webserver +xrandr"
+REQUIRED_USE="pvr? ( mysql )"
+
+COMMON_DEPEND="virtual/glu
+ virtual/opengl
+ app-arch/bzip2
+ app-arch/unzip
+ app-arch/zip
+ app-i18n/enca
+ airplay? ( app-pda/libplist )
+ >=dev-lang/python-2.4
+ dev-libs/boost
+ dev-libs/fribidi
+ dev-libs/libcdio[-minimal]
+ cec? ( >=dev-libs/libcec-2 )
+ dev-libs/libpcre[cxx]
+ >=dev-libs/lzo-2.04
+ dev-libs/tinyxml[stl]
+ dev-libs/yajl
+ dev-python/simplejson
+ media-libs/alsa-lib
+ media-libs/flac
+ media-libs/fontconfig
+ media-libs/freetype
+ >=media-libs/glew-1.5.6
+ media-libs/jasper
+ media-libs/jbigkit
+ >=media-libs/libass-0.9.7
+ bluray? ( media-libs/libbluray )
+ css? ( media-libs/libdvdcss )
+ media-libs/libmad
+ media-libs/libmodplug
+ media-libs/libmpeg2
+ media-libs/libogg
+ media-libs/libpng
+ projectm? ( media-libs/libprojectm )
+ media-libs/libsamplerate
+ media-libs/libsdl[audio,opengl,video,X]
+ alsa? ( media-libs/libsdl[alsa] )
+ >=media-libs/taglib-1.8
+ media-libs/libvorbis
+ media-libs/sdl-gfx
+ >=media-libs/sdl-image-1.2.10[gif,jpeg,png]
+ media-libs/sdl-mixer
+ media-libs/sdl-sound
+ media-libs/tiff
+ pulseaudio? ( media-sound/pulseaudio )
+ media-sound/wavpack
+ || ( media-libs/libpostproc <media-video/libav-0.8.2-r1 media-video/ffmpeg )
+ >=virtual/ffmpeg-0.6[encode]
+ rtmp? ( media-video/rtmpdump )
+ avahi? ( net-dns/avahi )
+ nfs? ( net-fs/libnfs )
+ webserver? ( net-libs/libmicrohttpd[messages] )
+ sftp? ( net-libs/libssh )
+ net-misc/curl
+ samba? ( >=net-fs/samba-3.4.6[smbclient] )
+ bluetooth? ( net-wireless/bluez )
+ sys-apps/dbus
+ sys-libs/zlib
+ virtual/jpeg
+ mysql? ( virtual/mysql )
+ x11-apps/xdpyinfo
+ x11-apps/mesa-progs
+ vaapi? ( x11-libs/libva[opengl] )
+ vdpau? (
+ || ( x11-libs/libvdpau >=x11-drivers/nvidia-drivers-180.51 )
+ virtual/ffmpeg[vdpau]
+ )
+ x11-libs/libXinerama
+ xrandr? ( x11-libs/libXrandr )
+ x11-libs/libXrender"
+RDEPEND="${COMMON_DEPEND}
+ udev? ( sys-fs/udisks:0 sys-power/upower )"
+DEPEND="${COMMON_DEPEND}
+ app-arch/xz-utils
+ dev-lang/swig
+ dev-util/gperf
+ x11-proto/xineramaproto
+ dev-util/cmake
+ x86? ( dev-lang/nasm )
+ java? ( virtual/jre )"
+
+S=${WORKDIR}/${MY_P}
+
+pkg_setup() {
+ python_set_active_version 2
+ python_pkg_setup
+}
+
+src_unpack() {
+ [[ ${PV} == "9999" ]] && git-2_src_unpack || default
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-9999-nomythtv.patch
+ epatch "${FILESDIR}"/${PN}-9999-no-arm-flags.patch #400617
+ # The mythtv patch touches configure.ac, so force a regen
+ rm -f configure
+
+ # some dirs ship generated autotools, some dont
+ multijob_init
+ local d
+ for d in $(printf 'f:\n\t@echo $(BOOTSTRAP_TARGETS)\ninclude bootstrap.mk\n' | emake -f - f) ; do
+ [[ -e ${d} ]] && continue
+ pushd ${d/%configure/.} >/dev/null || die
+ AT_NOELIBTOOLIZE="yes" AT_TOPLEVEL_EAUTORECONF="yes" \
+ multijob_child_init eautoreconf
+ popd >/dev/null
+ done
+ multijob_finish
+ elibtoolize
+
+ # Disable internal func checks as our USE/DEPEND
+ # stuff handles this just fine already #408395
+ export ac_cv_lib_avcodec_ff_vdpau_vc1_decode_picture=yes
+
+ local squish #290564
+ use altivec && squish="-DSQUISH_USE_ALTIVEC=1 -maltivec"
+ use sse && squish="-DSQUISH_USE_SSE=1 -msse"
+ use sse2 && squish="-DSQUISH_USE_SSE=2 -msse2"
+ sed -i \
+ -e '/^CXXFLAGS/{s:-D[^=]*=.::;s:-m[[:alnum:]]*::}' \
+ -e "1iCXXFLAGS += ${squish}" \
+ lib/libsquish/Makefile.in || die
+
+ # Fix XBMC's final version string showing as "exported"
+ # instead of the SVN revision number.
+ export HAVE_GIT=no GIT_REV=${EGIT_VERSION:-exported}
+
+ # avoid long delays when powerkit isn't running #348580
+ sed -i \
+ -e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \
+ xbmc/linux/*.cpp || die
+
+ epatch_user #293109
+
+ # Tweak autotool timestamps to avoid regeneration
+ find . -type f -print0 | xargs -0 touch -r configure
+}
+
+src_configure() {
+ # Disable documentation generation
+ export ac_cv_path_LATEX=no
+ # Avoid help2man
+ export HELP2MAN=$(type -P help2man || echo true)
+ # No configure flage for this #403561
+ export ac_cv_lib_bluetooth_hci_devid=$(usex bluetooth)
+ # Requiring java is asine #434662
+ export ac_cv_path_JAVA_EXE=$(which $(usex java java true))
+
+ econf \
+ --docdir=/usr/share/doc/${PF} \
+ --disable-ccache \
+ --disable-optimizations \
+ --enable-external-libraries \
+ --enable-gl \
+ $(use_enable airplay) \
+ $(use_enable avahi) \
+ $(use_enable bluray libbluray) \
+ $(use_enable cec libcec) \
+ $(use_enable css dvdcss) \
+ $(use_enable debug) \
+ $(use_enable goom) \
+ --disable-hal \
+ $(use_enable joystick) \
+ $(use_enable midi mid) \
+ $(use_enable mysql) \
+ $(use_enable nfs) \
+ $(use_enable profile profiling) \
+ $(use_enable projectm) \
+ $(use_enable pulseaudio pulse) \
+ $(use_enable pvr mythtv) \
+ $(use_enable rsxs) \
+ $(use_enable rtmp) \
+ $(use_enable samba) \
+ $(use_enable sftp ssh) \
+ $(use_enable upnp) \
+ $(use_enable vaapi) \
+ $(use_enable vdpau) \
+ $(use_enable webserver) \
+ $(use_enable xrandr)
+}
+
+src_install() {
+ default
+ rm "${ED}"/usr/share/doc/*/{LICENSE.GPL,copying.txt}*
+
+ domenu tools/Linux/xbmc.desktop
+ newicon tools/Linux/xbmc-48x48.png xbmc.png
+
+ insinto "$(python_get_sitedir)" #309885
+ doins tools/EventClients/lib/python/xbmcclient.py || die
+ newbin "tools/EventClients/Clients/XBMC Send/xbmc-send.py" xbmc-send || die
+}
+
+pkg_postinst() {
+ elog "Visit http://wiki.xbmc.org/?title=XBMC_Online_Manual"
+}