Commit 14e7e310 authored by Rémi Denis-Courmont's avatar 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)
parent 4abeb549
...@@ -91,9 +91,11 @@ static int SplitConversion( const audio_sample_format_t *restrict infmt, ...@@ -91,9 +91,11 @@ static int SplitConversion( const audio_sample_format_t *restrict infmt,
{ {
*midfmt = *outfmt; *midfmt = *outfmt;
/* Lastly: resample (after format conversion and remixing) */
if( infmt->i_rate != outfmt->i_rate ) if( infmt->i_rate != outfmt->i_rate )
midfmt->i_rate = infmt->i_rate; midfmt->i_rate = infmt->i_rate;
else else
/* Penultimately: remix channels (after format conversion) */
if( infmt->i_physical_channels != outfmt->i_physical_channels if( infmt->i_physical_channels != outfmt->i_physical_channels
|| infmt->i_original_channels != outfmt->i_original_channels ) || infmt->i_original_channels != outfmt->i_original_channels )
{ {
...@@ -101,22 +103,25 @@ static int SplitConversion( const audio_sample_format_t *restrict infmt, ...@@ -101,22 +103,25 @@ static int SplitConversion( const audio_sample_format_t *restrict infmt,
midfmt->i_original_channels = infmt->i_original_channels; midfmt->i_original_channels = infmt->i_original_channels;
} }
else else
/* Second: convert linear to S16N as intermediate format */
if( AOUT_FMT_LINEAR( infmt ) )
{ {
assert( infmt->i_format != outfmt->i_format ); /* All conversion from linear to S16N must be supported directly. */
if( AOUT_FMT_LINEAR( infmt ) ) if( outfmt->i_format == VLC_CODEC_S16N )
/* NOTE: Use S16N as intermediate. We have all conversions to S16N, return -1;
* and all useful conversions from S16N. TODO: FL32 if HAVE_FPU. */ midfmt->i_format = VLC_CODEC_S16N;
midfmt->i_format = VLC_CODEC_S16N; }
else else
if( AOUT_FMT_LINEAR( outfmt ) ) /* First: convert non-linear to FI32 as intermediate format */
/* NOTE: our non-linear -> linear filters always output 32-bits */ {
midfmt->i_format = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_FI32; if( outfmt->i_format == VLC_CODEC_FI32 )
else return -1;
return -1; /* no indirect non-linear -> non-linear */ midfmt->i_format = VLC_CODEC_FI32;
} }
assert( !AOUT_FMTS_IDENTICAL( infmt, midfmt ) );
aout_FormatPrepare( midfmt ); aout_FormatPrepare( midfmt );
return AOUT_FMTS_IDENTICAL( infmt, midfmt ) ? -1 : 0; return 0;
} }
#undef aout_FiltersCreatePipeline #undef aout_FiltersCreatePipeline
......
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