Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/audio/musicpd musicpd: Various improvements in Solaris...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/907030b3fce6
branches:  trunk
changeset: 428961:907030b3fce6
user:      nia <nia%pkgsrc.org@localhost>
date:      Tue Apr 14 12:55:04 2020 +0000

description:
musicpd: Various improvements in SolarisOutputPlugin

- Use AUDIO_INITINFO rather than AUDIO_GETINFO for initialization
  This is recommended by Solaris and NetBSD documentation.
- Don't open the device with O_NONBLOCK then remove the flag.
  AFAIK this is a workaround for old implementations that wouldn't
  allow the device to be opened in blocking mode if it was already
  in use. Either way, it hasn't been necessary for a long time.
- Support S8 and S32 audio formats.

diffstat:

 audio/musicpd/Makefile                                                 |   4 +-
 audio/musicpd/distinfo                                                 |   3 +-
 audio/musicpd/patches/patch-src_output_plugins_SolarisOutputPlugin.cxx |  70 ++++++++++
 3 files changed, 74 insertions(+), 3 deletions(-)

diffs (101 lines):

diff -r bddc165d791c -r 907030b3fce6 audio/musicpd/Makefile
--- a/audio/musicpd/Makefile    Tue Apr 14 12:50:02 2020 +0000
+++ b/audio/musicpd/Makefile    Tue Apr 14 12:55:04 2020 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.214 2020/04/12 08:28:19 adam Exp $
+# $NetBSD: Makefile,v 1.215 2020/04/14 12:55:04 nia Exp $
 
 DISTNAME=      mpd-0.21.22
 PKGNAME=       ${DISTNAME:S/mpd/musicpd/}
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    audio
 MASTER_SITES=  https://www.musicpd.org/download/mpd/0.21/
 EXTRACT_SUFX=  .tar.xz
diff -r bddc165d791c -r 907030b3fce6 audio/musicpd/distinfo
--- a/audio/musicpd/distinfo    Tue Apr 14 12:50:02 2020 +0000
+++ b/audio/musicpd/distinfo    Tue Apr 14 12:55:04 2020 +0000
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.112 2020/04/05 13:33:41 nia Exp $
+$NetBSD: distinfo,v 1.113 2020/04/14 12:55:04 nia Exp $
 
 SHA1 (mpd-0.21.22.tar.xz) = 51a2965f6c14c27f5de7d96e7e80a7f5b387edf1
 RMD160 (mpd-0.21.22.tar.xz) = 1fe7d8193c52b0d65382ed990e2fd2b9692414ca
 SHA512 (mpd-0.21.22.tar.xz) = 051d97500d8224fe4769a667a58c7915eebcca809e9345a30881f99d7c33d99907d9cc0258c0a5fd20f10609edbeb6da16941099ac3c033762ceb4b116e4df04
 Size (mpd-0.21.22.tar.xz) = 679244 bytes
 SHA1 (patch-src_net_IPv6Address.hxx) = c9e9a5676451e6834fcef359266d37fc15f079e6
+SHA1 (patch-src_output_plugins_SolarisOutputPlugin.cxx) = a72534ddac7b695623841eb53f0520aae6870b28
diff -r bddc165d791c -r 907030b3fce6 audio/musicpd/patches/patch-src_output_plugins_SolarisOutputPlugin.cxx
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/musicpd/patches/patch-src_output_plugins_SolarisOutputPlugin.cxx    Tue Apr 14 12:55:04 2020 +0000
@@ -0,0 +1,70 @@
+$NetBSD: patch-src_output_plugins_SolarisOutputPlugin.cxx,v 1.4 2020/04/14 12:55:04 nia Exp $
+
+- Use AUDIO_INITINFO rather than AUDIO_GETINFO for initialization
+- Don't open the device in non-blocking mode, no OS has needed this for years
+- Support S8 and S32 formats
+
+https://github.com/MusicPlayerDaemon/MPD/pull/826
+
+--- src/output/plugins/SolarisOutputPlugin.cxx.orig    2020-04-02 15:48:56.000000000 +0000
++++ src/output/plugins/SolarisOutputPlugin.cxx
+@@ -43,6 +43,7 @@
+ #define I_FLUSH 0
+ #endif
+ 
++#define AUDIO_INITINFO(v)
+ #define AUDIO_GETINFO 0
+ #define AUDIO_SETINFO 0
+ #define AUDIO_ENCODING_LINEAR 0
+@@ -93,33 +94,31 @@ SolarisOutput::Open(AudioFormat &audio_f
+       struct audio_info info;
+       int ret;
+ 
+-      /* support only 16 bit mono/stereo for now; nothing else has
+-         been tested */
+-      audio_format.format = SampleFormat::S16;
++      AUDIO_INITINFO(&info);
+ 
+-      /* open the device in non-blocking mode */
+-
+-      if (!fd.Open(device, O_WRONLY|O_NONBLOCK))
+-              throw FormatErrno("Failed to open %s",
+-                                device);
+-
+-      /* restore blocking mode */
+-
+-      fd.SetBlocking();
++      if (!fd.Open(device, O_WRONLY))
++              throw FormatErrno("Failed to open %s", device);
+ 
+       /* configure the audio device */
+ 
+-      ret = ioctl(fd.Get(), AUDIO_GETINFO, &info);
+-      if (ret < 0) {
+-              const int e = errno;
+-              fd.Close();
+-              throw MakeErrno(e, "AUDIO_GETINFO failed");
++#ifdef AUMODE_PLAY
++      info.mode = AUMODE_PLAY; /* BSD extension */
++#endif
++      info.play.encoding = AUDIO_ENCODING_LINEAR;
++      switch (audio_format.format) {
++      case SampleFormat::S8:
++              info.play.precision = 8;
++              break;
++      case SampleFormat::S16:
++              info.play.precision = 16;
++              break;
++      default:
++              info.play.precision = 32;
++              audio_format.format = SampleFormat::S32;
++              break;
+       }
+-
+       info.play.sample_rate = audio_format.sample_rate;
+       info.play.channels = audio_format.channels;
+-      info.play.precision = 16;
+-      info.play.encoding = AUDIO_ENCODING_LINEAR;
+ 
+       ret = ioctl(fd.Get(), AUDIO_SETINFO, &info);
+       if (ret < 0) {



Home | Main Index | Thread Index | Old Index