sndiod: Remove dev_{cmin,cmax} from slot struct, use those in opt struct.

This commit is contained in:
Alexandre Ratchov 2018-06-11 19:53:11 +02:00
parent 72c6c0a9b8
commit 5754ba3986
3 changed files with 12 additions and 16 deletions

View File

@ -1426,7 +1426,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;
@ -1441,7 +1441,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 =
@ -1461,7 +1461,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;
@ -1474,7 +1474,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) {
@ -1671,12 +1671,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;

View File

@ -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 */

View File

@ -628,14 +628,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(":");
@ -650,7 +649,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);
@ -659,9 +657,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