From 3a63bde079305ed3eb3de74a1e9c551b6b6e2a3a Mon Sep 17 00:00:00 2001 From: James Courtier-Dutton Date: Sat, 21 Feb 2004 14:16:48 +0000 Subject: =?UTF-8?q?Fix=20mixer=20failure=20for=20envy24=20sound=20cards.?= =?UTF-8?q?=20Error=20message=20reported:=20-=20xine:=20simple.c:1465:=20s?= =?UTF-8?q?nd=5Fmixer=5Fselem=5Fget=5Fplayback=5Fvolume:=20Zusicherung=20?= =?UTF-8?q?=C2=BBelem=C2=AB=20nicht=20erf=C3=BCllt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CVS patchset: 6181 CVS date: 2004/02/21 14:16:48 --- src/audio_out/audio_alsa_out.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index b1ac9fb18..2a26132da 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.123 2004/01/29 22:01:07 jstembridge Exp $ + * $Id: audio_alsa_out.c,v 1.124 2004/02/21 14:16:48 jcdutton Exp $ */ #ifdef HAVE_CONFIG_H @@ -832,6 +832,7 @@ static void ao_alsa_exit(ao_driver_t *this_gen) { pthread_cancel(this->mixer.thread); pthread_join(this->mixer.thread, &p); snd_mixer_close(this->mixer.handle); + this->mixer.handle=0; } if (this->audio_fd) snd_pcm_close(this->audio_fd); @@ -1079,6 +1080,7 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { if ((err = snd_mixer_open (&this->mixer.handle, 0)) < 0) { xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_open(): %s\n", snd_strerror(err)); + this->mixer.handle=0; return; } @@ -1086,6 +1088,7 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_attach(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); + this->mixer.handle=0; return; } @@ -1093,6 +1096,7 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_selem_register(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); + this->mixer.handle=0; return; } @@ -1100,6 +1104,7 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: snd_mixer_load(): %s\n", snd_strerror(err)); snd_mixer_close(this->mixer.handle); + this->mixer.handle=0; return; } @@ -1108,6 +1113,7 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "audio_alsa_out: alloca() failed: %s\n", strerror(errno)); snd_mixer_close(this->mixer.handle); + this->mixer.handle=0; return; } @@ -1126,7 +1132,6 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { mixer_n_selems++; if(!strcmp((snd_mixer_selem_get_name(elem)), this->mixer.name)) { - /* printf("found %s\n", snd_mixer_selem_get_name(elem)); */ this->mixer.elem = elem; @@ -1212,6 +1217,12 @@ static void ao_alsa_mixer_init(ao_driver_t *this_gen) { this->capabilities |= AO_CAP_MIXER_VOL; else this->capabilities |= AO_CAP_PCM_VOL; + } else { + if (this->mixer.handle) { + snd_mixer_close(this->mixer.handle); + this->mixer.handle=0; + } + return; } /* Create a thread which wait/handle mixer events */ -- cgit v1.2.3