Commit 9dd393c7 authored by Gildas Bazin's avatar Gildas Bazin

* include/aout_internal.h: added a b_restart field to aout_input_t.

* src/audio_output/input.c: simplified VisualizationCallback() and don't restart the aout inputs in there but rather set the b_restart flag so they automatically get restarted on the next aout_InputPlay().
parent f27afe7d
......@@ -2,7 +2,7 @@
* aout_internal.h : internal defines for audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aout_internal.h,v 1.42 2003/11/16 21:07:30 gbazin Exp $
* $Id$
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -167,6 +167,9 @@ struct aout_input_t
/* Mixer information */
byte_t * p_first_byte_to_mix;
/* If b_restart == 1, the input pipeline will be re-created. */
vlc_bool_t b_restart;
/* If b_error == 1, there is no input pipeline. */
vlc_bool_t b_error;
......
......@@ -272,7 +272,8 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
/* Allocate in the heap, it is more convenient for the decoder. */
p_input->input_alloc.i_alloc_type = AOUT_ALLOC_HEAP;
p_input->b_error = 0;
p_input->b_error = VLC_FALSE;
p_input->b_restart = VLC_FALSE;
return 0;
}
......@@ -305,6 +306,16 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
{
mtime_t start_date;
if( p_input->b_restart )
{
vlc_mutex_lock( &p_aout->mixer_lock );
vlc_mutex_lock( &p_input->lock );
aout_InputDelete( p_aout, p_input );
aout_InputNew( p_aout, p_input );
vlc_mutex_unlock( &p_input->lock );
vlc_mutex_unlock( &p_aout->mixer_lock );
}
/* We don't care if someone changes the start date behind our back after
* this. We'll deal with that when pushing the buffer, and compensate
* with the next incoming buffer. */
......@@ -458,12 +469,9 @@ static int VisualizationCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
aout_instance_t *p_aout = (aout_instance_t *)p_this;
vlc_value_t val;
char *psz_mode = newval.psz_string;
char *psz_filter;
var_Get( p_aout, "audio-filter", &val );
psz_filter = val.psz_string;
vlc_value_t val;
int i;
if( !psz_mode || !*psz_mode )
{
......@@ -472,38 +480,28 @@ static int VisualizationCallback( vlc_object_t *p_this, char const *psz_cmd,
}
else
{
if( !psz_filter || !*psz_filter )
if( !strcmp( "goom", psz_mode ) )
{
if( !strcmp( "goom", psz_mode) )
val.psz_string = "goom";
else
val.psz_string = "visual";
var_Set( p_aout, "audio-filter", val );
}
else
{
if( strstr( psz_filter, "visual" ) == NULL )
{
psz_filter = realloc( psz_filter, strlen( psz_filter ) + 20 );
strcat( psz_filter, ",visual" );
val.psz_string = psz_mode;
var_Create( p_aout, "effect-list", VLC_VAR_STRING );
var_Set( p_aout, "effect-list", val );
val.psz_string = "visual";
}
val.psz_string = psz_filter;
var_Set( p_aout, "audio-filter", val );
}
}
if( psz_mode && *psz_mode )
/* That sucks */
for( i = 0; i < p_aout->i_nb_inputs; i++ )
{
vlc_value_t val;
val.psz_string = psz_mode;
var_Create( p_aout, "effect-list", VLC_VAR_STRING );
var_Set( p_aout, "effect-list", val);
p_aout->pp_inputs[i]->b_restart = VLC_TRUE;
}
if( psz_filter ) free( psz_filter );
aout_Restart( p_aout );
return VLC_SUCCESS;
}
......
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