summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibaut Mattern <tmattern@users.sourceforge.net>2002-06-17 16:59:43 +0000
committerThibaut Mattern <tmattern@users.sourceforge.net>2002-06-17 16:59:43 +0000
commitae3ab4e40eedc8097a8de0cfe397b5d6c62c2320 (patch)
treeebc25fc30547201f5dd27154d6e88b2df4113654
parenta633da8ebfa135cba934f6e6c7d5c9e968d2d012 (diff)
downloadxine-lib-ae3ab4e40eedc8097a8de0cfe397b5d6c62c2320.tar.gz
xine-lib-ae3ab4e40eedc8097a8de0cfe397b5d6c62c2320.tar.bz2
Use reset call instead of drop.
I hope it fixes Daniel's problem. CVS patchset: 2089 CVS date: 2002/06/17 16:59:43
-rw-r--r--src/audio_out/audio_alsa_out.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c
index c60ac1dc5..fa280aa4f 100644
--- a/src/audio_out/audio_alsa_out.c
+++ b/src/audio_out/audio_alsa_out.c
@@ -26,7 +26,7 @@
* (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk>
*
*
- * $Id: audio_alsa_out.c,v 1.58 2002/06/15 10:24:48 tmattern Exp $
+ * $Id: audio_alsa_out.c,v 1.59 2002/06/17 16:59:43 tmattern Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -646,22 +646,35 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) {
switch (cmd) {
case AO_CTRL_PLAY_PAUSE:
- if ((this->has_pause_resume) && (this->audio_fd > 0)) {
- if ((result=snd_pcm_pause(this->audio_fd, 1)) < 0) {
- printf("audio_alsa_out: Pause call failed err=%d\n", result);
- this->has_pause_resume = 0;
- ao_alsa_ctrl(this_gen, AO_CTRL_FLUSH_BUFFERS);
+ if (this->audio_fd > 0) {
+ if (this->has_pause_resume) {
+ if ((result=snd_pcm_pause(this->audio_fd, 1)) < 0) {
+ printf("audio_alsa_out: Pause call failed err=%d\n", result);
+ this->has_pause_resume = 0;
+ ao_alsa_ctrl(this_gen, AO_CTRL_PLAY_PAUSE);
+ }
+ } else {
+ if ((result=snd_pcm_reset(this->audio_fd)) < 0) {
+ printf("audio_alsa_out: Reset call failed err=%d\n",result);
+ }
+ if ((result=snd_pcm_drain(this->audio_fd)) < 0) {
+ printf("audio_alsa_out: Drain call failed err=%d\n",result);
+ }
+ if ((result=snd_pcm_prepare(this->audio_fd)) < 0) {
+ printf("audio_alsa_out: Prepare call failed err=%d\n",result);
+ }
}
- } else {
- ao_alsa_ctrl(this_gen, AO_CTRL_FLUSH_BUFFERS);
}
break;
case AO_CTRL_PLAY_RESUME:
- if ((this->has_pause_resume) && (this->audio_fd > 0) ) {
- if ((result=snd_pcm_pause(this->audio_fd, 0)) < 0) {
- printf("audio_alsa_out: Resume call failed err=%d\n",result);
- this->has_pause_resume = 0;
+ if (this->audio_fd > 0) {
+ if (this->has_pause_resume) {
+ if ((result=snd_pcm_pause(this->audio_fd, 0)) < 0) {
+ printf("audio_alsa_out: Resume call failed err=%d\n",result);
+ this->has_pause_resume = 0;
+ ao_alsa_ctrl(this_gen, AO_CTRL_PLAY_RESUME);
+ }
}
}
break;
@@ -669,8 +682,11 @@ static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) {
case AO_CTRL_FLUSH_BUFFERS:
if (this->audio_fd > 0) {
printf("audio_alsa_out: flush buffer\n");
- if ((result=snd_pcm_drop(this->audio_fd)) < 0) {
- printf("audio_alsa_out: Drop call failed err=%d\n",result);
+ if ((result=snd_pcm_reset(this->audio_fd)) < 0) {
+ printf("audio_alsa_out: Reset call failed err=%d\n",result);
+ }
+ if ((result=snd_pcm_drain(this->audio_fd)) < 0) {
+ printf("audio_alsa_out: Drain call failed err=%d\n",result);
}
if ((result=snd_pcm_prepare(this->audio_fd)) < 0) {
printf("audio_alsa_out: Prepare call failed err=%d\n",result);