diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2006-01-25 17:40:59 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2006-01-25 17:40:59 +0000 |
commit | 325c49cf90cb8d35fe5766fe9b6a4b7581411c91 (patch) | |
tree | 5946dbd978db21eb2b9eaf031b3d9f53988c807c /src | |
parent | e0c973e27e4ae8ad3646c0d9ff23efa7a0219334 (diff) | |
download | xine-lib-325c49cf90cb8d35fe5766fe9b6a4b7581411c91.tar.gz xine-lib-325c49cf90cb8d35fe5766fe9b6a4b7581411c91.tar.bz2 |
* Patch from SuSE to fix alsa after hardware suspend
* Fix the ./configure --enable-static-xv parameter
CVS patchset: 7844
CVS date: 2006/01/25 17:40:59
Diffstat (limited to 'src')
-rw-r--r-- | src/audio_out/audio_alsa_out.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 9f188222c..c0a9e9ba0 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.156 2005/09/24 19:27:33 miguelfreitas Exp $ + * $Id: audio_alsa_out.c,v 1.157 2006/01/25 17:40:59 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -719,6 +719,19 @@ static void xrun(alsa_driver_t *this) #endif /* + * resume from suspend + */ +static int resume(snd_pcm_t *pcm) +{ + int res; + while ((res = snd_pcm_resume(pcm)) == -EAGAIN) + sleep(1); + if (! res) + return 0; + return snd_pcm_prepare(pcm); +} + +/* * Write audio data to output buffer (blocking using snd_pcm_wait) */ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { @@ -742,6 +755,12 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { #endif snd_pcm_status_alloca(&pcm_stat); state = snd_pcm_state(this->audio_fd); + if (state == SND_PCM_STATE_SUSPENDED) { + res = resume(this->audio_fd); + if (res < 0) + return 0; + state = snd_pcm_state(this->audio_fd); + } if (state == SND_PCM_STATE_XRUN) { #ifdef LOG_DEBUG printf("audio_alsa_out:write:XRUN before\n"); @@ -791,6 +810,12 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { printf("audio_alsa_out:write:result=%ld:%s\n",result, snd_strerror(result)); #endif state = snd_pcm_state(this->audio_fd); + if (state == SND_PCM_STATE_SUSPENDED) { + res = resume(this->audio_fd); + if (res < 0) + return 0; + continue; + } if ( (state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) && (state != SND_PCM_STATE_DRAINING) ) { |