mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 03:25:43 +01:00
- fixed the capture to stdout in WAV.
- allow more than 32bit int in the raw capture mode.
This commit is contained in:
parent
093a701102
commit
436b33787d
1 changed files with 21 additions and 16 deletions
|
@ -1527,6 +1527,10 @@ static void begin_wave(int fd, size_t cnt)
|
||||||
u_int tmp;
|
u_int tmp;
|
||||||
u_short tmp2;
|
u_short tmp2;
|
||||||
|
|
||||||
|
/* WAVE cannot handle greater than 32bit (signed?) int */
|
||||||
|
if (cnt == (size_t)-2)
|
||||||
|
cnt = 0x7fffff00;
|
||||||
|
|
||||||
bits = 8;
|
bits = 8;
|
||||||
switch ((unsigned long) hwparams.format) {
|
switch ((unsigned long) hwparams.format) {
|
||||||
case SND_PCM_FORMAT_U8:
|
case SND_PCM_FORMAT_U8:
|
||||||
|
@ -1754,28 +1758,29 @@ void playback_go(int fd, size_t loaded, size_t count, int rtype, char *name)
|
||||||
|
|
||||||
void capture_go(int fd, size_t count, int rtype, char *name)
|
void capture_go(int fd, size_t count, int rtype, char *name)
|
||||||
{
|
{
|
||||||
size_t c;
|
size_t c, cur;
|
||||||
ssize_t r, err;
|
ssize_t r, err;
|
||||||
|
|
||||||
header(rtype, name);
|
header(rtype, name);
|
||||||
set_params();
|
set_params();
|
||||||
|
|
||||||
while (count > 0) {
|
do {
|
||||||
c = count;
|
for (cur = count; cur > 0; cur -= r) {
|
||||||
if (c > chunk_bytes)
|
c = cur;
|
||||||
c = chunk_bytes;
|
if (c > chunk_bytes)
|
||||||
c = c * 8 / bits_per_frame;
|
c = chunk_bytes;
|
||||||
if ((size_t)(r = pcm_read(audiobuf, c)) != c)
|
c = c * 8 / bits_per_frame;
|
||||||
break;
|
if ((size_t)(r = pcm_read(audiobuf, c)) != c)
|
||||||
r = r * bits_per_frame / 8;
|
break;
|
||||||
if ((err = write(fd, audiobuf, r)) != r) {
|
r = r * bits_per_frame / 8;
|
||||||
perror(name);
|
if ((err = write(fd, audiobuf, r)) != r) {
|
||||||
exit(EXIT_FAILURE);
|
perror(name);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
if (err > 0)
|
||||||
|
fdcount += err;
|
||||||
}
|
}
|
||||||
if (err > 0)
|
} while (rtype == FORMAT_RAW && !timelimit);
|
||||||
fdcount += err;
|
|
||||||
count -= r;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue