1 /*****************************************************************************
2 * input.c : internal management of input streams for the audio output
3 *****************************************************************************
4 * Copyright (C) 2002-2004 the VideoLAN team
7 * Authors: Christophe Massiot <massiot@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
27 #include <stdlib.h> /* calloc(), malloc(), free() */
31 #include <vlc/input.h> /* for input_thread_t and i_pts_delay */
37 #include "audio_output.h"
38 #include "aout_internal.h"
40 static void inputFailure( aout_instance_t *, aout_input_t *, char * );
41 static int VisualizationCallback( vlc_object_t *, char const *,
42 vlc_value_t, vlc_value_t, void * );
43 static int EqualizerCallback( vlc_object_t *, char const *,
44 vlc_value_t, vlc_value_t, void * );
46 /*****************************************************************************
47 * aout_InputNew : allocate a new input and rework the filter pipeline
48 *****************************************************************************/
49 int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
51 audio_sample_format_t chain_input_format;
52 audio_sample_format_t chain_output_format;
53 vlc_value_t val, text;
54 char * psz_filters, *psz_visual;
56 aout_FormatPrint( p_aout, "input", &p_input->input );
58 p_input->i_nb_filters = 0;
61 aout_FifoInit( p_aout, &p_input->fifo, p_aout->mixer.mixer.i_rate );
62 p_input->p_first_byte_to_mix = NULL;
64 /* Prepare format structure */
65 memcpy( &chain_input_format, &p_input->input,
66 sizeof(audio_sample_format_t) );
67 memcpy( &chain_output_format, &p_aout->mixer.mixer,
68 sizeof(audio_sample_format_t) );
69 chain_output_format.i_rate = p_input->input.i_rate;
70 aout_FormatPrepare( &chain_output_format );
72 /* Now add user filters */
73 if( var_Type( p_aout, "visual" ) == 0 )
76 var_Create( p_aout, "visual", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
77 text.psz_string = _("Visualizations");
78 var_Change( p_aout, "visual", VLC_VAR_SETTEXT, &text, NULL );
79 val.psz_string = ""; text.psz_string = _("Disable");
80 var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
81 val.psz_string = "spectrometer"; text.psz_string = _("Spectrometer");
82 var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
83 val.psz_string = "scope"; text.psz_string = _("Scope");
84 var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
85 val.psz_string = "spectrum"; text.psz_string = _("Spectrum");
86 var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
88 /* Look for goom plugin */
89 p_module = config_FindModule( VLC_OBJECT(p_aout), "goom" );
92 val.psz_string = "goom"; text.psz_string = "Goom";
93 var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
96 /* Look for galaktos plugin */
97 p_module = config_FindModule( VLC_OBJECT(p_aout), "galaktos" );
100 val.psz_string = "galaktos"; text.psz_string = "GaLaktos";
101 var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text );
104 if( var_Get( p_aout, "effect-list", &val ) == VLC_SUCCESS )
106 var_Set( p_aout, "visual", val );
107 if( val.psz_string ) free( val.psz_string );
109 var_AddCallback( p_aout, "visual", VisualizationCallback, NULL );
112 if( var_Type( p_aout, "equalizer" ) == 0 )
114 module_config_t *p_config;
117 p_config = config_FindConfig( VLC_OBJECT(p_aout), "equalizer-preset" );
118 if( p_config && p_config->i_list )
120 var_Create( p_aout, "equalizer",
121 VLC_VAR_STRING | VLC_VAR_HASCHOICE );
122 text.psz_string = _("Equalizer");
123 var_Change( p_aout, "equalizer", VLC_VAR_SETTEXT, &text, NULL );
125 val.psz_string = ""; text.psz_string = _("Disable");
126 var_Change( p_aout, "equalizer", VLC_VAR_ADDCHOICE, &val, &text );
128 for( i = 0; i < p_config->i_list; i++ )
130 val.psz_string = p_config->ppsz_list[i];
131 text.psz_string = p_config->ppsz_list_text[i];
132 var_Change( p_aout, "equalizer", VLC_VAR_ADDCHOICE,
136 var_AddCallback( p_aout, "equalizer", EqualizerCallback, NULL );
140 if( var_Type( p_aout, "audio-filter" ) == 0 )
142 var_Create( p_aout, "audio-filter",
143 VLC_VAR_STRING | VLC_VAR_DOINHERIT );
144 text.psz_string = _("Audio filters");
145 var_Change( p_aout, "audio-filter", VLC_VAR_SETTEXT, &text, NULL );
147 if( var_Type( p_aout, "audio-visual" ) == 0 )
149 var_Create( p_aout, "audio-visual",
150 VLC_VAR_STRING | VLC_VAR_DOINHERIT );
151 text.psz_string = _("Audio visualizations");
152 var_Change( p_aout, "audio-visual", VLC_VAR_SETTEXT, &text, NULL );
155 var_Get( p_aout, "audio-filter", &val );
156 psz_filters = val.psz_string;
157 var_Get( p_aout, "audio-visual", &val );
158 psz_visual = val.psz_string;
160 if( psz_filters && *psz_filters && psz_visual && *psz_visual )
162 psz_filters = (char *)realloc( psz_filters, strlen( psz_filters ) +
163 strlen( psz_visual ) + 1);
164 sprintf( psz_filters, "%s:%s", psz_filters, psz_visual );
166 else if( psz_visual && *psz_visual )
168 if( psz_filters ) free( psz_filters );
169 psz_filters = strdup( psz_visual );
172 /* parse user filter list */
173 if( psz_filters && *psz_filters )
175 char *psz_parser = psz_filters;
177 while( psz_parser && *psz_parser )
179 aout_filter_t * p_filter = NULL;
181 if( p_input->i_nb_filters >= AOUT_MAX_FILTERS )
183 msg_Dbg( p_aout, "max filter reached (%d)", AOUT_MAX_FILTERS );
187 while( *psz_parser == ' ' && *psz_parser == ':' )
191 if( ( psz_next = strchr( psz_parser , ':' ) ) )
195 if( *psz_parser =='\0' )
200 /* Create a VLC object */
201 p_filter = vlc_object_create( p_aout, sizeof(aout_filter_t) );
202 if( p_filter == NULL )
204 msg_Err( p_aout, "cannot add user filter %s (skipped)",
206 psz_parser = psz_next;
210 vlc_object_attach( p_filter , p_aout );
213 memcpy( &p_filter->input, &chain_input_format,
214 sizeof(audio_sample_format_t) );
215 memcpy( &p_filter->output, &chain_output_format,
216 sizeof(audio_sample_format_t) );
218 /* try to find the requested filter */
219 p_filter->p_module = module_Need( p_filter, "audio filter",
220 psz_parser, VLC_TRUE );
222 if ( p_filter->p_module == NULL )
224 /* if the filter requested a special format, retry */
225 if ( !( AOUT_FMTS_IDENTICAL( &p_filter->input,
226 &chain_input_format )
227 && AOUT_FMTS_IDENTICAL( &p_filter->output,
228 &chain_output_format ) ) )
230 aout_FormatPrepare( &p_filter->input );
231 aout_FormatPrepare( &p_filter->output );
232 p_filter->p_module = module_Need( p_filter, "audio filter",
233 psz_parser, VLC_TRUE );
235 /* try visual filters */
238 memcpy( &p_filter->input, &chain_output_format,
239 sizeof(audio_sample_format_t) );
240 memcpy( &p_filter->output, &chain_output_format,
241 sizeof(audio_sample_format_t) );
242 p_filter->p_module = module_Need( p_filter, "visualization",
243 psz_parser, VLC_TRUE );
248 if ( p_filter->p_module == NULL )
250 msg_Err( p_aout, "cannot add user filter %s (skipped)",
253 vlc_object_detach( p_filter );
254 vlc_object_destroy( p_filter );
256 psz_parser = psz_next;
260 /* complete the filter chain if necessary */
261 if ( !AOUT_FMTS_IDENTICAL( &chain_input_format, &p_filter->input ) )
263 if ( aout_FiltersCreatePipeline( p_aout, p_input->pp_filters,
264 &p_input->i_nb_filters,
266 &p_filter->input ) < 0 )
268 msg_Err( p_aout, "cannot add user filter %s (skipped)",
271 module_Unneed( p_filter, p_filter->p_module );
272 vlc_object_detach( p_filter );
273 vlc_object_destroy( p_filter );
275 psz_parser = psz_next;
281 p_filter->b_continuity = VLC_FALSE;
282 p_input->pp_filters[p_input->i_nb_filters++] = p_filter;
283 memcpy( &chain_input_format, &p_filter->output,
284 sizeof( audio_sample_format_t ) );
286 /* next filter if any */
287 psz_parser = psz_next;
290 if( psz_filters ) free( psz_filters );
291 if( psz_visual ) free( psz_visual );
293 /* complete the filter chain if necessary */
294 if ( !AOUT_FMTS_IDENTICAL( &chain_input_format, &chain_output_format ) )
296 if ( aout_FiltersCreatePipeline( p_aout, p_input->pp_filters,
297 &p_input->i_nb_filters,
299 &chain_output_format ) < 0 )
301 inputFailure( p_aout, p_input, "couldn't set an input pipeline" );
306 /* Prepare hints for the buffer allocator. */
307 p_input->input_alloc.i_alloc_type = AOUT_ALLOC_HEAP;
308 p_input->input_alloc.i_bytes_per_sec = -1;
310 /* Create resamplers. */
311 if ( AOUT_FMT_NON_LINEAR( &p_aout->mixer.mixer ) )
313 p_input->i_nb_resamplers = 0;
317 chain_output_format.i_rate = (__MAX(p_input->input.i_rate,
318 p_aout->mixer.mixer.i_rate)
319 * (100 + AOUT_MAX_RESAMPLING)) / 100;
320 if ( chain_output_format.i_rate == p_aout->mixer.mixer.i_rate )
322 /* Just in case... */
323 chain_output_format.i_rate++;
325 p_input->i_nb_resamplers = 0;
326 if ( aout_FiltersCreatePipeline( p_aout, p_input->pp_resamplers,
327 &p_input->i_nb_resamplers,
328 &chain_output_format,
329 &p_aout->mixer.mixer ) < 0 )
331 inputFailure( p_aout, p_input, "couldn't set a resampler pipeline");
335 aout_FiltersHintBuffers( p_aout, p_input->pp_resamplers,
336 p_input->i_nb_resamplers,
337 &p_input->input_alloc );
338 p_input->input_alloc.i_alloc_type = AOUT_ALLOC_HEAP;
340 /* Setup the initial rate of the resampler */
341 p_input->pp_resamplers[0]->input.i_rate = p_input->input.i_rate;
343 p_input->i_resampling_type = AOUT_RESAMPLING_NONE;
345 aout_FiltersHintBuffers( p_aout, p_input->pp_filters,
346 p_input->i_nb_filters,
347 &p_input->input_alloc );
348 p_input->input_alloc.i_alloc_type = AOUT_ALLOC_HEAP;
350 /* i_bytes_per_sec is still == -1 if no filters */
351 p_input->input_alloc.i_bytes_per_sec = __MAX(
352 p_input->input_alloc.i_bytes_per_sec,
353 (int)(p_input->input.i_bytes_per_frame
354 * p_input->input.i_rate
355 / p_input->input.i_frame_length) );
358 p_input->b_error = VLC_FALSE;
359 p_input->b_restart = VLC_FALSE;
364 /*****************************************************************************
365 * aout_InputDelete : delete an input
366 *****************************************************************************
367 * This function must be entered with the mixer lock.
368 *****************************************************************************/
369 int aout_InputDelete( aout_instance_t * p_aout, aout_input_t * p_input )
371 if ( p_input->b_error ) return 0;
373 aout_FiltersDestroyPipeline( p_aout, p_input->pp_filters,
374 p_input->i_nb_filters );
375 p_input->i_nb_filters = 0;
376 aout_FiltersDestroyPipeline( p_aout, p_input->pp_resamplers,
377 p_input->i_nb_resamplers );
378 p_input->i_nb_resamplers = 0;
379 aout_FifoDestroy( p_aout, &p_input->fifo );
384 /*****************************************************************************
385 * aout_InputPlay : play a buffer
386 *****************************************************************************
387 * This function must be entered with the input lock.
388 *****************************************************************************/
389 int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
390 aout_buffer_t * p_buffer )
394 if( p_input->b_restart )
396 aout_fifo_t fifo, dummy_fifo;
397 byte_t *p_first_byte_to_mix;
399 vlc_mutex_lock( &p_aout->mixer_lock );
401 /* A little trick to avoid loosing our input fifo */
402 aout_FifoInit( p_aout, &dummy_fifo, p_aout->mixer.mixer.i_rate );
403 p_first_byte_to_mix = p_input->p_first_byte_to_mix;
404 fifo = p_input->fifo;
405 p_input->fifo = dummy_fifo;
406 aout_InputDelete( p_aout, p_input );
407 aout_InputNew( p_aout, p_input );
408 p_input->p_first_byte_to_mix = p_first_byte_to_mix;
409 p_input->fifo = fifo;
411 vlc_mutex_unlock( &p_aout->mixer_lock );
414 /* We don't care if someone changes the start date behind our back after
415 * this. We'll deal with that when pushing the buffer, and compensate
416 * with the next incoming buffer. */
417 vlc_mutex_lock( &p_aout->input_fifos_lock );
418 start_date = aout_FifoNextStart( p_aout, &p_input->fifo );
419 vlc_mutex_unlock( &p_aout->input_fifos_lock );
421 if ( start_date != 0 && start_date < mdate() )
423 /* The decoder is _very_ late. This can only happen if the user
424 * pauses the stream (or if the decoder is buggy, which cannot
426 msg_Warn( p_aout, "computed PTS is out of range ("I64Fd"), "
427 "clearing out", mdate() - start_date );
428 vlc_mutex_lock( &p_aout->input_fifos_lock );
429 aout_FifoSet( p_aout, &p_input->fifo, 0 );
430 p_input->p_first_byte_to_mix = NULL;
431 vlc_mutex_unlock( &p_aout->input_fifos_lock );
432 if ( p_input->i_resampling_type != AOUT_RESAMPLING_NONE )
433 msg_Warn( p_aout, "timing screwed, stopping resampling" );
434 p_input->i_resampling_type = AOUT_RESAMPLING_NONE;
435 if ( p_input->i_nb_resamplers != 0 )
437 p_input->pp_resamplers[0]->input.i_rate = p_input->input.i_rate;
438 p_input->pp_resamplers[0]->b_continuity = VLC_FALSE;
443 if ( p_buffer->start_date < mdate() + AOUT_MIN_PREPARE_TIME )
445 /* The decoder gives us f*cked up PTS. It's its business, but we
446 * can't present it anyway, so drop the buffer. */
447 msg_Warn( p_aout, "PTS is out of range ("I64Fd"), dropping buffer",
448 mdate() - p_buffer->start_date );
449 aout_BufferFree( p_buffer );
450 p_input->i_resampling_type = AOUT_RESAMPLING_NONE;
451 if ( p_input->i_nb_resamplers != 0 )
453 p_input->pp_resamplers[0]->input.i_rate = p_input->input.i_rate;
454 p_input->pp_resamplers[0]->b_continuity = VLC_FALSE;
459 /* If the audio drift is too big then it's not worth trying to resample
461 if ( start_date != 0 &&
462 ( start_date < p_buffer->start_date - 3 * AOUT_PTS_TOLERANCE ) )
464 msg_Warn( p_aout, "audio drift is too big ("I64Fd"), clearing out",
465 start_date - p_buffer->start_date );
466 vlc_mutex_lock( &p_aout->input_fifos_lock );
467 aout_FifoSet( p_aout, &p_input->fifo, 0 );
468 p_input->p_first_byte_to_mix = NULL;
469 vlc_mutex_unlock( &p_aout->input_fifos_lock );
470 if ( p_input->i_resampling_type != AOUT_RESAMPLING_NONE )
471 msg_Warn( p_aout, "timing screwed, stopping resampling" );
472 p_input->i_resampling_type = AOUT_RESAMPLING_NONE;
473 if ( p_input->i_nb_resamplers != 0 )
475 p_input->pp_resamplers[0]->input.i_rate = p_input->input.i_rate;
476 p_input->pp_resamplers[0]->b_continuity = VLC_FALSE;
480 else if ( start_date != 0 &&
481 ( start_date > p_buffer->start_date + 3 * AOUT_PTS_TOLERANCE ) )
483 msg_Warn( p_aout, "audio drift is too big ("I64Fd"), dropping buffer",
484 start_date - p_buffer->start_date );
485 aout_BufferFree( p_buffer );
489 if ( start_date == 0 ) start_date = p_buffer->start_date;
491 /* Run pre-filters. */
493 aout_FiltersPlay( p_aout, p_input->pp_filters, p_input->i_nb_filters,
496 /* Run the resampler if needed.
497 * We first need to calculate the output rate of this resampler. */
498 if ( ( p_input->i_resampling_type == AOUT_RESAMPLING_NONE ) &&
499 ( start_date < p_buffer->start_date - AOUT_PTS_TOLERANCE
500 || start_date > p_buffer->start_date + AOUT_PTS_TOLERANCE ) &&
501 p_input->i_nb_resamplers > 0 )
503 /* Can happen in several circumstances :
504 * 1. A problem at the input (clock drift)
505 * 2. A small pause triggered by the user
506 * 3. Some delay in the output stage, causing a loss of lip
508 * Solution : resample the buffer to avoid a scratch.
510 mtime_t drift = p_buffer->start_date - start_date;
512 p_input->i_resamp_start_date = mdate();
513 p_input->i_resamp_start_drift = (int)drift;
516 p_input->i_resampling_type = AOUT_RESAMPLING_DOWN;
518 p_input->i_resampling_type = AOUT_RESAMPLING_UP;
520 msg_Warn( p_aout, "buffer is "I64Fd" %s, triggering %ssampling",
521 drift > 0 ? drift : -drift,
522 drift > 0 ? "in advance" : "late",
523 drift > 0 ? "down" : "up");
526 if ( p_input->i_resampling_type != AOUT_RESAMPLING_NONE )
528 /* Resampling has been triggered previously (because of dates
529 * mismatch). We want the resampling to happen progressively so
530 * it isn't too audible to the listener. */
532 if( p_input->i_resampling_type == AOUT_RESAMPLING_UP )
534 p_input->pp_resamplers[0]->input.i_rate += 2; /* Hz */
538 p_input->pp_resamplers[0]->input.i_rate -= 2; /* Hz */
541 /* Check if everything is back to normal, in which case we can stop the
543 if( p_input->pp_resamplers[0]->input.i_rate ==
544 p_input->input.i_rate )
546 p_input->i_resampling_type = AOUT_RESAMPLING_NONE;
547 msg_Warn( p_aout, "resampling stopped after "I64Fi" usec "
549 mdate() - p_input->i_resamp_start_date,
550 p_buffer->start_date - start_date);
552 else if( abs( (int)(p_buffer->start_date - start_date) ) <
553 abs( p_input->i_resamp_start_drift ) / 2 )
555 /* if we reduced the drift from half, then it is time to switch
556 * back the resampling direction. */
557 if( p_input->i_resampling_type == AOUT_RESAMPLING_UP )
558 p_input->i_resampling_type = AOUT_RESAMPLING_DOWN;
560 p_input->i_resampling_type = AOUT_RESAMPLING_UP;
561 p_input->i_resamp_start_drift = 0;
563 else if( p_input->i_resamp_start_drift &&
564 ( abs( (int)(p_buffer->start_date - start_date) ) >
565 abs( p_input->i_resamp_start_drift ) * 3 / 2 ) )
567 /* If the drift is increasing and not decreasing, than something
568 * is bad. We'd better stop the resampling right now. */
569 msg_Warn( p_aout, "timing screwed, stopping resampling" );
570 p_input->i_resampling_type = AOUT_RESAMPLING_NONE;
571 p_input->pp_resamplers[0]->input.i_rate = p_input->input.i_rate;
575 /* Adding the start date will be managed by aout_FifoPush(). */
576 p_buffer->end_date = start_date +
577 (p_buffer->end_date - p_buffer->start_date);
578 p_buffer->start_date = start_date;
580 /* Actually run the resampler now. */
581 if ( p_input->i_nb_resamplers > 0 )
583 aout_FiltersPlay( p_aout, p_input->pp_resamplers,
584 p_input->i_nb_resamplers,
588 vlc_mutex_lock( &p_aout->input_fifos_lock );
589 aout_FifoPush( p_aout, &p_input->fifo, p_buffer );
590 vlc_mutex_unlock( &p_aout->input_fifos_lock );
595 /*****************************************************************************
597 *****************************************************************************/
599 static void inputFailure( aout_instance_t * p_aout, aout_input_t * p_input,
600 char * psz_error_message )
603 msg_Err( p_aout, "couldn't set an input pipeline" );
606 aout_FiltersDestroyPipeline( p_aout, p_input->pp_filters,
607 p_input->i_nb_filters );
608 aout_FiltersDestroyPipeline( p_aout, p_input->pp_resamplers,
609 p_input->i_nb_resamplers );
610 aout_FifoDestroy( p_aout, &p_input->fifo );
611 var_Destroy( p_aout, "visual" );
612 var_Destroy( p_aout, "equalizer" );
613 var_Destroy( p_aout, "audio-filter" );
614 var_Destroy( p_aout, "audio-visual" );
617 p_input->b_error = 1;
620 static int ChangeFiltersString( aout_instance_t * p_aout, char* psz_variable,
621 char *psz_name, vlc_bool_t b_add )
626 var_Get( p_aout, psz_variable, &val );
628 if( !val.psz_string ) val.psz_string = strdup("");
630 psz_parser = strstr( val.psz_string, psz_name );
636 psz_parser = val.psz_string;
637 asprintf( &val.psz_string, (*val.psz_string) ? "%s:%s" : "%s%s",
638 val.psz_string, psz_name );
650 memmove( psz_parser, psz_parser + strlen(psz_name) +
651 (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
652 strlen(psz_parser + strlen(psz_name)) + 1 );
656 free( val.psz_string );
661 var_Set( p_aout, psz_variable, val );
662 free( val.psz_string );
666 static int VisualizationCallback( vlc_object_t *p_this, char const *psz_cmd,
667 vlc_value_t oldval, vlc_value_t newval, void *p_data )
669 aout_instance_t *p_aout = (aout_instance_t *)p_this;
670 char *psz_mode = newval.psz_string;
674 if( !psz_mode || !*psz_mode )
676 ChangeFiltersString( p_aout, "audio-visual", "goom", VLC_FALSE );
677 ChangeFiltersString( p_aout, "audio-visual", "visual", VLC_FALSE );
678 ChangeFiltersString( p_aout, "audio-visual", "galaktos", VLC_FALSE );
682 if( !strcmp( "goom", psz_mode ) )
684 ChangeFiltersString( p_aout, "audio-visual", "visual", VLC_FALSE );
685 ChangeFiltersString( p_aout, "audio-visual", "goom", VLC_TRUE );
686 ChangeFiltersString( p_aout, "audio-visual", "galaktos", VLC_FALSE);
688 else if( !strcmp( "galaktos", psz_mode ) )
690 ChangeFiltersString( p_aout, "audio-visual", "visual", VLC_FALSE );
691 ChangeFiltersString( p_aout, "audio-visual", "goom", VLC_FALSE );
692 ChangeFiltersString( p_aout, "audio-visual", "galaktos", VLC_TRUE );
696 val.psz_string = psz_mode;
697 var_Create( p_aout, "effect-list", VLC_VAR_STRING );
698 var_Set( p_aout, "effect-list", val );
700 ChangeFiltersString( p_aout, "audio-visual", "goom", VLC_FALSE );
701 ChangeFiltersString( p_aout, "audio-visual", "visual", VLC_TRUE );
702 ChangeFiltersString( p_aout, "audio-visual", "galaktos", VLC_FALSE);
707 for( i = 0; i < p_aout->i_nb_inputs; i++ )
709 p_aout->pp_inputs[i]->b_restart = VLC_TRUE;
715 static int EqualizerCallback( vlc_object_t *p_this, char const *psz_cmd,
716 vlc_value_t oldval, vlc_value_t newval, void *p_data )
718 aout_instance_t *p_aout = (aout_instance_t *)p_this;
719 char *psz_mode = newval.psz_string;
724 if( !psz_mode || !*psz_mode )
726 i_ret = ChangeFiltersString( p_aout, "audio-filter", "equalizer",
731 val.psz_string = psz_mode;
732 var_Create( p_aout, "equalizer-preset", VLC_VAR_STRING );
733 var_Set( p_aout, "equalizer-preset", val );
734 i_ret = ChangeFiltersString( p_aout, "audio-filter", "equalizer",
742 for( i = 0; i < p_aout->i_nb_inputs; i++ )
744 p_aout->pp_inputs[i]->b_restart = VLC_TRUE;