summaryrefslogtreecommitdiff
path: root/lib/libsndio
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-05-15 13:10:40 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-05-15 13:10:40 +0000
commit082f4b351ae4a380867632abd47b4c8f88201983 (patch)
tree9ec9c4af28981a7fae6932eec687f5638b12f355 /lib/libsndio
parent6ca72687c46f4e2a5ad5cce7c6194a0a9210756d (diff)
replace s/sa/sio/, left from when libsa was renamed to libsndio
Diffstat (limited to 'lib/libsndio')
-rw-r--r--lib/libsndio/aucat.c54
-rw-r--r--lib/libsndio/sun.c134
2 files changed, 94 insertions, 94 deletions
diff --git a/lib/libsndio/aucat.c b/lib/libsndio/aucat.c
index f2d63415c20..3c20365ae5b 100644
--- a/lib/libsndio/aucat.c
+++ b/lib/libsndio/aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aucat.c,v 1.16 2009/05/15 13:04:52 ratchov Exp $ */
+/* $OpenBSD: aucat.c,v 1.17 2009/05/15 13:10:39 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -29,7 +29,7 @@
#include "sndio_priv.h"
struct aucat_hdl {
- struct sio_hdl sa;
+ struct sio_hdl sio;
int fd; /* socket */
struct amsg rmsg, wmsg; /* temporary messages */
size_t wtodo, rtodo; /* bytes to complete the packet */
@@ -93,7 +93,7 @@ sio_open_aucat(char *path, unsigned mode, int nbio)
hdl = malloc(sizeof(struct aucat_hdl));
if (hdl == NULL)
return NULL;
- sio_create(&hdl->sa, &aucat_ops, mode, nbio);
+ sio_create(&hdl->sio, &aucat_ops, mode, nbio);
s = socket(AF_UNIX, SOCK_STREAM, 0);
if (s < 0)
@@ -114,7 +114,7 @@ sio_open_aucat(char *path, unsigned mode, int nbio)
hdl->wtodo = 0xdeadbeef;
hdl->curvol = SIO_MAXVOL;
hdl->reqvol = SIO_MAXVOL;
- if (!sio_getcap(&hdl->sa, &cap))
+ if (!sio_getcap(&hdl->sio, &cap))
goto bad_connect;
if (((mode & SIO_PLAY) && cap.confs[0].pchan == 0) ||
((mode & SIO_REC) && cap.confs[0].rchan == 0))
@@ -144,14 +144,14 @@ aucat_rmsg(struct aucat_hdl *hdl)
if (errno == EINTR)
continue;
if (errno != EAGAIN) {
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
DPERROR("aucat_rmsg: read");
}
return 0;
}
if (n == 0) {
DPRINTF("aucat_rmsg: eof\n");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
hdl->rtodo -= n;
@@ -175,7 +175,7 @@ aucat_wmsg(struct aucat_hdl *hdl)
if (errno == EINTR)
continue;
if (errno != EAGAIN) {
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
DPERROR("aucat_wmsg: write");
}
return 0;
@@ -198,7 +198,7 @@ aucat_runmsg(struct aucat_hdl *hdl)
if (hdl->rmsg.u.data.size == 0 ||
hdl->rmsg.u.data.size % hdl->rbpf) {
DPRINTF("aucat_runmsg: bad data message\n");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
hdl->rstate = STATE_DATA;
@@ -206,7 +206,7 @@ aucat_runmsg(struct aucat_hdl *hdl)
break;
case AMSG_MOVE:
hdl->maxwrite += hdl->rmsg.u.ts.delta * (int)hdl->wbpf;
- sio_onmove_cb(&hdl->sa, hdl->rmsg.u.ts.delta);
+ sio_onmove_cb(&hdl->sio, hdl->rmsg.u.ts.delta);
hdl->rstate = STATE_MSG;
hdl->rtodo = sizeof(struct amsg);
break;
@@ -217,7 +217,7 @@ aucat_runmsg(struct aucat_hdl *hdl)
break;
default:
DPRINTF("aucat_runmsg: unknown message\n");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
return 1;
@@ -242,7 +242,7 @@ aucat_start(struct sio_hdl *sh)
/*
* save bpf
*/
- if (!sio_getpar(&hdl->sa, &par))
+ if (!sio_getpar(&hdl->sio, &par))
return 0;
hdl->wbpf = par.bps * par.pchan;
hdl->rbpf = par.bps * par.rchan;
@@ -257,7 +257,7 @@ aucat_start(struct sio_hdl *sh)
hdl->rtodo = sizeof(struct amsg);
if (fcntl(hdl->fd, F_SETFL, O_NONBLOCK) < 0) {
DPERROR("aucat_start: fcntl(0)");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
return 1;
@@ -273,7 +273,7 @@ aucat_stop(struct sio_hdl *sh)
if (fcntl(hdl->fd, F_SETFL, 0) < 0) {
DPERROR("aucat_stop: fcntl(0)");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
@@ -289,7 +289,7 @@ aucat_stop(struct sio_hdl *sh)
count = todo;
if (count > ZERO_MAX)
count = ZERO_MAX;
- n = aucat_write(&hdl->sa, zero, count);
+ n = aucat_write(&hdl->sio, zero, count);
if (n == 0)
return 0;
todo -= n;
@@ -319,7 +319,7 @@ aucat_stop(struct sio_hdl *sh)
return 0;
break;
case STATE_DATA:
- if (!aucat_read(&hdl->sa, zero, ZERO_MAX))
+ if (!aucat_read(&hdl->sio, zero, ZERO_MAX))
return 0;
break;
}
@@ -342,10 +342,10 @@ aucat_setpar(struct sio_hdl *sh, struct sio_par *par)
hdl->wmsg.u.par.rate = par->rate;
hdl->wmsg.u.par.appbufsz = par->appbufsz;
hdl->wmsg.u.par.xrun = par->xrun;
- hdl->wmsg.u.par.mode = hdl->sa.mode;
- if (hdl->sa.mode & SIO_REC)
+ hdl->wmsg.u.par.mode = hdl->sio.mode;
+ if (hdl->sio.mode & SIO_REC)
hdl->wmsg.u.par.rchan = par->rchan;
- if (hdl->sa.mode & SIO_PLAY)
+ if (hdl->sio.mode & SIO_PLAY)
hdl->wmsg.u.par.pchan = par->pchan;
hdl->wtodo = sizeof(struct amsg);
if (!aucat_wmsg(hdl))
@@ -368,7 +368,7 @@ aucat_getpar(struct sio_hdl *sh, struct sio_par *par)
return 0;
if (hdl->rmsg.cmd != AMSG_GETPAR) {
DPRINTF("aucat_getpar: protocol err\n");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
par->bits = hdl->rmsg.u.par.bits;
@@ -381,9 +381,9 @@ aucat_getpar(struct sio_hdl *sh, struct sio_par *par)
par->appbufsz = hdl->rmsg.u.par.appbufsz;
par->xrun = hdl->rmsg.u.par.xrun;
par->round = hdl->rmsg.u.par.round;
- if (hdl->sa.mode & SIO_PLAY)
+ if (hdl->sio.mode & SIO_PLAY)
par->pchan = hdl->rmsg.u.par.pchan;
- if (hdl->sa.mode & SIO_REC)
+ if (hdl->sio.mode & SIO_REC)
par->rchan = hdl->rmsg.u.par.rchan;
return 1;
}
@@ -403,7 +403,7 @@ aucat_getcap(struct sio_hdl *sh, struct sio_cap *cap)
return 0;
if (hdl->rmsg.cmd != AMSG_GETCAP) {
DPRINTF("aucat_getcap: protocol err\n");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
cap->enc[0].bits = hdl->rmsg.u.cap.bits;
@@ -445,14 +445,14 @@ aucat_read(struct sio_hdl *sh, void *buf, size_t len)
if (errno == EINTR)
continue;
if (errno != EAGAIN) {
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
DPERROR("aucat_read: read");
}
return 0;
}
if (n == 0) {
DPRINTF("aucat_read: eof\n");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
hdl->rtodo -= n;
@@ -529,7 +529,7 @@ aucat_write(struct sio_hdl *sh, void *buf, size_t len)
if (errno == EINTR)
continue;
if (errno != EAGAIN) {
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
DPERROR("aucat_write: write");
}
return 0;
@@ -576,7 +576,7 @@ aucat_revents(struct sio_hdl *sh, struct pollfd *pfd)
if (hdl->maxwrite <= 0)
revents &= ~POLLOUT;
}
- if (hdl->sa.eof)
+ if (hdl->sio.eof)
return POLLHUP;
return revents & (hdl->events | POLLHUP);
}
@@ -595,6 +595,6 @@ aucat_getvol(struct sio_hdl *sh)
{
struct aucat_hdl *hdl = (struct aucat_hdl *)sh;
- sio_onvol_cb(&hdl->sa, hdl->reqvol);
+ sio_onvol_cb(&hdl->sio, hdl->reqvol);
return;
}
diff --git a/lib/libsndio/sun.c b/lib/libsndio/sun.c
index 927cdbad839..41ac81d1c08 100644
--- a/lib/libsndio/sun.c
+++ b/lib/libsndio/sun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sun.c,v 1.15 2009/05/15 13:04:52 ratchov Exp $ */
+/* $OpenBSD: sun.c,v 1.16 2009/05/15 13:10:39 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -42,7 +42,7 @@
#include "sndio_priv.h"
struct sun_hdl {
- struct sio_hdl sa;
+ struct sio_hdl sio;
int fd;
int filling;
unsigned ibpf, obpf; /* bytes per frame */
@@ -171,21 +171,21 @@ sun_tryinfo(struct sun_hdl *hdl, struct sio_enc *enc,
if (rchan)
aui.record.channels = rchan;
if (rate) {
- if (hdl->sa.mode & SIO_PLAY)
+ if (hdl->sio.mode & SIO_PLAY)
aui.play.sample_rate = rate;
- if (hdl->sa.mode & SIO_REC)
+ if (hdl->sio.mode & SIO_REC)
aui.record.sample_rate = rate;
}
if (ioctl(hdl->fd, AUDIO_SETINFO, &aui) < 0) {
if (errno == EINVAL)
return 0;
DPERROR("sun_tryinfo: setinfo");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
if (ioctl(hdl->fd, AUDIO_GETINFO, &aui) < 0) {
DPERROR("sun_tryinfo: getinfo");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
if (pchan && aui.play.channels != pchan)
@@ -193,10 +193,10 @@ sun_tryinfo(struct sun_hdl *hdl, struct sio_enc *enc,
if (rchan && aui.record.channels != rchan)
return 0;
if (rate) {
- if ((hdl->sa.mode & SIO_PLAY) &&
+ if ((hdl->sio.mode & SIO_PLAY) &&
(aui.play.sample_rate != rate))
return 0;
- if ((hdl->sa.mode & SIO_REC) &&
+ if ((hdl->sio.mode & SIO_REC) &&
(aui.record.sample_rate != rate))
return 0;
}
@@ -225,7 +225,7 @@ sun_getcap(struct sio_hdl *sh, struct sio_cap *cap)
unsigned enc_map = 0, rchan_map = 0, pchan_map = 0, rate_map = 0;
unsigned i, j, map;
- if (!sun_getpar(&hdl->sa, &savepar))
+ if (!sun_getpar(&hdl->sio, &savepar))
return 0;
/*
@@ -236,7 +236,7 @@ sun_getcap(struct sio_hdl *sh, struct sio_cap *cap)
if (errno == EINVAL)
break;
DPERROR("sun_getcap: getenc");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
if (ae.flags & AUDIO_ENCODINGFLAG_EMULATED)
@@ -277,14 +277,14 @@ sun_getcap(struct sio_hdl *sh, struct sio_cap *cap)
* number of channels and the encoding are independent so we can
* use the current encoding and try various channels.
*/
- if (hdl->sa.mode & SIO_PLAY) {
+ if (hdl->sio.mode & SIO_PLAY) {
memcpy(&cap->pchan, chans, NCHANS * sizeof(unsigned));
for (i = 0; i < NCHANS; i++) {
if (sun_tryinfo(hdl, NULL, chans[i], 0, 0))
pchan_map |= (1 << i);
}
}
- if (hdl->sa.mode & SIO_REC) {
+ if (hdl->sio.mode & SIO_REC) {
memcpy(&cap->rchan, chans, NCHANS * sizeof(unsigned));
for (i = 0; i < NCHANS; i++) {
if (sun_tryinfo(hdl, NULL, 0, chans[i], 0))
@@ -318,7 +318,7 @@ sun_getcap(struct sio_hdl *sh, struct sio_cap *cap)
}
}
cap->nconf = nconf;
- if (!sun_setpar(&hdl->sa, &savepar))
+ if (!sun_setpar(&hdl->sio, &savepar))
return 0;
return 1;
#undef NCHANS
@@ -330,7 +330,7 @@ sun_getvol(struct sio_hdl *sh)
{
struct sun_hdl *hdl = (struct sun_hdl *)sh;
- sio_onvol_cb(&hdl->sa, SIO_MAXVOL);
+ sio_onvol_cb(&hdl->sio, SIO_MAXVOL);
}
int
@@ -350,7 +350,7 @@ sio_open_sun(char *path, unsigned mode, int nbio)
hdl = malloc(sizeof(struct sun_hdl));
if (hdl == NULL)
return NULL;
- sio_create(&hdl->sa, &sun_ops, mode, nbio);
+ sio_create(&hdl->sio, &sun_ops, mode, nbio);
if (path == NULL)
path = SIO_SUN_PATH;
@@ -384,9 +384,9 @@ sio_open_sun(char *path, unsigned mode, int nbio)
}
hdl->fd = fd;
AUDIO_INITINFO(&aui);
- if (hdl->sa.mode & SIO_PLAY)
+ if (hdl->sio.mode & SIO_PLAY)
aui.play.encoding = AUDIO_ENCODING_SLINEAR;
- if (hdl->sa.mode & SIO_REC)
+ if (hdl->sio.mode & SIO_REC)
aui.record.encoding = AUDIO_ENCODING_SLINEAR;
if (ioctl(hdl->fd, AUDIO_SETINFO, &aui) < 0) {
DPERROR("sio_open_sun: setinfo");
@@ -397,7 +397,7 @@ sio_open_sun(char *path, unsigned mode, int nbio)
par.sig = 1;
par.bits = 16;
par.appbufsz = 1200;
- if (!sio_setpar(&hdl->sa, &par))
+ if (!sio_setpar(&hdl->sio, &par))
goto bad_close;
return (struct sio_hdl *)hdl;
bad_close:
@@ -426,7 +426,7 @@ sun_start(struct sio_hdl *sh)
struct sun_hdl *hdl = (struct sun_hdl *)sh;
struct audio_info aui;
- if (!sio_getpar(&hdl->sa, &par))
+ if (!sio_getpar(&hdl->sio, &par))
return 0;
hdl->obpf = par.pchan * par.bps;
hdl->ibpf = par.rchan * par.bps;
@@ -438,19 +438,19 @@ sun_start(struct sio_hdl *sh)
hdl->idelta = 0;
hdl->odelta = 0;
- if (hdl->sa.mode & SIO_PLAY) {
+ if (hdl->sio.mode & SIO_PLAY) {
/*
* pause the device and let sun_write() trigger the
* start later, to avoid buffer underruns
*/
AUDIO_INITINFO(&aui);
- if (hdl->sa.mode & SIO_PLAY)
+ if (hdl->sio.mode & SIO_PLAY)
aui.play.pause = 1;
- if (hdl->sa.mode & SIO_REC)
+ if (hdl->sio.mode & SIO_REC)
aui.record.pause = 1;
if (ioctl(hdl->fd, AUDIO_SETINFO, &aui) < 0) {
DPERROR("sun_start: setinfo2");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
hdl->filling = 1;
@@ -459,17 +459,17 @@ sun_start(struct sio_hdl *sh)
* no play buffers to fill, start now!
*/
AUDIO_INITINFO(&aui);
- if (hdl->sa.mode & SIO_PLAY)
+ if (hdl->sio.mode & SIO_PLAY)
aui.play.pause = 0;
- if (hdl->sa.mode & SIO_REC)
+ if (hdl->sio.mode & SIO_REC)
aui.record.pause = 0;
if (ioctl(hdl->fd, AUDIO_SETINFO, &aui) < 0) {
DPERROR("sun_start: setinfo");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
hdl->filling = 0;
- sio_onmove_cb(&hdl->sa, 0);
+ sio_onmove_cb(&hdl->sio, 0);
}
return 1;
}
@@ -483,7 +483,7 @@ sun_stop(struct sio_hdl *sh)
if (ioctl(hdl->fd, AUDIO_GETINFO, &aui) < 0) {
DPERROR("sun_stop: getinfo");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
mode = aui.mode;
@@ -496,14 +496,14 @@ sun_stop(struct sio_hdl *sh)
aui.mode = 0;
if (ioctl(hdl->fd, AUDIO_SETINFO, &aui) < 0) {
DPERROR("sun_stop: setinfo1");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
AUDIO_INITINFO(&aui);
aui.mode = mode;
if (ioctl(hdl->fd, AUDIO_SETINFO, &aui) < 0) {
DPERROR("sun_stop: setinfo2");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
return 1;
@@ -522,19 +522,19 @@ sun_setpar(struct sio_hdl *sh, struct sio_par *par)
* first, set encoding, rate and channels
*/
AUDIO_INITINFO(&aui);
- if (hdl->sa.mode & SIO_PLAY) {
+ if (hdl->sio.mode & SIO_PLAY) {
aui.play.sample_rate = par->rate;
aui.play.channels = par->pchan;
sun_enctoinfo(hdl, &aui.play, par);
}
- if (hdl->sa.mode & SIO_REC) {
+ if (hdl->sio.mode & SIO_REC) {
aui.record.sample_rate = par->rate;
aui.record.channels = par->rchan;
sun_enctoinfo(hdl, &aui.record, par);
}
if (ioctl(hdl->fd, AUDIO_SETINFO, &aui) < 0 && errno != EINVAL) {
DPERROR("sun_setpar: setinfo");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
@@ -558,12 +558,12 @@ sun_setpar(struct sio_hdl *sh, struct sio_par *par)
*/
if (ioctl(hdl->fd, AUDIO_GETINFO, &aui) < 0) {
DPERROR("sun_setpar: GETINFO");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
- ibpf = (hdl->sa.mode & SIO_REC) ?
+ ibpf = (hdl->sio.mode & SIO_REC) ?
aui.record.channels * aui.record.precision / 8 : 1;
- obpf = (hdl->sa.mode & SIO_PLAY) ?
+ obpf = (hdl->sio.mode & SIO_PLAY) ?
aui.play.channels * aui.play.precision / 8 : 1;
DPRINTF("sun_setpar: bpf = (%u, %u)\n", ibpf, obpf);
@@ -576,18 +576,18 @@ sun_setpar(struct sio_hdl *sh, struct sio_par *par)
AUDIO_INITINFO(&aui);
aui.hiwat = (bufsz + round - 1) / round;
aui.lowat = aui.hiwat;
- if (hdl->sa.mode & SIO_REC)
+ if (hdl->sio.mode & SIO_REC)
aui.record.block_size = round * ibpf;
- if (hdl->sa.mode & SIO_PLAY)
+ if (hdl->sio.mode & SIO_PLAY)
aui.play.block_size = round * obpf;
if (ioctl(hdl->fd, AUDIO_SETINFO, &aui) < 0) {
DPERROR("sun_setpar2: SETINFO");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
if (ioctl(hdl->fd, AUDIO_GETINFO, &aui) < 0) {
DPERROR("sun_setpar2: GETINFO");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
infr = aui.record.block_size / ibpf;
@@ -598,7 +598,7 @@ sun_setpar(struct sio_hdl *sh, struct sio_par *par)
/*
* if half-duplex or both block sizes match, we're done
*/
- if (hdl->sa.mode != (SIO_REC | SIO_PLAY) || infr == onfr) {
+ if (hdl->sio.mode != (SIO_REC | SIO_PLAY) || infr == onfr) {
DPRINTF("sun_setpar: blocksize ok\n");
return 1;
}
@@ -613,7 +613,7 @@ sun_setpar(struct sio_hdl *sh, struct sio_par *par)
round = infr < onfr ? onfr : infr;
}
DPRINTF("sun_setpar: couldn't find a working blocksize\n");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
#undef NRETRIES
}
@@ -626,22 +626,22 @@ sun_getpar(struct sio_hdl *sh, struct sio_par *par)
if (ioctl(hdl->fd, AUDIO_GETINFO, &aui) < 0) {
DPERROR("sun_getpar: getinfo");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
- if (hdl->sa.mode & SIO_PLAY) {
+ if (hdl->sio.mode & SIO_PLAY) {
par->rate = aui.play.sample_rate;
sun_infotoenc(hdl, &aui.play, par);
- } else if (hdl->sa.mode & SIO_REC) {
+ } else if (hdl->sio.mode & SIO_REC) {
par->rate = aui.record.sample_rate;
sun_infotoenc(hdl, &aui.record, par);
} else
return 0;
- par->pchan = (hdl->sa.mode & SIO_PLAY) ?
+ par->pchan = (hdl->sio.mode & SIO_PLAY) ?
aui.play.channels : 0;
- par->rchan = (hdl->sa.mode & SIO_REC) ?
+ par->rchan = (hdl->sio.mode & SIO_REC) ?
aui.record.channels : 0;
- par->round = (hdl->sa.mode & SIO_REC) ?
+ par->round = (hdl->sio.mode & SIO_REC) ?
aui.record.block_size / (par->bps * par->rchan) :
aui.play.block_size / (par->bps * par->pchan);
par->appbufsz = aui.hiwat * par->round;
@@ -666,13 +666,13 @@ sun_read(struct sio_hdl *sh, void *buf, size_t len)
continue;
if (errno != EAGAIN) {
DPERROR("sun_read: read");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
}
return 0;
}
if (n == 0) {
DPRINTF("sun_read: eof\n");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
hdl->offset -= (int)n / (int)hdl->ibpf;
@@ -685,13 +685,13 @@ sun_read(struct sio_hdl *sh, void *buf, size_t len)
continue;
if (errno != EAGAIN) {
DPERROR("sun_read: read");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
}
return 0;
}
if (n == 0) {
DPRINTF("sun_read: eof\n");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
return n;
@@ -709,22 +709,22 @@ sun_autostart(struct sun_hdl *hdl)
if (errno == EINTR)
continue;
DPERROR("sun_autostart: poll");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
if (!(pfd.revents & POLLOUT)) {
hdl->filling = 0;
AUDIO_INITINFO(&aui);
- if (hdl->sa.mode & SIO_PLAY)
+ if (hdl->sio.mode & SIO_PLAY)
aui.play.pause = 0;
- if (hdl->sa.mode & SIO_REC)
+ if (hdl->sio.mode & SIO_REC)
aui.record.pause = 0;
if (ioctl(hdl->fd, AUDIO_SETINFO, &aui) < 0) {
DPERROR("sun_autostart: setinfo");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
- sio_onmove_cb(&hdl->sa, 0);
+ sio_onmove_cb(&hdl->sio, 0);
}
return 1;
}
@@ -747,7 +747,7 @@ sun_write(struct sio_hdl *sh, void *buf, size_t len)
continue;
if (errno != EAGAIN) {
DPERROR("sun_write: sil");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
return 0;
@@ -763,7 +763,7 @@ sun_write(struct sio_hdl *sh, void *buf, size_t len)
continue;
if (errno != EAGAIN) {
DPERROR("sun_write: write");
- hdl->sa.eof = 1;
+ hdl->sio.eof = 1;
return 0;
}
return 0;
@@ -793,24 +793,24 @@ sun_revents(struct sio_hdl *sh, struct pollfd *pfd)
int xrun, dmove, dierr = 0, doerr = 0, doffset = 0;
int revents = pfd->revents;
- if (hdl->sa.mode & SIO_PLAY) {
+ if (hdl->sio.mode & SIO_PLAY) {
if (ioctl(hdl->fd, AUDIO_PERROR, &xrun) < 0) {
DPERROR("sun_revents: PERROR");
exit(1);
}
doerr = xrun - hdl->oerr;
hdl->oerr = xrun;
- if (hdl->sa.mode & SIO_REC)
+ if (hdl->sio.mode & SIO_REC)
doffset += doerr;
}
- if (hdl->sa.mode & SIO_REC) {
+ if (hdl->sio.mode & SIO_REC) {
if (ioctl(hdl->fd, AUDIO_RERROR, &xrun) < 0) {
DPERROR("sun_revents: RERROR");
exit(1);
}
dierr = xrun - hdl->ierr;
hdl->ierr = xrun;
- if (hdl->sa.mode & SIO_PLAY)
+ if (hdl->sio.mode & SIO_PLAY)
doffset -= dierr;
}
hdl->offset += doffset;
@@ -818,7 +818,7 @@ sun_revents(struct sio_hdl *sh, struct pollfd *pfd)
hdl->idelta -= dmove;
hdl->odelta -= dmove;
- if ((revents & POLLOUT) && !(hdl->sa.mode & SIO_REC)) {
+ if ((revents & POLLOUT) && !(hdl->sio.mode & SIO_REC)) {
if (ioctl(hdl->fd, AUDIO_GETOOFFS, &ao) < 0) {
DPERROR("sun_revents: GETOOFFS");
exit(1);
@@ -826,11 +826,11 @@ sun_revents(struct sio_hdl *sh, struct pollfd *pfd)
hdl->odelta += (ao.samples - hdl->obytes) / hdl->obpf;
hdl->obytes = ao.samples;
if (hdl->odelta != 0) {
- sio_onmove_cb(&hdl->sa, hdl->odelta);
+ sio_onmove_cb(&hdl->sio, hdl->odelta);
hdl->odelta = 0;
}
}
- if ((revents & POLLIN) && (hdl->sa.mode & SIO_REC)) {
+ if ((revents & POLLIN) && (hdl->sio.mode & SIO_REC)) {
if (ioctl(hdl->fd, AUDIO_GETIOFFS, &ao) < 0) {
DPERROR("sun_revents: GETIOFFS");
exit(1);
@@ -838,7 +838,7 @@ sun_revents(struct sio_hdl *sh, struct pollfd *pfd)
hdl->idelta += (ao.samples - hdl->ibytes) / hdl->ibpf;
hdl->ibytes = ao.samples;
if (hdl->idelta != 0) {
- sio_onmove_cb(&hdl->sa, hdl->idelta);
+ sio_onmove_cb(&hdl->sio, hdl->idelta);
hdl->idelta = 0;
}
}