diff options
author | Thibaut Mattern <tmattern@users.sourceforge.net> | 2002-06-03 23:12:44 +0000 |
---|---|---|
committer | Thibaut Mattern <tmattern@users.sourceforge.net> | 2002-06-03 23:12:44 +0000 |
commit | 77e59d9aee93a21400b75f36e1eb89f91036c767 (patch) | |
tree | 074bf4a85eb4ce933085d4eeb2b1393ca26e7517 | |
parent | 06a76b6c287a3ebf57669bc964e0b61d19369e58 (diff) | |
download | xine-lib-77e59d9aee93a21400b75f36e1eb89f91036c767.tar.gz xine-lib-77e59d9aee93a21400b75f36e1eb89f91036c767.tar.bz2 |
Flush audio_out buffers at seek and pause.
CVS patchset: 2008
CVS date: 2002/06/03 23:12:44
-rw-r--r-- | src/audio_out/audio_alsa_out.c | 29 | ||||
-rw-r--r-- | src/audio_out/audio_oss_out.c | 12 |
2 files changed, 32 insertions, 9 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 86309986c..b77e9dbc8 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.54 2002/06/03 09:45:12 f1rmb Exp $ + * $Id: audio_alsa_out.c,v 1.55 2002/06/03 23:12:44 tmattern Exp $ */ #ifdef HAVE_CONFIG_H @@ -640,36 +640,51 @@ static int ao_alsa_set_property (ao_driver_t *this_gen, int property, int value) static int ao_alsa_ctrl(ao_driver_t *this_gen, int cmd, ...) { alsa_driver_t *this = (alsa_driver_t *) this_gen; int result; -#if 0 - /* Alsa 0.9.x pause and result is not stable enough at the moment. - * FIXME: Change these to snd_pcm_drop and restart. + + /* Alsa 0.9.x pause and resume is not stable enough at the moment. + * Use snd_pcm_drop and restart instead. */ switch (cmd) { case AO_CTRL_PLAY_PAUSE: if ((this->has_pause_resume) && (this->audio_fd > 0)) { +#if 0 if ((result=snd_pcm_pause(this->audio_fd, 1)) < 0) { printf("Pause call failed err=%d\n",result); } +#else + if ((result=snd_pcm_drop(this->audio_fd)) < 0) { + printf("Drop call failed err=%d\n",result); + } + if ((result=snd_pcm_prepare(this->audio_fd)) < 0) { + printf("Prepare call failed err=%d\n",result); + } +#endif } break; case AO_CTRL_PLAY_RESUME: if ((this->has_pause_resume) && (this->audio_fd > 0) ) { +#if 0 if ((result=snd_pcm_pause(this->audio_fd, 0)) < 0) { printf("Resume call failed err=%d\n",result); } +#endif } break; case AO_CTRL_FLUSH_BUFFERS: if (this->audio_fd > 0) { - snd_pcm_drop(this->audio_fd); - snd_pcm_prepare(this->audio_fd); + printf("audio_alsa_out: flush buffer\n"); + if ((result=snd_pcm_drop(this->audio_fd)) < 0) { + printf("Drop call failed err=%d\n",result); + } + if ((result=snd_pcm_prepare(this->audio_fd)) < 0) { + printf("Prepare call failed err=%d\n",result); + } } break; } -#endif return 0; } diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index 9d26a6cd3..19cbdbfa5 100644 --- a/src/audio_out/audio_oss_out.c +++ b/src/audio_out/audio_oss_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_oss_out.c,v 1.66 2002/06/03 09:45:12 f1rmb Exp $ + * $Id: audio_oss_out.c,v 1.67 2002/06/03 23:12:44 tmattern Exp $ * * 20-8-2001 First implementation of Audio sync and Audio driver separation. * Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -403,6 +403,7 @@ static int ao_oss_write(ao_driver_t *this_gen, oss_driver_t *this = (oss_driver_t *) this_gen; + //printf ("audio_oss_out: ao_oss_write()\n"); if (this->sync_method == OSS_SYNC_SOFTSYNC) { int simulated_bytes_in_buffer, frames ; struct timeval tv; @@ -582,17 +583,24 @@ static int ao_oss_set_property (ao_driver_t *this_gen, int property, int value) } static int ao_oss_ctrl(ao_driver_t *this_gen, int cmd, ...) { - /*oss_driver_t *this = (oss_driver_t *) this_gen;*/ + oss_driver_t *this = (oss_driver_t *) this_gen; switch (cmd) { case AO_CTRL_PLAY_PAUSE: + printf ("audio_oss_out: AO_CTRL_PLAY_PAUSE\n"); + ioctl(this->audio_fd, SNDCTL_DSP_RESET, NULL); + ao_oss_close(this_gen); + ao_oss_open(this_gen, this->bits_per_sample, this->input_sample_rate, this->mode); break; case AO_CTRL_PLAY_RESUME: + printf ("audio_oss_out: AO_CTRL_PLAY_RESUME\n"); break; case AO_CTRL_FLUSH_BUFFERS: + printf ("audio_oss_out: AO_CTRL_FLUSH_BUFFERS\n"); + ioctl(this->audio_fd, SNDCTL_DSP_RESET, NULL); break; } |