| 160 | | if( psz_filters && *psz_filters && psz_visual && *psz_visual ) |
|---|
| 161 | | { |
|---|
| 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 ); |
|---|
| 165 | | } |
|---|
| 166 | | else if( psz_visual && *psz_visual ) |
|---|
| 167 | | { |
|---|
| 168 | | if( psz_filters ) free( psz_filters ); |
|---|
| 169 | | psz_filters = strdup( psz_visual ); |
|---|
| 170 | | } |
|---|
| 171 | | |
|---|
| 172 | | /* parse user filter list */ |
|---|
| 173 | | if( psz_filters && *psz_filters ) |
|---|
| 174 | | { |
|---|
| 175 | | char *psz_parser = psz_filters; |
|---|
| 176 | | char *psz_next; |
|---|
| | 161 | /* parse user filter lists */ |
|---|
| | 162 | for( i_visual = 0; i_visual < 2; i_visual++ ) |
|---|
| | 163 | { |
|---|
| | 164 | char *psz_next = NULL; |
|---|
| | 165 | char *psz_parser = i_visual ? psz_visual : psz_filters; |
|---|
| | 166 | |
|---|
| | 167 | if( psz_parser == NULL || !*psz_parser ) |
|---|
| | 168 | continue; |
|---|
| | 169 | |
|---|
| 219 | | p_filter->p_module = module_Need( p_filter, "audio filter", |
|---|
| | 206 | if( i_visual == 1 ) /* this can only be a visualization module */ |
|---|
| | 207 | { |
|---|
| | 208 | /* request format */ |
|---|
| | 209 | memcpy( &p_filter->input, &chain_output_format, |
|---|
| | 210 | sizeof(audio_sample_format_t) ); |
|---|
| | 211 | memcpy( &p_filter->output, &chain_output_format, |
|---|
| | 212 | sizeof(audio_sample_format_t) ); |
|---|
| | 213 | |
|---|
| | 214 | p_filter->p_module = module_Need( p_filter, "visualization", |
|---|
| | 215 | psz_parser, VLC_TRUE ); |
|---|
| | 216 | } |
|---|
| | 217 | else /* this can be a audio filter module as well as a visualization module */ |
|---|
| | 218 | { |
|---|
| | 219 | /* request format */ |
|---|
| | 220 | memcpy( &p_filter->input, &chain_input_format, |
|---|
| | 221 | sizeof(audio_sample_format_t) ); |
|---|
| | 222 | memcpy( &p_filter->output, &chain_output_format, |
|---|
| | 223 | sizeof(audio_sample_format_t) ); |
|---|
| | 224 | |
|---|
| | 225 | p_filter->p_module = module_Need( p_filter, "audio filter", |
|---|
| 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 ); |
|---|
| 234 | | } |
|---|
| 235 | | /* try visual filters */ |
|---|
| 236 | | else |
|---|
| 237 | | { |
|---|
| 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 ); |
|---|
| | 230 | /* if the filter requested a special format, retry */ |
|---|
| | 231 | if ( !( AOUT_FMTS_IDENTICAL( &p_filter->input, |
|---|
| | 232 | &chain_input_format ) |
|---|
| | 233 | && AOUT_FMTS_IDENTICAL( &p_filter->output, |
|---|
| | 234 | &chain_output_format ) ) ) |
|---|
| | 235 | { |
|---|
| | 236 | aout_FormatPrepare( &p_filter->input ); |
|---|
| | 237 | aout_FormatPrepare( &p_filter->output ); |
|---|
| | 238 | p_filter->p_module = module_Need( p_filter, "audio filter", |
|---|
| | 239 | psz_parser, VLC_TRUE ); |
|---|
| | 240 | } |
|---|
| | 241 | /* try visual filters */ |
|---|
| | 242 | else |
|---|
| | 243 | { |
|---|
| | 244 | memcpy( &p_filter->input, &chain_output_format, |
|---|
| | 245 | sizeof(audio_sample_format_t) ); |
|---|
| | 246 | memcpy( &p_filter->output, &chain_output_format, |
|---|
| | 247 | sizeof(audio_sample_format_t) ); |
|---|
| | 248 | p_filter->p_module = module_Need( p_filter, "visualization", |
|---|
| | 249 | psz_parser, VLC_TRUE ); |
|---|
| | 250 | } |
|---|