mirror of https://github.com/ericonr/sndio.git
initialize wav structure enough, for wav_close() to work
This commit is contained in:
parent
718a891d31
commit
3f1b2007ce
16
aucat/wav.c
16
aucat/wav.c
|
@ -796,7 +796,11 @@ wav_new_in(struct fileops *ops, struct dev *dev,
|
|||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
f->mode = mode;
|
||||
f->pstate = WAV_CFG;
|
||||
f->endpos = f->startpos = 0;
|
||||
f->next = wav_list;
|
||||
wav_list = f;
|
||||
if (hdr == HDR_WAV) {
|
||||
if (!wav_readhdr(f->pipe.fd, par,
|
||||
&f->startpos, &f->rbytes, &f->map)) {
|
||||
|
@ -805,7 +809,6 @@ wav_new_in(struct fileops *ops, struct dev *dev,
|
|||
}
|
||||
f->endpos = f->startpos + f->rbytes;
|
||||
} else {
|
||||
f->startpos = 0;
|
||||
f->endpos = pipe_endpos(&f->pipe.file);
|
||||
if (f->endpos > 0) {
|
||||
if (!pipe_seek(&f->pipe.file, 0)) {
|
||||
|
@ -846,8 +849,6 @@ wav_new_in(struct fileops *ops, struct dev *dev,
|
|||
dbg_puts("\n");
|
||||
}
|
||||
#endif
|
||||
f->next = wav_list;
|
||||
wav_list = f;
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -881,7 +882,11 @@ wav_new_out(struct fileops *ops, struct dev *dev,
|
|||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
f->mode = mode;
|
||||
f->pstate = WAV_CFG;
|
||||
f->endpos = f->startpos = 0;
|
||||
f->next = wav_list;
|
||||
wav_list = f;
|
||||
if (hdr == HDR_WAV) {
|
||||
par->le = 1;
|
||||
par->sig = (par->bits <= 8) ? 0 : 1;
|
||||
|
@ -892,14 +897,11 @@ wav_new_out(struct fileops *ops, struct dev *dev,
|
|||
}
|
||||
f->wbytes = WAV_DATAMAX;
|
||||
f->endpos = f->startpos;
|
||||
} else {
|
||||
} else
|
||||
f->wbytes = -1;
|
||||
f->startpos = f->endpos = 0;
|
||||
}
|
||||
f->dev = dev;
|
||||
f->mmc = mmc;
|
||||
f->join = join;
|
||||
f->mode = mode;
|
||||
f->hpar = *par;
|
||||
f->hdr = hdr;
|
||||
f->xrun = xrun;
|
||||
|
|
Loading…
Reference in New Issue