summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Tumaykin <itumaykin@gmail.com>2016-07-18 01:01:00 +0300
committerPatrice Clement <monsieurp@gentoo.org>2016-07-25 15:03:08 +0200
commit8acfe6db0f4025b2661cf4cc0f97d56f61089a06 (patch)
tree6899f8d97e0defbafb0e43509145eb9635e28028 /media-video/mpv
parentmedia-video/mpv: warn re softvol, non-fatal ffmpeg version check in 9999 (diff)
downloadgentoo-8acfe6db0f4025b2661cf4cc0f97d56f61089a06.tar.gz
gentoo-8acfe6db0f4025b2661cf4cc0f97d56f61089a06.tar.bz2
gentoo-8acfe6db0f4025b2661cf4cc0f97d56f61089a06.zip
media-video/mpv: verbump to 0.18.1
Gentoo-Bug: 588492 Package-Manager: portage-2.3.0 Signed-off-by: Patrice Clement <monsieurp@gentoo.org>
Diffstat (limited to 'media-video/mpv')
-rw-r--r--media-video/mpv/Manifest1
-rw-r--r--media-video/mpv/files/0.18.1/mpv-0.18.1-fix-audio-uninit-crash.patch39
-rw-r--r--media-video/mpv/files/0.18.1/mpv-0.18.1-fix-doc-build.patch23
-rw-r--r--media-video/mpv/files/0.18.1/mpv-0.18.1-fix-high-CPU-on-wayland.patch34
-rw-r--r--media-video/mpv/files/0.18.1/mpv-0.18.1-fix-stuck-volume-on-pulseaudio.patch32
-rw-r--r--media-video/mpv/files/0.18.1/mpv-0.18.1-handle-ffmpeg-ABI-changes.patch69
-rw-r--r--media-video/mpv/files/0.18.1/mpv-0.18.1-respect-deinterlace-auto.patch38
-rw-r--r--media-video/mpv/files/0.18.1/mpv-0.18.1-show-osd-with-ao-volume.patch46
-rw-r--r--media-video/mpv/mpv-0.18.1.ebuild329
9 files changed, 611 insertions, 0 deletions
diff --git a/media-video/mpv/Manifest b/media-video/mpv/Manifest
index 4ed6ad1eeb34..7ce670868a47 100644
--- a/media-video/mpv/Manifest
+++ b/media-video/mpv/Manifest
@@ -1,6 +1,7 @@
DIST mpv-0.17.0-patches-06.tar.gz 14418 SHA256 a0fcf861ed50686f35556a9334581e1d735f2910f834d1885b9940bd90d7525c SHA512 0bbd040df7d59e30e5c0b37b6966e5f24bd9041b3916a68b68f97a1f2aa3c2447a2dc873742d779f8ebfe599aeef6474c542f8acc7cd2fdf871d89b6b458452b WHIRLPOOL 38ab169a92b0d2c8266e459037c152ca841440231ba5dda2c2153dbee2f5a6e2193351d8f7e01e9eb6110fd21687deb1f39ea765e35dc8c69db358c45ff3c25e
DIST mpv-0.17.0.tar.gz 2882629 SHA256 602cd2b0f5fc7e43473234fbb96e3f7bbb6418f15eb8fa720d9433cce31eba6e SHA512 fb79738a16dbc12b60199a68836aca121a800958af4eaf6c2bdf1114bde36c156bafc232e814045a16fd738d2de1e2d8392bc98507961e5a73fa692e270dc7a2 WHIRLPOOL 704133b4033a5a2be8db92a4f1e52397d5b261a99a035d38e33b91d2c478e0e9bfcb2ba0e24ee03d37fffe693b275f50f7f1e453263a5afe61e8944f51eefa61
DIST mpv-0.18.0.tar.gz 2758960 SHA256 b656638d4f6bce2621baaacb60d8be384aa492fcd86dfd43996aaa2c16fee02b SHA512 5a899ea680b4da6d668a6e77a254e623bafef16f376ee46639e40f151da5a000de84b382f2b07f3a1e87b60fc8e524132767fdf243e36474966af11a88277437 WHIRLPOOL c491e61cb2d7f453cfc23605120048e81c2b7621b8d9591cad6415d3b550f55db6a6c8c6f90d27c7ce214ff89f92a9861d202b457c2de25c5b7de11d8d1d40af
+DIST mpv-0.18.1.tar.gz 2763392 SHA256 e413d57fec4ad43b9f9b848f38d13fb921313fc9a4a64bf1e906c8d0f7a46329 SHA512 4ed94a5365d432d1fb07c11a8e40ed7564925eacec8b61576690b8f3d8ff82d4e0b2841cc941fb711c659c77ff67bfea86b66bd5f570d3ae953bce715981cd2a WHIRLPOOL 6c46555f31fdc240065e5500b055aa6845e0103b1e48a55a912b3fa3de777f10859d517c00f5f2651ef84b1da98457439335b8dad43b0a142a6b3b678c542b5f
DIST mpv-0.9.2.tar.gz 2701306 SHA256 c0148f55dbd17705f49bb496d0ce374419de62e1b17195d91409d7727cbd4751 SHA512 4f652a8e78d65b0ef44a06287b05250dfdfbce4cf5a6e21d3b446eedec268d83cf98afcc687272e2da2cfac9e9f69a303847dffdfd45cecdd4273b943ce50967 WHIRLPOOL 1512bacc2ce50e875770c76106a1bb2bc1d0cc5f6e2bdce91ff8c5cfc8bf13ffb48519858a5fa2a7d57880820dc12e5eb20f34ab71eca5d76ec303618da8f3fe
DIST waf-1.8.12 97567 SHA256 01bf2beab2106d1558800c8709bc2c8e496d3da4a2ca343fe091f22fca60c98b SHA512 8e47112abb134f965f15a27a600b4453cad3075afb5dadc17f2f6dac33d80ec68b679ac0ebc5f8a0245cbd07ae9fc7b899e69afc1bd021cce74e7af2ab457939 WHIRLPOOL c36d37c2d8c08e4048b4800f511611af5cf534304fcb58388ca491ff308bfcbcdd959d153edfd6ff8c118404e7293d8b786e43b07486139bf915a82aa75d792b
DIST waf-1.8.4 96179 SHA256 f02035fa5d8814f33f19b2b20d43822ddef6bb39b955ca196c2a247a1f9ffaa8 SHA512 3a132d8b1cba0af0e3df046c0204c5df706fae4e0fac41cf74b53f6cdea6210ed798671c7a3cb3fee70573aacab16d4c0cc699cc4b7aa74c8a416346c5513f4c WHIRLPOOL fe8d7f42e5118a1f9490a0c9add1355c969185376b57d0bab024068dd6e7364632d862bf9432e1209165c5313ae843479ef334f4bd6285db05dfebff9a1b640e
diff --git a/media-video/mpv/files/0.18.1/mpv-0.18.1-fix-audio-uninit-crash.patch b/media-video/mpv/files/0.18.1/mpv-0.18.1-fix-audio-uninit-crash.patch
new file mode 100644
index 000000000000..8300d4b2311b
--- /dev/null
+++ b/media-video/mpv/files/0.18.1/mpv-0.18.1-fix-audio-uninit-crash.patch
@@ -0,0 +1,39 @@
+commit 79974e7ad94e7658c780e3b446a7822a533675e4
+Author: wm4 <wm4@nowhere>
+Date: Fri Jul 15 23:11:25 2016 +0200
+
+audio: fix crashes due to broken uninit check
+
+Since mixer->ao is always NULL now (it was really just forgotten to be
+removed), the uninit call never actually cleared the af field, leaving
+a dangling pointer that could be accessed by volume control.
+
+diff --git a/audio/mixer.c b/audio/mixer.c
+index a58a814..795edfa 100644
+--- a/audio/mixer.c
++++ b/audio/mixer.c
+@@ -23,7 +23,6 @@
+ #include <libavutil/common.h>
+
+ #include "config.h"
+-#include "audio/out/ao.h"
+ #include "audio/filter/af.h"
+ #include "common/global.h"
+ #include "common/msg.h"
+@@ -33,7 +32,6 @@
+ struct mixer {
+ struct mp_log *log;
+ struct MPOpts *opts;
+- struct ao *ao;
+ struct af_stream *af;
+ // Other stuff
+ float balance;
+@@ -145,8 +143,5 @@ void mixer_reinit_audio(struct mixer *mixer, struct af_stream *af)
+ */
+ void mixer_uninit_audio(struct mixer *mixer)
+ {
+- if (!mixer->ao)
+- return;
+-
+ mixer->af = NULL;
+ }
diff --git a/media-video/mpv/files/0.18.1/mpv-0.18.1-fix-doc-build.patch b/media-video/mpv/files/0.18.1/mpv-0.18.1-fix-doc-build.patch
new file mode 100644
index 000000000000..26c8f72d4dae
--- /dev/null
+++ b/media-video/mpv/files/0.18.1/mpv-0.18.1-fix-doc-build.patch
@@ -0,0 +1,23 @@
+commit 4a4a9f330281ad11eb39a013bf7308063767bab8
+Author: Martin Herkt <lachs0r@srsfckn.biz>
+Date: Fri Jul 15 12:57:12 2016 +0200
+
+man: fix PDF build error
+
+ReportLab really doesn’t like breaking inline literals, so insert an
+explicit line break.
+
+Fixes #3338
+
+diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
+index 9a251ae..74d17a6 100644
+--- a/DOCS/man/options.rst
++++ b/DOCS/man/options.rst
+@@ -588,6 +588,7 @@ Video
+ :videotoolbox: requires ``--vo=opengl`` (OS X 10.8 and up only)
+ :videotoolbox-copy: copies video back into system RAM (OS X 10.8 and up only)
+ :dxva2: requires ``--vo=opengl:backend=angle`` or
++
+ ``--vo=opengl:backend=dxinterop`` (Windows only)
+ :dxva2-copy: copies video back to system RAM (Windows only)
+ :d3d11va: requires ``--vo=opengl:backend=angle`` (Windows only)
diff --git a/media-video/mpv/files/0.18.1/mpv-0.18.1-fix-high-CPU-on-wayland.patch b/media-video/mpv/files/0.18.1/mpv-0.18.1-fix-high-CPU-on-wayland.patch
new file mode 100644
index 000000000000..b558da34f699
--- /dev/null
+++ b/media-video/mpv/files/0.18.1/mpv-0.18.1-fix-high-CPU-on-wayland.patch
@@ -0,0 +1,34 @@
+commit e11a20a8122b370b66235284dd4f67ce1f1bbc0b
+Author: Rostislav Pehlivanov <atomnuker@gmail.com>
+Date: Tue Jul 19 03:00:03 2016 +0100
+
+vo_wayland: fix high CPU usage due to busy polling
+
+There's no need to call wl_display_flush() since all the client-side
+buffered data has already been flushed prior to polling the fd.
+Instead only check for POLLIN and the usual ERR+HUP.
+
+diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
+index 0e44ddd..6861c93 100644
+--- a/video/out/wayland_common.c
++++ b/video/out/wayland_common.c
+@@ -1106,7 +1106,7 @@ static int vo_wayland_poll (struct vo *vo, int timeout_msecs)
+
+ struct pollfd fd = {
+ wl->display.display_fd,
+- POLLIN | POLLOUT | POLLERR | POLLHUP,
++ POLLIN | POLLERR | POLLHUP,
+ 0
+ };
+
+@@ -1125,8 +1125,8 @@ static int vo_wayland_poll (struct vo *vo, int timeout_msecs)
+ }
+ if (fd.revents & POLLIN)
+ wl_display_dispatch(dp);
+- if (fd.revents & POLLOUT)
+- wl_display_flush(dp);
++ else
++ wl_display_dispatch_pending(dp);
+ }
+
+ return polled;
diff --git a/media-video/mpv/files/0.18.1/mpv-0.18.1-fix-stuck-volume-on-pulseaudio.patch b/media-video/mpv/files/0.18.1/mpv-0.18.1-fix-stuck-volume-on-pulseaudio.patch
new file mode 100644
index 000000000000..8d77687e27ca
--- /dev/null
+++ b/media-video/mpv/files/0.18.1/mpv-0.18.1-fix-stuck-volume-on-pulseaudio.patch
@@ -0,0 +1,32 @@
+commit d191d76e52a992840ab614f760f1189391a5507d
+Author: wm4 <wm4@nowhere>
+Date: Thu Jul 14 18:11:14 2016 +0200
+
+ao_pulse: fix some volume control rounding issues
+
+Volume could get easily "stuck" or making too huge steps when doing
+things like "add ao-volume 1".
+
+diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c
+index d553b67..fc0dd0d 100644
+--- a/audio/out/ao_pulse.c
++++ b/audio/out/ao_pulse.c
+@@ -23,6 +23,7 @@
+ #include <stdbool.h>
+ #include <string.h>
+ #include <stdint.h>
++#include <math.h>
+ #include <pthread.h>
+
+ #include <pulse/pulseaudio.h>
+@@ -34,8 +35,8 @@
+ #include "ao.h"
+ #include "internal.h"
+
+-#define VOL_PA2MP(v) ((v) * 100 / PA_VOLUME_NORM)
+-#define VOL_MP2PA(v) ((v) * PA_VOLUME_NORM / 100)
++#define VOL_PA2MP(v) ((v) * 100.0 / PA_VOLUME_NORM)
++#define VOL_MP2PA(v) lrint((v) * PA_VOLUME_NORM / 100)
+
+ struct priv {
+ // PulseAudio playback stream object
diff --git a/media-video/mpv/files/0.18.1/mpv-0.18.1-handle-ffmpeg-ABI-changes.patch b/media-video/mpv/files/0.18.1/mpv-0.18.1-handle-ffmpeg-ABI-changes.patch
new file mode 100644
index 000000000000..7c006b8506ae
--- /dev/null
+++ b/media-video/mpv/files/0.18.1/mpv-0.18.1-handle-ffmpeg-ABI-changes.patch
@@ -0,0 +1,69 @@
+commit dcfde2934dd7b5401b29d6a604fa3eca1b867d5c
+Author: wm4 <wm4@nowhere>
+Date: Sun Jul 24 19:31:47 2016 +0200
+
+audio: use idiotic FFmpeg ABI rules for public-except-not-public fields
+
+The FFmpeg API is incredibly weird and inconsistent about this. This is
+also a FFmpeg-only issue and nothing like this is in Libav - which
+doesn't really show FFmpeg in a very positive light.
+
+(To make it even worse: this is a full-blown Libav API incompatibility,
+even though this crap was added for Libav ABI-compatibility. It's
+absurd.)
+
+Quoting the FFmpeg header for the AVFrame.channels field:
+
+ /**
+ * number of audio channels, only used for audio.
+ * Code outside libavutil should access this field using:
+ * av_frame_get_channels(frame)
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int channels;
+
+It says "should" not must, and it doesn't even mention
+av_frame_set_channels(). It's also in the section for public fields (not
+below a marker that indicates private fields in a public struct, like
+it's done e.g. in AVCodecContext).
+
+But not using the accessor will cause silent failures on ABI changes.
+The failure that happened due to this code didn't even make it apparent
+what was wrong. So just use the idiotic accessor.
+
+Also harmonize the FFmpeg-cursing in the code. (It's fully justified.)
+
+Fixes #3295.
+
+Note that mpv will still check the exact library version numbers, and
+reject mismatches - to protect itself from such issues in the future.
+
+diff --git a/audio/audio.c b/audio/audio.c
+index 710cc03..4c67a9a 100644
+--- a/audio/audio.c
++++ b/audio/audio.c
+@@ -347,9 +347,9 @@ struct mp_audio *mp_audio_from_avframe(struct AVFrame *avframe)
+ mp_chmap_from_lavc(&lavc_chmap, avframe->channel_layout);
+
+ #if LIBAVUTIL_VERSION_MICRO >= 100
+- // FFmpeg being special again
+- if (lavc_chmap.num != avframe->channels)
+- mp_chmap_from_channels(&lavc_chmap, avframe->channels);
++ // FFmpeg being stupid POS again
++ if (lavc_chmap.num != av_frame_get_channels(avframe))
++ mp_chmap_from_channels(&lavc_chmap, av_frame_get_channels(avframe));
+ #endif
+
+ new->rate = avframe->sample_rate;
+@@ -407,8 +407,8 @@ int mp_audio_to_avframe(struct mp_audio *frame, struct AVFrame *avframe)
+ if (!avframe->channel_layout)
+ goto fail;
+ #if LIBAVUTIL_VERSION_MICRO >= 100
+- // FFmpeg being a stupid POS (but I respect it)
+- avframe->channels = frame->channels.num;
++ // FFmpeg being a stupid POS again
++ av_frame_set_channels(avframe, frame->channels.num);
+ #endif
+ avframe->sample_rate = frame->rate;
+
diff --git a/media-video/mpv/files/0.18.1/mpv-0.18.1-respect-deinterlace-auto.patch b/media-video/mpv/files/0.18.1/mpv-0.18.1-respect-deinterlace-auto.patch
new file mode 100644
index 000000000000..63be15ab0580
--- /dev/null
+++ b/media-video/mpv/files/0.18.1/mpv-0.18.1-respect-deinterlace-auto.patch
@@ -0,0 +1,38 @@
+commit 8b47e5daa440ed30d8e0aa83287bb7a7c014d2ae
+Author: wm4 <wm4@nowhere>
+Date: Tue Jul 12 19:35:47 2016 +0200
+
+video: respect --deinterlace=auto
+
+--deinterlace=auto is the default, and has the obscure semantics that
+deinterlacing is disabled, unless the user has manually inserted a
+deinterlacing filter.
+
+While in software decoding this doesn't matter, and we will happily
+insert 2 yadif filters (if the user has already added one), or not
+remove the yadif filter (if deinterlacing is disabled, but the user has
+added the filter manually), this is different with hardware deinterlacer
+filters. These support VFCTRL_SET_DEINTERLACE for toggling deinterlacing
+filtering at runtime. It exists mainly for legacy reasons, and possibly
+because it makes switching deinterlacing modes more efficient. It might
+also gives us an entry-point for VO deinterlacing, maybe. For whatever
+reasons this mechanism exists, we still support and use it.
+
+This commit fixes that video.c always used VFCTRL_SET_DEINTERLACE to
+disable deinterlacing, even if --deinterlace=auto was set. Fix this by
+checking the value of the option directly.
+
+diff --git a/player/video.c b/player/video.c
+index 59ce72f..0f324b3 100644
+--- a/player/video.c
++++ b/player/video.c
+@@ -214,7 +214,8 @@ static void filter_reconfig(struct MPContext *mpctx, struct vo_chain *vo_c)
+ }
+
+ // Make sure to reset this even if runtime deint switching is used.
+- video_vf_vo_control(vo_c, VFCTRL_SET_DEINTERLACE, &(int){0});
++ if (mpctx->opts->deinterlace >= 0)
++ video_vf_vo_control(vo_c, VFCTRL_SET_DEINTERLACE, &(int){0});
+
+ if (params.rotate && (params.rotate % 90 == 0)) {
+ if (!(vo_c->vo->driver->caps & VO_CAP_ROTATE90)) {
diff --git a/media-video/mpv/files/0.18.1/mpv-0.18.1-show-osd-with-ao-volume.patch b/media-video/mpv/files/0.18.1/mpv-0.18.1-show-osd-with-ao-volume.patch
new file mode 100644
index 000000000000..dc9f55050d1f
--- /dev/null
+++ b/media-video/mpv/files/0.18.1/mpv-0.18.1-show-osd-with-ao-volume.patch
@@ -0,0 +1,46 @@
+commit c5827387fd9a9c2986992b64382e6dad86f1eb6c
+Author: Uros Vampl <mobile.leecher@gmail.com>
+Date: Sun Jul 10 12:50:58 2016 +0200
+
+audio: show an osd bar when changing ao-volume
+
+also, make the osd msg prettier
+
+diff --git a/player/command.c b/player/command.c
+index 3bca64b..b44e12a 100644
+--- a/player/command.c
++++ b/player/command.c
+@@ -1635,8 +1635,20 @@ static int mp_property_ao_volume(void *ctx, struct m_property *prop,
+ return M_PROPERTY_OK;
+ }
+ case M_PROPERTY_GET_TYPE:
+- *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_FLOAT};
++ *(struct m_option *)arg = (struct m_option){
++ .type = CONF_TYPE_FLOAT,
++ .flags = M_OPT_RANGE,
++ .min = 0,
++ .max = 100,
++ };
+ return M_PROPERTY_OK;
++ case M_PROPERTY_PRINT: {
++ ao_control_vol_t vol = {0};
++ if (ao_control(ao, AOCONTROL_GET_VOLUME, &vol) != CONTROL_OK)
++ return M_PROPERTY_UNAVAILABLE;
++ *(char **)arg = talloc_asprintf(NULL, "%.f", (vol.left + vol.right) / 2.0f);
++ return M_PROPERTY_OK;
++ }
+ }
+ return M_PROPERTY_NOT_IMPLEMENTED;
+ }
+@@ -4051,7 +4063,11 @@ static const struct property_osd_display {
+ { "volume", "Volume",
+ .msg = "Volume: ${?volume:${volume}% ${?mute==yes:(Muted)}}${!volume:${volume}}",
+ .osd_progbar = OSD_VOLUME },
++ { "ao-volume", "AO Volume",
++ .msg = "AO Volume: ${?ao-volume:${ao-volume}% ${?ao-mute==yes:(Muted)}}${!ao-volume:${ao-volume}}",
++ .osd_progbar = OSD_VOLUME },
+ { "mute", "Mute" },
++ { "ao-mute", "AO Mute" },
+ { "audio-delay", "A-V delay" },
+ { "audio", "Audio" },
+ { "balance", "Balance", .osd_progbar = OSD_BALANCE },
diff --git a/media-video/mpv/mpv-0.18.1.ebuild b/media-video/mpv/mpv-0.18.1.ebuild
new file mode 100644
index 000000000000..aaee04bd8741
--- /dev/null
+++ b/media-video/mpv/mpv-0.18.1.ebuild
@@ -0,0 +1,329 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} )
+PYTHON_REQ_USE='threads(+)'
+
+WAF_PV=1.8.12
+
+inherit fdo-mime gnome2-utils pax-utils python-any-r1 toolchain-funcs versionator waf-utils
+
+DESCRIPTION="Media player based on MPlayer and mplayer2"
+HOMEPAGE="https://mpv.io/"
+
+if [[ ${PV} != *9999* ]]; then
+ SRC_URI="https://github.com/mpv-player/mpv/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux"
+ DOCS=( RELEASE_NOTES )
+else
+ EGIT_REPO_URI="git://github.com/mpv-player/mpv.git"
+ inherit git-r3
+fi
+SRC_URI+=" https://waf.io/waf-${WAF_PV}"
+DOCS+=( README.md )
+
+# See Copyright in sources and Gentoo bug 506946. Waf is BSD, libmpv is ISC.
+LICENSE="GPL-2+ BSD ISC"
+SLOT="0"
+IUSE="aqua +alsa archive bluray cdda +cli coreaudio doc drm dvb dvd +egl +enca
+ encode gbm +iconv jack jpeg lcms +libass libav libcaca libguess libmpv lua
+ luajit openal +opengl oss pulseaudio raspberry-pi rubberband samba -sdl
+ selinux test uchardet v4l vaapi vdpau vf-dlopen wayland +X xinerama
+ +xscreensaver +xv zsh-completion"
+
+REQUIRED_USE="
+ || ( cli libmpv )
+ aqua? ( opengl )
+ egl? ( || ( gbm X wayland ) )
+ enca? ( iconv )
+ gbm? ( drm egl )
+ lcms? ( || ( opengl egl ) )
+ libguess? ( iconv )
+ luajit? ( lua )
+ uchardet? ( iconv )
+ v4l? ( || ( alsa oss ) )
+ vaapi? ( || ( gbm X wayland ) )
+ vdpau? ( X )
+ wayland? ( egl )
+ xinerama? ( X )
+ xscreensaver? ( X )
+ xv? ( X )
+ zsh-completion? ( cli )
+"
+
+COMMON_DEPEND="
+ !libav? ( >=media-video/ffmpeg-2.4:0=[encode?,threads,vaapi?,vdpau?] )
+ libav? ( >=media-video/libav-11:0=[encode?,threads,vaapi?,vdpau?] )
+ sys-libs/zlib
+ alsa? ( >=media-libs/alsa-lib-1.0.18 )
+ archive? ( >=app-arch/libarchive-3.0.0:= )
+ bluray? ( >=media-libs/libbluray-0.3.0 )
+ cdda? ( dev-libs/libcdio-paranoia )
+ drm? ( x11-libs/libdrm )
+ dvb? ( virtual/linuxtv-dvb-headers )
+ dvd? (
+ >=media-libs/libdvdnav-4.2.0
+ >=media-libs/libdvdread-4.1.0
+ )
+ egl? ( media-libs/mesa[egl,gbm(-)?,wayland(-)?] )
+ iconv? (
+ virtual/libiconv
+ enca? ( app-i18n/enca )
+ libguess? ( >=app-i18n/libguess-1.0 )
+ uchardet? ( dev-libs/uchardet )
+ )
+ jack? ( virtual/jack )
+ jpeg? ( virtual/jpeg:0 )
+ lcms? ( >=media-libs/lcms-2.6:2 )
+ libass? (
+ >=media-libs/libass-0.12.1:=[fontconfig,harfbuzz]
+ virtual/ttf-fonts
+ )
+ libcaca? ( >=media-libs/libcaca-0.99_beta18 )
+ lua? (
+ !luajit? ( <dev-lang/lua-5.3:= )
+ luajit? ( dev-lang/luajit:2 )
+ )
+ openal? ( >=media-libs/openal-1.13 )
+ opengl? ( !aqua? ( virtual/opengl ) )
+ pulseaudio? ( media-sound/pulseaudio )
+ raspberry-pi? (
+ >=media-libs/raspberrypi-userland-0_pre20160305-r1
+ media-libs/mesa[egl,gles2]
+ )
+ rubberband? ( >=media-libs/rubberband-1.8.0 )
+ samba? ( net-fs/samba )
+ sdl? ( media-libs/libsdl2[sound,threads,video,X?,wayland?] )
+ v4l? ( media-libs/libv4l )
+ vaapi? ( >=x11-libs/libva-1.4.0[drm?,X?,wayland?] )
+ wayland? (
+ >=dev-libs/wayland-1.6.0
+ >=x11-libs/libxkbcommon-0.3.0
+ )
+ X? (
+ x11-libs/libX11
+ x11-libs/libXext
+ >=x11-libs/libXrandr-1.2.0
+ opengl? ( x11-libs/libXdamage )
+ vdpau? ( >=x11-libs/libvdpau-0.2 )
+ xinerama? ( x11-libs/libXinerama )
+ xscreensaver? ( x11-libs/libXScrnSaver )
+ xv? ( x11-libs/libXv )
+ )
+"
+DEPEND="${COMMON_DEPEND}
+ ${PYTHON_DEPS}
+ >=dev-lang/perl-5.8
+ dev-python/docutils
+ virtual/pkgconfig
+ doc? ( dev-python/rst2pdf )
+ test? ( >=dev-util/cmocka-1.0.0 )
+"
+RDEPEND="${COMMON_DEPEND}
+ selinux? ( sec-policy/selinux-mplayer )
+"
+
+PATCHES=(
+ "${FILESDIR}/${P}-make-ffmpeg-version-check-non-fatal.patch"
+ "${FILESDIR}/${PV}/${P}-show-osd-with-ao-volume.patch"
+ "${FILESDIR}/${PV}/${P}-respect-deinterlace-auto.patch"
+ "${FILESDIR}/${PV}/${P}-fix-stuck-volume-on-pulseaudio.patch"
+ "${FILESDIR}/${PV}/${P}-fix-doc-build.patch"
+ "${FILESDIR}/${PV}/${P}-fix-audio-uninit-crash.patch"
+ "${FILESDIR}/${PV}/${P}-fix-high-CPU-on-wayland.patch"
+ "${FILESDIR}/${PV}/${P}-handle-ffmpeg-ABI-changes.patch"
+)
+
+pkg_pretend() {
+ if [[ ${MERGE_TYPE} != "binary" ]] && ! tc-has-tls && use vaapi && use egl; then
+ die "Your compiler lacks C++11 TLS support. Use GCC>=4.8.0 or Clang>=3.3."
+ fi
+}
+
+src_prepare() {
+ cp "${DISTDIR}/waf-${WAF_PV}" "${S}"/waf || die
+ chmod +x "${S}"/waf || die
+ default_src_prepare
+}
+
+src_configure() {
+ local mywafargs=(
+ --confdir="${EPREFIX}/etc/${PN}"
+ --docdir="${EPREFIX}/usr/share/doc/${PF}"
+
+ $(usex cli '' '--disable-cplayer')
+ $(use_enable libmpv libmpv-shared)
+
+ # See deep down below for build-date.
+ --disable-libmpv-static
+ --disable-static-build
+ --disable-optimize # Don't add '-O2' to CFLAGS.
+ --disable-debug-build # Don't add '-g' to CFLAGS.
+
+ $(use_enable doc html-build)
+ $(use_enable doc pdf-build)
+ $(use_enable vf-dlopen vf-dlopen-filters)
+ $(use_enable zsh-completion zsh-comp)
+ $(use_enable test)
+
+ $(use_enable iconv)
+ $(use_enable samba libsmbclient)
+ $(use_enable lua)
+ $(usex luajit '--lua=luajit' '')
+ $(use_enable libass)
+ $(use_enable libass libass-osd)
+ $(use_enable encode encoding)
+ $(use_enable bluray libbluray)
+ $(use_enable dvd dvdread)
+ $(use_enable dvd dvdnav)
+ $(use_enable cdda)
+ $(use_enable enca)
+ $(use_enable libguess)
+ $(use_enable uchardet)
+ $(use_enable rubberband)
+ $(use_enable lcms lcms2)
+ --disable-vapoursynth # Only available in overlays.
+ --disable-vapoursynth-lazy
+ $(use_enable archive libarchive)
+
+ --enable-libavdevice
+
+ # Audio outputs:
+ $(use_enable sdl sdl2) # Listed under audio, but also includes video.
+ --disable-sdl1
+ $(use_enable oss oss-audio)
+ --disable-rsound # Only available in overlays.
+ $(use_enable pulseaudio pulse)
+ $(use_enable jack)
+ $(use_enable openal)
+ --disable-opensles
+ $(use_enable alsa)
+ $(use_enable coreaudio)
+
+ # Video outputs:
+ $(use_enable aqua cocoa)
+ $(use_enable drm)
+ $(use_enable gbm)
+ $(use_enable wayland)
+ $(use_enable X x11)
+ $(use_enable xscreensaver xss)
+ $(use_enable X xext)
+ $(use_enable xv)
+ $(use_enable xinerama)
+ $(use_enable X xrandr)
+ $(usex opengl "$(use_enable aqua gl-cocoa)" '--disable-gl-cocoa')
+ $(usex opengl "$(use_enable X gl-x11)" '--disable-gl-x11')
+ $(usex egl "$(use_enable X egl-x11)" '--disable-egl-x11')
+ $(usex egl "$(use_enable gbm egl-drm)" '--disable-egl-drm')
+ $(use_enable wayland gl-wayland)
+ $(use_enable vdpau)
+ $(usex vdpau "$(use_enable opengl vdpau-gl-x11)" '--disable-vdpau-gl-x11')
+ $(use_enable vaapi) # See below for vaapi-glx, vaapi-x-egl.
+ $(usex vaapi "$(use_enable X vaapi-x11)" '--disable-vaapi-x11')
+ $(usex vaapi "$(use_enable wayland vaapi-wayland)" '--disable-vaapi-wayland')
+ $(usex vaapi "$(use_enable gbm vaapi-drm)" '--disable-vaapi-drm')
+ $(use_enable libcaca caca)
+ $(use_enable jpeg)
+ --disable-android
+ $(use_enable raspberry-pi rpi)
+ $(usex libmpv "$(use_enable opengl plain-gl)" '--disable-plain-gl')
+
+ # HWaccels:
+ # Automagic Video Toolbox HW acceleration. See Gentoo bug 577332.
+ $(use_enable vaapi vaapi-hwaccel)
+ # Automagic VDPAU HW acceleration. See Gentoo bug 558870.
+
+ # TV features:
+ $(use_enable v4l tv)
+ $(use_enable v4l tv-v4l2)
+ $(use_enable v4l libv4l2)
+ $(use_enable v4l audio-input)
+ $(use_enable dvb dvbin)
+
+ # Miscellaneous features:
+ --disable-apple-remote # Needs testing first. See Gentoo bug 577332.
+ )
+
+ if use vaapi && use X; then
+ mywafargs+=(
+ $(use_enable opengl vaapi-glx)
+ $(use_enable egl vaapi-x-egl)
+ )
+ fi
+
+ if ! use egl && ! use opengl && ! use raspberry-pi; then
+ mywafargs+=(--disable-gl)
+ fi
+
+ # Create reproducible non-live builds.
+ [[ ${PV} != *9999* ]] && mywafargs+=(--disable-build-date)
+
+ waf-utils_src_configure "${mywafargs[@]}"
+}
+
+src_install() {
+ waf-utils_src_install
+
+ if use cli && use luajit; then
+ pax-mark -m "${ED}"usr/bin/${PN}
+ fi
+}
+
+pkg_preinst() {
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ fdo-mime_desktop_database_update
+ gnome2_icon_cache_update
+
+ local softvol_0_18_1=0
+ for rv in ${REPLACING_VERSIONS}; do
+ version_compare ${rv} 0.18.1
+ [[ $? -eq 1 ]] && softvol_0_18_1=1
+ done
+
+ if [[ ${softvol_0_18_1} -eq 1 ]]; then
+ echo
+ elog "Starting from version 0.18.1 the software volume control is"
+ elog "enabled by default, see:"
+ elog "https://github.com/mpv-player/mpv/blob/v0.18.1/DOCS/interface-changes.rst"
+ elog "https://github.com/mpv-player/mpv/issues/3322"
+ elog
+ elog "This means that volume controls don't change the system volume,"
+ elog "e.g. per-application volume with PulseAudio."
+ elog "If you want to restore the old behaviour, please refer to"
+ elog "https://bugs.gentoo.org/show_bug.cgi?id=588492#c4"
+ echo
+ fi
+
+ # bash-completion < 2.3-r1 already installs (mostly broken) mpv completion.
+ if use cli && ! has_version '<app-shells/bash-completion-2.3-r1' && \
+ ! has_version 'app-shells/mpv-bash-completion'; then
+ elog "If you want to have command-line completion via bash-completion,"
+ elog "please install app-shells/mpv-bash-completion."
+ fi
+
+ if use cli && [[ -n ${REPLACING_VERSIONS} ]] && \
+ has_version 'app-shells/mpv-bash-completion'; then
+ elog "If command-line completion doesn't work after mpv update,"
+ elog "please rebuild app-shells/mpv-bash-completion."
+ fi
+}
+
+pkg_postrm() {
+ fdo-mime_desktop_database_update
+ gnome2_icon_cache_update
+}
+
+src_test() {
+ cd "${S}"/build/test || die
+ for test in *; do
+ if [[ -x ${test} ]]; then
+ ./"${test}" || die "Test suite failed"
+ fi
+ done
+}