summaryrefslogtreecommitdiff
path: root/media-sound/xmms2
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /media-sound/xmms2
reinit the tree, so we can have metadata
Diffstat (limited to 'media-sound/xmms2')
-rw-r--r--media-sound/xmms2/Manifest28
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-audio4-p1.patch123
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-audio4-p2.patch171
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-audio4-p3.patch388
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-audio4-p4.patch296
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-audio4-p5.patch154
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-audio4-p6.patch106
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-audio4-p7.patch147
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-cpython.patch9
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-cython-0.19.1.patch47
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-ffmpeg-0.11.patch18
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-ffmpeg2.patch15
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-libav-9-p2.patch50
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-libav-9.patch20
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-memset.patch19
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-modpug.patch11
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-rtvg.patch36
-rw-r--r--media-sound/xmms2/files/xmms2-0.8-samba-4.patch30
-rw-r--r--media-sound/xmms2/files/xmms2-0.8DrO_o-waflib-fix-perl.patch27
-rw-r--r--media-sound/xmms2/files/xmms2-0.8_p20161122-be-hash.patch39
-rw-r--r--media-sound/xmms2/files/xmms2-0.8_p20161122-tarball.patch78
-rw-r--r--media-sound/xmms2/metadata.xml53
-rw-r--r--media-sound/xmms2/xmms2-0.8-r4.ebuild296
-rw-r--r--media-sound/xmms2/xmms2-0.8_p20161122-r1.ebuild294
-rw-r--r--media-sound/xmms2/xmms2-0.8_p20161122.ebuild291
25 files changed, 2746 insertions, 0 deletions
diff --git a/media-sound/xmms2/Manifest b/media-sound/xmms2/Manifest
new file mode 100644
index 000000000000..8f16a6372c16
--- /dev/null
+++ b/media-sound/xmms2/Manifest
@@ -0,0 +1,28 @@
+AUX xmms2-0.8-audio4-p1.patch 4453 SHA256 910845476e01339cfc4c637b55fa2a2a908cfb45be095efaa7d08146f413209b SHA512 4490e0729b2d048da17b0c9537dbd31de240f918f9be1de808609c473365a2f905b5fb3e6912beb500b668b53121764c171ef7978d4ed842d45578c50c7f78c8 WHIRLPOOL 3fc9f24ae32e86d55eba295808b608ce42b3b24bea1fd13dda7d8a98d35fe7a10662c3eca115f66daba326df2056e48c54519738c4709f3798f7931dfdfe6ae9
+AUX xmms2-0.8-audio4-p2.patch 6191 SHA256 cb682cd935ba39d7ccd131a56712f0234210709d8db2af0b193a3b68d5d9a8f3 SHA512 7e3a443812f6ad3f05bb5cec3ed60a0b1134ce76e32e5123ee8fc86b4da70ec8a26bbfeb62ecc4aee62c9c30efdc929faf82e71bdaa7128f52a265ee6561da25 WHIRLPOOL f026fe348b6d9af082235049d165d70f8f8cdb8494abec31ffadeb05f0280424f8fdc4eb95ce6781f01f6cbcfaf8c35674c5484cb3491f1d38f6b3e64416ddb4
+AUX xmms2-0.8-audio4-p3.patch 11107 SHA256 09161ae6a6a929f4ab7f748c78329c080bcf20c6d173290ccd4329e64d940085 SHA512 cf40f6c1b8b501ec3deb9808836abdf2afd03602d77a783b6be1e667c9c2664f4ca25ad9da8c0249f3aee4562ebc86d8156db0a5504ceb786528c37dc6e07d0c WHIRLPOOL 8e945f7cd4b2f3515fa01bfd065428c0252f9c918d95f0dca4d68974c5c44ad84b399ca5a0313c2eccbfb79f80727a5dae6cd2cfe76cee5471743b34d95116a9
+AUX xmms2-0.8-audio4-p4.patch 10088 SHA256 974966585e1bb963798fd3ff0b74612168786165b8ac949e4d1281f81a1c480f SHA512 a326eecdf6bb207ce367917f63edffa602bf8817ca2471f7ae1f70afbc86559769c91c6bd3477a236bc5061ba8ff92b566074f92a37541bec523195b6a97f71f WHIRLPOOL bffcd4c86a0e84c1365fa43208f67a9f25668d553246aab07eeec24b012f8a0ad97dc80968b7ab3ff9d6dbda4dde80d30a13d1a29c20f8818ec2b9b8c3eda46c
+AUX xmms2-0.8-audio4-p5.patch 5021 SHA256 97f5450828310fb618fed206bafb9a6fc64e94ec1204698a933f2855e15c5bcb SHA512 b6b7ff8fb1f9378c1ded3b56f1d5e4347fa468054d2da5e8862a58e31f1e4233b4cedf52ed6fdbc0121297f8691a7f9aa15ddfd20414bf24f6815ee7e6d1bbac WHIRLPOOL 007598ff2ddecd8e6297e5d25dc8937242385596fdba640319a425d8af4aee8d18d98d959bd22b78e07761281b6ba723bba35395548c588a9b9151b71c62d343
+AUX xmms2-0.8-audio4-p6.patch 3895 SHA256 b8023827abd97cedaaf9a3795638568ba1903b7b5da42e28f8c2a5c1f06534cb SHA512 28ba0b69018c9b36ccf66dfcf88ba11105840eb3e688dc1c7da9a2804cc0bb0335d20c48793c9492aa5fcfee514f576a0bce375b0b42858a37ac192bad40d1a5 WHIRLPOOL dd703b3295a014e60ae15b2d0aad7c134ed5d8b2c586b883734189375b623c1f31e7a53b46b774b66c4338cd4a967bc27f58ce4d2870df1d9120eafe1042f949
+AUX xmms2-0.8-audio4-p7.patch 5263 SHA256 4c8cf20328c5003fdd945e9ededd1d11b917e776eeb04ac19cfa6263fa46b2eb SHA512 b2e3615b0e2a20490ffbc6de307f3dc0cfc87e913170ef6a94f5673f1bd7ba3e92741a04b24068df7a8746dba52dc558b41f59eed67d9f89890825bb125f263d WHIRLPOOL b53e1c94f66f8a093aeeec681a331d9b0b2c478b88534635b005802b635dfd7ef990dc38507cdca1ffe192e6b4ee303a4bf7b79ba192d152268c7faf54edd42b
+AUX xmms2-0.8-cpython.patch 471 SHA256 99f357d96e0e45fa9e1b74b313427c0c09f7a9f881fc7105e9e2cf7fa29d958b SHA512 7beca90f3af10c49399c2b996d7f3b11b2c55232ec2231877c841da31b29b94dfa9dfc2eb91f3529b8a37f9a01c00bc1727af1ba8850fc7d050a94ef841656ca WHIRLPOOL c170784db9ed44837136cce7f6735261caf7443f14a6721e01cc4f2584857cc41e5ce79bb2393b678b6fe9e2c8757d94af9e8eaa3db609e01f14c026e589f8cb
+AUX xmms2-0.8-cython-0.19.1.patch 1726 SHA256 be06ffe3ffa6d78381e0b81426ae192493a73e6131e17b577f2f5842102a5114 SHA512 8ecfc40196bf8643bde54aaaf21197746dcc31930da68deb7dce48ff0285640bd57a7218788e7dde937af434080a7aaf7cf900193e129cc1b4f6a077b53a2494 WHIRLPOOL a94421a30880dbaad8dc7113f0a091f2b6d097b4deb89490b145ac38000dabf7c0db371c5bfd77a3502bb126ecdd1dc698f7c59fbd135cd689f1249cce49233d
+AUX xmms2-0.8-ffmpeg-0.11.patch 638 SHA256 3fccbf6d730f56a88fb570715b424759b7d2767aa0fc51053a75dbf34606947f SHA512 5b54c9284577f57da5b1ab6f51f620fe20a2815cc38dfca2437aaac9424917ddbba2d174576d619d36c18ec5ffa194dcff7333e1e68c27bf8abe48f3c6a464a7 WHIRLPOOL de4e6337292d115cf127ae9aecaed5e4bbb840dbf30eb577a75db95df43e648ba7e5f835ca8a4924c890473df0cb52308319262802dc6c97213053542f23c3cb
+AUX xmms2-0.8-ffmpeg2.patch 455 SHA256 5fa4f735ef74a2de49150520fa3ba62abff9aca2ac7f84d18b51a55e73cd7e53 SHA512 6aa567c3d823780c7fc8951735f59bcbe3345989e077d3ea6d8100acedd3ebf30523f05152fb80827c236ff83674bb47ca0917b5d2331c4d79c4502e41b365a3 WHIRLPOOL 92101bff32090216545a226c2d76f342931a5cfc9478e568b92cae0a3565ee5940e6f532ef9ebcd689af44a85d171486a659d05a449a5f36073592c145458a08
+AUX xmms2-0.8-libav-9-p2.patch 1823 SHA256 107b2c23e71bf06c8d304808cb97fed44776c57d7a0b3600652ea610c162a290 SHA512 fef46159dc8d40ee05d091076e78f5ffa8d1c93ee2e476110fa96f4f52f79c05c5177192828258ab6e4ec75118ea382458546325692110c819a5fed3cf2c198c WHIRLPOOL cf57cd221c0963212d2699f23dd965db7d77d6aaccde44cadc3f6149f29ef43a152ba672900be0c475614b19416713c5b35e3478fd6fd33c38b0e1e543a0c2df
+AUX xmms2-0.8-libav-9.patch 526 SHA256 43bcee24cb163524519d8abc07b2729e20628ef9d25ed21cadae6f6d653baff5 SHA512 2a6218fb8a27c89321c08025c110425ed1deae0f498bca9a9b306f2848c605a964aef05adcb1f3fd006786fda0b88d8a6d701c4fc8834cb7fb0fe561d8f9e5fb WHIRLPOOL 0c06b8bd2fbab37054bc3063f97ec4f8812c9ad324e9655eca8c398c2e58fc13628ffe751328efa17fd4f953b3ced177f4040a406e8c096010b1290d145dd2b4
+AUX xmms2-0.8-memset.patch 685 SHA256 dd85003c15c4ff0e122422b154d4a8fa5f3371ae3673b23a89c77848e43d47d0 SHA512 aa45c8f4e04e7b5edae131ac60baad265d2fdbc6297fc2595d2caedc0205956ae551408ea208daec857d1cb44a1698c663f8fc6dcb16d3f1a998b12380a562e4 WHIRLPOOL 78c4df892814ee857fff81b8c3357c83f932521a5f17c86999dc066e13a7dd7bd406f9521be5dd133ec93e851e7d34cbd5e30a446169543c57011137ead2f42e
+AUX xmms2-0.8-modpug.patch 361 SHA256 b604238fab805b465522e4aba344518a3cf357cf65566f78fa756b32c763c7b8 SHA512 a86b764526a82a719751f0cf2a10f22086f75d5efde6e4a1afd19c6dd4132d8770b7db2d6b46c3c7f0b7ff319ab11bef64a812d5a13164438d7f1a4595ec9f49 WHIRLPOOL 67ac32908653edb5c7914c6787c32012e46d2d0172bd11e92e00f4f3d0009aac102f10b576d154c33ce7d444075d06cc82fbbb0382f9b53d0344bb6275016673
+AUX xmms2-0.8-rtvg.patch 1539 SHA256 a5486f791ee431171c3bf3a813165279f3218b2f2c6293f1e564ef606ddd9fb7 SHA512 b8c6b908f48ab239c2c734452eebd2b9a4a2f4f2b98278bb0951d9a97e0d3df03b5443bc3a6bb92ff3133894d7b6239373b3323251f34c6852eee988aae5205f WHIRLPOOL bf9381f3f6a121f06d1ba3309cd4107e26f39db0f83772cc7d42a6dc85d27ad25f51b2c98be0a304d77e62e06e157c35f7b8304e32761319f11321da787f0696
+AUX xmms2-0.8-samba-4.patch 1125 SHA256 e453c2d3ecea7d95da393fce2d246a3372351cf25a60c0f1dedd61eb0ebf9d38 SHA512 f6a3ef39188b077217becc7317253e7ab652d6bd603bf26239a8398d8de6d34c62415f42baed78720fce9048f2499de90f0cca07d7219f281df8a441b16a7e01 WHIRLPOOL c3d2219eb5aa4979d5319776a14afb2a700d0a6d1e1249005dab057bbfa1e31776daba54812367b5657e8f18631a8ab9d5516c26810ca2c06aa7929f00ebb4e9
+AUX xmms2-0.8DrO_o-waflib-fix-perl.patch 1693 SHA256 92677d5cd31efa55cad5a0c9918b50be274f7de65065c3f491482ee95fb77b92 SHA512 0f7f86cebd0ff75ed53366776f8c93abb54adf5942f53d7424183a4bd6913b73493882d4d3caadba6a959ddf22da0a22fa53d0fc18ce5b8508eb5670482e8c92 WHIRLPOOL a7259c7071f70082f23044743302f96aa403e428fe93f4854f63ac900c7da948ebf1cc1332d8adbfd72a3862e888cb5d6b56481e8ec1e4e299e19c50c14bf34b
+AUX xmms2-0.8_p20161122-be-hash.patch 1075 SHA256 0a5a5bdef85c3169c0b0761b6b3e4b3ae1e27dcf506210501598cfee32c4a7c0 SHA512 051e22907315bb6bda201497e1c2ef84d919fc7d39aefac187b3616c5f6c41e768cdd79cfe197fbadfdda3863f9e9c96b5f72fa07d5e1655451328cde8ba5781 WHIRLPOOL a7e82bd247c7630dabcb95425a2db7b18feeafe90b5e613fce6baa7495bef09699b7dff18e74c902963bb06696f6561f6fe65525c1a1f59f2e3699a3d8bd0080
+AUX xmms2-0.8_p20161122-tarball.patch 2764 SHA256 3de2d3c0cc8cf0a0ca28c4d51082c55fc7fe19839a54b8f2787335ff2f9bd7ba SHA512 5b03d129a55ac14462a68e47ecba29c2817eb83d122a3614c624c743ecc29a7bac066644aa61d5ac74f9cb59808d1a9bac077dc360c507da722c206b948301ac WHIRLPOOL 48567b17881749e0ebb933dd445c663b89ebb005d8e8c5c55ad97edfa3ebb249d69cd8812588a5a62e4272064375447940be04fca6259b9428b543a53954f9a3
+DIST xmms2-0.8DrO_o-949-gca15e830.tar.bz2 1928653 SHA256 58bd62f1e3ca83d4d82ad6854ee769b97238fc1c89967262c0e9e9e20e35092e SHA512 affd7fdd259cdb952e972b62f24ab8eb6afd2c87786254a7ae81adffdcfe1454dcf2fb95811a8b90db74dba84918526fd8c920e11582b36aa48725f293c73edb WHIRLPOOL 438d33793b808dd151b27ac51af9998b819ffc03cbc0ce789d693192f8aa5cab3c48402ef83f2b8fe1442dd9130248f561b1fe466168c0569c2e017ee1a0ede3
+DIST xmms2-0.8DrO_o.tar.bz2 1670726 SHA256 c77e41e7bd5788889d5a2f78331ca8c748b8721bd2e59f36c36ad4c7cae8694a SHA512 478103d80264c0cb32912e828f74d0f5b2f10fe310f530a87ebecda7ca547a69e238cd572788f90bda29494494160d459fa6d1356b4fb87c7a8f0bf02e3b75f8 WHIRLPOOL 741dd85b8c065eea799675588a8d4c389c47fa3dcf129a9fd799bb5da0ffcb1eeffa45cfaca40af7c505908818b5e7960c1a54e947f53358edeb43841f2eaa5c
+EBUILD xmms2-0.8-r4.ebuild 7874 SHA256 471384c64f1a54c2dc421a44c6673f9d18b4b0841ed2459639aa18ba08efa2ad SHA512 529fb2aa5655d0acc7b8c76c50e51e336771eec912dd5b5c3c469c6f32942eab15c1ca6aa9716c06b5103a2e852729b295d1b3f862d4e8e1c3c24918fa7550ae WHIRLPOOL 378209b1ae3bbdbc31c891ee47a92c87bee5fc714854bdec209e9ed3afb66b5d29a2f0063f72c8d5b53c26817c3beeae214e01f461b40a2a1321cec33e0f11a2
+EBUILD xmms2-0.8_p20161122-r1.ebuild 7492 SHA256 ac947dea9d870ed6a876a37bcb222cea492eda3a0adc3f4a08417df77a9313c1 SHA512 a05b1284416709210ed396a95ee66e53687e3ed957c21827d7e9274efa3ba79e4522ede456ce07eb447d366898bfb66f5c056c7d6d110e3593a14535b7e096a1 WHIRLPOOL 147afe919b4e09803f7479caec286f74caa0d6596ec4787bb50da63fd1db20770eea462677b0a6963f90c1e80aed44e8a032451749d9caae77d74e601d577bf8
+EBUILD xmms2-0.8_p20161122.ebuild 7395 SHA256 3606e852697e31ca64d8888441ccad3f270ec4bff3fe0eb80453c8015d62a7ca SHA512 3b1afecead61985d6ff70bf85252fbfba891c07d14cf2557cd992b42a04b69c79d44a48d2a55768d77c2cee85079e5dac132c71d94859f775ce28d593a8acf98 WHIRLPOOL f82ff2cfe21680175049af774a636020d7befc28f70dcfb9305507fcfbc435e8bb44f96b1e6ad869265a68b32f002e2052db7fbfde94d8861f64ac0fd1a0d032
+MISC ChangeLog 6165 SHA256 38f2d2683f2a7fc4c39fa78ee02ebae2589538d80cc195efc5183a157772bf3c SHA512 1c47e67574b722dbc4363c9a5bcf7292bd062b72abb53eb3e20dc7de5e2e4ed6715ddf5110c4aa9f04f66d0364a1cb66f7affee15f6940671a4db24ff713b92d WHIRLPOOL cf953aa3bfd0f1d054773c09ef961d084d8d5466612079a63811b258b31ca59d68dbdb50cd69d4a419309a5bf1d771789f4fd3eb5986ca2368e20320916d3270
+MISC ChangeLog-2015 7596 SHA256 a519587f0ed0529ca29d316c0e958984ccc5c02887219ca49de1d5a69c34e49d SHA512 22539404663febb287ecc813a8655256c2696864e7cd99409a957aa5c665b3a348a3744666621dfa8ce775eda08077b36a0f721f754c42957bb97305625d86a4 WHIRLPOOL a08bedf3739615df0c51931df17507be30792afe66f9353460db786648dbb91504449b30bd4c12a9adc95fbadc42f3bee9f1d85645aafdb511ba9e5b238290d8
+MISC metadata.xml 2711 SHA256 e4aefd014be07da17cabbb1487cf5c0918438988321e7b2c384fe5d809a26946 SHA512 001f334780da23cfc8d3c2ae2ce01e9268b4171d01cdae868f0d67296444ee64d27f0819cf431279269413f22227265dc1ea4dbf87b6ff86b7f00426f70cb044 WHIRLPOOL 8d6cbb8f1f1d9ec1efabc2c96874cc4420b738e7288b3bd7ccd41276fd2b33adfb64fa27418901d39b27359632dfd65d59b815dc5126431f8eb74d86c16ff08c
diff --git a/media-sound/xmms2/files/xmms2-0.8-audio4-p1.patch b/media-sound/xmms2/files/xmms2-0.8-audio4-p1.patch
new file mode 100644
index 000000000000..21ed6492a44d
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-audio4-p1.patch
@@ -0,0 +1,123 @@
+commit 8831bc77d705c03b3f8081de0520dd10afa85c69
+Author: Uli Franke <cls@nebadje.org>
+Date: Tue Jan 17 23:23:46 2012 +0100
+
+ BUG(2509): Avoid unaligned reads in avcodec xform.
+
+diff --git a/src/plugins/avcodec/avcodec.c b/src/plugins/avcodec/avcodec.c
+index fe58fc5..1b4a659 100644
+--- a/src/plugins/avcodec/avcodec.c
++++ b/src/plugins/avcodec/avcodec.c
+@@ -36,6 +36,9 @@ typedef struct {
+ guint buffer_size;
+ gboolean no_demuxer;
+
++ gchar *read_out_buffer;
++ gint read_out_buffer_size;
++
+ guint channels;
+ guint samplerate;
+ xmms_sample_format_t sampleformat;
+@@ -107,6 +110,7 @@ xmms_avcodec_destroy (xmms_xform_t *xform)
+
+ avcodec_close (data->codecctx);
+ av_free (data->codecctx);
++ av_free (data->read_out_buffer);
+
+ g_string_free (data->outbuf, TRUE);
+ g_free (data->buffer);
+@@ -132,6 +136,9 @@ xmms_avcodec_init (xmms_xform_t *xform)
+ data->buffer_size = AVCODEC_BUFFER_SIZE;
+ data->codecctx = NULL;
+
++ data->read_out_buffer = av_malloc (AVCODEC_MAX_AUDIO_FRAME_SIZE);
++ data->read_out_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
++
+ xmms_xform_private_data_set (xform, data);
+
+ avcodec_init ();
+@@ -196,7 +203,7 @@ xmms_avcodec_init (xmms_xform_t *xform)
+ } else {
+ /* A demuxer plugin forgot to give decoder config? */
+ xmms_log_error ("Decoder config data not found!");
+- return FALSE;
++ goto err;
+ }
+ }
+
+@@ -220,7 +227,7 @@ xmms_avcodec_init (xmms_xform_t *xform)
+
+ /* some codecs need to have something read before they set
+ * the samplerate and channels correctly, unfortunately... */
+- if ((ret = xmms_avcodec_read (xform, buf, 42, &error)) > 0) {
++ if ((ret = xmms_avcodec_read (xform, buf, sizeof (buf), &error)) > 0) {
+ g_string_insert_len (data->outbuf, 0, buf, ret);
+ } else {
+ XMMS_DBG ("First read failed, codec is not working...");
+@@ -251,6 +258,9 @@ err:
+ if (data->codecctx) {
+ av_free (data->codecctx);
+ }
++ if (data->read_out_buffer) {
++ av_free (data->read_out_buffer);
++ }
+ g_string_free (data->outbuf, TRUE);
+ g_free (data->extradata);
+ g_free (data);
+@@ -263,8 +273,7 @@ xmms_avcodec_read (xmms_xform_t *xform, xmms_sample_t *buf, gint len,
+ xmms_error_t *error)
+ {
+ xmms_avcodec_data_t *data;
+- char outbuf[AVCODEC_MAX_AUDIO_FRAME_SIZE];
+- gint outbufsize, bytes_read = 0;
++ gint bytes_read = 0;
+ guint size;
+
+ data = xmms_xform_private_data_get (xform);
+@@ -330,9 +339,9 @@ xmms_avcodec_read (xmms_xform_t *xform, xmms_sample_t *buf, gint len,
+ packet.data = data->buffer;
+ packet.size = data->buffer_length;
+
+- outbufsize = sizeof (outbuf);
+- bytes_read = avcodec_decode_audio3 (data->codecctx, (short *) outbuf,
+- &outbufsize, &packet);
++ data->read_out_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
++ bytes_read = avcodec_decode_audio3 (data->codecctx, (short *) data->read_out_buffer,
++ &data->read_out_buffer_size, &packet);
+
+ /* The DTS decoder of ffmpeg is buggy and always returns
+ * the input buffer length, get frame length from header */
+@@ -354,8 +363,8 @@ xmms_avcodec_read (xmms_xform_t *xform, xmms_sample_t *buf, gint len,
+
+ data->buffer_length -= bytes_read;
+
+- if (outbufsize > 0) {
+- g_string_append_len (data->outbuf, outbuf, outbufsize);
++ if (data->read_out_buffer_size > 0) {
++ g_string_append_len (data->outbuf, data->read_out_buffer, data->read_out_buffer_size);
+ }
+
+ size = MIN (data->outbuf->len, len);
+@@ -371,8 +380,7 @@ static gint64
+ xmms_avcodec_seek (xmms_xform_t *xform, gint64 samples, xmms_xform_seek_mode_t whence, xmms_error_t *err)
+ {
+ xmms_avcodec_data_t *data;
+- char outbuf[AVCODEC_MAX_AUDIO_FRAME_SIZE];
+- gint outbufsize, bytes_read = 0;
++ gint bytes_read = 0;
+ gint64 ret = -1;
+
+ g_return_val_if_fail (xform, -1);
+@@ -396,9 +404,9 @@ xmms_avcodec_seek (xmms_xform_t *xform, gint64 samples, xmms_xform_seek_mode_t w
+ packet.data = data->buffer;
+ packet.size = data->buffer_length;
+
+- outbufsize = sizeof (outbuf);
+- bytes_read = avcodec_decode_audio3 (data->codecctx, (short *) outbuf,
+- &outbufsize, &packet);
++ data->read_out_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
++ bytes_read = avcodec_decode_audio3 (data->codecctx, (short *) data->read_out_buffer,
++ &data->read_out_buffer_size, &packet);
+
+ if (bytes_read < 0 || bytes_read > data->buffer_length) {
+ XMMS_DBG ("Error decoding data!");
diff --git a/media-sound/xmms2/files/xmms2-0.8-audio4-p2.patch b/media-sound/xmms2/files/xmms2-0.8-audio4-p2.patch
new file mode 100644
index 000000000000..46b5b1d3b926
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-audio4-p2.patch
@@ -0,0 +1,171 @@
+commit b614459dc1ea353d6c24b4a77c7f92a5577d5bc3
+Author: Uli Franke <cls@nebadje.org>
+Date: Thu Jan 19 11:53:57 2012 +0100
+
+ BUG(2510): Add more bitrates/samplerates to AAC/ALAC.
+
+diff --git a/src/plugins/avcodec/avcodec.c b/src/plugins/avcodec/avcodec.c
+index 1b4a659..b32de4d 100644
+--- a/src/plugins/avcodec/avcodec.c
++++ b/src/plugins/avcodec/avcodec.c
+@@ -60,6 +60,7 @@ static gint xmms_avcodec_read (xmms_xform_t *xform, xmms_sample_t *buf, gint len
+ xmms_error_t *error);
+ static gint64 xmms_avcodec_seek (xmms_xform_t *xform, gint64 samples,
+ xmms_xform_seek_mode_t whence, xmms_error_t *err);
++static xmms_sample_format_t xmms_avcodec_translate_sample_format (enum AVSampleFormat av_sample_format);
+
+ /*
+ * Plugin header
+@@ -168,12 +169,12 @@ xmms_avcodec_init (xmms_xform_t *xform)
+ data->channels = ret;
+ }
+
+- /* bitrate required for WMA files */
++ /* Required by WMA xform. */
+ xmms_xform_auxdata_get_int (xform,
+ "bitrate",
+ &data->bitrate);
+
+- /* ALAC and MAC require bits per sample field to be 16 */
++ /* Required by tta and apefile xforms. */
+ xmms_xform_auxdata_get_int (xform,
+ "samplebits",
+ &data->samplebits);
+@@ -238,12 +239,17 @@ xmms_avcodec_init (xmms_xform_t *xform)
+
+ data->samplerate = data->codecctx->sample_rate;
+ data->channels = data->codecctx->channels;
++ data->sampleformat = xmms_avcodec_translate_sample_format (data->codecctx->sample_fmt);
++ if (data->sampleformat == XMMS_SAMPLE_FORMAT_UNKNOWN) {
++ avcodec_close (data->codecctx);
++ goto err;
++ }
+
+ xmms_xform_outdata_type_add (xform,
+ XMMS_STREAM_TYPE_MIMETYPE,
+ "audio/pcm",
+ XMMS_STREAM_TYPE_FMT_FORMAT,
+- XMMS_SAMPLE_FORMAT_S16,
++ data->sampleformat,
+ XMMS_STREAM_TYPE_FMT_CHANNELS,
+ data->channels,
+ XMMS_STREAM_TYPE_FMT_SAMPLERATE,
+@@ -428,3 +434,23 @@ xmms_avcodec_seek (xmms_xform_t *xform, gint64 samples, xmms_xform_seek_mode_t w
+
+ return ret;
+ }
++
++static xmms_sample_format_t
++xmms_avcodec_translate_sample_format (enum AVSampleFormat av_sample_format)
++{
++ switch (av_sample_format) {
++ case AV_SAMPLE_FMT_U8:
++ return XMMS_SAMPLE_FORMAT_U8;
++ case AV_SAMPLE_FMT_S16:
++ return XMMS_SAMPLE_FORMAT_S16;
++ case AV_SAMPLE_FMT_S32:
++ return XMMS_SAMPLE_FORMAT_S32;
++ case AV_SAMPLE_FMT_FLT:
++ return XMMS_SAMPLE_FORMAT_FLOAT;
++ case AV_SAMPLE_FMT_DBL:
++ return XMMS_SAMPLE_FORMAT_DOUBLE;
++ default:
++ XMMS_DBG ("AVSampleFormat (%i) not supported.", av_sample_format);
++ return XMMS_SAMPLE_FORMAT_UNKNOWN;
++ }
++}
+diff --git a/src/plugins/mp4/mp4.c b/src/plugins/mp4/mp4.c
+index 7c915c4..3ee9357 100644
+--- a/src/plugins/mp4/mp4.c
++++ b/src/plugins/mp4/mp4.c
+@@ -186,9 +186,6 @@ xmms_mp4_init (xmms_xform_t *xform)
+ xmms_xform_auxdata_set_bin (xform, "decoder_config", tmpbuf, tmpbuflen);
+ g_free (tmpbuf);
+
+- /* This is only for ALAC to set 16-bit samples, ignored for AAC */
+- xmms_xform_auxdata_set_int (xform, "samplebits", 16);
+-
+ xmms_mp4_get_mediainfo (xform);
+
+ XMMS_DBG ("MP4 demuxer inited successfully!");
+@@ -288,7 +285,7 @@ xmms_mp4_get_mediainfo (xmms_xform_t *xform)
+ data = xmms_xform_private_data_get (xform);
+ g_return_if_fail (data);
+
+- if ((temp = mp4ff_get_sample_rate (data->mp4ff, data->track)) >= 0) {
++ if ((temp = mp4ff_get_sample_rate (data->mp4ff, data->track)) > 0) {
+ glong srate = temp;
+
+ if ((temp = mp4ff_get_track_duration_use_offsets (data->mp4ff,
+@@ -492,7 +489,7 @@ xmms_mp4_get_track (xmms_xform_t *xform, mp4ff_t *infile)
+ case 0x69: /* MPEG-2 audio */
+ case 0x6B: /* MPEG-1 audio */
+ continue;
+- case 0xff:
++ case 0xff: /* ALAC */
+ chans = mp4ff_get_channel_count (infile, i);
+ rate = mp4ff_get_sample_rate (infile, i);
+ if (chans <= 0 || rate <= 0) {
+diff --git a/src/plugins/mp4/mp4ff/README.xmms2 b/src/plugins/mp4/mp4ff/README.xmms2
+index c2737c5..8021618 100644
+--- a/src/plugins/mp4/mp4ff/README.xmms2
++++ b/src/plugins/mp4/mp4ff/README.xmms2
+@@ -12,3 +12,4 @@ Changes:
+ * Add value_length variable to tag type and use it when adding new item-value pairs,
+ necessary for cover art since it's binary data and can't be handled as a string
+ * Add support for Apple Lossless audio files
++ * Add a workaround for supporting higher samplerates.
+diff --git a/src/plugins/mp4/mp4ff/mp4ff.c b/src/plugins/mp4/mp4ff/mp4ff.c
+index ee7f7fb..b6f0a37 100644
+--- a/src/plugins/mp4/mp4ff/mp4ff.c
++++ b/src/plugins/mp4/mp4ff/mp4ff.c
+@@ -32,6 +32,8 @@
+ #include <string.h>
+ #include "mp4ffint.h"
+
++static uint32_t mp4ff_normalize_flawed_sample_rate (uint16_t samplerate);
++
+ mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f)
+ {
+ mp4ff_t *ff = malloc(sizeof(mp4ff_t));
+@@ -304,12 +306,39 @@ int32_t mp4ff_num_samples(const mp4ff_t *f, const int32_t track)
+ return total;
+ }
+
++static uint32_t
++mp4ff_normalize_flawed_sample_rate (uint16_t samplerate)
++{
++ /* A list of common rates can be found at
++ * http://en.wikipedia.org/wiki/Sampling_rate */
++ uint32_t rates[] = {8000, 11025, 16000, 22050, 32000, 44056, 44100,
++ 47250, 48000, 50000, 50400, 88200, 96000, 176400,
++ 192000, 352800, 384000, 0};
++ uint32_t* rate;
++
++ /* First check standard rates. */
++ for (rate = rates; *rate; rate++) {
++ if (*rate == samplerate) {
++ return *rate;
++ }
++ }
++
++ /* No standard rates matching - check if sample rate got truncated when
++ * added to MP4 container */
++ for (rate = rates; *rate; rate++) {
++ if ((*rate & 0x0000FFFF) == samplerate) {
++ return *rate;
++ }
++ }
+
++ /* Failed to find a standard rate - we give up returning the original rate */
++ return samplerate;
++}
+
+
+ uint32_t mp4ff_get_sample_rate(const mp4ff_t *f, const int32_t track)
+ {
+- return f->track[track]->sampleRate;
++ return mp4ff_normalize_flawed_sample_rate (f->track[track]->sampleRate);
+ }
+
+ uint32_t mp4ff_get_channel_count(const mp4ff_t * f,const int32_t track)
diff --git a/media-sound/xmms2/files/xmms2-0.8-audio4-p3.patch b/media-sound/xmms2/files/xmms2-0.8-audio4-p3.patch
new file mode 100644
index 000000000000..a9145c0d3d26
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-audio4-p3.patch
@@ -0,0 +1,388 @@
+commit 4d0682030e20a8ed218f4ff924554f93d276d9ee
+Author: Anthony Garcia <lagg@lavabit.com>
+Date: Thu Apr 22 16:59:37 2010 -0700
+
+ OTHER: Cleanup
+
+ Re-enabled nellymoser (ffmpeg appears to be okay with it now)
+
+ Fixed possible infinite loop in the code that handles the data (if any)
+ between the header and tag data.
+
+diff --git a/src/plugins/avcodec/avcodec.c b/src/plugins/avcodec/avcodec.c
+index 6c9fea8..5554056 100644
+--- a/src/plugins/avcodec/avcodec.c
++++ b/src/plugins/avcodec/avcodec.c
+@@ -90,7 +90,7 @@ xmms_avcodec_plugin_setup (xmms_xform_plugin_t *xform_plugin)
+ xmms_magic_add ("A/52 (AC-3) header", "audio/x-ffmpeg-ac3",
+ "0 beshort 0x0b77", NULL);
+ xmms_magic_add ("DTS header", "audio/x-ffmpeg-dca",
+- "0 belong 0x7ffe8001", NULL);
++ "0 belong 0x7ffe8001", NULL);
+
+ xmms_xform_plugin_indata_add (xform_plugin,
+ XMMS_STREAM_TYPE_MIMETYPE,
+@@ -197,7 +197,8 @@ xmms_avcodec_init (xmms_xform_t *xform)
+ !strcmp (data->codec_id, "adpcm_swf") ||
+ !strcmp (data->codec_id, "pcm_s16le") ||
+ !strcmp (data->codec_id, "ac3") ||
+- !strcmp (data->codec_id, "dca")) {
++ !strcmp (data->codec_id, "dca") ||
++ !strcmp (data->codec_id, "nellymoser")) {
+ /* number 1024 taken from libavformat raw.c RAW_PACKET_SIZE */
+ data->extradata = g_malloc0 (1024);
+ data->extradata_size = 1024;
+diff --git a/src/plugins/flv/flv.c b/src/plugins/flv/flv.c
+index 440010c..266fea6 100644
+--- a/src/plugins/flv/flv.c
++++ b/src/plugins/flv/flv.c
+@@ -25,29 +25,41 @@
+ * and other info, then data
+ */
+ #define FLV_TAG_SIZE 11
+-/* random constant */
+ #define FLV_CHUNK_SIZE 4096
+
+-/* let libavcodec take care of swapping sample bytes */
+-static const gchar *mime_pcm_s16le = "audio/x-ffmpeg-pcm_s16le";
+-static const gchar *fmt_mime[11] = {
+- /* Supported when samples are 8 bit
+- * (otherwise there's no way of knowing endianness)
+- */
+- "audio/pcm",
+- "audio/x-ffmpeg-adpcm_swf",
+- "audio/mpeg",
+- /* if bps is 8 bit u8
+- * if bps is 16 bit sle16
+- */
+- "audio/pcm",
+- /* libavcodec can't handle nelly without dying yet */
+- /*"audio/x-ffmpeg-nellymoser",
+- "audio/x-ffmpeg-nellymoser",
+- "audio/x-ffmpeg-nellymoser",*/
+- "", "", "",
+- "", "", "",
+- "audio/aac"
++typedef enum {
++ /* Only u8 bit samples since
++ there's no way to determine endianness
++ */
++ CODEC_PCM_HOST,
++ CODEC_ADPCM,
++ CODEC_MP3,
++ /* 8 bps: unsigned
++ 16 bps: signed
++ */
++ CODEC_PCM_LE,
++ CODEC_NELLYMOSER_16K,
++ CODEC_NELLYMOSER_8K,
++ /* Uses the sample rate in
++ the tag as normal
++ */
++ CODEC_NELLYMOSER,
++ CODEC_AAC = 10
++} xmms_flv_codec_id;
++
++struct xmms_flv_codec_table {
++ xmms_flv_codec_id id;
++ const gchar *mime;
++} static flv_codecs[] = {
++ {CODEC_PCM_HOST, "audio/pcm"},
++ {CODEC_ADPCM, "audio/x-ffmpeg-adpcm_swf"},
++ {CODEC_MP3, "audio/mpeg"},
++ /* Will be audio/x-ffmpeg-pcm_s16le if bps is 16 */
++ {CODEC_PCM_LE, "audio/pcm"},
++ {CODEC_NELLYMOSER_16K, "audio/x-ffmpeg-nellymoser"},
++ {CODEC_NELLYMOSER_8K, "audio/x-ffmpeg-nellymoser"},
++ {CODEC_NELLYMOSER, "audio/x-ffmpeg-nellymoser"},
++ {CODEC_AAC, "audio/aac"}
+ };
+
+ typedef struct {
+@@ -111,23 +123,26 @@ static gboolean
+ xmms_flv_init (xmms_xform_t *xform)
+ {
+ xmms_sample_format_t bps;
+- gint readret;
++ gint readret, i;
+ guint8 channels, flags, format;
+- guint8 header[FLV_TAG_SIZE + 5];
+- const gchar *mime;
++ guint8 header[FLV_TAG_SIZE + 1];
+ guint32 dataoffset, samplerate;
+ xmms_error_t err;
+ xmms_flv_data_t *flvdata;
++ struct xmms_flv_codec_table *codec = NULL;
++
++ flvdata = g_new0 (xmms_flv_data_t, 1);
++ xmms_xform_private_data_set (xform, flvdata);
+
+ readret = xmms_xform_read (xform, header, FLV_HDR_SIZE, &err);
+ if (readret != FLV_HDR_SIZE) {
+ xmms_log_error ("Header read error");
+- return FALSE;
++ goto init_err;
+ }
+
+ if ((header[4] & HAS_AUDIO) != HAS_AUDIO) {
+ xmms_log_error ("FLV has no audio stream");
+- return FALSE;
++ goto init_err;
+ }
+
+ dataoffset = get_be32 (&header[5]) - FLV_HDR_SIZE;
+@@ -140,7 +155,7 @@ xmms_flv_init (xmms_xform_t *xform)
+ dataoffset : FLV_HDR_SIZE, &err);
+ if (readret <= 0) {
+ xmms_log_error ("Error reading header:tag body gap");
+- return FALSE;
++ goto init_err;
+ }
+
+ dataoffset -= readret;
+@@ -148,86 +163,99 @@ xmms_flv_init (xmms_xform_t *xform)
+
+ if (next_audio_tag (xform) <= 0) {
+ xmms_log_error ("Can't find first audio tag");
+- return FALSE;
++ goto init_err;
+ }
+
+- if (xmms_xform_peek (xform, header, FLV_TAG_SIZE + 5, &err) < FLV_TAG_SIZE + 5) {
++ if (xmms_xform_read (xform, header, FLV_TAG_SIZE + 1, &err) < FLV_TAG_SIZE + 1) {
+ xmms_log_error ("Can't read first audio tag");
+- return FALSE;
++ goto init_err;
+ }
+
+- flags = header[FLV_TAG_SIZE + 4];
++ flags = header[11];
+ XMMS_DBG ("Audio flags: %X", flags);
+
+- switch (flags&12) {
+- case 0: samplerate = 5512; break;
+- case 4: samplerate = 11025; break;
+- case 8: samplerate = 22050; break;
+- case 12: samplerate = 44100; break;
+- default: samplerate = 8000; break;
++ format = flags >> 4;
++ for (i = 0; i < G_N_ELEMENTS (flv_codecs); i++) {
++ if (flv_codecs[i].id == format) {
++ codec = &flv_codecs[i];
++ break;
++ }
+ }
+
+- if (flags&2) {
+- bps = XMMS_SAMPLE_FORMAT_S16;
++ if (flags & 1) {
++ channels = 2;
+ } else {
+- bps = XMMS_SAMPLE_FORMAT_U8;
++ channels = 1;
+ }
+
+- if (flags&1) {
+- channels = 2;
++ if (flags & 2) {
++ bps = XMMS_SAMPLE_FORMAT_S16;
+ } else {
+- channels = 1;
++ bps = XMMS_SAMPLE_FORMAT_U8;
+ }
+
+- format = flags >> 4;
+- mime = (format <= 10)? fmt_mime[format] : NULL;
+- switch (format) {
+- case 0:
+- /* If the flv has an HE PCM audio stream, the
+- * samples must be unsigned and 8 bits long
+- */
+- if (bps != XMMS_SAMPLE_FORMAT_U8) {
+- xmms_log_error ("Only u8 HE PCM is supported");
+- return FALSE;
+- }
+- break;
+- case 3:
+- if (bps == XMMS_SAMPLE_FORMAT_S16) {
+- mime = mime_pcm_s16le;
+- }
+- break;
++ switch ((flags & 12) >> 2) {
++ case 0: samplerate = 5512; break;
++ case 1: samplerate = 11025; break;
++ case 2: samplerate = 22050; break;
++ case 3: samplerate = 44100; break;
++ default: samplerate = 8000; break;
+ }
+
+- if (mime && *mime) {
+- flvdata = g_new0 (xmms_flv_data_t, 1);
++ if (codec) {
++ switch (codec->id) {
++ case CODEC_PCM_HOST:
++ if (bps != XMMS_SAMPLE_FORMAT_U8) {
++ xmms_log_error ("Only u8 HE PCM is supported");
++ goto init_err;
++ }
++ break;
++ case CODEC_PCM_LE:
++ if (bps == XMMS_SAMPLE_FORMAT_S16) {
++ codec->mime = "audio/x-ffmpeg-pcm_s16le";
++ }
++ break;
++ case CODEC_NELLYMOSER_16K:
++ samplerate = 16000;
++ break;
++ case CODEC_NELLYMOSER_8K:
++ samplerate = 8000;
++ break;
++ default:
++ break;
++ }
++
+ flvdata->format = format;
++ flvdata->last_datasize = get_be24 (&header[1]) - 1;
+
+ XMMS_DBG ("Rate: %d, bps: %d, channels: %d", samplerate,
+ bps, channels);
+
+- xmms_xform_private_data_set (xform, flvdata);
+ xmms_xform_outdata_type_add (xform,
+ XMMS_STREAM_TYPE_MIMETYPE,
+- mime,
+- XMMS_STREAM_TYPE_FMT_SAMPLERATE,
+- samplerate,
+- XMMS_STREAM_TYPE_FMT_FORMAT,
+- bps,
+- XMMS_STREAM_TYPE_FMT_CHANNELS,
+- channels,
+- XMMS_STREAM_TYPE_END);
++ codec->mime,
++ XMMS_STREAM_TYPE_FMT_SAMPLERATE,
++ samplerate,
++ XMMS_STREAM_TYPE_FMT_FORMAT,
++ bps,
++ XMMS_STREAM_TYPE_FMT_CHANNELS,
++ channels,
++ XMMS_STREAM_TYPE_END);
+ return TRUE;
+ } else {
+ xmms_log_error ("Unsupported audio format");
+- return FALSE;
+ }
++
++init_err:
++ g_free (flvdata);
++ return FALSE;
+ }
+
+ static gint
+ xmms_flv_read (xmms_xform_t *xform, xmms_sample_t *buf, gint len, xmms_error_t *err)
+ {
+- gint ret = 0, thismuch = FLV_TAG_SIZE + 5;
+- guint8 header[FLV_TAG_SIZE + 6], gap = 1;
++ gint ret = 0, thismuch = FLV_TAG_SIZE + 1;
++ guint8 header[FLV_TAG_SIZE + 1];
+ xmms_flv_data_t *data = NULL;
+
+ data = xmms_xform_private_data_get (xform);
+@@ -236,12 +264,8 @@ xmms_flv_read (xmms_xform_t *xform, xmms_sample_t *buf, gint len, xmms_error_t *
+ xmms_xform_auxdata_barrier (xform);
+ ret = next_audio_tag (xform);
+ if (ret > 0) {
+- if (data->format == 10) {
+- thismuch++;
+- gap++;
+- }
+ if (xmms_xform_read (xform, header, thismuch, err) == thismuch) {
+- data->last_datasize = get_be24 (&header[5]) - gap;
++ data->last_datasize = get_be24 (&header[1]) - 1;
+ } else {
+ xmms_log_error ("Need %d bytes", thismuch);
+ return -1;
+@@ -280,40 +304,51 @@ xmms_flv_destroy (xmms_xform_t *xform)
+ static gint
+ next_audio_tag (xmms_xform_t *xform)
+ {
+- guint8 header[FLV_TAG_SIZE + 4];
++ guint8 header[FLV_TAG_SIZE];
+ guint8 dumb[FLV_CHUNK_SIZE];
+ gint ret = 0;
+ xmms_error_t err;
+- guint32 datasize = 0;
++ xmms_flv_data_t *data;
++
++ data = xmms_xform_private_data_get (xform);
+
+ do {
+- /* there's a last 4 bytes at the end of an FLV giving the final
+- * tag's size, this isn't an error
+- */
+- ret = xmms_xform_peek (xform, header, FLV_TAG_SIZE + 4, &err);
+- if ((ret < FLV_TAG_SIZE) && (ret > -1)) {
+- ret = 0;
+- break;
+- } else if (ret == -1) {
+- xmms_log_error ("%s", xmms_error_message_get (&err));
+- break;
+- }
++ /* If > 0 assume we're in the middle of a tag's data */
++ if (!data->last_datasize) {
++ /* There are 4 bytes before an actual tag giving
++ the previous tag's size. The first size in an
++ flv is always 0.
++ */
++ if (xmms_xform_read (xform, header, 4, &err) != 4) {
++ xmms_log_error ("Couldn't read last tag size");
++ return -1;
++ }
+
+- if (header[4] == 8) {
+- /* woo audio tag! */
+- break;
+- }
++ ret = xmms_xform_peek (xform, header, FLV_TAG_SIZE, &err);
++ if ((ret < FLV_TAG_SIZE) && (ret > -1)) {
++ return 0;
++ } else if (ret == -1) {
++ xmms_log_error ("%s", xmms_error_message_get (&err));
++ return ret;
++ }
++
++ if (header[0] == 8) {
++ /* woo audio tag! */
++ break;
++ }
+
+- ret = xmms_xform_read (xform, header, FLV_TAG_SIZE + 4, &err);
+- if (ret <= 0) { return ret; }
++ if ((ret = xmms_xform_read (xform, header, FLV_TAG_SIZE, &err)) <= 0) {
++ return ret;
++ }
+
+- datasize = get_be24 (&header[5]);
++ data->last_datasize = get_be24 (&header[1]);
++ }
+
+- while (datasize) {
++ while (data->last_datasize) {
+ ret = xmms_xform_read (xform, dumb,
+- (datasize < FLV_CHUNK_SIZE) ?
+- datasize : FLV_CHUNK_SIZE,
+- &err);
++ (data->last_datasize < FLV_CHUNK_SIZE) ?
++ data->last_datasize : FLV_CHUNK_SIZE,
++ &err);
+ if (ret == 0) {
+ xmms_log_error ("Data field short!");
+ break;
+@@ -323,7 +358,7 @@ next_audio_tag (xmms_xform_t *xform)
+ break;
+ }
+
+- datasize -= ret;
++ data->last_datasize -= ret;
+ }
+
+ } while (ret);
diff --git a/media-sound/xmms2/files/xmms2-0.8-audio4-p4.patch b/media-sound/xmms2/files/xmms2-0.8-audio4-p4.patch
new file mode 100644
index 000000000000..552f202df19d
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-audio4-p4.patch
@@ -0,0 +1,296 @@
+commit 4198d9bf5dff517740ed51b22313367f156107e1
+Author: Erik Massop <e.massop@hccnet.nl>
+Date: Sun Dec 22 17:19:30 2013 +0100
+
+ OTHER: Split xmms_avcodec_read, remove some duplicate code
+
+diff --git a/src/plugins/avcodec/avcodec.c b/src/plugins/avcodec/avcodec.c
+index 5b9b606..eed7964 100644
+--- a/src/plugins/avcodec/avcodec.c
++++ b/src/plugins/avcodec/avcodec.c
+@@ -57,6 +57,9 @@ typedef struct {
+ static gboolean xmms_avcodec_plugin_setup (xmms_xform_plugin_t *xform_plugin);
+ static gboolean xmms_avcodec_init (xmms_xform_t *xform);
+ static void xmms_avcodec_destroy (xmms_xform_t *xform);
++static gint xmms_avcodec_internal_read_some (xmms_xform_t *xform, xmms_avcodec_data_t *data, xmms_error_t *error);
++static gint xmms_avcodec_internal_decode_some (xmms_avcodec_data_t *data);
++static void xmms_avcodec_internal_append (xmms_avcodec_data_t *data);
+ static gint xmms_avcodec_read (xmms_xform_t *xform, xmms_sample_t *buf, gint len,
+ xmms_error_t *error);
+ static gint64 xmms_avcodec_seek (xmms_xform_t *xform, gint64 samples,
+@@ -281,101 +284,24 @@ xmms_avcodec_read (xmms_xform_t *xform, xmms_sample_t *buf, gint len,
+ xmms_error_t *error)
+ {
+ xmms_avcodec_data_t *data;
+- gint bytes_read = 0;
+ guint size;
+
+ data = xmms_xform_private_data_get (xform);
+ g_return_val_if_fail (data, -1);
+
+- size = MIN (data->outbuf->len, len);
+- while (size == 0) {
+- AVPacket packet;
+- av_init_packet (&packet);
++ while (0 == (size = MIN (data->outbuf->len, len))) {
++ gint res;
+
+ if (data->no_demuxer || data->buffer_length == 0) {
+- gint read_total;
+-
+- bytes_read = xmms_xform_read (xform,
+- (gchar *) (data->buffer + data->buffer_length),
+- data->buffer_size - data->buffer_length,
+- error);
+-
+- if (bytes_read < 0) {
+- XMMS_DBG ("Error while reading data");
+- return bytes_read;
+- } else if (bytes_read == 0) {
+- XMMS_DBG ("EOF");
+- return 0;
+- }
+-
+- read_total = bytes_read;
+-
+- /* If we have a demuxer plugin, make sure we read the whole packet */
+- while (read_total == data->buffer_size && !data->no_demuxer) {
+- /* multiply the buffer size and try to read again */
+- data->buffer = g_realloc (data->buffer, data->buffer_size * 2);
+- bytes_read = xmms_xform_read (xform,
+- (gchar *) data->buffer +
+- data->buffer_size,
+- data->buffer_size,
+- error);
+- data->buffer_size *= 2;
+-
+- if (bytes_read < 0) {
+- XMMS_DBG ("Error while reading data");
+- return bytes_read;
+- }
+-
+- read_total += bytes_read;
+-
+- if (read_total < data->buffer_size) {
+- /* finally double the buffer size for performance reasons, the
+- * hotspot handling likes to fit two frames in the buffer */
+- data->buffer = g_realloc (data->buffer, data->buffer_size * 2);
+- data->buffer_size *= 2;
+- XMMS_DBG ("Reallocated avcodec internal buffer to be %d bytes",
+- data->buffer_size);
+-
+- break;
+- }
+- }
+-
+- /* Update the buffer length */
+- data->buffer_length += read_total;
+- }
+-
+- packet.data = data->buffer;
+- packet.size = data->buffer_length;
+-
+- data->read_out_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+- bytes_read = avcodec_decode_audio3 (data->codecctx, (short *) data->read_out_buffer,
+- &data->read_out_buffer_size, &packet);
++ gint bytes_read;
+
+- /* The DTS decoder of ffmpeg is buggy and always returns
+- * the input buffer length, get frame length from header */
+- if (!strcmp (data->codec_id, "dca") && bytes_read > 0) {
+- bytes_read = ((int)data->buffer[5] << 12) |
+- ((int)data->buffer[6] << 4) |
+- ((int)data->buffer[7] >> 4);
+- bytes_read = (bytes_read & 0x3fff) + 1;
++ bytes_read = xmms_avcodec_internal_read_some (xform, data, error);
++ if (bytes_read <= 0) { return bytes_read; }
+ }
+
+- if (bytes_read < 0 || bytes_read > data->buffer_length) {
+- XMMS_DBG ("Error decoding data!");
+- return -1;
+- } else if (bytes_read != data->buffer_length) {
+- g_memmove (data->buffer,
+- data->buffer + bytes_read,
+- data->buffer_length - bytes_read);
+- }
+-
+- data->buffer_length -= bytes_read;
+-
+- if (data->read_out_buffer_size > 0) {
+- g_string_append_len (data->outbuf, data->read_out_buffer, data->read_out_buffer_size);
+- }
+-
+- size = MIN (data->outbuf->len, len);
++ res = xmms_avcodec_internal_decode_some (data);
++ if (res < 0) { return res; }
++ if (res > 0) { xmms_avcodec_internal_append (data); }
+ }
+
+ memcpy (buf, data->outbuf->str, size);
+@@ -388,7 +314,6 @@ static gint64
+ xmms_avcodec_seek (xmms_xform_t *xform, gint64 samples, xmms_xform_seek_mode_t whence, xmms_error_t *err)
+ {
+ xmms_avcodec_data_t *data;
+- gint bytes_read = 0;
+ gint64 ret = -1;
+
+ g_return_val_if_fail (xform, -1);
+@@ -406,23 +331,11 @@ xmms_avcodec_seek (xmms_xform_t *xform, gint64 samples, xmms_xform_seek_mode_t w
+
+ /* The buggy ape decoder doesn't flush buffers, so we need to finish decoding
+ * the frame before seeking to avoid segfaults... this hack sucks */
++ /* FIXME: Is ^^^ still true? */
+ while (data->buffer_length > 0) {
+- AVPacket packet;
+- av_init_packet (&packet);
+- packet.data = data->buffer;
+- packet.size = data->buffer_length;
+-
+- data->read_out_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+- bytes_read = avcodec_decode_audio3 (data->codecctx, (short *) data->read_out_buffer,
+- &data->read_out_buffer_size, &packet);
+-
+- if (bytes_read < 0 || bytes_read > data->buffer_length) {
+- XMMS_DBG ("Error decoding data!");
++ if (xmms_avcodec_internal_decode_some (data) < 0) {
+ return -1;
+ }
+-
+- data->buffer_length -= bytes_read;
+- g_memmove (data->buffer, data->buffer + bytes_read, data->buffer_length);
+ }
+
+ ret = xmms_xform_seek (xform, samples, whence, err);
+@@ -456,3 +369,131 @@ xmms_avcodec_translate_sample_format (enum AVSampleFormat av_sample_format)
+ return XMMS_SAMPLE_FORMAT_UNKNOWN;
+ }
+ }
++
++/*
++Read some data from our source of data to data->buffer, updating buffer_length
++and buffer_size as needed.
++
++Returns: on error: negative
++ on EOF: zero
++ otherwise: number of bytes read.
++*/
++static gint
++xmms_avcodec_internal_read_some (xmms_xform_t *xform,
++ xmms_avcodec_data_t *data,
++ xmms_error_t *error)
++{
++ gint bytes_read, read_total;
++
++ bytes_read = xmms_xform_read (xform,
++ (gchar *) (data->buffer + data->buffer_length),
++ data->buffer_size - data->buffer_length,
++ error);
++
++ if (bytes_read < 0) {
++ XMMS_DBG ("Error while reading data");
++ return bytes_read;
++ } else if (bytes_read == 0) {
++ XMMS_DBG ("EOF");
++ return 0;
++ }
++
++ read_total = bytes_read;
++
++ /* If we have a demuxer plugin, make sure we read the whole packet */
++ while (read_total == data->buffer_size && !data->no_demuxer) {
++ /* multiply the buffer size and try to read again */
++ data->buffer = g_realloc (data->buffer, data->buffer_size * 2);
++ bytes_read = xmms_xform_read (xform,
++ (gchar *) data->buffer +
++ data->buffer_size,
++ data->buffer_size,
++ error);
++ data->buffer_size *= 2;
++
++ if (bytes_read < 0) {
++ XMMS_DBG ("Error while reading data");
++ return bytes_read;
++ }
++
++ read_total += bytes_read;
++
++ if (read_total < data->buffer_size) {
++ /* finally double the buffer size for performance reasons, the
++ * hotspot handling likes to fit two frames in the buffer */
++ data->buffer = g_realloc (data->buffer, data->buffer_size * 2);
++ data->buffer_size *= 2;
++ XMMS_DBG ("Reallocated avcodec internal buffer to be %d bytes",
++ data->buffer_size);
++
++ break;
++ }
++ }
++
++ /* Update the buffer length */
++ data->buffer_length += read_total;
++
++ return read_total;
++}
++
++/*
++Decode some data from data->buffer[0..data->buffer_length-1] to
++data->read_out_buffer. Number of bytes in data->read_out_buffer
++is stored in data->read_out_buffer_size.
++
++Returns: on error: negative
++ on no new data produced: zero
++ otherwise: positive
++
++FIXME: data->buffer should be at least data->buffer_length +
++FF_INPUT_BUFFER_PADDING_SIZE long.
++*/
++static gint
++xmms_avcodec_internal_decode_some (xmms_avcodec_data_t *data)
++{
++ gint bytes_read = 0;
++ AVPacket packet;
++
++ av_init_packet (&packet);
++ packet.data = data->buffer;
++ packet.size = data->buffer_length;
++
++ data->read_out_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
++ bytes_read = avcodec_decode_audio3 (data->codecctx,
++ (short *) data->read_out_buffer,
++ &data->read_out_buffer_size, &packet);
++
++ /* The DTS decoder of ffmpeg is buggy and always returns
++ * the input buffer length, get frame length from header */
++ /* FIXME: Is ^^^^ still true? */
++ if (!strcmp (data->codec_id, "dca") && bytes_read > 0) {
++ bytes_read = ((int)data->buffer[5] << 12) |
++ ((int)data->buffer[6] << 4) |
++ ((int)data->buffer[7] >> 4);
++ bytes_read = (bytes_read & 0x3fff) + 1;
++ }
++
++ if (bytes_read < 0 || bytes_read > data->buffer_length) {
++ XMMS_DBG ("Error decoding data!");
++ return -1;
++ }
++
++ if (bytes_read < data->buffer_length) {
++ data->buffer_length -= bytes_read;
++ g_memmove (data->buffer,
++ data->buffer + bytes_read,
++ data->buffer_length);
++ } else {
++ data->buffer_length = 0;
++ }
++
++ return data->read_out_buffer_size;
++}
++
++static void
++xmms_avcodec_internal_append (xmms_avcodec_data_t *data)
++{
++ g_string_append_len (data->outbuf,
++ (gchar *) data->read_out_buffer,
++ data->read_out_buffer_size);
++}
diff --git a/media-sound/xmms2/files/xmms2-0.8-audio4-p5.patch b/media-sound/xmms2/files/xmms2-0.8-audio4-p5.patch
new file mode 100644
index 000000000000..8ed5bb4a24a5
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-audio4-p5.patch
@@ -0,0 +1,154 @@
+commit d44312fb14bde0ab47ee6de1b3fe7435d4a97c99
+Author: Erik Massop <e.massop@hccnet.nl>
+Date: Sun Dec 22 20:01:18 2013 +0100
+
+ BUG(2572): Use avcodec_decode_audio4
+
+diff --git a/src/plugins/avcodec/avcodec.c b/src/plugins/avcodec/avcodec.c
+index 266a607..a41a675 100644
+--- a/src/plugins/avcodec/avcodec.c
++++ b/src/plugins/avcodec/avcodec.c
+@@ -37,8 +37,7 @@ typedef struct {
+ guint buffer_size;
+ gboolean no_demuxer;
+
+- gchar *read_out_buffer;
+- gint read_out_buffer_size;
++ AVFrame *read_out_frame;
+
+ guint channels;
+ guint samplerate;
+@@ -125,7 +124,7 @@ xmms_avcodec_destroy (xmms_xform_t *xform)
+
+ avcodec_close (data->codecctx);
+ av_free (data->codecctx);
+- av_free (data->read_out_buffer);
++ avcodec_free_frame (&data->read_out_frame);
+
+ g_string_free (data->outbuf, TRUE);
+ g_free (data->buffer);
+@@ -151,8 +150,7 @@ xmms_avcodec_init (xmms_xform_t *xform)
+ data->buffer_size = AVCODEC_BUFFER_SIZE;
+ data->codecctx = NULL;
+
+- data->read_out_buffer = av_malloc (AVCODEC_MAX_AUDIO_FRAME_SIZE);
+- data->read_out_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
++ data->read_out_frame = avcodec_alloc_frame ();
+
+ xmms_xform_private_data_set (xform, data);
+
+@@ -233,6 +231,7 @@ xmms_avcodec_init (xmms_xform_t *xform)
+ data->codecctx->extradata_size = data->extradata_size;
+ data->codecctx->codec_id = codec->id;
+ data->codecctx->codec_type = codec->type;
++ data->codecctx->refcounted_frames = 0;
+
+ if (avcodec_open2 (data->codecctx, codec, NULL) < 0) {
+ XMMS_DBG ("Opening decoder '%s' failed", codec->name);
+@@ -279,8 +278,8 @@ err:
+ if (data->codecctx) {
+ av_free (data->codecctx);
+ }
+- if (data->read_out_buffer) {
+- av_free (data->read_out_buffer);
++ if (data->read_out_frame) {
++ avcodec_free_frame (&data->read_out_frame);
+ }
+ g_string_free (data->outbuf, TRUE);
+ g_free (data->extradata);
+@@ -365,17 +364,23 @@ xmms_avcodec_translate_sample_format (enum AVSampleFormat av_sample_format)
+ {
+ switch (av_sample_format) {
+ case AV_SAMPLE_FMT_U8:
++ case AV_SAMPLE_FMT_U8P:
+ return XMMS_SAMPLE_FORMAT_U8;
+ case AV_SAMPLE_FMT_S16:
++ case AV_SAMPLE_FMT_S16P:
+ return XMMS_SAMPLE_FORMAT_S16;
+ case AV_SAMPLE_FMT_S32:
++ case AV_SAMPLE_FMT_S32P:
+ return XMMS_SAMPLE_FORMAT_S32;
+ case AV_SAMPLE_FMT_FLT:
++ case AV_SAMPLE_FMT_FLTP:
+ return XMMS_SAMPLE_FORMAT_FLOAT;
+ case AV_SAMPLE_FMT_DBL:
++ case AV_SAMPLE_FMT_DBLP:
+ return XMMS_SAMPLE_FORMAT_DOUBLE;
+ default:
+- XMMS_DBG ("AVSampleFormat (%i) not supported.", av_sample_format);
++ XMMS_DBG ("AVSampleFormat (%i: %s) not supported.", av_sample_format,
++ av_get_sample_fmt_name (av_sample_format));
+ return XMMS_SAMPLE_FORMAT_UNKNOWN;
+ }
+ }
+@@ -448,8 +453,7 @@ xmms_avcodec_internal_read_some (xmms_xform_t *xform,
+
+ /*
+ Decode some data from data->buffer[0..data->buffer_length-1] to
+-data->read_out_buffer. Number of bytes in data->read_out_buffer
+-is stored in data->read_out_buffer_size.
++data->read_out_frame
+
+ Returns: on error: negative
+ on no new data produced: zero
+@@ -461,6 +465,7 @@ FF_INPUT_BUFFER_PADDING_SIZE long.
+ static gint
+ xmms_avcodec_internal_decode_some (xmms_avcodec_data_t *data)
+ {
++ int got_frame = 0;
+ gint bytes_read = 0;
+ AVPacket packet;
+
+@@ -468,10 +473,10 @@ xmms_avcodec_internal_decode_some (xmms_avcodec_data_t *data)
+ packet.data = data->buffer;
+ packet.size = data->buffer_length;
+
+- data->read_out_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+- bytes_read = avcodec_decode_audio3 (data->codecctx,
+- (short *) data->read_out_buffer,
+- &data->read_out_buffer_size, &packet);
++ avcodec_get_frame_defaults (data->read_out_frame);
++
++ bytes_read = avcodec_decode_audio4 (
++ data->codecctx, data->read_out_frame, &got_frame, &packet);
+
+ /* The DTS decoder of ffmpeg is buggy and always returns
+ * the input buffer length, get frame length from header */
+@@ -497,13 +502,33 @@ xmms_avcodec_internal_decode_some (xmms_avcodec_data_t *data)
+ data->buffer_length = 0;
+ }
+
+- return data->read_out_buffer_size;
++ return got_frame ? 1 : 0;
+ }
+
+ static void
+ xmms_avcodec_internal_append (xmms_avcodec_data_t *data)
+ {
+- g_string_append_len (data->outbuf,
+- (gchar *) data->read_out_buffer,
+- data->read_out_buffer_size);
++ enum AVSampleFormat fmt = (enum AVSampleFormat) data->read_out_frame->format;
++ int samples = data->read_out_frame->nb_samples;
++ int channels = data->codecctx->channels;
++ int bps = av_get_bytes_per_sample (fmt);
++
++ if (av_sample_fmt_is_planar (fmt)) {
++ /* Convert from planar to packed format */
++ gint i, j;
++
++ for (i = 0; i < samples; i++) {
++ for (j = 0; j < channels; j++) {
++ g_string_append_len (
++ data->outbuf,
++ (gchar *) (data->read_out_frame->extended_data[j] + i*bps),
++ bps
++ );
++ }
++ }
++ } else {
++ g_string_append_len (data->outbuf,
++ (gchar *) data->read_out_frame->extended_data[0],
++ samples * channels * bps);
++ }
+ }
diff --git a/media-sound/xmms2/files/xmms2-0.8-audio4-p6.patch b/media-sound/xmms2/files/xmms2-0.8-audio4-p6.patch
new file mode 100644
index 000000000000..b1bc1c5d609b
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-audio4-p6.patch
@@ -0,0 +1,106 @@
+commit fc66249e69f53eef709c5210546fdd92e1c89554
+Author: Erik Massop <e.massop@hccnet.nl>
+Date: Sun Dec 22 23:04:08 2013 +0100
+
+ OTHER: Some compatibility with different avcodec versions
+
+diff --git a/src/plugins/avcodec/avcodec.c b/src/plugins/avcodec/avcodec.c
+index a41a675..023833d 100644
+--- a/src/plugins/avcodec/avcodec.c
++++ b/src/plugins/avcodec/avcodec.c
+@@ -124,7 +124,7 @@ xmms_avcodec_destroy (xmms_xform_t *xform)
+
+ avcodec_close (data->codecctx);
+ av_free (data->codecctx);
+- avcodec_free_frame (&data->read_out_frame);
++ av_frame_free (&data->read_out_frame);
+
+ g_string_free (data->outbuf, TRUE);
+ g_free (data->buffer);
+@@ -150,7 +150,7 @@ xmms_avcodec_init (xmms_xform_t *xform)
+ data->buffer_size = AVCODEC_BUFFER_SIZE;
+ data->codecctx = NULL;
+
+- data->read_out_frame = avcodec_alloc_frame ();
++ data->read_out_frame = av_frame_alloc ();
+
+ xmms_xform_private_data_set (xform, data);
+
+@@ -231,7 +231,6 @@ xmms_avcodec_init (xmms_xform_t *xform)
+ data->codecctx->extradata_size = data->extradata_size;
+ data->codecctx->codec_id = codec->id;
+ data->codecctx->codec_type = codec->type;
+- data->codecctx->refcounted_frames = 0;
+
+ if (avcodec_open2 (data->codecctx, codec, NULL) < 0) {
+ XMMS_DBG ("Opening decoder '%s' failed", codec->name);
+@@ -473,7 +472,8 @@ xmms_avcodec_internal_decode_some (xmms_avcodec_data_t *data)
+ packet.data = data->buffer;
+ packet.size = data->buffer_length;
+
+- avcodec_get_frame_defaults (data->read_out_frame);
++ /* clear buffers and reset fields to defaults */
++ av_frame_unref (data->read_out_frame);
+
+ bytes_read = avcodec_decode_audio4 (
+ data->codecctx, data->read_out_frame, &got_frame, &packet);
+diff --git a/src/plugins/avcodec/avcodec_compat.h b/src/plugins/avcodec/avcodec_compat.h
+index 73ac2ab..e74b3f8 100644
+--- a/src/plugins/avcodec/avcodec_compat.h
++++ b/src/plugins/avcodec/avcodec_compat.h
+@@ -83,3 +83,17 @@ typedef struct AVPacket {
+ # define avcodec_open2(avctx, codec, options) \
+ avcodec_open(avctx, codec)
+ #endif
++
++/* Map avcodec_free_frame to av_freep if the former doesn't exist.
++ * (This is in versions earlier than 54.28.0 (libav) or 54.59.100 (ffmpeg)) */
++#if ! HAVE_AVCODEC_FREE_FRAME
++# define avcodec_free_frame av_freep
++#endif
++
++/* Map av_frame_alloc, av_frame_unref, av_frame_free into their
++ * deprecated versions in versions earlier than 55.28.1 */
++#if LIBAVCODEC_VERSION_INT < 0x371c01
++# define av_frame_alloc avcodec_alloc_frame
++# define av_frame_unref avcodec_get_frame_defaults
++# define av_frame_free avcodec_free_frame
++#endif
+diff --git a/src/plugins/avcodec/wscript b/src/plugins/avcodec/wscript
+index 03ba7d8..d367816 100644
+--- a/src/plugins/avcodec/wscript
++++ b/src/plugins/avcodec/wscript
+@@ -1,10 +1,33 @@
+ from waftools.plugin import plugin
+
++## Code fragments for configuration
++avcodec_free_frame_fragment = """
++#ifdef HAVE_LIBAVCODEC_AVCODEC_H
++# include "libavcodec/avcodec.h"
++#else
++# include "avcodec.h"
++#endif
++int main(void) {
++ AVFrame *frame;
++
++ avcodec_free_frame (&frame);
++
++ return 0;
++}
++"""
++
+ def plugin_configure(conf):
+ conf.check_cfg(package="libavcodec", uselib_store="avcodec",
+ args="--cflags --libs")
+ conf.check_cc(header_name="avcodec.h", uselib="avcodec", type="cshlib", mandatory=False)
+ conf.check_cc(header_name="libavcodec/avcodec.h", uselib="avcodec", type="cshlib", mandatory=False)
+
++ # non-mandatory function avcodec_free_frame since
++ # * ffmpeg: commit 46a3595, lavc 54.59.100, release 1.0
++ # * libav: commit a42aada, lavc 54.28.0, release 9
++ conf.check_cc(fragment=avcodec_free_frame_fragment, uselib="avcodec",
++ uselib_store="avcodec_free_frame",
++ msg="Checking for function avcodec_free_frame", mandatory=False)
++
+ configure, build = plugin('avcodec', configure=plugin_configure,
+ libs=["avcodec"])
diff --git a/media-sound/xmms2/files/xmms2-0.8-audio4-p7.patch b/media-sound/xmms2/files/xmms2-0.8-audio4-p7.patch
new file mode 100644
index 000000000000..2d4bafd95a7d
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-audio4-p7.patch
@@ -0,0 +1,147 @@
+commit f460440b3f2a9db1a9deef3faf7dae6e626dd7b5
+Author: Erik Massop <e.massop@hccnet.nl>
+Date: Sun Dec 22 23:34:12 2013 +0100
+
+ OTHER: Require avcodec_decode_audio4
+
+ This was introduced in versions 53.40.0 (ffmpeg) and 53.25.0 (libav) of
+ avcodec. Hence we drop compatibility for earlier versions.
+
+diff --git a/src/plugins/avcodec/avcodec.c b/src/plugins/avcodec/avcodec.c
+index 023833d..6d0b667 100644
+--- a/src/plugins/avcodec/avcodec.c
++++ b/src/plugins/avcodec/avcodec.c
+@@ -154,7 +154,6 @@ xmms_avcodec_init (xmms_xform_t *xform)
+
+ xmms_xform_private_data_set (xform, data);
+
+- avcodec_init ();
+ avcodec_register_all ();
+
+ mimetype = xmms_xform_indata_get_str (xform,
+@@ -225,7 +224,7 @@ xmms_avcodec_init (xmms_xform_t *xform)
+ data->codecctx->sample_rate = data->samplerate;
+ data->codecctx->channels = data->channels;
+ data->codecctx->bit_rate = data->bitrate;
+- CONTEXT_BPS (data->codecctx) = data->samplebits;
++ data->codecctx->bits_per_coded_sample = data->samplebits;
+ data->codecctx->block_align = data->block_align;
+ data->codecctx->extradata = data->extradata;
+ data->codecctx->extradata_size = data->extradata_size;
+diff --git a/src/plugins/avcodec/avcodec_compat.h b/src/plugins/avcodec/avcodec_compat.h
+index e74b3f8..b50fa4b 100644
+--- a/src/plugins/avcodec/avcodec_compat.h
++++ b/src/plugins/avcodec/avcodec_compat.h
+@@ -21,69 +21,6 @@
+ # include "avcodec.h"
+ #endif
+
+-/* Map avcodec_decode_audio2 into the deprecated version
+- * avcodec_decode_audio in versions earlier than 51.28 */
+-#if LIBAVCODEC_VERSION_INT < 0x331c00
+-# define avcodec_decode_audio2 avcodec_decode_audio
+-#endif
+-
+-/* Handle API change that happened in libavcodec 52.00 */
+-#if LIBAVCODEC_VERSION_INT < 0x340000
+-# define CONTEXT_BPS(codecctx) (codecctx)->bits_per_sample
+-#else
+-# define CONTEXT_BPS(codecctx) (codecctx)->bits_per_coded_sample
+-#endif
+-
+-/* Before 52.23 AVPacket was defined in avformat.h which we
+- * do not want to depend on, so we define part of it manually
+- * on versions smaller than 52.23 (this makes me cry) */
+-#if LIBAVCODEC_VERSION_INT < 0x341700
+-typedef struct AVPacket {
+- uint8_t *data;
+- int size;
+-} AVPacket;
+-#endif
+-
+-/* Same thing as above for av_init_packet and version 52.25 */
+-#if LIBAVCODEC_VERSION_INT < 0x341900
+-# define av_init_packet(pkt) do { \
+- (pkt)->data = NULL; \
+- (pkt)->size = 0; \
+- } while(0)
+-#endif
+-
+-/* Map avcodec_decode_audio3 into the deprecated version
+- * avcodec_decode_audio2 in versions earlier than 52.26 */
+-#if LIBAVCODEC_VERSION_INT < 0x341a00
+-# define avcodec_decode_audio3(avctx, samples, frame_size_ptr, avpkt) \
+- avcodec_decode_audio2(avctx, samples, frame_size_ptr, \
+- (avpkt)->data, (avpkt)->size)
+-#endif
+-
+-/* Handle API change that happened in libavcodec 52.64 */
+-#if LIBAVCODEC_VERSION_INT < 0x344000
+-# define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
+-#endif
+-
+-/* Calling avcodec_init is not necessary after 53.04 (ffmpeg 0.9) */
+-#if LIBAVCODEC_VERSION_INT >= 0x350400
+-# define avcodec_init()
+-#endif
+-
+-/* Map avcodec_alloc_context3 into the deprecated version
+- * avcodec_alloc_context in versions earlier than 53.04 (ffmpeg 0.9) */
+-#if LIBAVCODEC_VERSION_INT < 0x350400
+-# define avcodec_alloc_context3(codec) \
+- avcodec_alloc_context()
+-#endif
+-
+-/* Map avcodec_open2 into the deprecated version
+- * avcodec_open in versions earlier than 53.04 (ffmpeg 0.9) */
+-#if LIBAVCODEC_VERSION_INT < 0x350400
+-# define avcodec_open2(avctx, codec, options) \
+- avcodec_open(avctx, codec)
+-#endif
+-
+ /* Map avcodec_free_frame to av_freep if the former doesn't exist.
+ * (This is in versions earlier than 54.28.0 (libav) or 54.59.100 (ffmpeg)) */
+ #if ! HAVE_AVCODEC_FREE_FRAME
+diff --git a/src/plugins/avcodec/wscript b/src/plugins/avcodec/wscript
+index d367816..00b182b 100644
+--- a/src/plugins/avcodec/wscript
++++ b/src/plugins/avcodec/wscript
+@@ -1,6 +1,24 @@
+ from waftools.plugin import plugin
+
+ ## Code fragments for configuration
++avcodec_decode_audio4_fragment = """
++#ifdef HAVE_LIBAVCODEC_AVCODEC_H
++# include "libavcodec/avcodec.h"
++#else
++# include "avcodec.h"
++#endif
++int main(void) {
++ AVCodecContext *ctx;
++ AVFrame *frame;
++ int got_frame;
++ AVPacket *pkt;
++
++ avcodec_decode_audio4 (ctx, frame, &got_frame, pkt);
++
++ return 0;
++}
++"""
++
+ avcodec_free_frame_fragment = """
+ #ifdef HAVE_LIBAVCODEC_AVCODEC_H
+ # include "libavcodec/avcodec.h"
+@@ -22,6 +40,13 @@ def plugin_configure(conf):
+ conf.check_cc(header_name="avcodec.h", uselib="avcodec", type="cshlib", mandatory=False)
+ conf.check_cc(header_name="libavcodec/avcodec.h", uselib="avcodec", type="cshlib", mandatory=False)
+
++ # mandatory function avcodec_decode_audio4 available since
++ # * ffmpeg: commit e4de716, lavc 53.40.0, release 0.9
++ # * libav: commit 0eea212, lavc 53.25.0, release 0.8
++ conf.check_cc(fragment=avcodec_decode_audio4_fragment, uselib="avcodec",
++ uselib_store="avcodec_decode_audio4",
++ msg="Checking for function avcodec_decode_audio4", mandatory=True)
++
+ # non-mandatory function avcodec_free_frame since
+ # * ffmpeg: commit 46a3595, lavc 54.59.100, release 1.0
+ # * libav: commit a42aada, lavc 54.28.0, release 9
diff --git a/media-sound/xmms2/files/xmms2-0.8-cpython.patch b/media-sound/xmms2/files/xmms2-0.8-cpython.patch
new file mode 100644
index 000000000000..58227ba5db85
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-cpython.patch
@@ -0,0 +1,9 @@
+diff --git a/src/clients/lib/python/cython_include/cxmmsclient.pxd b/src/clients/lib/python/cython_include/cxmmsclient.pxd
+index 66390a7..629bc7f 100644
+--- a/src/clients/lib/python/cython_include/cxmmsclient.pxd
++++ b/src/clients/lib/python/cython_include/cxmmsclient.pxd
+@@ -30,3 +30,3 @@ cdef extern from "xmmsc/xmmsc_idnumbers.h":
+
+- ctypedef enum xmmsc_collection_changed_actions_t:
++ ctypedef enum xmms_collection_changed_actions_t:
+ XMMS_COLLECTION_CHANGED_ADD
diff --git a/media-sound/xmms2/files/xmms2-0.8-cython-0.19.1.patch b/media-sound/xmms2/files/xmms2-0.8-cython-0.19.1.patch
new file mode 100644
index 000000000000..1d6e59f6c830
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-cython-0.19.1.patch
@@ -0,0 +1,47 @@
+From 6d6d7a7ee38c8e3f57242f2510e06a03f4e7e249 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Mon, 5 Aug 2013 22:29:46 +0300
+Subject: [PATCH] unbreak xmms2 building on cython-0.19.1
+
+Error compiling Cython file:
+------------------------------------------------------------
+...
+ def medialib_path_import(self, path, cb = None, encoded=False):
+ """
+ @deprecated
+ Use medialib_import_path(path, ...) instead
+ """
+ return self.medialib_import_path(self, path, cb=cb, encoded=encoded)
+ ^
+
+Reported-by: ChunFeng
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ src/clients/lib/python/xmmsapi.pyx | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/clients/lib/python/xmmsapi.pyx b/src/clients/lib/python/xmmsapi.pyx
+index 501a068..863db88 100644
+--- a/src/clients/lib/python/xmmsapi.pyx
++++ b/src/clients/lib/python/xmmsapi.pyx
+@@ -1364,7 +1364,7 @@ cdef class XmmsApi(XmmsCore):
+ @deprecated
+ Use medialib_import_path(path, ...) instead
+ """
+- return self.medialib_import_path(self, path, cb=cb, encoded=encoded)
++ return self.medialib_import_path(path, cb=cb, encoded=encoded)
+
+ @deprecated
+ def medialib_path_import_encoded(self, path, cb = None):
+@@ -1372,7 +1372,7 @@ cdef class XmmsApi(XmmsCore):
+ @deprecated
+ Use medialib_import_path(path, ..., encoded=True) instead
+ """
+- return self.medialib_import_path(self, path, cb=cb, encoded=True)
++ return self.medialib_import_path(path, cb=cb, encoded=True)
+
+ cpdef XmmsResult medialib_property_set(self, int id, key, value, source=None, cb=None):
+ """
+--
+1.8.3.2
+
diff --git a/media-sound/xmms2/files/xmms2-0.8-ffmpeg-0.11.patch b/media-sound/xmms2/files/xmms2-0.8-ffmpeg-0.11.patch
new file mode 100644
index 000000000000..bac2fba7e9fd
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-ffmpeg-0.11.patch
@@ -0,0 +1,18 @@
+commit 8743e0c3a4f06053d89b74e40a362ba4949ed53c
+Author: Juho Vähä-Herttua <juhovh@iki.fi>
+Date: Fri Jun 8 09:30:47 2012 +0300
+
+ OTHER: Quick fix to make XMMS2 compile on ffmpeg 0.11
+
+diff --git a/src/plugins/avcodec/avcodec_compat.h b/src/plugins/avcodec/avcodec_compat.h
+index df87b27..f1b1af7 100644
+--- a/src/plugins/avcodec/avcodec_compat.h
++++ b/src/plugins/avcodec/avcodec_compat.h
+@@ -65,3 +65,7 @@ typedef struct AVPacket {
+ # define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
+ #endif
+
++/* Calling avcodec_init is not necessary after 53.04 (ffmpeg 0.9) */
++#if LIBAVCODEC_VERSION_INT >= 0x350400
++# define avcodec_init()
++#endif
diff --git a/media-sound/xmms2/files/xmms2-0.8-ffmpeg2.patch b/media-sound/xmms2/files/xmms2-0.8-ffmpeg2.patch
new file mode 100644
index 000000000000..2e9fac380ea0
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-ffmpeg2.patch
@@ -0,0 +1,15 @@
+Index: xmms2-0.8DrO_o/src/plugins/avcodec/avcodec.c
+===================================================================
+--- xmms2-0.8DrO_o.orig/src/plugins/avcodec/avcodec.c
++++ xmms2-0.8DrO_o/src/plugins/avcodec/avcodec.c
+@@ -29,6 +29,10 @@
+
+ #define AVCODEC_BUFFER_SIZE 16384
+
++#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
++#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
++#endif
++
+ typedef struct {
+ AVCodecContext *codecctx;
+
diff --git a/media-sound/xmms2/files/xmms2-0.8-libav-9-p2.patch b/media-sound/xmms2/files/xmms2-0.8-libav-9-p2.patch
new file mode 100644
index 000000000000..db55bc8a6933
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-libav-9-p2.patch
@@ -0,0 +1,50 @@
+commit 4781c507be338fe151e08af7d13267a24cbd7572
+Author: Juho Vähä-Herttua <juhovh@iki.fi>
+Date: Fri Jun 8 09:47:03 2012 +0300
+
+ OTHER: Fix some deprecated warnings in libavcodec
+
+diff --git a/src/plugins/avcodec/avcodec.c b/src/plugins/avcodec/avcodec.c
+index 242e333..c846d64 100644
+--- a/src/plugins/avcodec/avcodec.c
++++ b/src/plugins/avcodec/avcodec.c
+@@ -208,7 +208,7 @@ xmms_avcodec_init (xmms_xform_t *xform)
+ }
+ }
+
+- data->codecctx = avcodec_alloc_context ();
++ data->codecctx = avcodec_alloc_context3 (codec);
+ data->codecctx->sample_rate = data->samplerate;
+ data->codecctx->channels = data->channels;
+ data->codecctx->bit_rate = data->bitrate;
+@@ -219,7 +219,7 @@ xmms_avcodec_init (xmms_xform_t *xform)
+ data->codecctx->codec_id = codec->id;
+ data->codecctx->codec_type = codec->type;
+
+- if (avcodec_open (data->codecctx, codec) < 0) {
++ if (avcodec_open2 (data->codecctx, codec, NULL) < 0) {
+ XMMS_DBG ("Opening decoder '%s' failed", codec->name);
+ goto err;
+ } else {
+diff --git a/src/plugins/avcodec/avcodec_compat.h b/src/plugins/avcodec/avcodec_compat.h
+index f1b1af7..bc770f2 100644
+--- a/src/plugins/avcodec/avcodec_compat.h
++++ b/src/plugins/avcodec/avcodec_compat.h
+@@ -69,3 +69,17 @@ typedef struct AVPacket {
+ #if LIBAVCODEC_VERSION_INT >= 0x350400
+ # define avcodec_init()
+ #endif
++
++/* Map avcodec_alloc_context3 into the deprecated version
++ * avcodec_alloc_context in versions earlier than 53.04 (ffmpeg 0.9) */
++#if LIBAVCODEC_VERSION_INT < 0x350400
++# define avcodec_alloc_context3(codec) \
++ avcodec_alloc_context()
++#endif
++
++/* Map avcodec_open2 into the deprecated version
++ * avcodec_open in versions earlier than 53.04 (ffmpeg 0.9) */
++#if LIBAVCODEC_VERSION_INT < 0x350400
++# define avcodec_open2(avctx, codec, options) \
++ avcodec_open(avctx, codec)
++#endif
diff --git a/media-sound/xmms2/files/xmms2-0.8-libav-9.patch b/media-sound/xmms2/files/xmms2-0.8-libav-9.patch
new file mode 100644
index 000000000000..9c13ec41e025
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-libav-9.patch
@@ -0,0 +1,20 @@
+commit d61dbc522f4024debb1f99de758de9e5cc7c0936
+Author: Diego Biurrun <diego@biurrun.de>
+Date: Sun Nov 25 17:33:02 2012 +0100
+
+ OTHER: Support for newer libavcodec versions
+
+ Add missing #include
+
+diff --git a/src/plugins/avcodec/avcodec.c b/src/plugins/avcodec/avcodec.c
+index c846d64..114d7df 100644
+--- a/src/plugins/avcodec/avcodec.c
++++ b/src/plugins/avcodec/avcodec.c
+@@ -23,6 +23,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <glib.h>
++#include <libavutil/mem.h>
+
+ #include "avcodec_compat.h"
+
diff --git a/media-sound/xmms2/files/xmms2-0.8-memset.patch b/media-sound/xmms2/files/xmms2-0.8-memset.patch
new file mode 100644
index 000000000000..6f8377d9f928
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-memset.patch
@@ -0,0 +1,19 @@
+commit 00f4736bbb8ebc88a08e24e98d384b43d5afbbe4
+Author: Raphaël Bois <virtualdust@gmail.com>
+Date: Sun Feb 12 16:39:46 2012 +0100
+
+ OTHER: fix erroneous sizeof usage
+
+diff --git a/src/plugins/daap/daap_md5.c b/src/plugins/daap/daap_md5.c
+index d4d8d74..69c84a5 100644
+--- a/src/plugins/daap/daap_md5.c
++++ b/src/plugins/daap/daap_md5.c
+@@ -191,7 +191,7 @@ OpenDaap_MD5Final (MD5_CTX *ctx,
+ MD5Transform (ctx->buf, (guint32 *) ctx->in, ctx->version);
+ byteReverse ((unsigned char *) ctx->buf, 4);
+ memcpy (digest, ctx->buf, 16);
+- memset (ctx, 0, sizeof (ctx)); /* In case it's sensitive */
++ memset (ctx, 0, sizeof (*ctx)); /* In case it's sensitive */
+
+ return;
+ }
diff --git a/media-sound/xmms2/files/xmms2-0.8-modpug.patch b/media-sound/xmms2/files/xmms2-0.8-modpug.patch
new file mode 100644
index 000000000000..ce401279c14c
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-modpug.patch
@@ -0,0 +1,11 @@
+--- a/src/plugins/modplug/modplug.c 2011-10-20 20:26:08.000000000 +0000
++++ b/src/plugins/modplug/modplug.c 2015-01-08 19:52:43.889787624 +0000
+@@ -9,7 +9,7 @@
+ #include "xmms/xmms_sample.h"
+ #include "xmms/xmms_medialib.h"
+ #include "xmms/xmms_log.h"
+-#include <modplug.h>
++#include <libmodplug/modplug.h>
+
+ #include <glib.h>
+ #include <string.h>
diff --git a/media-sound/xmms2/files/xmms2-0.8-rtvg.patch b/media-sound/xmms2/files/xmms2-0.8-rtvg.patch
new file mode 100644
index 000000000000..20be34273883
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-rtvg.patch
@@ -0,0 +1,36 @@
+Add knob to disable valgrind at test runtime.
+
+When valgrind is installed in system but is not
+working we should still be able to run tests.
+
+Reported-by: Diego Elio Pettenò
+Bug: https://bugs.gentoo.org/424377
+diff --git a/waftools/unittest.py b/waftools/unittest.py
+index 4317287..6179dfd 100644
+--- a/waftools/unittest.py
++++ b/waftools/unittest.py
+@@ -64,7 +64,8 @@ def generate_coverage(bld):
+
+ def configure(conf):
+ conf.load("waf_unit_test")
+- conf.find_program("valgrind", var="VALGRIND", mandatory=False)
++ if conf.options.enable_valgrind is True:
++ conf.find_program("valgrind", var="VALGRIND", mandatory=False)
+ conf.find_program("lcov", var="LCOV", mandatory=False)
+ conf.find_program("genhtml", var="GENHTML", mandatory=False)
+
+diff --git a/wscript b/wscript
+index 99c1fa3..a98d5e3 100644
+--- a/wscript
++++ b/wscript
+@@ -501,6 +501,10 @@ def options(opt):
+ dest='ldconfig', help="Run ldconfig after install even if not root")
+ opt.add_option('--without-ldconfig', action='store_false',
+ dest='ldconfig', help="Don't run ldconfig after install")
++ opt.add_option('--with-valgrind', action='store_true', default=None,
++ dest='enable_valgrind', help="Run testsuite under valgrind (if present).")
++ opt.add_option('--without-valgrind', action='store_false', default=None,
++ dest='enable_valgrind', help="Don't run testsuite under valgrind.")
+
+ opt.sub_options("src/xmms")
+ for o in optional_subdirs + subdirs:
diff --git a/media-sound/xmms2/files/xmms2-0.8-samba-4.patch b/media-sound/xmms2/files/xmms2-0.8-samba-4.patch
new file mode 100644
index 000000000000..937f3d75bea9
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8-samba-4.patch
@@ -0,0 +1,30 @@
+commit 86ea5e2d2ac2d8c8c1aee484e8c264440fafcb6a
+Author: Daniel P. Chokola <dan.chokola@gmail.com>
+Date: Wed Jan 1 14:57:35 2014 -0500
+
+ BUG(2573): Samba 4.0 uses pkg-config. Find libsmbclient.h properly.
+
+diff --git a/src/plugins/samba/wscript b/src/plugins/samba/wscript
+index 8398169..77d7cda 100644
+--- a/src/plugins/samba/wscript
++++ b/src/plugins/samba/wscript
+@@ -1,8 +1,17 @@
+ from waftools.plugin import plugin
++from waflib import Errors
+
+ def plugin_configure(conf):
+- conf.check_cc(header_name="libsmbclient.h")
+- conf.check(lib="smbclient", uselib_store="smbclient")
++ try:
++ conf.check_cfg(package="smbclient", uselib_store="smbclient",
++ args="--cflags --libs")
++ except Errors.ConfigurationError:
++ conf.check_cc(header_name="libsmbclient.h",
++ uselib="smbclient",
++ type="cshlib")
++ conf.check(lib="smbclient", uselib_store="smbclient",
++ uselib="smbclient",
++ type="cshlib")
+
+ configure, build = plugin("samba", configure=plugin_configure,
+ libs=["smbclient"])
diff --git a/media-sound/xmms2/files/xmms2-0.8DrO_o-waflib-fix-perl.patch b/media-sound/xmms2/files/xmms2-0.8DrO_o-waflib-fix-perl.patch
new file mode 100644
index 000000000000..220e91e68136
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8DrO_o-waflib-fix-perl.patch
@@ -0,0 +1,27 @@
+Fix build failure when user has non-core xsubpp.
+
+> Could not find a typemap for C type 'xmmsv_t *' in XMMSClientPlaylist.xs, line 132
+> Undefined subroutine &ExtUtils::ParseXS::errors called at /usr/lib/perl5/5.12.4/ExtUtils/xsubpp line 41.
+> Undefined subroutine &ExtUtils::ParseXS::errors called at /usr/lib/perl5/5.12.4/ExtUtils/xsubpp line 41.
+> Could not find a typemap for C type 'const unsigned char *' in XMMSClient.xs, line 1179
+
+Use xsubpp from @INC instead of bundled one with perl.
+
+Original bug: https://bugs.gentoo.org/380469
+Related: https://bugs.gentoo.org/378783
+Updated for perl-5.20.2: https://bugs.gentoo.org/578778
+diff --git a/waflib/Tools/perl.py b/waflib/Tools/perl.py
+index 2c69fe5..a75b069 100644
+--- a/waflib/Tools/perl.py
++++ b/waflib/Tools/perl.py
+@@ -60,8 +60,8 @@ def check_perl_ext_devel(self):
+ env['LINKFLAGS_PERLEXT']=read_out(" -MConfig -e'print $Config{lddlflags}'")
+ env['INCLUDES_PERLEXT']=read_out(" -MConfig -e'print \"$Config{archlib}/CORE\"'")
+ env['CFLAGS_PERLEXT']=read_out(" -MConfig -e'print \"$Config{ccflags} $Config{cccdlflags}\"'")
+- env['XSUBPP']=read_out(" -MConfig -e'print \"$Config{privlib}/ExtUtils/xsubpp$Config{exe_ext}\"'")
+- env['EXTUTILS_TYPEMAP']=read_out(" -MConfig -e'print \"$Config{privlib}/ExtUtils/typemap\"'")
++ env["XSUBPP"] = read_out(" -MModule::Metadata -e'print Module::Metadata->find_module_by_name(\"ExtUtils::xsubpp\")'")
++ env["EXTUTILS_TYPEMAP"] = read_out(" -MModule::Metadata -e'print Module::Metadata->find_module_by_name(\"ExtUtils::typemap\")'")
+ if not getattr(Options.options,'perlarchdir',None):
+ env['ARCHDIR_PERL']=self.cmd_and_log(perl+" -MConfig -e'print $Config{sitearch}'")
+ else:
diff --git a/media-sound/xmms2/files/xmms2-0.8_p20161122-be-hash.patch b/media-sound/xmms2/files/xmms2-0.8_p20161122-be-hash.patch
new file mode 100644
index 000000000000..5fa43298cf7f
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8_p20161122-be-hash.patch
@@ -0,0 +1,39 @@
+From d97c8b8239e8b3c5ddb951d427b7d78ea7faad25 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Sun, 30 Jul 2017 23:08:02 +0100
+Subject: [PATCH] OTHER: _xmmsv_dict_hash: make hash function
+ endianness-agnostic
+
+The following code:
+ uint32_t k;
+ memcpy (&k, data, sizeof (k));
+computes different data depending on platform endianness.
+
+That causes test_xmmsv_serialize_coll_match test to fail
+as collection order is serialized in wrong order.
+
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ src/lib/xmmstypes/xmmsv_dict.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/lib/xmmstypes/xmmsv_dict.c b/src/lib/xmmstypes/xmmsv_dict.c
+index 5ebe4eb3..32533285 100644
+--- a/src/lib/xmmstypes/xmmsv_dict.c
++++ b/src/lib/xmmstypes/xmmsv_dict.c
+@@ -66,8 +66,10 @@ _xmmsv_dict_hash (const void *key, int len)
+
+ while (len >= 4)
+ {
+- uint32_t k;
+- memcpy (&k, data, sizeof (k));
++ uint32_t k = data [0]
++ | data [1] << 8
++ | data [2] << 16
++ | data [3] << 24;
+
+ k *= m;
+ k ^= k >> r;
+--
+2.13.3
+
diff --git a/media-sound/xmms2/files/xmms2-0.8_p20161122-tarball.patch b/media-sound/xmms2/files/xmms2-0.8_p20161122-tarball.patch
new file mode 100644
index 000000000000..eef49b13f16f
--- /dev/null
+++ b/media-sound/xmms2/files/xmms2-0.8_p20161122-tarball.patch
@@ -0,0 +1,78 @@
+diff --git a/utils/gen-changelog.py b/utils/gen-changelog.py
+index b539088a..301c0461 100755
+--- a/utils/gen-changelog.py
++++ b/utils/gen-changelog.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python2
+ from subprocess import check_output
+ import os
+
+diff --git a/utils/gen-tarball.py b/utils/gen-tarball.py
+index 2ae2a4d1..09ed5074 100755
+--- a/utils/gen-tarball.py
++++ b/utils/gen-tarball.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+ from subprocess import check_output, call
+ import tarfile
+ import os
+@@ -40,15 +40,19 @@ def add_files(ball, prefix, template, files):
+
+ VERSION = check_output(["git", "describe"]).strip()
+
++# TODO: derive paths from submodule configuration
+ TUTORIAL_DIR="doc/tutorial"
++S4_DIR="src/lib/s4"
+
+ PREFIX="xmms2-%s" % VERSION
+ PREFIX_TUTORIAL="%s/%s" % (PREFIX, TUTORIAL_DIR)
++PREFIX_S4="%s/%s" % (PREFIX, S4_DIR)
+
+ DIST_DIR="dist"
+ DIST_XMMS2="%s/xmms2-%s.tar" % (DIST_DIR, VERSION)
+ DIST_XMMS2_BZ2="%s/xmms2-%s.tar.bz2" % (DIST_DIR, VERSION)
+ DIST_TUTORIAL="%s/xmms2-tutorial-%s.tar" % (DIST_DIR, VERSION)
++DIST_S4="%s/xmms2-tutorial-%s.tar" % (DIST_DIR, VERSION)
+
+ if not os.path.exists(DIST_DIR):
+ os.mkdir(DIST_DIR)
+@@ -62,6 +66,9 @@ if os.path.exists(DIST_XMMS2_BZ2):
+ if os.path.exists(DIST_TUTORIAL):
+ os.unlink(DIST_TUTORIAL)
+
++if os.path.exists(DIST_S4):
++ os.unlink(DIST_S4)
++
+ # Tar up XMMS2
+ call("git archive --format=tar --prefix=%s/ HEAD > %s" % (PREFIX, DIST_XMMS2), shell=True)
+
+@@ -69,9 +76,11 @@ call("git archive --format=tar --prefix=%s/ HEAD > %s" % (PREFIX, DIST_XMMS2), s
+ call("git submodule init", shell=True)
+ call("git submodule update", shell=True)
+ call("git --git-dir=%s/.git archive --format=tar --prefix=%s/ HEAD > %s" % (TUTORIAL_DIR, PREFIX_TUTORIAL, DIST_TUTORIAL), shell=True)
++call("git --git-dir=%s/.git archive --format=tar --prefix=%s/ HEAD > %s" % (S4_DIR, PREFIX_S4, DIST_S4), shell=True)
+
+-# Append the tutorials to the XMMS2 archive
++# Append the tutorials and s4 to the XMMS2 archive
+ call("tar -Af %s %s" % (DIST_XMMS2, DIST_TUTORIAL), shell=True)
++call("tar -Af %s %s" % (DIST_XMMS2, DIST_S4), shell=True)
+
+ # Append ChangeLog and a summary of all file hashes."
+ add_files(DIST_XMMS2, PREFIX, get_template(DIST_XMMS2, os.path.join(PREFIX, "wscript")), [
+diff --git a/utils/gen-tree-hashes.py b/utils/gen-tree-hashes.py
+index 7f8b9e4f..9d27adb0 100755
+--- a/utils/gen-tree-hashes.py
++++ b/utils/gen-tree-hashes.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+ from subprocess import check_output
+ from operator import itemgetter
+ import os
+@@ -21,3 +21,4 @@ def collect_hashes(*paths):
+
+ print check_output("git describe", shell=True)
+ print collect_hashes(".", "doc/tutorial")
++print collect_hashes(".", "src/lib/s4")
diff --git a/media-sound/xmms2/metadata.xml b/media-sound/xmms2/metadata.xml
new file mode 100644
index 000000000000..26ce4e0e0a61
--- /dev/null
+++ b/media-sound/xmms2/metadata.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>slyfox@gentoo.org</email>
+ <name>Sergei Trofimovich</name>
+ <description>Primary Maintainer</description>
+ </maintainer>
+ <longdescription>
+ It features a client-server model, allowing multiple (even simultaneous!) user
+ interfaces, both textual and graphical. All common audio formats are supported
+ using plugins. On top of this, there is a flexible media library to organize
+ your music.
+
+ List of features currently offered by XMMS2:
+ Client-server model:
+ * Allows XMMS2 to have various multiple interfaces (as clients).
+ o Command line interfaces
+ o GTK clients (matching GNOME &amp; XFCE4 look and feel)
+ o KDE clients (matching KDE look and feel)
+ * Network transparency means you can run and control XMMS2 remotely, (e.g. run
+ XMMS2 on your 'media box' and control it over network using a bluetooth-enabled
+ PDA (TCP))
+ Wide format support:
+ * Can play FLAC, mp3, MOD, SID, speex, ogg vorbis, wave files.
+ * Clean separation of transport and decoder subsystems
+ Allows for more flexible access to media. (e.g. play mp3 files from a Samba
+ share without having to mount it on the local filesystem)
+ Medialib:
+ Database-driven media library stores metadata about songs as they're played,
+ so songs can be quickly recalled and new playlists easily made.
+ </longdescription>
+ <use>
+ <flag name="airplay">Support for airplay format</flag>
+ <flag name="asf">Support for Monkey's Audio (APE) format with help of bundled libasf</flag>
+ <flag name="fluidsynth">Enable fluidsynth support (MIDI)</flag>
+ <flag name="gvfs">Transport for glibs virtual filesystem</flag>
+ <flag name="ices">Icecast source output plugin</flag>
+ <flag name="mac">Support for Monkey's Audio (APE) format with help of <pkg>media-sound/mac</pkg></flag>
+ <flag name="ofa">Support for Open Fingerprint Architecture (OFA)</flag>
+ <flag name="opus">Enable Opus audio codec support</flag>
+ <flag name="phonehome">This client sends anonymous usage-statistics to the xmms2</flag>
+ <flag name="server">Build xmms2 player daemon (otherwise only clients are built)</flag>
+ <flag name="sid">Support for C64 SID</flag>
+ <flag name="valgrind">Run unit tests under valgrind.</flag>
+ <flag name="vocoder">Phase vocoder effect plugin</flag>
+ <flag name="mlib-update">Enable building of xmms2-mlib-updater client</flag>
+ <flag name="xml">Enable support for various XML based playlists and sources: RSS, XSPF</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">xmms2</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/media-sound/xmms2/xmms2-0.8-r4.ebuild b/media-sound/xmms2/xmms2-0.8-r4.ebuild
new file mode 100644
index 000000000000..56a0c20caf22
--- /dev/null
+++ b/media-sound/xmms2/xmms2-0.8-r4.ebuild
@@ -0,0 +1,296 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+# waf fails on python3_5: AttributeError: Can't pickle local object 'Context.__init__.<locals>.node_class'
+PYTHON_COMPAT=( python{2_7,3_4} )
+USE_RUBY="ruby20 ruby21 ruby22"
+
+inherit eutils multiprocessing python-single-r1 ruby-single toolchain-funcs
+
+MY_P="${P}DrO_o"
+
+DESCRIPTION="X(cross)platform Music Multiplexing System. Next generation of the XMMS player"
+HOMEPAGE="https://xmms2.org/wiki/Main_Page"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.bz2"
+LICENSE="GPL-2 LGPL-2.1"
+
+SLOT="0"
+KEYWORDS="alpha amd64 ppc x86"
+
+IUSE="aac airplay +alsa ao asf cdda curl cxx ffmpeg flac gvfs ices
+jack mac mlib-update mms +mad modplug mp3 mp4 musepack ofa oss
+perl phonehome pulseaudio python ruby samba +server sid sndfile speex
+test valgrind +vorbis vocoder wavpack xml zeroconf"
+
+RDEPEND="server? (
+ >=dev-db/sqlite-3.3.4
+
+ aac? ( >=media-libs/faad2-2.0 )
+ airplay? ( dev-libs/openssl:0= )
+ alsa? ( media-libs/alsa-lib )
+ ao? ( media-libs/libao )
+ cdda? ( dev-libs/libcdio-paranoia
+ >=media-libs/libdiscid-0.1.1
+ >=media-sound/cdparanoia-3.9.8 )
+ curl? ( >=net-misc/curl-7.15.1 )
+ ffmpeg? ( virtual/ffmpeg )
+ flac? ( media-libs/flac )
+ gvfs? ( gnome-base/gnome-vfs )
+ ices? ( media-libs/libogg
+ media-libs/libshout
+ media-libs/libvorbis )
+ jack? ( >=media-sound/jack-audio-connection-kit-0.101.1 )
+ mac? ( media-sound/mac )
+ mms? ( virtual/ffmpeg
+ >=media-libs/libmms-0.3 )
+ modplug? ( media-libs/libmodplug )
+ mad? ( media-libs/libmad )
+ mp3? ( >=media-sound/mpg123-1.5.1 )
+ musepack? ( media-sound/musepack-tools )
+ ofa? ( media-libs/libofa )
+ pulseaudio? ( media-sound/pulseaudio )
+ samba? ( >=net-fs/samba-4.2 )
+ sid? ( media-sound/sidplay
+ media-libs/resid )
+ sndfile? ( media-libs/libsndfile )
+ speex? ( media-libs/speex
+ media-libs/libogg )
+ vorbis? ( media-libs/libvorbis )
+ vocoder? ( sci-libs/fftw:3.0= media-libs/libsamplerate )
+ wavpack? ( media-sound/wavpack )
+ xml? ( dev-libs/libxml2 )
+ zeroconf? ( net-dns/avahi[mdnsresponder-compat] )
+ )
+
+ >=dev-libs/glib-2.12.9
+ cxx? ( >=dev-libs/boost-1.32 )
+ perl? ( >=dev-lang/perl-5.8.8 )
+ python? ( ${PYTHON_DEPS} )
+ ruby? ( ${RUBY_DEPS} )
+"
+
+DEPEND="${RDEPEND}
+ dev-lang/python
+ virtual/pkgconfig
+ perl? ( dev-perl/Module-Build
+ virtual/perl-Module-Metadata )
+ python? ( >=dev-python/cython-0.15.1
+ dev-python/pyrex )
+ test? ( dev-util/cunit
+ valgrind? ( dev-util/valgrind ) )
+"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ # used both for building xmms2 and
+ # optionally linking client library
+ # against python
+ python-single-r1_pkg_setup
+}
+
+# use_enable() is taken as proto
+# $1 - useflag
+# $2 - xmms2 option/plugin name (equals to $1 if not set)
+
+xmms2_flag() {
+ [[ -z $1 ]] && eerror "!!! empty arg. usage: xmms2_flag <USEFLAG> [<xmms2_flagname>]."
+
+ local UWORD=${2:-$1}
+
+ case $1 in
+ ENABLED)
+ echo ",${UWORD}"
+ ;;
+ DISABLED)
+ ;;
+ *)
+ use $1 && echo ",${UWORD}"
+ ;;
+ esac
+}
+
+src_prepare() {
+ ./waf # inflate waf
+ cd .waf* || die
+ epatch "${FILESDIR}/${PN}"-0.8DrO_o-waflib-fix-perl.patch #578778
+ cd "${S}"
+ epatch "${FILESDIR}/${P}"-ffmpeg-0.11.patch #443256
+ epatch "${FILESDIR}/${P}"-libav-9-p2.patch #443256
+ epatch "${FILESDIR}/${P}"-libav-9.patch #443256
+ epatch "${FILESDIR}/${P}"-cython-0.19.1.patch
+ epatch "${FILESDIR}/${P}"-memset.patch
+ epatch "${FILESDIR}/${P}"-ffmpeg2.patch #536232
+ epatch "${FILESDIR}/${P}"-cpython.patch
+ epatch "${FILESDIR}/${P}"-modpug.patch #536046
+ epatch "${FILESDIR}/${P}"-audio4-p1.patch #540890
+ epatch "${FILESDIR}/${P}"-audio4-p2.patch
+ epatch "${FILESDIR}/${P}"-audio4-p3.patch
+ epatch "${FILESDIR}/${P}"-audio4-p4.patch
+ epatch "${FILESDIR}/${P}"-audio4-p5.patch
+ epatch "${FILESDIR}/${P}"-audio4-p6.patch
+ epatch "${FILESDIR}/${P}"-audio4-p7.patch
+ epatch "${FILESDIR}/${P}"-rtvg.patch #424377
+ epatch "${FILESDIR}/${P}"-samba-4.patch
+
+ if has_version dev-libs/libcdio-paranoia; then
+ sed -i -e 's:cdio/cdda.h:cdio/paranoia/cdda.h:' src/plugins/cdda/cdda.c || die
+ fi
+ epatch_user
+}
+
+src_configure() {
+ # ./configure alike options.
+ local waf_params="--prefix=/usr \
+ --libdir=/usr/$(get_libdir) \
+ --with-target-platform=${CHOST} \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --datadir=/usr/share \
+ --sysconfdir=/etc \
+ --localstatedir=/var/lib"
+
+ local optionals=""
+ local plugins=""
+ if ! use server ; then
+ waf_params+=" --without-xmms2d"
+ else
+ # some fun static mappings:
+ local option_map=( # USE # sorted xmms2 option flag (same, as USE if empty)
+ "phonehome et"
+ "ENABLED launcher"
+ "mlib-update medialib-updater"
+ "ENABLED nycli"
+ " perl"
+ "ENABLED pixmaps"
+ " python"
+ " ruby"
+ "DISABLED tests"
+ "DISABLED vistest"
+ "cxx xmmsclient++"
+ "cxx xmmsclient++-glib"
+ "DISABLED xmmsclient-cf"
+ "DISABLED xmmsclient-ecore" # not in tree
+
+ "test tests"
+ )
+
+ local plugin_map=( # USE # sorted xmms2 plugin flag (same, as USE if empty)
+ " alsa"
+ " airplay"
+ " ao"
+ "ffmpeg apefile"
+ "ffmpeg avcodec"
+ " asf"
+ "ENABLED asx"
+ " cdda"
+ "DISABLED coreaudio" # MacOS only?
+ " curl"
+ "ENABLED cue"
+ "zeroconf daap"
+ "ENABLED diskwrite"
+ "ENABLED equalizer"
+ "aac faad"
+ "ENABLED file"
+ " flac"
+ "ffmpeg flv"
+ "ffmpeg tta"
+ "DISABLED gme" # not in tree
+ " gvfs"
+ "ENABLED html"
+ " ices"
+ "ENABLED icymetaint"
+ "ENABLED id3v2"
+ " jack"
+ "ENABLED karaoke"
+ "ENABLED m3u"
+ " mac"
+ " mms"
+ " mad"
+ " mp4" # bug #387961 (aac, mp3, ape can sit there)
+ "mp3 mpg123"
+ " modplug"
+ " musepack"
+ "DISABLED nms" # not in tree
+ "ENABLED normalize"
+ "ENABLED null"
+ "ENABLED nulstripper"
+ " ofa"
+ " oss"
+ "ENABLED pls"
+ "pulseaudio pulse"
+ "ENABLED replaygain"
+ "xml rss"
+ " samba"
+ "DISABLED sc68" #not in tree
+ " sid"
+ " sndfile"
+ " speex"
+ "DISABLED sun" # {Open,Net}BSD only
+ "DISABLED tremor" # not in tree
+ " vorbis"
+ " vocoder"
+ "ffmpeg tta"
+ "ENABLED wave"
+ "DISABLED waveout" # windows only
+ " wavpack"
+ "xml xspf"
+ "ENABLED xml"
+ )
+
+ local option
+ for option in "${option_map[@]}"; do
+ optionals+=$(xmms2_flag $option)
+ done
+
+ local plugin
+ for plugin in "${plugin_map[@]}"; do
+ plugins+=$(xmms2_flag $plugin)
+ done
+ fi # ! server
+
+ # pass them explicitely even if empty as we try to avoid magic deps
+ waf_params+=" --with-optionals=${optionals:1}" # skip first ',' if yet
+ waf_params+=" --with-plugins=${plugins:1}"
+ waf_params+=" $(use_with valgrind)"
+
+ CC="$(tc-getCC)" \
+ CPP="$(tc-getCPP)" \
+ AR="$(tc-getAR)" \
+ RANLIB="$(tc-getRANLIB)" \
+ CXX="$(tc-getCXX)" \
+ ./waf configure ${waf_params} || die "'waf configure' failed"
+}
+
+src_compile() {
+ # waf is very keen to run tests in build phase (bug #424377) but
+ # it does not bother running tests twice, so the hack below works:
+ ./waf --verbose build || ./waf --verbose build || die "waf build failed"
+}
+
+src_test() {
+ # rerun tests
+ ./waf --alltests || die "waf --alltests failed"
+}
+
+src_install() {
+ ./waf --without-ldconfig --destdir="${D}" install || die "'waf install' failed"
+ dodoc AUTHORS TODO
+}
+
+pkg_postinst() {
+ elog "This version is built on experimental development code"
+ elog "If you encounter any errors report them at http://bugs.xmms2.org"
+ elog "and visit #xmms2 at irc://irc.freenode.net"
+ if use phonehome ; then
+ einfo ""
+ einfo "The phone-home client xmms2-et was activated"
+ einfo "This client sends anonymous usage-statistics to the xmms2"
+ einfo "developers which may help finding bugs"
+ einfo "Disable the phonehome useflag if you don't like that"
+ fi
+}
diff --git a/media-sound/xmms2/xmms2-0.8_p20161122-r1.ebuild b/media-sound/xmms2/xmms2-0.8_p20161122-r1.ebuild
new file mode 100644
index 000000000000..8e1a03998bf6
--- /dev/null
+++ b/media-sound/xmms2/xmms2-0.8_p20161122-r1.ebuild
@@ -0,0 +1,294 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
+USE_RUBY="ruby20 ruby21 ruby22"
+
+inherit eutils multiprocessing python-single-r1 ruby-single toolchain-funcs
+
+# generated as 'python2 ./utils/gen-tarball.py' from clean git tree
+MY_P="${P%_p*}DrO_o-949-gca15e830"
+
+DESCRIPTION="X(cross)platform Music Multiplexing System. Next generation of the XMMS player"
+HOMEPAGE="https://xmms2.org/wiki/Main_Page"
+#SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.bz2"
+SRC_URI="https://dev.gentoo.org/~slyfox/distfiles/${MY_P}.tar.bz2"
+LICENSE="GPL-2 LGPL-2.1"
+
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ppc ~x86"
+
+IUSE="aac airplay +alsa ao asf cdda curl cxx ffmpeg flac fluidsynth gvfs ices
+jack mac mlib-update mms +mad modplug mp3 mp4 musepack ofa opus oss
+perl phonehome pulseaudio python ruby samba +server sid sndfile speex
+test valgrind +vorbis vocoder wavpack xml zeroconf"
+
+RDEPEND="server? (
+ >=dev-db/sqlite-3.3.4
+
+ aac? ( >=media-libs/faad2-2.0 )
+ airplay? ( dev-libs/openssl:0= )
+ alsa? ( media-libs/alsa-lib )
+ ao? ( media-libs/libao )
+ cdda? ( dev-libs/libcdio-paranoia
+ >=media-libs/libdiscid-0.1.1
+ >=media-sound/cdparanoia-3.9.8 )
+ curl? ( >=net-misc/curl-7.15.1 )
+ ffmpeg? ( virtual/ffmpeg )
+ flac? ( media-libs/flac )
+ fluidsynth? ( media-sound/fluidsynth )
+ gvfs? ( gnome-base/gnome-vfs )
+ ices? ( media-libs/libogg
+ media-libs/libshout
+ media-libs/libvorbis )
+ jack? ( >=media-sound/jack-audio-connection-kit-0.101.1 )
+ mac? ( media-sound/mac )
+ mms? ( virtual/ffmpeg
+ >=media-libs/libmms-0.3 )
+ modplug? ( media-libs/libmodplug )
+ mad? ( media-libs/libmad )
+ mp3? ( >=media-sound/mpg123-1.5.1 )
+ musepack? ( media-sound/musepack-tools )
+ ofa? ( media-libs/libofa )
+ opus? ( media-libs/opus
+ media-libs/opusfile )
+ pulseaudio? ( media-sound/pulseaudio )
+ samba? ( >=net-fs/samba-4.2 )
+ sid? ( media-sound/sidplay
+ media-libs/resid )
+ sndfile? ( media-libs/libsndfile )
+ speex? ( media-libs/speex
+ media-libs/libogg )
+ vorbis? ( media-libs/libvorbis )
+ vocoder? ( sci-libs/fftw:3.0= media-libs/libsamplerate )
+ wavpack? ( media-sound/wavpack )
+ xml? ( dev-libs/libxml2 )
+ zeroconf? ( net-dns/avahi[mdnsresponder-compat] )
+ )
+
+ >=dev-libs/glib-2.12.9
+ cxx? ( >=dev-libs/boost-1.32 )
+ perl? ( >=dev-lang/perl-5.8.8 )
+ python? ( ${PYTHON_DEPS} )
+ ruby? ( ${RUBY_DEPS} )
+"
+
+DEPEND="${RDEPEND}
+ dev-lang/python
+ virtual/pkgconfig
+ perl? ( dev-perl/Module-Build
+ virtual/perl-Module-Metadata )
+ python? ( >=dev-python/cython-0.15.1
+ dev-python/pyrex )
+ test? ( dev-util/cunit
+ valgrind? ( dev-util/valgrind ) )
+"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ # used both for building xmms2 and
+ # optionally linking client library
+ # against python
+ python-single-r1_pkg_setup
+}
+
+# use_enable() is taken as proto
+# $1 - useflag
+# $2 - xmms2 option/plugin name (equals to $1 if not set)
+
+xmms2_flag() {
+ [[ -z $1 ]] && eerror "!!! empty arg. usage: xmms2_flag <USEFLAG> [<xmms2_flagname>]."
+
+ local UWORD=${2:-$1}
+
+ case $1 in
+ ENABLED)
+ echo ",${UWORD}"
+ ;;
+ DISABLED)
+ ;;
+ *)
+ use $1 && echo ",${UWORD}"
+ ;;
+ esac
+}
+
+src_prepare() {
+ ./waf # inflate waf
+ cd .waf* || die
+ # needs port
+ #epatch "${FILESDIR}/${PN}"-0.8DrO_o-waflib-fix-perl.patch #578778
+ cd "${S}"
+
+ eapply "${FILESDIR}/${PN}"-0.8-ffmpeg2.patch #536232
+
+ eapply "${FILESDIR}/${PN}"-0.8-rtvg.patch #424377
+
+ # required to build tarball from git tree
+ eapply "${FILESDIR}/${P}"-tarball.patch
+
+ # fix hash to be the same on LE/BE platforms
+ eapply "${FILESDIR}/${P}"-be-hash.patch
+
+ eapply_user
+}
+
+src_configure() {
+ # ./configure alike options.
+ local waf_params="--prefix=/usr \
+ --libdir=/usr/$(get_libdir) \
+ --with-target-platform=${CHOST} \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --datadir=/usr/share \
+ --sysconfdir=/etc \
+ --localstatedir=/var/lib"
+
+ local optionals=""
+ local plugins=""
+ if ! use server ; then
+ waf_params+=" --without-xmms2d"
+ else
+ # some fun static mappings:
+ local option_map=( # USE # sorted xmms2 option flag (same, as USE if empty)
+ "phonehome et"
+ "ENABLED launcher"
+ "mlib-update medialib-updater"
+ "ENABLED nycli"
+ " perl"
+ "ENABLED pixmaps"
+ " python"
+ " ruby"
+ "DISABLED tests"
+ "DISABLED vistest"
+ "cxx xmmsclient++"
+ "cxx xmmsclient++-glib"
+ "DISABLED xmmsclient-cf"
+ "DISABLED xmmsclient-ecore" # not in tree
+
+ "test tests"
+ )
+
+ local plugin_map=( # USE # sorted xmms2 plugin flag (same, as USE if empty)
+ " alsa"
+ " airplay"
+ " ao"
+ "ffmpeg apefile"
+ "ffmpeg avcodec"
+ " asf"
+ "ENABLED asx"
+ " cdda"
+ "DISABLED coreaudio" # MacOS only?
+ " curl"
+ "ENABLED cue"
+ "zeroconf daap"
+ "ENABLED diskwrite"
+ "ENABLED equalizer"
+ "aac faad"
+ "ENABLED file"
+ " flac"
+ " fluidsynth"
+ "ffmpeg flv"
+ "ffmpeg tta"
+ "DISABLED gme" # not in tree
+ " gvfs"
+ "ENABLED html"
+ " ices"
+ "ENABLED icymetaint"
+ "ENABLED id3v2"
+ " jack"
+ "ENABLED karaoke"
+ "ENABLED m3u"
+ " mac"
+ " mms"
+ " mad"
+ "ENABLED midsquash"
+ " mp4" # bug #387961 (aac, mp3, ape can sit there)
+ "mp3 mpg123"
+ " modplug"
+ " musepack"
+ "DISABLED nms" # not in tree
+ "ENABLED normalize"
+ "ENABLED null"
+ "ENABLED nulstripper"
+ " ofa"
+ " opus"
+ " oss"
+ "ENABLED pls"
+ "pulseaudio pulse"
+ "ENABLED replaygain"
+ "xml rss"
+ " samba"
+ "DISABLED sc68" #not in tree
+ " sid"
+ " sndfile"
+ " speex"
+ "DISABLED sun" # {Open,Net}BSD only
+ "DISABLED tremor" # not in tree
+ " vorbis"
+ " vocoder"
+ "ffmpeg tta"
+ "ENABLED wave"
+ "DISABLED waveout" # windows only
+ " wavpack"
+ "xml xspf"
+ "ENABLED xml"
+ )
+
+ local option
+ for option in "${option_map[@]}"; do
+ optionals+=$(xmms2_flag $option)
+ done
+
+ local plugin
+ for plugin in "${plugin_map[@]}"; do
+ plugins+=$(xmms2_flag $plugin)
+ done
+ fi # ! server
+
+ # pass them explicitely even if empty as we try to avoid magic deps
+ waf_params+=" --with-optionals=${optionals:1}" # skip first ',' if yet
+ waf_params+=" --with-plugins=${plugins:1}"
+ waf_params+=" $(use_with valgrind)"
+
+ CC="$(tc-getCC)" \
+ CPP="$(tc-getCPP)" \
+ AR="$(tc-getAR)" \
+ RANLIB="$(tc-getRANLIB)" \
+ CXX="$(tc-getCXX)" \
+ ./waf configure ${waf_params} || die "'waf configure' failed"
+}
+
+src_compile() {
+ # waf is very keen to run tests in build phase (bug #424377) but
+ # it does not bother running tests twice, so the hack below works:
+ ./waf --verbose build || ./waf --verbose build || die "waf build failed"
+}
+
+src_test() {
+ # rerun tests
+ ./waf --alltests || die "waf --alltests failed"
+}
+
+src_install() {
+ ./waf --without-ldconfig --destdir="${D}" install || die "'waf install' failed"
+ dodoc AUTHORS TODO
+}
+
+pkg_postinst() {
+ elog "This version is built on experimental development code"
+ elog "If you encounter any errors report them at http://bugs.xmms2.org"
+ elog "and visit #xmms2 at irc://irc.freenode.net"
+ if use phonehome ; then
+ einfo ""
+ einfo "The phone-home client xmms2-et was activated"
+ einfo "This client sends anonymous usage-statistics to the xmms2"
+ einfo "developers which may help finding bugs"
+ einfo "Disable the phonehome useflag if you don't like that"
+ fi
+}
diff --git a/media-sound/xmms2/xmms2-0.8_p20161122.ebuild b/media-sound/xmms2/xmms2-0.8_p20161122.ebuild
new file mode 100644
index 000000000000..14ef8f66ad1c
--- /dev/null
+++ b/media-sound/xmms2/xmms2-0.8_p20161122.ebuild
@@ -0,0 +1,291 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
+USE_RUBY="ruby20 ruby21 ruby22"
+
+inherit eutils multiprocessing python-single-r1 ruby-single toolchain-funcs
+
+# generated as 'python2 ./utils/gen-tarball.py' from clean git tree
+MY_P="${P%_p*}DrO_o-949-gca15e830"
+
+DESCRIPTION="X(cross)platform Music Multiplexing System. Next generation of the XMMS player"
+HOMEPAGE="https://xmms2.org/wiki/Main_Page"
+#SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.bz2"
+SRC_URI="https://dev.gentoo.org/~slyfox/distfiles/${MY_P}.tar.bz2"
+LICENSE="GPL-2 LGPL-2.1"
+
+SLOT="0"
+KEYWORDS="alpha amd64 ppc x86"
+
+IUSE="aac airplay +alsa ao asf cdda curl cxx ffmpeg flac fluidsynth gvfs ices
+jack mac mlib-update mms +mad modplug mp3 mp4 musepack ofa opus oss
+perl phonehome pulseaudio python ruby samba +server sid sndfile speex
+test valgrind +vorbis vocoder wavpack xml zeroconf"
+
+RDEPEND="server? (
+ >=dev-db/sqlite-3.3.4
+
+ aac? ( >=media-libs/faad2-2.0 )
+ airplay? ( dev-libs/openssl:0= )
+ alsa? ( media-libs/alsa-lib )
+ ao? ( media-libs/libao )
+ cdda? ( dev-libs/libcdio-paranoia
+ >=media-libs/libdiscid-0.1.1
+ >=media-sound/cdparanoia-3.9.8 )
+ curl? ( >=net-misc/curl-7.15.1 )
+ ffmpeg? ( virtual/ffmpeg )
+ flac? ( media-libs/flac )
+ fluidsynth? ( media-sound/fluidsynth )
+ gvfs? ( gnome-base/gnome-vfs )
+ ices? ( media-libs/libogg
+ media-libs/libshout
+ media-libs/libvorbis )
+ jack? ( >=media-sound/jack-audio-connection-kit-0.101.1 )
+ mac? ( media-sound/mac )
+ mms? ( virtual/ffmpeg
+ >=media-libs/libmms-0.3 )
+ modplug? ( media-libs/libmodplug )
+ mad? ( media-libs/libmad )
+ mp3? ( >=media-sound/mpg123-1.5.1 )
+ musepack? ( media-sound/musepack-tools )
+ ofa? ( media-libs/libofa )
+ opus? ( media-libs/opus
+ media-libs/opusfile )
+ pulseaudio? ( media-sound/pulseaudio )
+ samba? ( >=net-fs/samba-4.2 )
+ sid? ( media-sound/sidplay
+ media-libs/resid )
+ sndfile? ( media-libs/libsndfile )
+ speex? ( media-libs/speex
+ media-libs/libogg )
+ vorbis? ( media-libs/libvorbis )
+ vocoder? ( sci-libs/fftw:3.0= media-libs/libsamplerate )
+ wavpack? ( media-sound/wavpack )
+ xml? ( dev-libs/libxml2 )
+ zeroconf? ( net-dns/avahi[mdnsresponder-compat] )
+ )
+
+ >=dev-libs/glib-2.12.9
+ cxx? ( >=dev-libs/boost-1.32 )
+ perl? ( >=dev-lang/perl-5.8.8 )
+ python? ( ${PYTHON_DEPS} )
+ ruby? ( ${RUBY_DEPS} )
+"
+
+DEPEND="${RDEPEND}
+ dev-lang/python
+ virtual/pkgconfig
+ perl? ( dev-perl/Module-Build
+ virtual/perl-Module-Metadata )
+ python? ( >=dev-python/cython-0.15.1
+ dev-python/pyrex )
+ test? ( dev-util/cunit
+ valgrind? ( dev-util/valgrind ) )
+"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ # used both for building xmms2 and
+ # optionally linking client library
+ # against python
+ python-single-r1_pkg_setup
+}
+
+# use_enable() is taken as proto
+# $1 - useflag
+# $2 - xmms2 option/plugin name (equals to $1 if not set)
+
+xmms2_flag() {
+ [[ -z $1 ]] && eerror "!!! empty arg. usage: xmms2_flag <USEFLAG> [<xmms2_flagname>]."
+
+ local UWORD=${2:-$1}
+
+ case $1 in
+ ENABLED)
+ echo ",${UWORD}"
+ ;;
+ DISABLED)
+ ;;
+ *)
+ use $1 && echo ",${UWORD}"
+ ;;
+ esac
+}
+
+src_prepare() {
+ ./waf # inflate waf
+ cd .waf* || die
+ # needs port
+ #epatch "${FILESDIR}/${PN}"-0.8DrO_o-waflib-fix-perl.patch #578778
+ cd "${S}"
+
+ eapply "${FILESDIR}/${PN}"-0.8-ffmpeg2.patch #536232
+
+ eapply "${FILESDIR}/${PN}"-0.8-rtvg.patch #424377
+
+ # required to build tarball from git tree
+ eapply "${FILESDIR}/${P}"-tarball.patch
+
+ eapply_user
+}
+
+src_configure() {
+ # ./configure alike options.
+ local waf_params="--prefix=/usr \
+ --libdir=/usr/$(get_libdir) \
+ --with-target-platform=${CHOST} \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --datadir=/usr/share \
+ --sysconfdir=/etc \
+ --localstatedir=/var/lib"
+
+ local optionals=""
+ local plugins=""
+ if ! use server ; then
+ waf_params+=" --without-xmms2d"
+ else
+ # some fun static mappings:
+ local option_map=( # USE # sorted xmms2 option flag (same, as USE if empty)
+ "phonehome et"
+ "ENABLED launcher"
+ "mlib-update medialib-updater"
+ "ENABLED nycli"
+ " perl"
+ "ENABLED pixmaps"
+ " python"
+ " ruby"
+ "DISABLED tests"
+ "DISABLED vistest"
+ "cxx xmmsclient++"
+ "cxx xmmsclient++-glib"
+ "DISABLED xmmsclient-cf"
+ "DISABLED xmmsclient-ecore" # not in tree
+
+ "test tests"
+ )
+
+ local plugin_map=( # USE # sorted xmms2 plugin flag (same, as USE if empty)
+ " alsa"
+ " airplay"
+ " ao"
+ "ffmpeg apefile"
+ "ffmpeg avcodec"
+ " asf"
+ "ENABLED asx"
+ " cdda"
+ "DISABLED coreaudio" # MacOS only?
+ " curl"
+ "ENABLED cue"
+ "zeroconf daap"
+ "ENABLED diskwrite"
+ "ENABLED equalizer"
+ "aac faad"
+ "ENABLED file"
+ " flac"
+ " fluidsynth"
+ "ffmpeg flv"
+ "ffmpeg tta"
+ "DISABLED gme" # not in tree
+ " gvfs"
+ "ENABLED html"
+ " ices"
+ "ENABLED icymetaint"
+ "ENABLED id3v2"
+ " jack"
+ "ENABLED karaoke"
+ "ENABLED m3u"
+ " mac"
+ " mms"
+ " mad"
+ "ENABLED midsquash"
+ " mp4" # bug #387961 (aac, mp3, ape can sit there)
+ "mp3 mpg123"
+ " modplug"
+ " musepack"
+ "DISABLED nms" # not in tree
+ "ENABLED normalize"
+ "ENABLED null"
+ "ENABLED nulstripper"
+ " ofa"
+ " opus"
+ " oss"
+ "ENABLED pls"
+ "pulseaudio pulse"
+ "ENABLED replaygain"
+ "xml rss"
+ " samba"
+ "DISABLED sc68" #not in tree
+ " sid"
+ " sndfile"
+ " speex"
+ "DISABLED sun" # {Open,Net}BSD only
+ "DISABLED tremor" # not in tree
+ " vorbis"
+ " vocoder"
+ "ffmpeg tta"
+ "ENABLED wave"
+ "DISABLED waveout" # windows only
+ " wavpack"
+ "xml xspf"
+ "ENABLED xml"
+ )
+
+ local option
+ for option in "${option_map[@]}"; do
+ optionals+=$(xmms2_flag $option)
+ done
+
+ local plugin
+ for plugin in "${plugin_map[@]}"; do
+ plugins+=$(xmms2_flag $plugin)
+ done
+ fi # ! server
+
+ # pass them explicitely even if empty as we try to avoid magic deps
+ waf_params+=" --with-optionals=${optionals:1}" # skip first ',' if yet
+ waf_params+=" --with-plugins=${plugins:1}"
+ waf_params+=" $(use_with valgrind)"
+
+ CC="$(tc-getCC)" \
+ CPP="$(tc-getCPP)" \
+ AR="$(tc-getAR)" \
+ RANLIB="$(tc-getRANLIB)" \
+ CXX="$(tc-getCXX)" \
+ ./waf configure ${waf_params} || die "'waf configure' failed"
+}
+
+src_compile() {
+ # waf is very keen to run tests in build phase (bug #424377) but
+ # it does not bother running tests twice, so the hack below works:
+ ./waf --verbose build || ./waf --verbose build || die "waf build failed"
+}
+
+src_test() {
+ # rerun tests
+ ./waf --alltests || die "waf --alltests failed"
+}
+
+src_install() {
+ ./waf --without-ldconfig --destdir="${D}" install || die "'waf install' failed"
+ dodoc AUTHORS TODO
+}
+
+pkg_postinst() {
+ elog "This version is built on experimental development code"
+ elog "If you encounter any errors report them at http://bugs.xmms2.org"
+ elog "and visit #xmms2 at irc://irc.freenode.net"
+ if use phonehome ; then
+ einfo ""
+ einfo "The phone-home client xmms2-et was activated"
+ einfo "This client sends anonymous usage-statistics to the xmms2"
+ einfo "developers which may help finding bugs"
+ einfo "Disable the phonehome useflag if you don't like that"
+ fi
+}