mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 04:15:44 +01:00
alsabat: use variable for thread return value
Use variable instead of 0/1 to indicate the return value of playback and capture threads. Signed-off-by: Lu, Han <han.lu@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
f2f6583ee6
commit
98de9f7905
1 changed files with 10 additions and 10 deletions
20
bat/alsa.c
20
bat/alsa.c
|
@ -383,13 +383,13 @@ void *playback_alsa(struct bat *bat)
|
|||
if (err != 0) {
|
||||
fprintf(bat->err, _("Cannot open PCM playback device: "));
|
||||
fprintf(bat->err, _("%s(%d)\n"), snd_strerror(err), err);
|
||||
retval_play = 1;
|
||||
retval_play = err;
|
||||
goto exit1;
|
||||
}
|
||||
|
||||
err = set_snd_pcm_params(bat, &sndpcm);
|
||||
if (err != 0) {
|
||||
retval_play = 1;
|
||||
retval_play = err;
|
||||
goto exit2;
|
||||
}
|
||||
|
||||
|
@ -406,20 +406,20 @@ void *playback_alsa(struct bat *bat)
|
|||
if (bat->fp == NULL) {
|
||||
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||
bat->playback.file, err);
|
||||
retval_play = 1;
|
||||
retval_play = err;
|
||||
goto exit3;
|
||||
}
|
||||
/* Skip header */
|
||||
err = read_wav_header(bat, bat->playback.file, bat->fp, true);
|
||||
if (err != 0) {
|
||||
retval_play = 1;
|
||||
retval_play = err;
|
||||
goto exit4;
|
||||
}
|
||||
}
|
||||
|
||||
err = write_to_pcm_loop(&sndpcm, bat);
|
||||
if (err != 0) {
|
||||
retval_play = 1;
|
||||
retval_play = err;
|
||||
goto exit4;
|
||||
}
|
||||
|
||||
|
@ -533,13 +533,13 @@ void *record_alsa(struct bat *bat)
|
|||
if (err != 0) {
|
||||
fprintf(bat->err, _("Cannot open PCM capture device: "));
|
||||
fprintf(bat->err, _("%s(%d)\n"), snd_strerror(err), err);
|
||||
retval_record = 1;
|
||||
retval_record = err;
|
||||
goto exit1;
|
||||
}
|
||||
|
||||
err = set_snd_pcm_params(bat, &sndpcm);
|
||||
if (err != 0) {
|
||||
retval_record = 1;
|
||||
retval_record = err;
|
||||
goto exit2;
|
||||
}
|
||||
|
||||
|
@ -549,7 +549,7 @@ void *record_alsa(struct bat *bat)
|
|||
if (fp == NULL) {
|
||||
fprintf(bat->err, _("Cannot open file: %s %d\n"),
|
||||
bat->capture.file, err);
|
||||
retval_record = 1;
|
||||
retval_record = err;
|
||||
goto exit3;
|
||||
}
|
||||
|
||||
|
@ -563,7 +563,7 @@ void *record_alsa(struct bat *bat)
|
|||
|
||||
err = write_wav_header(fp, &wav, bat);
|
||||
if (err != 0) {
|
||||
retval_record = 1;
|
||||
retval_record = err;
|
||||
goto exit4;
|
||||
}
|
||||
|
||||
|
@ -571,7 +571,7 @@ void *record_alsa(struct bat *bat)
|
|||
fprintf(bat->log, _("Recording ...\n"));
|
||||
err = read_from_pcm_loop(fp, count, &sndpcm, bat);
|
||||
if (err != 0) {
|
||||
retval_record = 1;
|
||||
retval_record = err;
|
||||
goto exit4;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue