Commit b7e5d7c5 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* backport of [13046] , refs #416

parent 91e7f05a
...@@ -52,6 +52,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input ) ...@@ -52,6 +52,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
audio_sample_format_t chain_output_format; audio_sample_format_t chain_output_format;
vlc_value_t val, text; vlc_value_t val, text;
char * psz_filters, *psz_visual; char * psz_filters, *psz_visual;
int i_visual;
aout_FormatPrint( p_aout, "input", &p_input->input ); aout_FormatPrint( p_aout, "input", &p_input->input );
...@@ -157,23 +158,15 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input ) ...@@ -157,23 +158,15 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
var_Get( p_aout, "audio-visual", &val ); var_Get( p_aout, "audio-visual", &val );
psz_visual = val.psz_string; psz_visual = val.psz_string;
if( psz_filters && *psz_filters && psz_visual && *psz_visual ) /* parse user filter lists */
for( i_visual = 0; i_visual < 2; i_visual++ )
{ {
psz_filters = (char *)realloc( psz_filters, strlen( psz_filters ) + char *psz_next = NULL;
strlen( psz_visual ) + 1); char *psz_parser = i_visual ? psz_visual : psz_filters;
sprintf( psz_filters, "%s:%s", psz_filters, psz_visual );
}
else if( psz_visual && *psz_visual )
{
if( psz_filters ) free( psz_filters );
psz_filters = strdup( psz_visual );
}
/* parse user filter list */ if( psz_parser == NULL || !*psz_parser )
if( psz_filters && *psz_filters ) continue;
{
char *psz_parser = psz_filters;
char *psz_next;
while( psz_parser && *psz_parser ) while( psz_parser && *psz_parser )
{ {
aout_filter_t * p_filter = NULL; aout_filter_t * p_filter = NULL;
...@@ -209,38 +202,52 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input ) ...@@ -209,38 +202,52 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
vlc_object_attach( p_filter , p_aout ); vlc_object_attach( p_filter , p_aout );
/* request format */
memcpy( &p_filter->input, &chain_input_format,
sizeof(audio_sample_format_t) );
memcpy( &p_filter->output, &chain_output_format,
sizeof(audio_sample_format_t) );
/* try to find the requested filter */ /* try to find the requested filter */
p_filter->p_module = module_Need( p_filter, "audio filter", if( i_visual == 1 ) /* this can only be a visualization module */
{
/* request format */
memcpy( &p_filter->input, &chain_output_format,
sizeof(audio_sample_format_t) );
memcpy( &p_filter->output, &chain_output_format,
sizeof(audio_sample_format_t) );
p_filter->p_module = module_Need( p_filter, "visualization",
psz_parser, VLC_TRUE );
}
else /* this can be a audio filter module as well as a visualization module */
{
/* request format */
memcpy( &p_filter->input, &chain_input_format,
sizeof(audio_sample_format_t) );
memcpy( &p_filter->output, &chain_output_format,
sizeof(audio_sample_format_t) );
p_filter->p_module = module_Need( p_filter, "audio filter",
psz_parser, VLC_TRUE ); psz_parser, VLC_TRUE );
if ( p_filter->p_module == NULL ) if ( p_filter->p_module == NULL )
{
/* if the filter requested a special format, retry */
if ( !( AOUT_FMTS_IDENTICAL( &p_filter->input,
&chain_input_format )
&& AOUT_FMTS_IDENTICAL( &p_filter->output,
&chain_output_format ) ) )
{
aout_FormatPrepare( &p_filter->input );
aout_FormatPrepare( &p_filter->output );
p_filter->p_module = module_Need( p_filter, "audio filter",
psz_parser, VLC_TRUE );
}
/* try visual filters */
else
{ {
memcpy( &p_filter->input, &chain_output_format, /* if the filter requested a special format, retry */
sizeof(audio_sample_format_t) ); if ( !( AOUT_FMTS_IDENTICAL( &p_filter->input,
memcpy( &p_filter->output, &chain_output_format, &chain_input_format )
sizeof(audio_sample_format_t) ); && AOUT_FMTS_IDENTICAL( &p_filter->output,
p_filter->p_module = module_Need( p_filter, "visualization", &chain_output_format ) ) )
psz_parser, VLC_TRUE ); {
aout_FormatPrepare( &p_filter->input );
aout_FormatPrepare( &p_filter->output );
p_filter->p_module = module_Need( p_filter, "audio filter",
psz_parser, VLC_TRUE );
}
/* try visual filters */
else
{
memcpy( &p_filter->input, &chain_output_format,
sizeof(audio_sample_format_t) );
memcpy( &p_filter->output, &chain_output_format,
sizeof(audio_sample_format_t) );
p_filter->p_module = module_Need( p_filter, "visualization",
psz_parser, VLC_TRUE );
}
} }
} }
......
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