diff options
author | leot <leot@pkgsrc.org> | 2017-07-16 12:06:25 +0000 |
---|---|---|
committer | leot <leot@pkgsrc.org> | 2017-07-16 12:06:25 +0000 |
commit | 1b5ef6e2e810b5752254e4ee55b600ee9f1f73e2 (patch) | |
tree | d72ab66fb012c8a565eb9769b91330a030f0127d /multimedia | |
parent | 6056c919a2948fa6c8f37c701609855873bc1f78 (diff) | |
download | pkgsrc-1b5ef6e2e810b5752254e4ee55b600ee9f1f73e2.tar.gz |
Add stereo/mono fallback logic for `oss' audio output.
Previously playing files with more audio channels available than the ones
provided by audio device resulted in muted audio. A possible workaround to that
was forcing the `--audio-channels=2' or similar.
Thanks to <mrg> for kindly provided a reliable test (file|case) for that!
While here also get rid of a trailing whitespace in options.mk (spotted by
pkglint!)
Bump PKGREVISION.
Diffstat (limited to 'multimedia')
-rw-r--r-- | multimedia/mpv/Makefile | 3 | ||||
-rw-r--r-- | multimedia/mpv/distinfo | 3 | ||||
-rw-r--r-- | multimedia/mpv/options.mk | 4 | ||||
-rw-r--r-- | multimedia/mpv/patches/patch-audio_out_ao__oss.c | 40 |
4 files changed, 46 insertions, 4 deletions
diff --git a/multimedia/mpv/Makefile b/multimedia/mpv/Makefile index bd9bb37bef2..8086ac7b69f 100644 --- a/multimedia/mpv/Makefile +++ b/multimedia/mpv/Makefile @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.55 2017/04/24 15:18:01 maya Exp $ +# $NetBSD: Makefile,v 1.56 2017/07/16 12:06:25 leot Exp $ DISTNAME= mpv-0.25.0 +PKGREVISION= 1 CATEGORIES= multimedia MASTER_SITES= ${MASTER_SITE_GITHUB:=mpv-player/} GITHUB_TAG= v${PKGVERSION_NOREV} diff --git a/multimedia/mpv/distinfo b/multimedia/mpv/distinfo index 0b07cb4baab..622a9ef0182 100644 --- a/multimedia/mpv/distinfo +++ b/multimedia/mpv/distinfo @@ -1,7 +1,8 @@ -$NetBSD: distinfo,v 1.34 2017/04/24 15:18:01 maya Exp $ +$NetBSD: distinfo,v 1.35 2017/07/16 12:06:25 leot Exp $ SHA1 (mpv-0.25.0.tar.gz) = fe98e9afe0a5ed04ef957cb2d0bf014b5c6c6665 RMD160 (mpv-0.25.0.tar.gz) = fd9c2ebe95ae121de8f2f17aa4e36711457ed758 SHA512 (mpv-0.25.0.tar.gz) = eefc574e2995ddf6bd15c9b62986a5ca277c30949b036d57a11bbfb796c11c1e6dd7c313abd91a909dd98ca0f2b0be29ec6b980d0287a5891b42b0ffba926cbf Size (mpv-0.25.0.tar.gz) = 2874584 bytes +SHA1 (patch-audio_out_ao__oss.c) = 518f87f39e56d764046a198a9f9429e3c051d67a SHA1 (patch-player_main.c) = 842432e448526a9d170e7efd2b01276e36072e16 diff --git a/multimedia/mpv/options.mk b/multimedia/mpv/options.mk index 0db2bc7cb26..980de31b25f 100644 --- a/multimedia/mpv/options.mk +++ b/multimedia/mpv/options.mk @@ -1,11 +1,11 @@ -# $NetBSD: options.mk,v 1.13 2017/03/13 10:26:24 leot Exp $ +# $NetBSD: options.mk,v 1.14 2017/07/16 12:06:25 leot Exp $ PKG_OPTIONS_VAR= PKG_OPTIONS.mpv .include "../../multimedia/libva/available.mk" .include "../../multimedia/libvdpau/available.mk" -PKG_SUPPORTED_OPTIONS= ass caca lua pulseaudio rpi sdl sdl2 v4l2 +PKG_SUPPORTED_OPTIONS= ass caca lua pulseaudio rpi sdl sdl2 v4l2 PKG_SUGGESTED_OPTIONS= ass lua pulseaudio .if ${VAAPI_AVAILABLE} == "yes" diff --git a/multimedia/mpv/patches/patch-audio_out_ao__oss.c b/multimedia/mpv/patches/patch-audio_out_ao__oss.c new file mode 100644 index 00000000000..1aa09d013fb --- /dev/null +++ b/multimedia/mpv/patches/patch-audio_out_ao__oss.c @@ -0,0 +1,40 @@ +$NetBSD: patch-audio_out_ao__oss.c,v 1.4 2017/07/16 12:06:25 leot Exp $ + +ioctl(..., SNDCTL_DSP_CHANNELS, &nchannels) for not supported nchannels does not +return an error and instead set nchannels to the default value. Instead of +failing with no audio, fallback to stereo or mono. + +Fallback logic inspired by `OSS v3 Programmer's guide', p. 34. + +--- audio/out/ao_oss.c.orig 2017-02-12 01:31:16.000000000 +0000 ++++ audio/out/ao_oss.c +@@ -345,13 +345,26 @@ static int reopen_device(struct ao *ao, + // We only use SNDCTL_DSP_CHANNELS for >2 channels, in case some drivers don't have it + if (reqchannels > 2) { + int nchannels = reqchannels; +- if (ioctl(p->audio_fd, SNDCTL_DSP_CHANNELS, &nchannels) == -1 || +- nchannels != reqchannels) +- { ++ if (ioctl(p->audio_fd, SNDCTL_DSP_CHANNELS, &nchannels) == -1) { + MP_ERR(ao, "Failed to set audio device to %d channels.\n", + reqchannels); + goto fail; + } ++ if (nchannels != reqchannels) { ++ // Fallback to stereo or mono ++ int c; ++ for (nchannels = c = 2; c >= 1; c--, nchannels--) { ++ if (ioctl(p->audio_fd, SNDCTL_DSP_CHANNELS, &c) == -1) { ++ MP_ERR(ao, "Failed to set audio device to %d channels.\n", c); ++ goto fail; ++ } ++ if (c == nchannels) ++ break; ++ } ++ if (!ao_chmap_sel_get_def(ao, &sel, &channels, c)) ++ goto fail; ++ MP_WARN(ao, "using %d channels (requested: %d)\n", channels.num, reqchannels); ++ } + } else { + int c = reqchannels - 1; + if (ioctl(p->audio_fd, SNDCTL_DSP_STEREO, &c) == -1) { |