Commit d2549af0 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

aout_filter_t.(in|out)put -> aout_filter_t.fmt_(in|out).audio

This migrates to a filter_t-like syntax
parent 86997e00
...@@ -162,13 +162,14 @@ struct aout_filter_t ...@@ -162,13 +162,14 @@ struct aout_filter_t
{ {
VLC_COMMON_MEMBERS VLC_COMMON_MEMBERS
audio_sample_format_t input;
audio_sample_format_t output;
aout_alloc_t output_alloc;
module_t * p_module; module_t * p_module;
aout_filter_sys_t *p_sys; aout_filter_sys_t *p_sys;
es_format_t fmt_in;
es_format_t fmt_out;
aout_alloc_t output_alloc;
bool b_in_place; bool b_in_place;
bool b_continuity; bool b_continuity;
......
...@@ -84,22 +84,22 @@ static int Create( vlc_object_t *p_this ) ...@@ -84,22 +84,22 @@ static int Create( vlc_object_t *p_this )
aout_filter_sys_t *p_sys; aout_filter_sys_t *p_sys;
/* Validate audio filter format */ /* Validate audio filter format */
if ( p_filter->input.i_physical_channels != (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT) if ( p_filter->fmt_in.audio.i_physical_channels != (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT)
|| ! ( p_filter->input.i_original_channels & AOUT_CHAN_DOLBYSTEREO ) || ! ( p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
|| aout_FormatNbChannels( &p_filter->output ) <= 2 || aout_FormatNbChannels( &p_filter->fmt_out.audio ) <= 2
|| ( p_filter->input.i_original_channels & ~AOUT_CHAN_DOLBYSTEREO ) || ( p_filter->fmt_in.audio.i_original_channels & ~AOUT_CHAN_DOLBYSTEREO )
!= ( p_filter->output.i_original_channels & ~AOUT_CHAN_DOLBYSTEREO ) ) != ( p_filter->fmt_out.audio.i_original_channels & ~AOUT_CHAN_DOLBYSTEREO ) )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
if ( p_filter->input.i_rate != p_filter->output.i_rate ) if ( p_filter->fmt_in.audio.i_rate != p_filter->fmt_out.audio.i_rate )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
if ( p_filter->input.i_format != VLC_CODEC_FL32 if ( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32
|| p_filter->output.i_format != VLC_CODEC_FL32 ) || p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -117,7 +117,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -117,7 +117,7 @@ static int Create( vlc_object_t *p_this )
while ( pi_channels[i] ) while ( pi_channels[i] )
{ {
if ( p_filter->output.i_physical_channels & pi_channels[i] ) if ( p_filter->fmt_out.audio.i_physical_channels & pi_channels[i] )
{ {
switch ( pi_channels[i] ) switch ( pi_channels[i] )
{ {
...@@ -171,13 +171,13 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -171,13 +171,13 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
float * p_in = (float*) p_in_buf->p_buffer; float * p_in = (float*) p_in_buf->p_buffer;
float * p_out = (float*) p_out_buf->p_buffer; float * p_out = (float*) p_out_buf->p_buffer;
size_t i_nb_samples = p_in_buf->i_nb_samples; size_t i_nb_samples = p_in_buf->i_nb_samples;
size_t i_nb_channels = aout_FormatNbChannels( &p_filter->output ); size_t i_nb_channels = aout_FormatNbChannels( &p_filter->fmt_out.audio );
size_t i_nb_rear = 0; size_t i_nb_rear = 0;
size_t i; size_t i;
p_out_buf->i_nb_samples = i_nb_samples; p_out_buf->i_nb_samples = i_nb_samples;
p_out_buf->i_buffer = sizeof(float) * i_nb_samples p_out_buf->i_buffer = sizeof(float) * i_nb_samples
* aout_FormatNbChannels( &p_filter->output ); * aout_FormatNbChannels( &p_filter->fmt_out.audio );
memset( p_out, 0, p_out_buf->i_buffer ); memset( p_out, 0, p_out_buf->i_buffer );
......
...@@ -358,7 +358,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -358,7 +358,7 @@ static int Create( vlc_object_t *p_this )
bool b_fit = true; bool b_fit = true;
/* Activate this filter only with stereo devices */ /* Activate this filter only with stereo devices */
if( p_filter->output.i_physical_channels if( p_filter->fmt_out.audio.i_physical_channels
!= (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT) ) != (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT) )
{ {
msg_Dbg( p_filter, "filter discarded (incompatible format)" ); msg_Dbg( p_filter, "filter discarded (incompatible format)" );
...@@ -366,31 +366,31 @@ static int Create( vlc_object_t *p_this ) ...@@ -366,31 +366,31 @@ static int Create( vlc_object_t *p_this )
} }
/* Request a specific format if not already compatible */ /* Request a specific format if not already compatible */
if( p_filter->input.i_original_channels if( p_filter->fmt_in.audio.i_original_channels
!= p_filter->output.i_original_channels ) != p_filter->fmt_out.audio.i_original_channels )
{ {
b_fit = false; b_fit = false;
p_filter->input.i_original_channels = p_filter->fmt_in.audio.i_original_channels =
p_filter->output.i_original_channels; p_filter->fmt_out.audio.i_original_channels;
} }
if( p_filter->input.i_format != VLC_CODEC_FL32 if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32
|| p_filter->output.i_format != VLC_CODEC_FL32 ) || p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
{ {
b_fit = false; b_fit = false;
p_filter->input.i_format = VLC_CODEC_FL32; p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
p_filter->output.i_format = VLC_CODEC_FL32; p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32;
} }
if( p_filter->input.i_rate != p_filter->output.i_rate ) if( p_filter->fmt_in.audio.i_rate != p_filter->fmt_out.audio.i_rate )
{ {
b_fit = false; b_fit = false;
p_filter->input.i_rate = p_filter->output.i_rate; p_filter->fmt_in.audio.i_rate = p_filter->fmt_out.audio.i_rate;
} }
if( p_filter->input.i_physical_channels == (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT) if( p_filter->fmt_in.audio.i_physical_channels == (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT)
&& ( p_filter->input.i_original_channels & AOUT_CHAN_DOLBYSTEREO ) && ( p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
&& ! config_GetInt ( p_filter , "headphone-dolby" ) ) && ! config_GetInt ( p_filter , "headphone-dolby" ) )
{ {
b_fit = false; b_fit = false;
p_filter->input.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | p_filter->fmt_in.audio.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
AOUT_CHAN_CENTER | AOUT_CHAN_CENTER |
AOUT_CHAN_REARLEFT | AOUT_CHAN_REARLEFT |
AOUT_CHAN_REARRIGHT; AOUT_CHAN_REARRIGHT;
...@@ -412,9 +412,9 @@ static int Create( vlc_object_t *p_this ) ...@@ -412,9 +412,9 @@ static int Create( vlc_object_t *p_this )
p_sys->p_atomic_operations = NULL; p_sys->p_atomic_operations = NULL;
if( Init( VLC_OBJECT(p_filter), p_sys if( Init( VLC_OBJECT(p_filter), p_sys
, aout_FormatNbChannels ( &p_filter->input ) , aout_FormatNbChannels ( &p_filter->fmt_in.audio )
, p_filter->input.i_physical_channels , p_filter->fmt_in.audio.i_physical_channels
, p_filter->input.i_rate ) < 0 ) , p_filter->fmt_in.audio.i_rate ) < 0 )
{ {
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -446,8 +446,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -446,8 +446,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
{ {
VLC_UNUSED(p_aout); VLC_UNUSED(p_aout);
aout_filter_sys_t *p_sys = p_filter->p_sys; aout_filter_sys_t *p_sys = p_filter->p_sys;
int i_input_nb = aout_FormatNbChannels( &p_filter->input ); int i_input_nb = aout_FormatNbChannels( &p_filter->fmt_in.audio );
int i_output_nb = aout_FormatNbChannels( &p_filter->output ); int i_output_nb = aout_FormatNbChannels( &p_filter->fmt_out.audio );
float * p_in = (float*) p_in_buf->p_buffer; float * p_in = (float*) p_in_buf->p_buffer;
uint8_t * p_out; uint8_t * p_out;
...@@ -668,10 +668,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block ) ...@@ -668,10 +668,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
p_out->i_length = p_block->i_length; p_out->i_length = p_block->i_length;
aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys; aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys;
aout_filter.input = p_filter->fmt_in.audio; aout_filter.fmt_in.audio = p_filter->fmt_in.audio;
aout_filter.input.i_format = p_filter->fmt_in.i_codec; aout_filter.fmt_in.audio.i_format = p_filter->fmt_in.i_codec;
aout_filter.output = p_filter->fmt_out.audio; aout_filter.fmt_out.audio = p_filter->fmt_out.audio;
aout_filter.output.i_format = p_filter->fmt_out.i_codec; aout_filter.fmt_out.audio.i_format = p_filter->fmt_out.i_codec;
aout_filter.b_in_place = 0; aout_filter.b_in_place = 0;
in_buf.p_buffer = p_block->p_buffer; in_buf.p_buffer = p_block->p_buffer;
......
...@@ -484,10 +484,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block ) ...@@ -484,10 +484,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
p_out->i_length = p_block->i_length; p_out->i_length = p_block->i_length;
aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys; aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys;
aout_filter.input = p_filter->fmt_in.audio; aout_filter.fmt_in.audio = p_filter->fmt_in.audio;
aout_filter.input.i_format = p_filter->fmt_in.i_codec; aout_filter.fmt_in.audio.i_format = p_filter->fmt_in.i_codec;
aout_filter.output = p_filter->fmt_out.audio; aout_filter.fmt_out.audio = p_filter->fmt_out.audio;
aout_filter.output.i_format = p_filter->fmt_out.i_codec; aout_filter.fmt_out.audio.i_format = p_filter->fmt_out.i_codec;
in_buf.p_buffer = p_block->p_buffer; in_buf.p_buffer = p_block->p_buffer;
in_buf.i_buffer = p_block->i_buffer; in_buf.i_buffer = p_block->i_buffer;
...@@ -535,8 +535,8 @@ static void stereo2mono_downmix( aout_filter_t * p_filter, ...@@ -535,8 +535,8 @@ static void stereo2mono_downmix( aout_filter_t * p_filter,
{ {
filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys; filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
int i_input_nb = aout_FormatNbChannels( &p_filter->input ); int i_input_nb = aout_FormatNbChannels( &p_filter->fmt_in.audio );
int i_output_nb = aout_FormatNbChannels( &p_filter->output ); int i_output_nb = aout_FormatNbChannels( &p_filter->fmt_out.audio );
int16_t * p_in = (int16_t*) p_in_buf->p_buffer; int16_t * p_in = (int16_t*) p_in_buf->p_buffer;
uint8_t * p_out; uint8_t * p_out;
......
...@@ -85,7 +85,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -85,7 +85,7 @@ static int Create( vlc_object_t *p_this )
{ {
aout_filter_t * p_filter = (aout_filter_t *)p_this; aout_filter_t * p_filter = (aout_filter_t *)p_this;
if( !IsSupported( &p_filter->input, &p_filter->output ) ) if( !IsSupported( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
return -1; return -1;
p_filter->pf_do_work = DoWork; p_filter->pf_do_work = DoWork;
...@@ -101,7 +101,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -101,7 +101,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
{ {
VLC_UNUSED(p_aout); VLC_UNUSED(p_aout);
const unsigned i_input_physical = p_filter->input.i_physical_channels; const unsigned i_input_physical = p_filter->fmt_in.audio.i_physical_channels;
const bool b_input_7_0 = (i_input_physical & ~AOUT_CHAN_LFE) == AOUT_CHANS_7_0; const bool b_input_7_0 = (i_input_physical & ~AOUT_CHAN_LFE) == AOUT_CHANS_7_0;
const bool b_input_5_0 = !b_input_7_0 && const bool b_input_5_0 = !b_input_7_0 &&
...@@ -112,8 +112,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -112,8 +112,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
const bool b_input_3_0 = !b_input_7_0 && !b_input_5_0 && !b_input_4_center_rear && const bool b_input_3_0 = !b_input_7_0 && !b_input_5_0 && !b_input_4_center_rear &&
(i_input_physical & ~AOUT_CHAN_LFE) == AOUT_CHANS_3_0; (i_input_physical & ~AOUT_CHAN_LFE) == AOUT_CHANS_3_0;
int i_input_nb = aout_FormatNbChannels( &p_filter->input ); int i_input_nb = aout_FormatNbChannels( &p_filter->fmt_in.audio );
int i_output_nb = aout_FormatNbChannels( &p_filter->output ); int i_output_nb = aout_FormatNbChannels( &p_filter->fmt_out.audio );
float *p_dest = (float *)p_out_buf->p_buffer; float *p_dest = (float *)p_out_buf->p_buffer;
const float *p_src = (const float *)p_in_buf->p_buffer; const float *p_src = (const float *)p_in_buf->p_buffer;
int i; int i;
...@@ -121,7 +121,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -121,7 +121,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
p_out_buf->i_buffer = p_in_buf->i_buffer * i_output_nb / i_input_nb; p_out_buf->i_buffer = p_in_buf->i_buffer * i_output_nb / i_input_nb;
if( p_filter->output.i_physical_channels == AOUT_CHANS_2_0 ) if( p_filter->fmt_out.audio.i_physical_channels == AOUT_CHANS_2_0 )
{ {
if( b_input_7_0 ) if( b_input_7_0 )
for( i = p_in_buf->i_nb_samples; i--; ) for( i = p_in_buf->i_nb_samples; i--; )
...@@ -133,7 +133,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -133,7 +133,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src += 7; p_src += 7;
if( p_filter->input.i_physical_channels & AOUT_CHAN_LFE ) p_src++; if( p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ) p_src++;
} }
else if( b_input_5_0 ) else if( b_input_5_0 )
for( i = p_in_buf->i_nb_samples; i--; ) for( i = p_in_buf->i_nb_samples; i--; )
...@@ -145,7 +145,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -145,7 +145,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src += 5; p_src += 5;
if( p_filter->input.i_physical_channels & AOUT_CHAN_LFE ) p_src++; if( p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ) p_src++;
} }
else if( b_input_3_0 ) else if( b_input_3_0 )
for( i = p_in_buf->i_nb_samples; i--; ) for( i = p_in_buf->i_nb_samples; i--; )
...@@ -157,7 +157,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -157,7 +157,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src += 3; p_src += 3;
if( p_filter->input.i_physical_channels & AOUT_CHAN_LFE ) p_src++; if( p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ) p_src++;
} }
else if (b_input_4_center_rear) else if (b_input_4_center_rear)
for( i = p_in_buf->i_nb_samples; i--; ) for( i = p_in_buf->i_nb_samples; i--; )
...@@ -169,7 +169,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -169,7 +169,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src += 4; p_src += 4;
} }
} }
else if( p_filter->output.i_physical_channels == AOUT_CHAN_CENTER ) else if( p_filter->fmt_out.audio.i_physical_channels == AOUT_CHAN_CENTER )
{ {
if( b_input_7_0 ) if( b_input_7_0 )
for( i = p_in_buf->i_nb_samples; i--; ) for( i = p_in_buf->i_nb_samples; i--; )
...@@ -179,7 +179,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -179,7 +179,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src += 7; p_src += 7;
if( p_filter->input.i_physical_channels & AOUT_CHAN_LFE ) p_src++; if( p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ) p_src++;
} }
else if( b_input_5_0 ) else if( b_input_5_0 )
for( i = p_in_buf->i_nb_samples; i--; ) for( i = p_in_buf->i_nb_samples; i--; )
...@@ -189,7 +189,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -189,7 +189,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src += 5; p_src += 5;
if( p_filter->input.i_physical_channels & AOUT_CHAN_LFE ) p_src++; if( p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ) p_src++;
} }
else if( b_input_3_0 ) else if( b_input_3_0 )
for( i = p_in_buf->i_nb_samples; i--; ) for( i = p_in_buf->i_nb_samples; i--; )
...@@ -199,7 +199,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -199,7 +199,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src += 3; p_src += 3;
if( p_filter->input.i_physical_channels & AOUT_CHAN_LFE ) p_src++; if( p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ) p_src++;
} }
else else
for( i = p_in_buf->i_nb_samples; i--; ) for( i = p_in_buf->i_nb_samples; i--; )
...@@ -212,7 +212,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -212,7 +212,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
} }
else else
{ {
assert( p_filter->output.i_physical_channels == AOUT_CHANS_4_0 ); assert( p_filter->fmt_out.audio.i_physical_channels == AOUT_CHANS_4_0 );
assert( b_input_7_0 || b_input_5_0 ); assert( b_input_7_0 || b_input_5_0 );
if( b_input_7_0 ) if( b_input_7_0 )
...@@ -229,7 +229,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -229,7 +229,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src += 7; p_src += 7;
if( p_filter->input.i_physical_channels & AOUT_CHAN_LFE ) p_src++; if( p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ) p_src++;
} }
else else
for( i = p_in_buf->i_nb_samples; i--; ) for( i = p_in_buf->i_nb_samples; i--; )
...@@ -245,7 +245,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -245,7 +245,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_src += 5; p_src += 5;
if( p_filter->input.i_physical_channels & AOUT_CHAN_LFE ) p_src++; if( p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ) p_src++;
} }
} }
} }
...@@ -306,10 +306,10 @@ static block_t *Filter( filter_t *p_filter, block_t *p_block ) ...@@ -306,10 +306,10 @@ static block_t *Filter( filter_t *p_filter, block_t *p_block )
p_out->i_length = p_block->i_length; p_out->i_length = p_block->i_length;
aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys; aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys;
aout_filter.input = p_filter->fmt_in.audio; aout_filter.fmt_in.audio = p_filter->fmt_in.audio;
aout_filter.input.i_format = p_filter->fmt_in.i_codec; aout_filter.fmt_in.audio.i_format = p_filter->fmt_in.i_codec;
aout_filter.output = p_filter->fmt_out.audio; aout_filter.fmt_out.audio = p_filter->fmt_out.audio;
aout_filter.output.i_format = p_filter->fmt_out.i_codec; aout_filter.fmt_out.audio.i_format = p_filter->fmt_out.i_codec;
in_buf.p_buffer = p_block->p_buffer; in_buf.p_buffer = p_block->p_buffer;
in_buf.i_buffer = p_block->i_buffer; in_buf.i_buffer = p_block->i_buffer;
......
...@@ -59,21 +59,21 @@ static int Create( vlc_object_t *p_this ) ...@@ -59,21 +59,21 @@ static int Create( vlc_object_t *p_this )
{ {
aout_filter_t * p_filter = (aout_filter_t *)p_this; aout_filter_t * p_filter = (aout_filter_t *)p_this;
if ( (p_filter->input.i_physical_channels if ( (p_filter->fmt_in.audio.i_physical_channels
== p_filter->output.i_physical_channels == p_filter->fmt_out.audio.i_physical_channels
&& p_filter->input.i_original_channels && p_filter->fmt_in.audio.i_original_channels
== p_filter->output.i_original_channels) == p_filter->fmt_out.audio.i_original_channels)
|| p_filter->input.i_format != p_filter->output.i_format || p_filter->fmt_in.audio.i_format != p_filter->fmt_out.audio.i_format
|| p_filter->input.i_rate != p_filter->output.i_rate || p_filter->fmt_in.audio.i_rate != p_filter->fmt_out.audio.i_rate
|| (p_filter->input.i_format != VLC_CODEC_FL32 || (p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32
&& p_filter->input.i_format != VLC_CODEC_FI32) ) && p_filter->fmt_in.audio.i_format != VLC_CODEC_FI32) )
{ {
return -1; return -1;
} }
p_filter->pf_do_work = DoWork; p_filter->pf_do_work = DoWork;
if ( aout_FormatNbChannels( &p_filter->input ) if ( aout_FormatNbChannels( &p_filter->fmt_in.audio )
> aout_FormatNbChannels( &p_filter->output ) ) > aout_FormatNbChannels( &p_filter->fmt_out.audio ) )
{ {
/* Downmixing */ /* Downmixing */
p_filter->b_in_place = 1; p_filter->b_in_place = 1;
...@@ -113,26 +113,26 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -113,26 +113,26 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
{ {
VLC_UNUSED(p_aout); VLC_UNUSED(p_aout);
int i_input_nb = aout_FormatNbChannels( &p_filter->input ); int i_input_nb = aout_FormatNbChannels( &p_filter->fmt_in.audio );
int i_output_nb = aout_FormatNbChannels( &p_filter->output ); int i_output_nb = aout_FormatNbChannels( &p_filter->fmt_out.audio );
int32_t * p_dest = (int32_t *)p_out_buf->p_buffer; int32_t * p_dest = (int32_t *)p_out_buf->p_buffer;
int32_t * p_src = (int32_t *)p_in_buf->p_buffer; int32_t * p_src = (int32_t *)p_in_buf->p_buffer;
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
p_out_buf->i_buffer = p_in_buf->i_buffer * i_output_nb / i_input_nb; p_out_buf->i_buffer = p_in_buf->i_buffer * i_output_nb / i_input_nb;
if ( (p_filter->output.i_original_channels & AOUT_CHAN_PHYSMASK) if ( (p_filter->fmt_out.audio.i_original_channels & AOUT_CHAN_PHYSMASK)
!= (p_filter->input.i_original_channels & AOUT_CHAN_PHYSMASK) != (p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_PHYSMASK)
&& (p_filter->input.i_original_channels & AOUT_CHAN_PHYSMASK) && (p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_PHYSMASK)
== (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT) ) == (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT) )
{ {
int i; int i;
/* This is a bit special. */ /* This is a bit special. */
if ( !(p_filter->output.i_original_channels & AOUT_CHAN_LEFT) ) if ( !(p_filter->fmt_out.audio.i_original_channels & AOUT_CHAN_LEFT) )
{ {
p_src++; p_src++;
} }
if ( p_filter->output.i_physical_channels == AOUT_CHAN_CENTER ) if ( p_filter->fmt_out.audio.i_physical_channels == AOUT_CHAN_CENTER )
{ {
/* Mono mode */ /* Mono mode */
for ( i = p_in_buf->i_nb_samples; i--; ) for ( i = p_in_buf->i_nb_samples; i--; )
...@@ -155,7 +155,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter, ...@@ -155,7 +155,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
} }
} }
} }
else if ( p_filter->output.i_original_channels else if ( p_filter->fmt_out.audio.i_original_channels
& AOUT_CHAN_REVERSESTEREO ) & AOUT_CHAN_REVERSESTEREO )
{ {
/* Reverse-stereo mode */ /* Reverse-stereo mode */
......
...@@ -116,17 +116,17 @@ static int Open( vlc_object_t *p_this ) ...@@ -116,17 +116,17 @@ static int Open( vlc_object_t *p_this )
aout_filter_t *p_filter = (aout_filter_t*)p_this; aout_filter_t *p_filter = (aout_filter_t*)p_this;
aout_filter_sys_t *p_sys; aout_filter_sys_t *p_sys;
if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) ) if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
{ {
msg_Err( p_filter, "input and output formats are not similar" ); msg_Err( p_filter, "input and output formats are not similar" );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
if( p_filter->input.i_format != VLC_CODEC_FL32 || if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 ||
p_filter->output.i_format != VLC_CODEC_FL32 ) p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
{ {
p_filter->input.i_format = VLC_CODEC_FL32; p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
p_filter->output.i_format = VLC_CODEC_FL32; p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32;
msg_Warn( p_filter, "bad input or output format" ); msg_Warn( p_filter, "bad input or output format" );