pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/multimedia/mpv



Module Name:    pkgsrc
Committed By:   leot
Date:           Sun Jul 16 12:06:25 UTC 2017

Modified Files:
        pkgsrc/multimedia/mpv: Makefile distinfo options.mk
Added Files:
        pkgsrc/multimedia/mpv/patches: patch-audio_out_ao__oss.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 pkgsrc/multimedia/mpv/Makefile
cvs rdiff -u -r1.34 -r1.35 pkgsrc/multimedia/mpv/distinfo
cvs rdiff -u -r1.13 -r1.14 pkgsrc/multimedia/mpv/options.mk
cvs rdiff -u -r0 -r1.4 \
    pkgsrc/multimedia/mpv/patches/patch-audio_out_ao__oss.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/multimedia/mpv/Makefile
diff -u pkgsrc/multimedia/mpv/Makefile:1.55 pkgsrc/multimedia/mpv/Makefile:1.56
--- pkgsrc/multimedia/mpv/Makefile:1.55 Mon Apr 24 15:18:01 2017
+++ pkgsrc/multimedia/mpv/Makefile      Sun Jul 16 12:06:25 2017
@@ -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}

Index: pkgsrc/multimedia/mpv/distinfo
diff -u pkgsrc/multimedia/mpv/distinfo:1.34 pkgsrc/multimedia/mpv/distinfo:1.35
--- pkgsrc/multimedia/mpv/distinfo:1.34 Mon Apr 24 15:18:01 2017
+++ pkgsrc/multimedia/mpv/distinfo      Sun Jul 16 12:06:25 2017
@@ -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

Index: pkgsrc/multimedia/mpv/options.mk
diff -u pkgsrc/multimedia/mpv/options.mk:1.13 pkgsrc/multimedia/mpv/options.mk:1.14
--- pkgsrc/multimedia/mpv/options.mk:1.13       Mon Mar 13 10:26:24 2017
+++ pkgsrc/multimedia/mpv/options.mk    Sun Jul 16 12:06:25 2017
@@ -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"

Added files:

Index: pkgsrc/multimedia/mpv/patches/patch-audio_out_ao__oss.c
diff -u /dev/null pkgsrc/multimedia/mpv/patches/patch-audio_out_ao__oss.c:1.4
--- /dev/null   Sun Jul 16 12:06:25 2017
+++ pkgsrc/multimedia/mpv/patches/patch-audio_out_ao__oss.c     Sun Jul 16 12:06:25 2017
@@ -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) {



Home | Main Index | Thread Index | Old Index