audio/sndio: Update to 1.5.0

This commit is contained in:
Tobias Kortkamp 2018-07-31 19:40:24 +00:00
parent 7b27898b2d
commit 587b9560db
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=476019
7 changed files with 17 additions and 184 deletions

View file

@ -5,6 +5,18 @@ they are unavoidable.
You should get into the habit of checking this file for changes each time You should get into the habit of checking this file for changes each time
you update your ports collection, before attempting any port upgrades. you update your ports collection, before attempting any port upgrades.
20180731:
AFFECTS: users of audio/sndio
AUTHOR: tobik@FreeBSD.org
sndiod(8) will now use the default audio device /dev/dsp instead
of /dev/dsp0 if no device was specified.
The location of ~/.aucat_cookie has moved to ~/.sndio/cookie. If
you share audio devices via sndiod(8) on the network or between
local users, please migrate it manually to the new location to
guarantee a smooth upgrade.
20180731: 20180731:
AFFECTS: users of x11/xorg and all ports with USE_XORG=*proto AFFECTS: users of x11/xorg and all ports with USE_XORG=*proto
AUTHOR: zeising@daemonic.se AUTHOR: zeising@daemonic.se

View file

@ -2,7 +2,7 @@
# $FreeBSD$ # $FreeBSD$
PORTNAME= sndio PORTNAME= sndio
PORTVERSION= 1.4.0 PORTVERSION= 1.5.0
CATEGORIES= audio CATEGORIES= audio
MASTER_SITES= http://www.sndio.org/ MASTER_SITES= http://www.sndio.org/

View file

@ -1,3 +1,3 @@
TIMESTAMP = 1515842737 TIMESTAMP = 1533063551
SHA256 (sndio-1.4.0.tar.gz) = 68713db624797dbff69c0f4ce1b24054fb0803da340508edbc5e08d6778f9781 SHA256 (sndio-1.5.0.tar.gz) = 12c70044749ad9cb7eaeb26c936816aa6b314fe4be71ef479d12272e4c5ad253
SIZE (sndio-1.4.0.tar.gz) = 126007 SIZE (sndio-1.5.0.tar.gz) = 125661

View file

@ -1,13 +0,0 @@
--- configure.orig 2018-01-11 20:57:37 UTC
+++ configure
@@ -80,8 +80,10 @@ case `uname` in
-DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME'
;;
DragonFly|FreeBSD)
+ oss=yes
umidi=yes
user=_sndio
+ so_ldflags="-Wl,-soname=libsndio.so.\${MAJ}.\${MIN}"
so_link="libsndio.so"
defs='-DHAVE_ARC4RANDOM -DHAVE_ISSETUGID \\\
-DHAVE_STRLCAT -DHAVE_STRLCPY -DHAVE_STRTONUM \\\

View file

