vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Tue Aug 14 21:58:38 2012 +0300| [14e7e310b0c2ce53663e3f7c8474dce4fa5b047c] | committer: Rémi Denis-Courmont
aout: convert non-linear to FI32 if direct conversion is unavailable (rather than FL32, which should be the destination format anyway) > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=14e7e310b0c2ce53663e3f7c8474dce4fa5b047c --- src/audio_output/filters.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c index b6a61bf..fdaad8e 100644 --- a/src/audio_output/filters.c +++ b/src/audio_output/filters.c @@ -91,9 +91,11 @@ static int SplitConversion( const audio_sample_format_t *restrict infmt, { *midfmt = *outfmt; + /* Lastly: resample (after format conversion and remixing) */ if( infmt->i_rate != outfmt->i_rate ) midfmt->i_rate = infmt->i_rate; else + /* Penultimately: remix channels (after format conversion) */ if( infmt->i_physical_channels != outfmt->i_physical_channels || infmt->i_original_channels != outfmt->i_original_channels ) { @@ -101,22 +103,25 @@ static int SplitConversion( const audio_sample_format_t *restrict infmt, midfmt->i_original_channels = infmt->i_original_channels; } else + /* Second: convert linear to S16N as intermediate format */ + if( AOUT_FMT_LINEAR( infmt ) ) { - assert( infmt->i_format != outfmt->i_format ); - if( AOUT_FMT_LINEAR( infmt ) ) - /* NOTE: Use S16N as intermediate. We have all conversions to S16N, - * and all useful conversions from S16N. TODO: FL32 if HAVE_FPU. */ - midfmt->i_format = VLC_CODEC_S16N; - else - if( AOUT_FMT_LINEAR( outfmt ) ) - /* NOTE: our non-linear -> linear filters always output 32-bits */ - midfmt->i_format = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_FI32; - else - return -1; /* no indirect non-linear -> non-linear */ + /* All conversion from linear to S16N must be supported directly. */ + if( outfmt->i_format == VLC_CODEC_S16N ) + return -1; + midfmt->i_format = VLC_CODEC_S16N; + } + else + /* First: convert non-linear to FI32 as intermediate format */ + { + if( outfmt->i_format == VLC_CODEC_FI32 ) + return -1; + midfmt->i_format = VLC_CODEC_FI32; } + assert( !AOUT_FMTS_IDENTICAL( infmt, midfmt ) ); aout_FormatPrepare( midfmt ); - return AOUT_FMTS_IDENTICAL( infmt, midfmt ) ? -1 : 0; + return 0; } #undef aout_FiltersCreatePipeline _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
