summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2018-06-26 07:30:27 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2018-06-26 07:30:27 +0000
commitef91a15272ebdfa920bfe1051a9b193956de9b5b (patch)
treec2c95ebe193b5cf14454a7376e3ded0364fd2f23
parenta2588425ab8f7a97d6fd7776cbb19b43efb1eb5e (diff)
Remove dev_{cmin,cmax} from the slot structure as the same information
is available in the opt structure.
-rw-r--r--usr.bin/sndiod/dev.c18
-rw-r--r--usr.bin/sndiod/dev.h4
-rw-r--r--usr.bin/sndiod/sock.c12
3 files changed, 15 insertions, 19 deletions
diff --git a/usr.bin/sndiod/dev.c b/usr.bin/sndiod/dev.c
index 8e558a289d4..62cb9c82001 100644
--- a/usr.bin/sndiod/dev.c
+++ b/usr.bin/sndiod/dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.c,v 1.39 2018/06/26 07:27:44 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.40 2018/06/26 07:30:26 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -1425,7 +1425,7 @@ slot_allocbufs(struct slot *s)
abuf_init(&s->mix.buf, s->appbufsz * s->mix.bpf);
slot_nch = s->mix.slot_cmax - s->mix.slot_cmin + 1;
- dev_nch = s->mix.dev_cmax - s->mix.dev_cmin + 1;
+ dev_nch = s->opt->pmax - s->opt->pmin + 1;
s->mix.decbuf = NULL;
s->mix.resampbuf = NULL;
s->mix.join = 1;
@@ -1440,7 +1440,7 @@ slot_allocbufs(struct slot *s)
s->mix.slot_cmin, s->mix.slot_cmax,
s->mix.slot_cmin, s->mix.slot_cmax,
0, d->pchan - 1,
- s->mix.dev_cmin, s->mix.dev_cmax);
+ s->opt->pmin, s->opt->pmax);
if (!aparams_native(&s->par)) {
dec_init(&s->mix.dec, &s->par, slot_nch);
s->mix.decbuf =
@@ -1460,7 +1460,7 @@ slot_allocbufs(struct slot *s)
abuf_init(&s->sub.buf, s->appbufsz * s->sub.bpf);
slot_nch = s->sub.slot_cmax - s->sub.slot_cmin + 1;
- dev_nch = s->sub.dev_cmax - s->sub.dev_cmin + 1;
+ dev_nch = s->opt->rmax - s->opt->rmin + 1;
s->sub.encbuf = NULL;
s->sub.resampbuf = NULL;
s->sub.join = 1;
@@ -1473,7 +1473,7 @@ slot_allocbufs(struct slot *s)
}
cmap_init(&s->sub.cmap,
0, ((s->mode & MODE_MON) ? d->pchan : d->rchan) - 1,
- s->sub.dev_cmin, s->sub.dev_cmax,
+ s->opt->rmin, s->opt->rmax,
s->sub.slot_cmin, s->sub.slot_cmax,
s->sub.slot_cmin, s->sub.slot_cmax);
if (s->rate != d->rate) {
@@ -1670,12 +1670,12 @@ found:
s->mode = mode;
aparams_init(&s->par);
if (s->mode & MODE_PLAY) {
- s->mix.slot_cmin = s->mix.dev_cmin = s->opt->pmin;
- s->mix.slot_cmax = s->mix.dev_cmax = s->opt->pmax;
+ s->mix.slot_cmin = s->opt->pmin;
+ s->mix.slot_cmax = s->opt->pmax;
}
if (s->mode & MODE_RECMASK) {
- s->sub.slot_cmin = s->sub.dev_cmin = s->opt->rmin;
- s->sub.slot_cmax = s->sub.dev_cmax = s->opt->rmax;
+ s->sub.slot_cmin = s->opt->rmin;
+ s->sub.slot_cmax = s->opt->rmax;
}
if (s->opt->mmc) {
s->xrun = XRUN_SYNC;
diff --git a/usr.bin/sndiod/dev.h b/usr.bin/sndiod/dev.h
index 7d112fdcf17..6288bedfd00 100644
--- a/usr.bin/sndiod/dev.h
+++ b/usr.bin/sndiod/dev.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.h,v 1.16 2018/06/26 07:27:44 ratchov Exp $ */
+/* $OpenBSD: dev.h,v 1.17 2018/06/26 07:30:26 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -48,7 +48,6 @@ struct slot {
struct abuf buf; /* socket side buffer */
int bpf; /* byte per frame */
int slot_cmin, slot_cmax; /* slot source chans */
- int dev_cmin, dev_cmax; /* device destination chans */
struct cmap cmap; /* channel mapper state */
struct resamp resamp; /* resampler state */
struct conv dec; /* format decoder params */
@@ -61,7 +60,6 @@ struct slot {
int prime; /* initial cycles to skip */
int bpf; /* byte per frame */
int slot_cmin, slot_cmax; /* slot destination chans */
- int dev_cmin, dev_cmax; /* device source chans */
struct cmap cmap; /* channel mapper state */
struct resamp resamp; /* buffer for resampling */
struct conv enc; /* buffer for encoding */
diff --git a/usr.bin/sndiod/sock.c b/usr.bin/sndiod/sock.c
index 810045f5dcf..9a19d84db82 100644
--- a/usr.bin/sndiod/sock.c
+++ b/usr.bin/sndiod/sock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sock.c,v 1.25 2018/06/26 07:20:37 ratchov Exp $ */
+/* $OpenBSD: sock.c,v 1.26 2018/06/26 07:30:26 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -627,14 +627,13 @@ sock_setpar(struct sock *f)
else if (rchan > NCHAN_MAX)
rchan = NCHAN_MAX;
s->sub.slot_cmax = s->opt->rmin + rchan - 1;
- s->sub.dev_cmax = s->opt->rmax;
#ifdef DEBUG
if (log_level >= 3) {
sock_log(f);
log_puts(": recording channels ");
- log_putu(s->sub.dev_cmin);
+ log_putu(s->opt->rmin);
log_puts(":");
- log_putu(s->sub.dev_cmax);
+ log_putu(s->opt->rmax);
log_puts(" -> ");
log_putu(s->sub.slot_cmin);
log_puts(":");
@@ -649,7 +648,6 @@ sock_setpar(struct sock *f)
else if (pchan > NCHAN_MAX)
pchan = NCHAN_MAX;
s->mix.slot_cmax = s->opt->pmin + pchan - 1;
- s->mix.dev_cmax = s->opt->pmax;
#ifdef DEBUG
if (log_level >= 3) {
sock_log(f);
@@ -658,9 +656,9 @@ sock_setpar(struct sock *f)
log_puts(":");
log_putu(s->mix.slot_cmax);
log_puts(" -> ");
- log_putu(s->mix.dev_cmin);
+ log_putu(s->opt->pmin);
log_puts(":");
- log_putu(s->mix.dev_cmax);
+ log_putu(s->opt->pmax);
log_puts("\n");
}
#endif