@ -1,11 +0,0 @@
--- libsndio/sio.c.orig 2016-11-06 11:21:59 UTC
+++ libsndio/sio.c
@@ -65,7 +65,7 @@ sio_open(const char *str, unsigned int m
#if defined(USE_SUN)
return _sio_sun_open("rsnd/0", mode, nbio);
#elif defined(USE_OSS)
- return _sio_oss_open("rsnd/0", mode, nbio);
+ return _sio_oss_open(SIO_DEVANY, mode, nbio);
#elif defined(USE_ALSA)
return _sio_alsa_open("rsnd/0", mode, nbio);
#else

View file

@ -1,154 +0,0 @@
--- libsndio/sio_oss.c.orig 2016-11-06 11:21:59 UTC
+++ libsndio/sio_oss.c
@@ -108,6 +108,8 @@ static int sio_oss_xrun(struct sio_oss_hdl *);
static size_t sio_oss_read(struct sio_hdl *, void *, size_t);
static size_t sio_oss_write(struct sio_hdl *, const void *, size_t);
static void sio_oss_close(struct sio_hdl *);
+static int sio_oss_setvol(struct sio_hdl *, unsigned int);
+static void sio_oss_getvol(struct sio_hdl *);
static struct sio_ops sio_oss_ops = {
sio_oss_close,
@@ -121,8 +123,8 @@ static struct sio_ops sio_oss_ops = {
sio_oss_nfds,
sio_oss_pollfd,
sio_oss_revents,
- NULL, /* setvol */
- NULL, /* getvol */
+ sio_oss_setvol,
+ sio_oss_getvol,
};
/*
@@ -228,12 +230,10 @@ sio_oss_getcap(struct sio_hdl *sh, struct sio_cap *cap
}
static int
-sio_oss_getfd(const char *str, unsigned int mode, int nbio)
+_sio_oss_getdev(const char *str, char *path, size_t len)
{
const char *p;
- char path[DEVPATH_MAX];
unsigned int devnum;
- int fd, flags, val;
p = _sndio_parsetype(str, "rsnd");
if (p == NULL) {
@@ -253,7 +253,24 @@ sio_oss_getfd(const char *str, unsigned int mode, int
DPRINTF("sio_oss_getfd: %s: number expected after '/'\n", str);
return -1;
}
- snprintf(path, sizeof(path), DEVPATH_PREFIX "%u", devnum);
+ snprintf(path, len, DEVPATH_PREFIX "%u", devnum);
+ return 0;
+}
+
+static int
+sio_oss_getfd(const char *str, unsigned int mode, int nbio)
+{
+ char path[DEVPATH_MAX];
+ int fd, flags, val;
+ audio_buf_info bi;
+
+ if (strcmp(str, SIO_DEVANY) == 0) {
+ /* Use /dev/dsp (the default device) directly */
+ snprintf(path, sizeof(path), DEVPATH_PREFIX);
+ } else if (_sio_oss_getdev(str, path, sizeof(path)) < 0) {
+ return -1;
+ }
+
if (mode == (SIO_PLAY | SIO_REC))
flags = O_RDWR;
else
@@ -264,6 +281,19 @@ sio_oss_getfd(const char *str, unsigned int mode, int
DPERROR(path);
return -1;
}
+ /*
+ * Check if the device supports playing/recording.
+ * Unfortunately, it's possible for devices to be opened RDWR
+ * even when they don't support playing/recording.
+ */
+ if (mode & SIO_PLAY && ioctl(fd, SNDCTL_DSP_GETOSPACE, &bi) < 0) {
+ close(fd);
+ return -1;
+ }
+ if (mode & SIO_REC && ioctl(fd, SNDCTL_DSP_GETISPACE, &bi) < 0) {
+ close(fd);
+ return -1;
+ }
val = 1;
if (ioctl(fd, SNDCTL_DSP_LOW_WATER, &val) < 0) {
DPERROR("sio_oss_start: LOW_WATER");
@@ -383,13 +413,25 @@ sio_oss_setpar(struct sio_hdl *sh, struct sio_par *par
struct sio_oss_hdl *hdl = (struct sio_oss_hdl *)sh;
unsigned int i, round, bufsz;
int frag_max, frag_shift, frag_count, frag;
+ unsigned int le, sig, msb;
+ le = par->le;
+ sig = par->sig;
+ msb = par->msb;
+
+ if (le == ~0U)
+ le = 0;
+ if (sig == ~0U)
+ sig = 0;
+ if (msb == ~0U)
+ msb = 0;
+
hdl->fmt = AFMT_S16_LE;
for (i = 0; i < sizeof(formats)/sizeof(formats[0]); i++) {
if (formats[i].bits == par->bits &&
- formats[i].le == par->le &&
- formats[i].sig == par->sig &&
- formats[i].msb == par->msb) {
+ formats[i].le == le &&
+ formats[i].sig == sig &&
+ formats[i].msb == msb) {
hdl->fmt = formats[i].fmt;
break;
}
@@ -734,6 +776,42 @@ sio_oss_revents(struct sio_hdl *sh, struct pollfd *pfd
hdl->odelta -= delta;
}
return revents;
+}
+
+static int
+sio_oss_setvol(struct sio_hdl *sh, unsigned int vol)
+{
+ struct sio_oss_hdl *hdl = (struct sio_oss_hdl *)sh;
+ int newvol;
+
+ /* Scale to 0..100 */
+ newvol = 1.0 * 100 * vol / SIO_MAXVOL;
+ newvol = newvol | (newvol << 8);
+
+ if (ioctl(hdl->fd, SNDCTL_DSP_SETPLAYVOL, &newvol) < 0) {
+ DPERROR("sio_oss_setvol");
+ hdl->sio.eof = 1;
+ return 0;
+ }
+
+ return 1;
+}
+
+static void
+sio_oss_getvol(struct sio_hdl *sh)
+{
+ struct sio_oss_hdl *hdl = (struct sio_oss_hdl *)sh;
+ int vol;
+
+ if (ioctl(hdl->fd, SNDCTL_DSP_GETPLAYVOL, &vol) < 0) {
+ DPERROR("sio_oss_getvol");
+ hdl->sio.eof = 1;
+ return;
+ }
+
+ /* Use left channel volume and scale to SIO_MAXVOL */
+ vol = SIO_MAXVOL * 1.0 * (vol & 0x7f) / 100;
+ _sio_onvol_cb(&hdl->sio, vol);
}
#endif /* defined USE_OSS */

View file

@ -14,9 +14,8 @@ rcvar=sndiod_enable
load_rc_config $name load_rc_config $name
: ${sndiod_dev="rsnd/$($SYSCTL -n hw.snd.default_unit)"}
: ${sndiod_enable="NO"} : ${sndiod_enable="NO"}
: ${sndiod_flags="-f ${sndiod_dev} -c 0:7 -j off -s default -m mon -s monitor"} : ${sndiod_flags="-c 0:7 -j off -s default -m mon -s monitor"}
command="%%PREFIX%%/bin/sndiod" command="%%PREFIX%%/bin/sndiod"