Commit aeade697 authored by Christophe Massiot's avatar Christophe Massiot

Fixed a segfault with quitting when no audio output plug-in was found

(closes #108).
parent 8afb82e2
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout_internal.h : internal defines for audio output * aout_internal.h : internal defines for audio output
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: aout_internal.h,v 1.36 2002/12/07 23:50:30 massiot Exp $ * $Id: aout_internal.h,v 1.37 2003/01/23 17:13:28 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -128,7 +128,7 @@ typedef struct aout_mixer_t ...@@ -128,7 +128,7 @@ typedef struct aout_mixer_t
void (* pf_do_work)( struct aout_instance_t *, void (* pf_do_work)( struct aout_instance_t *,
struct aout_buffer_t * ); struct aout_buffer_t * );
/* If b_error == 1, there is no mixer nor audio output pipeline. */ /* If b_error == 1, there is no mixer. */
vlc_bool_t b_error; vlc_bool_t b_error;
/* Multiplier used to raise or lower the volume of the sound in /* Multiplier used to raise or lower the volume of the sound in
* software. Beware, this creates sound distortion and should be avoided * software. Beware, this creates sound distortion and should be avoided
...@@ -202,6 +202,9 @@ typedef struct aout_output_t ...@@ -202,6 +202,9 @@ typedef struct aout_output_t
audio_volume_t i_volume; audio_volume_t i_volume;
/* Saved volume for aout_VolumeMute(). */ /* Saved volume for aout_VolumeMute(). */
audio_volume_t i_saved_volume; audio_volume_t i_saved_volume;
/* If b_error == 1, there is no audio output pipeline. */
vlc_bool_t b_error;
} aout_output_t; } aout_output_t;
/***************************************************************************** /*****************************************************************************
...@@ -264,7 +267,7 @@ void aout_FiltersPlay( aout_instance_t * p_aout, ...@@ -264,7 +267,7 @@ void aout_FiltersPlay( aout_instance_t * p_aout,
/* From mixer.c : */ /* From mixer.c : */
int aout_MixerNew( aout_instance_t * p_aout ); int aout_MixerNew( aout_instance_t * p_aout );
int aout_MixerDelete( aout_instance_t * p_aout ); void aout_MixerDelete( aout_instance_t * p_aout );
void aout_MixerRun( aout_instance_t * p_aout ); void aout_MixerRun( aout_instance_t * p_aout );
int aout_MixerMultiplierSet( aout_instance_t * p_aout, float f_multiplier ); int aout_MixerMultiplierSet( aout_instance_t * p_aout, float f_multiplier );
int aout_MixerMultiplierGet( aout_instance_t * p_aout, float * pf_multiplier ); int aout_MixerMultiplierGet( aout_instance_t * p_aout, float * pf_multiplier );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* common.c : audio output management of common data structures * common.c : audio output management of common data structures
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: common.c,v 1.15 2003/01/22 18:31:47 massiot Exp $ * $Id: common.c,v 1.16 2003/01/23 17:13:28 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -59,6 +59,7 @@ aout_instance_t * __aout_New( vlc_object_t * p_parent ) ...@@ -59,6 +59,7 @@ aout_instance_t * __aout_New( vlc_object_t * p_parent )
p_aout->i_nb_inputs = 0; p_aout->i_nb_inputs = 0;
p_aout->mixer.f_multiplier = 1.0; p_aout->mixer.f_multiplier = 1.0;
p_aout->mixer.b_error = 1; p_aout->mixer.b_error = 1;
p_aout->output.b_error = 1;
p_aout->output.b_starving = 1; p_aout->output.b_starving = 1;
var_Create( p_aout, "intf-change", VLC_VAR_BOOL ); var_Create( p_aout, "intf-change", VLC_VAR_BOOL );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* mixer.c : audio output mixing operations * mixer.c : audio output mixing operations
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: mixer.c,v 1.23 2003/01/06 22:07:47 massiot Exp $ * $Id: mixer.c,v 1.24 2003/01/23 17:13:28 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -58,13 +58,11 @@ int aout_MixerNew( aout_instance_t * p_aout ) ...@@ -58,13 +58,11 @@ int aout_MixerNew( aout_instance_t * p_aout )
***************************************************************************** *****************************************************************************
* Please note that you must hold the mixer lock. * Please note that you must hold the mixer lock.
*****************************************************************************/ *****************************************************************************/
int aout_MixerDelete( aout_instance_t * p_aout ) void aout_MixerDelete( aout_instance_t * p_aout )
{ {
if ( p_aout->mixer.b_error ) return 0; if ( p_aout->mixer.b_error ) return;
module_Unneed( p_aout, p_aout->mixer.p_module ); module_Unneed( p_aout, p_aout->mixer.p_module );
p_aout->mixer.b_error = 1; p_aout->mixer.b_error = 1;
return 0;
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* output.c : internal management of output streams for the audio output * output.c : internal management of output streams for the audio output
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: output.c,v 1.32 2003/01/23 11:48:18 massiot Exp $ * $Id: output.c,v 1.33 2003/01/23 17:13:28 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -200,6 +200,7 @@ int aout_OutputNew( aout_instance_t * p_aout, ...@@ -200,6 +200,7 @@ int aout_OutputNew( aout_instance_t * p_aout,
p_aout->output.i_nb_filters, p_aout->output.i_nb_filters,
&p_aout->mixer.output_alloc ); &p_aout->mixer.output_alloc );
p_aout->output.b_error = 0;
return 0; return 0;
} }
...@@ -210,11 +211,14 @@ int aout_OutputNew( aout_instance_t * p_aout, ...@@ -210,11 +211,14 @@ int aout_OutputNew( aout_instance_t * p_aout,
*****************************************************************************/ *****************************************************************************/
void aout_OutputDelete( aout_instance_t * p_aout ) void aout_OutputDelete( aout_instance_t * p_aout )
{ {
if ( p_aout->output.b_error ) return 0;
module_Unneed( p_aout, p_aout->output.p_module ); module_Unneed( p_aout, p_aout->output.p_module );
aout_FiltersDestroyPipeline( p_aout, p_aout->output.pp_filters, aout_FiltersDestroyPipeline( p_aout, p_aout->output.pp_filters,
p_aout->output.i_nb_filters ); p_aout->output.i_nb_filters );
aout_FifoDestroy( p_aout, &p_aout->output.fifo ); aout_FifoDestroy( p_aout, &p_aout->output.fifo );
p_aout->output.b_error = 1;
} }
/***************************************************************************** /*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment