[vlc-commits] channel_mixer: remap: don't modify fmt on error
Thomas Guillem
git at videolan.org
Wed Jul 12 19:10:17 CEST 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Jul 12 18:51:51 2017 +0200| [f9252eb556bc34b5441b7dedbf52540e12d68142] | committer: Thomas Guillem
channel_mixer: remap: don't modify fmt on error
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f9252eb556bc34b5441b7dedbf52540e12d68142
---
modules/audio_filter/channel_mixer/remap.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/modules/audio_filter/channel_mixer/remap.c b/modules/audio_filter/channel_mixer/remap.c
index 3a77e02e32..fa9f67c392 100644
--- a/modules/audio_filter/channel_mixer/remap.c
+++ b/modules/audio_filter/channel_mixer/remap.c
@@ -304,14 +304,13 @@ static int OpenFilter( vlc_object_t *p_this )
}
i_output_physical = CanonicaliseChannels( i_output_physical );
- audio_out->i_physical_channels = i_output_physical;
- aout_FormatPrepare( audio_out );
+ unsigned i_channels = popcount(i_output_physical);
/* condense out_channels */
uint8_t out_ch_sorted[ AOUT_CHAN_MAX ];
- for( uint8_t i = 0, wg4_i = 0; i < audio_out->i_channels; i++, wg4_i++ )
+ for( uint8_t i = 0, wg4_i = 0; i < i_channels; i++, wg4_i++ )
{
- while( ( audio_out->i_physical_channels & pi_vlc_chan_order_wg4[ wg4_i ] ) == 0 )
+ while( ( i_output_physical & pi_vlc_chan_order_wg4[ wg4_i ] ) == 0 )
{
wg4_i++;
assert( wg4_i < sizeof( pi_vlc_chan_order_wg4 )/sizeof( pi_vlc_chan_order_wg4[0] ) );
@@ -323,20 +322,13 @@ static int OpenFilter( vlc_object_t *p_this )
for( uint8_t i = 0; i < audio_in->i_channels; i++ )
{
uint8_t wg4_out_ch = pi_map_ch[i];
- uint8_t *pi_out_ch = memchr( out_ch_sorted, wg4_out_ch, audio_out->i_channels );
+ uint8_t *pi_out_ch = memchr( out_ch_sorted, wg4_out_ch, i_channels );
assert( pi_out_ch != NULL );
p_sys->map_ch[i] = pi_out_ch - out_ch_sorted;
if( ++p_sys->nb_in_ch[ p_sys->map_ch[i] ] > 1 )
b_multiple = true;
}
- msg_Dbg( p_filter, "%s '%4.4s'->'%4.4s' %d Hz->%d Hz %s->%s",
- "Remap filter",
- (char *)&audio_in->i_format, (char *)&audio_out->i_format,
- audio_in->i_rate, audio_out->i_rate,
- aout_FormatPrintChannels( audio_in ),
- aout_FormatPrintChannels( audio_out ) );
-
p_sys->pf_remap = GetRemapFun( audio_in, b_multiple );
if( !p_sys->pf_remap )
{
@@ -345,6 +337,16 @@ static int OpenFilter( vlc_object_t *p_this )
return VLC_EGENERIC;
}
+ audio_out->i_physical_channels = i_output_physical;
+ aout_FormatPrepare( audio_out );
+
+ msg_Dbg( p_filter, "%s '%4.4s'->'%4.4s' %d Hz->%d Hz %s->%s",
+ "Remap filter",
+ (char *)&audio_in->i_format, (char *)&audio_out->i_format,
+ audio_in->i_rate, audio_out->i_rate,
+ aout_FormatPrintChannels( audio_in ),
+ aout_FormatPrintChannels( audio_out ) );
+
p_filter->pf_audio_filter = Remap;
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list