diff options
-rw-r--r-- | src/liblpcm/xine_decoder.c | 6 | ||||
-rw-r--r-- | src/libmad/xine_decoder.c | 9 | ||||
-rw-r--r-- | src/libw32dll/w32codec.c | 25 |
3 files changed, 27 insertions, 13 deletions
diff --git a/src/liblpcm/xine_decoder.c b/src/liblpcm/xine_decoder.c index 3f7e1c0ad..89a34fc35 100644 --- a/src/liblpcm/xine_decoder.c +++ b/src/liblpcm/xine_decoder.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: xine_decoder.c,v 1.6 2001/09/01 01:51:50 jcdutton Exp $ + * $Id: xine_decoder.c,v 1.7 2001/09/06 13:36:18 jkeil Exp $ * * 31-8-2001 Added LPCM rate sensing. * (c) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -91,8 +91,8 @@ void lpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { return; if (!this->output_open) { this->output_open = (this->audio_out->open (this->audio_out, this->bits_per_sample, - this->rate, - this->ao_cap_mode)); + this->rate, + this->ao_cap_mode) == 1); } if (!this->output_open) return; diff --git a/src/libmad/xine_decoder.c b/src/libmad/xine_decoder.c index 6ca98cc85..94ce433e5 100644 --- a/src/libmad/xine_decoder.c +++ b/src/libmad/xine_decoder.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: xine_decoder.c,v 1.4 2001/09/01 21:56:38 guenter Exp $ + * $Id: xine_decoder.c,v 1.5 2001/09/06 13:36:18 jkeil Exp $ * * stuff needed to turn libmad into a xine decoder plugin */ @@ -172,11 +172,10 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { if (this->output_open) this->audio_out->close (this->audio_out); - this->audio_out->open(this->audio_out, - 16, this->frame.header.samplerate, - mode); + this->output_open = (this->audio_out->open(this->audio_out, 16, + this->frame.header.samplerate, + mode) == 1); - this->output_open = 1; this->output_sampling_rate = this->frame.header.samplerate; this->output_mode = mode; } diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index faac42cf9..5b9c7a6ff 100644 --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.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: w32codec.c,v 1.18 2001/08/30 17:14:23 jkeil Exp $ + * $Id: w32codec.c,v 1.19 2001/09/06 13:36:18 jkeil Exp $ * * routines for using w32 codecs * @@ -63,7 +63,8 @@ typedef struct w32v_decoder_s { typedef struct w32a_decoder_s { audio_decoder_t audio_decoder; - ao_instance_t *audio_out; + ao_instance_t *audio_out; + int output_open; int decoder_ok; unsigned char buf[16384]; @@ -417,6 +418,7 @@ static void w32a_init (audio_decoder_t *this_gen, ao_instance_t *audio_out) { w32a_decoder_t *this = (w32a_decoder_t *) this_gen; this->audio_out = audio_out; + this->output_open = 0; this->decoder_ok = 0; } @@ -440,9 +442,16 @@ static int w32a_init_audio (w32a_decoder_t *this, WAVEFORMATEX *in_fmt_){ this->srcstream = 0; this->num_channels = in_fmt->nChannels; - this->audio_out->open( this->audio_out, - 16, in_fmt->nSamplesPerSec, - (in_fmt->nChannels == 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO); + if (this->output_open) + this->audio_out->close (this->audio_out); + + this->output_open = (this->audio_out->open( this->audio_out, + 16, in_fmt->nSamplesPerSec, + (in_fmt->nChannels == 2) ? AO_CAP_MODE_STEREO : AO_CAP_MODE_MONO) == 1); + if (!this->output_open) { + printf("ACM_Decoder: Cannot open audio output device\n"); + return 0; + } wf.nChannels = in_fmt->nChannels; wf.nSamplesPerSec = in_fmt->nSamplesPerSec; @@ -584,6 +593,12 @@ static void w32a_close (audio_decoder_t *this_gen) { w32a_decoder_t *this = (w32a_decoder_t *) this_gen; acmStreamClose(this->srcstream, 0); + + if (!this->output_open) { + this->audio_out->close (this->audio_out); + this->output_open = 0; + } + } static char *w32a_get_id(void) { |