From 49da4ad331daa0a943397f408695b033f2b8aaa9 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sun, 25 Feb 2007 22:33:25 +0000 Subject: alsa patches from Julian Scheel and Matthias Kretz CVS patchset: 8630 CVS date: 2007/02/25 22:33:25 --- src/audio_out/audio_alsa_out.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 1f3ec700d..3651d21da 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 * * - * $Id: audio_alsa_out.c,v 1.167 2007/02/25 21:54:04 miguelfreitas Exp $ + * $Id: audio_alsa_out.c,v 1.168 2007/02/25 22:33:25 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -664,6 +664,15 @@ static int ao_alsa_delay (ao_driver_t *this_gen) { printf("audio_alsa_out:delay:ENTERED\n"); #endif err=snd_pcm_delay( this->audio_fd, &delay ); + + int state = snd_pcm_state(this->audio_fd); + + /* check for idle states, which need to be handled as delay=0 */ + if(state == SND_PCM_STATE_PREPARED || state == SND_PCM_STATE_PAUSED || + state == SND_PCM_STATE_OPEN || SND_PCM_STATE_XRUN) { + return 0; + } + #ifdef LOG_DEBUG printf("audio_alsa_out:delay:delay all=%ld err=%d\n",delay, err); gettimeofday(&now, 0); @@ -1505,6 +1514,13 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da this->capabilities |= AO_CAP_FLOAT32; xprintf(class->xine, XINE_VERBOSITY_LOG, _("32bit ")); } + if (0 == (this->capabilities & (AO_CAP_FLOAT32 | AO_CAP_24BITS | AO_CAP_16BITS | AO_CAP_8BITS))) { + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, + "\naudio_alsa_out: no supported PCM format found\n"); + snd_pcm_close(this->audio_fd); + free(this); + return NULL; + } if (!(snd_pcm_hw_params_test_channels(this->audio_fd, params, 1))) { this->capabilities |= AO_CAP_MODE_MONO; xprintf(class->xine, XINE_VERBOSITY_LOG, _("mono ")); -- cgit v1.2.3