Remove sleep_min from aplay

The sleep_min is the obsolete feature now.  Remove it from aplay.
This commit is contained in:
Takashi Iwai 2008-01-08 18:38:32 +01:00
parent fb1c2d53a1
commit 4cb74aed89

View file

@ -81,7 +81,6 @@ static struct {
static int timelimit = 0; static int timelimit = 0;
static int quiet_mode = 0; static int quiet_mode = 0;
static int file_type = FORMAT_DEFAULT; static int file_type = FORMAT_DEFAULT;
static unsigned int sleep_min = 0;
static int open_mode = 0; static int open_mode = 0;
static snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK; static snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;
static int mmap_flag = 0; static int mmap_flag = 0;
@ -164,7 +163,6 @@ _("Usage: %s [OPTION]... [FILE]...\n"
"-f, --format=FORMAT sample format (case insensitive)\n" "-f, --format=FORMAT sample format (case insensitive)\n"
"-r, --rate=# sample rate\n" "-r, --rate=# sample rate\n"
"-d, --duration=# interrupt after # seconds\n" "-d, --duration=# interrupt after # seconds\n"
"-s, --sleep-min=# min ticks to sleep\n"
"-M, --mmap mmap stream\n" "-M, --mmap mmap stream\n"
"-N, --nonblock nonblocking mode\n" "-N, --nonblock nonblocking mode\n"
"-F, --period-time=# distance between interrupts is # microseconds\n" "-F, --period-time=# distance between interrupts is # microseconds\n"
@ -339,7 +337,7 @@ enum {
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int option_index; int option_index;
char *short_options = "hnlLD:qt:c:f:r:d:s:MNF:A:R:T:B:vIPC"; char *short_options = "hnlLD:qt:c:f:r:d:MNF:A:R:T:B:vIPC";
static struct option long_options[] = { static struct option long_options[] = {
{"help", 0, 0, 'h'}, {"help", 0, 0, 'h'},
{"version", 0, 0, OPT_VERSION}, {"version", 0, 0, OPT_VERSION},
@ -353,7 +351,6 @@ int main(int argc, char *argv[])
{"format", 1, 0, 'f'}, {"format", 1, 0, 'f'},
{"rate", 1, 0, 'r'}, {"rate", 1, 0, 'r'},
{"duration", 1, 0 ,'d'}, {"duration", 1, 0 ,'d'},
{"sleep-min", 1, 0, 's'},
{"mmap", 0, 0, 'M'}, {"mmap", 0, 0, 'M'},
{"nonblock", 0, 0, 'N'}, {"nonblock", 0, 0, 'N'},
{"period-time", 1, 0, 'F'}, {"period-time", 1, 0, 'F'},
@ -478,9 +475,6 @@ int main(int argc, char *argv[])
case 'd': case 'd':
timelimit = strtol(optarg, NULL, 0); timelimit = strtol(optarg, NULL, 0);
break; break;
case 's':
sleep_min = strtol(optarg, NULL, 0);
break;
case 'N': case 'N':
nonblock = 1; nonblock = 1;
open_mode |= SND_PCM_NONBLOCK; open_mode |= SND_PCM_NONBLOCK;
@ -976,11 +970,6 @@ static void set_params(void)
error(_("Unable to obtain xfer align\n")); error(_("Unable to obtain xfer align\n"));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (sleep_min)
xfer_align = 1;
err = snd_pcm_sw_params_set_sleep_min(handle, swparams,
sleep_min);
assert(err >= 0);
if (avail_min < 0) if (avail_min < 0)
n = chunk_size; n = chunk_size;
else else
@ -1249,8 +1238,7 @@ static ssize_t pcm_write(u_char *data, size_t count)
ssize_t r; ssize_t r;
ssize_t result = 0; ssize_t result = 0;
if (sleep_min == 0 && if (count < chunk_size) {
count < chunk_size) {
snd_pcm_format_set_silence(hwparams.format, data + count * bits_per_frame / 8, (chunk_size - count) * hwparams.channels); snd_pcm_format_set_silence(hwparams.format, data + count * bits_per_frame / 8, (chunk_size - count) * hwparams.channels);
count = chunk_size; count = chunk_size;
} }
@ -1282,8 +1270,7 @@ static ssize_t pcm_writev(u_char **data, unsigned int channels, size_t count)
ssize_t r; ssize_t r;
size_t result = 0; size_t result = 0;
if (sleep_min == 0 && if (count != chunk_size) {
count != chunk_size) {
unsigned int channel; unsigned int channel;
size_t offset = count; size_t offset = count;
size_t remaining = chunk_size - count; size_t remaining = chunk_size - count;
@ -1330,8 +1317,7 @@ static ssize_t pcm_read(u_char *data, size_t rcount)
size_t result = 0; size_t result = 0;
size_t count = rcount; size_t count = rcount;
if (sleep_min == 0 && if (count != chunk_size) {
count != chunk_size) {
count = chunk_size; count = chunk_size;
} }
@ -1364,8 +1350,7 @@ static ssize_t pcm_readv(u_char **data, unsigned int channels, size_t rcount)
size_t result = 0; size_t result = 0;
size_t count = rcount; size_t count = rcount;
if (sleep_min == 0 && if (count != chunk_size) {
count != chunk_size) {
count = chunk_size; count = chunk_size;
} }
@ -1452,13 +1437,9 @@ static void voc_pcm_flush(void)
{ {
if (buffer_pos > 0) { if (buffer_pos > 0) {
size_t b; size_t b;
if (sleep_min == 0) { if (snd_pcm_format_set_silence(hwparams.format, audiobuf + buffer_pos, chunk_bytes - buffer_pos * 8 / bits_per_sample) < 0)
if (snd_pcm_format_set_silence(hwparams.format, audiobuf + buffer_pos, chunk_bytes - buffer_pos * 8 / bits_per_sample) < 0) fprintf(stderr, _("voc_pcm_flush - silence error"));
fprintf(stderr, _("voc_pcm_flush - silence error")); b = chunk_size;
b = chunk_size;
} else {
b = buffer_pos * 8 / bits_per_frame;
}
if (pcm_write(audiobuf, b) != (ssize_t)b) if (pcm_write(audiobuf, b) != (ssize_t)b)
error(_("voc_pcm_flush error")); error(_("voc_pcm_flush error"));
} }
@ -1981,7 +1962,7 @@ void playback_go(int fd, size_t loaded, off64_t count, int rtype, char *name)
if (r == 0) if (r == 0)
break; break;
l += r; l += r;
} while (sleep_min == 0 && (size_t)l < chunk_bytes); } while ((size_t)l < chunk_bytes);
l = l * 8 / bits_per_frame; l = l * 8 / bits_per_frame;
r = pcm_write(audiobuf, l); r = pcm_write(audiobuf, l);
if (r != l) if (r != l)
@ -2223,7 +2204,7 @@ void playbackv_go(int* fds, unsigned int channels, size_t loaded, off64_t count,
if (r == 0) if (r == 0)
break; break;
c += r; c += r;
} while (sleep_min == 0 && c < expected); } while (c < expected);
c = c * 8 / bits_per_sample; c = c * 8 / bits_per_sample;
r = pcm_writev(bufs, channels, c); r = pcm_writev(bufs, channels, c);
if ((size_t)r != c) if ((size_t)r != c)