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
{
VLC_COMMON_MEMBERS
audio_sample_format_t input;
audio_sample_format_t output;
aout_alloc_t output_alloc;
module_t * p_module;
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_continuity;
......
......@@ -84,22 +84,22 @@ static int Create( vlc_object_t *p_this )
aout_filter_sys_t *p_sys;
/* Validate audio filter format */
if ( p_filter->input.i_physical_channels != (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT)
|| ! ( p_filter->input.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
|| aout_FormatNbChannels( &p_filter->output ) <= 2
|| ( p_filter->input.i_original_channels & ~AOUT_CHAN_DOLBYSTEREO )
!= ( p_filter->output.i_original_channels & ~AOUT_CHAN_DOLBYSTEREO ) )
if ( p_filter->fmt_in.audio.i_physical_channels != (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT)
|| ! ( p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
|| aout_FormatNbChannels( &p_filter->fmt_out.audio ) <= 2
|| ( p_filter->fmt_in.audio.i_original_channels & ~AOUT_CHAN_DOLBYSTEREO )
!= ( p_filter->fmt_out.audio.i_original_channels & ~AOUT_CHAN_DOLBYSTEREO ) )
{
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;
}
if ( p_filter->input.i_format != VLC_CODEC_FL32
|| p_filter->output.i_format != VLC_CODEC_FL32 )
if ( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32
|| p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
{
return VLC_EGENERIC;
}
......@@ -117,7 +117,7 @@ static int Create( vlc_object_t *p_this )
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] )
{
......@@ -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_out = (float*) p_out_buf->p_buffer;
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;
p_out_buf->i_nb_samples = 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 );
......
......@@ -358,7 +358,7 @@ static int Create( vlc_object_t *p_this )
bool b_fit = true;
/* 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) )
{
msg_Dbg( p_filter, "filter discarded (incompatible format)" );
......@@ -366,31 +366,31 @@ static int Create( vlc_object_t *p_this )
}
/* Request a specific format if not already compatible */
if( p_filter->input.i_original_channels
!= p_filter->output.i_original_channels )
if( p_filter->fmt_in.audio.i_original_channels
!= p_filter->fmt_out.audio.i_original_channels )
{
b_fit = false;
p_filter->input.i_original_channels =
p_filter->output.i_original_channels;
p_filter->fmt_in.audio.i_original_channels =
p_filter->fmt_out.audio.i_original_channels;
}
if( p_filter->input.i_format != VLC_CODEC_FL32
|| p_filter->output.i_format != VLC_CODEC_FL32 )
if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32
|| p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
{
b_fit = false;
p_filter->input.i_format = VLC_CODEC_FL32;
p_filter->output.i_format = VLC_CODEC_FL32;
p_filter->fmt_in.audio.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;
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)
&& ( p_filter->input.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
if( p_filter->fmt_in.audio.i_physical_channels == (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT)
&& ( p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
&& ! config_GetInt ( p_filter , "headphone-dolby" ) )
{
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_REARLEFT |
AOUT_CHAN_REARRIGHT;
......@@ -412,9 +412,9 @@ static int Create( vlc_object_t *p_this )
p_sys->p_atomic_operations = NULL;
if( Init( VLC_OBJECT(p_filter), p_sys
, aout_FormatNbChannels ( &p_filter->input )
, p_filter->input.i_physical_channels
, p_filter->input.i_rate ) < 0 )
, aout_FormatNbChannels ( &p_filter->fmt_in.audio )
, p_filter->fmt_in.audio.i_physical_channels
, p_filter->fmt_in.audio.i_rate ) < 0 )
{
free( p_sys );
return VLC_EGENERIC;
......@@ -446,8 +446,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
{
VLC_UNUSED(p_aout);
aout_filter_sys_t *p_sys = p_filter->p_sys;
int i_input_nb = aout_FormatNbChannels( &p_filter->input );
int i_output_nb = aout_FormatNbChannels( &p_filter->output );
int i_input_nb = aout_FormatNbChannels( &p_filter->fmt_in.audio );
int i_output_nb = aout_FormatNbChannels( &p_filter->fmt_out.audio );
float * p_in = (float*) p_in_buf->p_buffer;
uint8_t * p_out;
......@@ -668,10 +668,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
p_out->i_length = p_block->i_length;
aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys;
aout_filter.input = p_filter->fmt_in.audio;
aout_filter.input.i_format = p_filter->fmt_in.i_codec;
aout_filter.output = p_filter->fmt_out.audio;
aout_filter.output.i_format = p_filter->fmt_out.i_codec;
aout_filter.fmt_in.audio = p_filter->fmt_in.audio;
aout_filter.fmt_in.audio.i_format = p_filter->fmt_in.i_codec;
aout_filter.fmt_out.audio = p_filter->fmt_out.audio;
aout_filter.fmt_out.audio.i_format = p_filter->fmt_out.i_codec;
aout_filter.b_in_place = 0;
in_buf.p_buffer = p_block->p_buffer;
......
......@@ -484,10 +484,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
p_out->i_length = p_block->i_length;
aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys;
aout_filter.input = p_filter->fmt_in.audio;
aout_filter.input.i_format = p_filter->fmt_in.i_codec;
aout_filter.output = p_filter->fmt_out.audio;
aout_filter.output.i_format = p_filter->fmt_out.i_codec;
aout_filter.fmt_in.audio = p_filter->fmt_in.audio;
aout_filter.fmt_in.audio.i_format = p_filter->fmt_in.i_codec;
aout_filter.fmt_out.audio = p_filter->fmt_out.audio;
aout_filter.fmt_out.audio.i_format = p_filter->fmt_out.i_codec;
in_buf.p_buffer = p_block->p_buffer;
in_buf.i_buffer = p_block->i_buffer;
......@@ -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;
int i_input_nb = aout_FormatNbChannels( &p_filter->input );
int i_output_nb = aout_FormatNbChannels( &p_filter->output );
int i_input_nb = aout_FormatNbChannels( &p_filter->fmt_in.audio );
int i_output_nb = aout_FormatNbChannels( &p_filter->fmt_out.audio );
int16_t * p_in = (int16_t*) p_in_buf->p_buffer;
uint8_t * p_out;
......
......@@ -85,7 +85,7 @@ static int Create( vlc_object_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;
p_filter->pf_do_work = DoWork;
......@@ -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 )
{
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_5_0 = !b_input_7_0 &&
......@@ -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 &&
(i_input_physical & ~AOUT_CHAN_LFE) == AOUT_CHANS_3_0;
int i_input_nb = aout_FormatNbChannels( &p_filter->input );
int i_output_nb = aout_FormatNbChannels( &p_filter->output );
int i_input_nb = aout_FormatNbChannels( &p_filter->fmt_in.audio );
int i_output_nb = aout_FormatNbChannels( &p_filter->fmt_out.audio );
float *p_dest = (float *)p_out_buf->p_buffer;
const float *p_src = (const float *)p_in_buf->p_buffer;
int i;
......@@ -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_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 )
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,
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 )
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,
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 )
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,
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)
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,
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 )
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,
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 )
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,
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 )
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,
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
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,
}
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 );
if( b_input_7_0 )
......@@ -229,7 +229,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
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
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,
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 )
p_out->i_length = p_block->i_length;
aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys;
aout_filter.input = p_filter->fmt_in.audio;
aout_filter.input.i_format = p_filter->fmt_in.i_codec;
aout_filter.output = p_filter->fmt_out.audio;
aout_filter.output.i_format = p_filter->fmt_out.i_codec;
aout_filter.fmt_in.audio = p_filter->fmt_in.audio;
aout_filter.fmt_in.audio.i_format = p_filter->fmt_in.i_codec;
aout_filter.fmt_out.audio = p_filter->fmt_out.audio;
aout_filter.fmt_out.audio.i_format = p_filter->fmt_out.i_codec;
in_buf.p_buffer = p_block->p_buffer;
in_buf.i_buffer = p_block->i_buffer;
......
......@@ -59,21 +59,21 @@ static int Create( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
if ( (p_filter->input.i_physical_channels
== p_filter->output.i_physical_channels
&& p_filter->input.i_original_channels
== p_filter->output.i_original_channels)
|| p_filter->input.i_format != p_filter->output.i_format
|| p_filter->input.i_rate != p_filter->output.i_rate
|| (p_filter->input.i_format != VLC_CODEC_FL32
&& p_filter->input.i_format != VLC_CODEC_FI32) )
if ( (p_filter->fmt_in.audio.i_physical_channels
== p_filter->fmt_out.audio.i_physical_channels
&& p_filter->fmt_in.audio.i_original_channels
== p_filter->fmt_out.audio.i_original_channels)
|| p_filter->fmt_in.audio.i_format != p_filter->fmt_out.audio.i_format
|| p_filter->fmt_in.audio.i_rate != p_filter->fmt_out.audio.i_rate
|| (p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32
&& p_filter->fmt_in.audio.i_format != VLC_CODEC_FI32) )
{
return -1;
}
p_filter->pf_do_work = DoWork;
if ( aout_FormatNbChannels( &p_filter->input )
> aout_FormatNbChannels( &p_filter->output ) )
if ( aout_FormatNbChannels( &p_filter->fmt_in.audio )
> aout_FormatNbChannels( &p_filter->fmt_out.audio ) )
{
/* Downmixing */
p_filter->b_in_place = 1;
......@@ -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 )
{
VLC_UNUSED(p_aout);
int i_input_nb = aout_FormatNbChannels( &p_filter->input );
int i_output_nb = aout_FormatNbChannels( &p_filter->output );
int i_input_nb = aout_FormatNbChannels( &p_filter->fmt_in.audio );
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_src = (int32_t *)p_in_buf->p_buffer;
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;
if ( (p_filter->output.i_original_channels & AOUT_CHAN_PHYSMASK)
!= (p_filter->input.i_original_channels & AOUT_CHAN_PHYSMASK)
&& (p_filter->input.i_original_channels & AOUT_CHAN_PHYSMASK)
if ( (p_filter->fmt_out.audio.i_original_channels & AOUT_CHAN_PHYSMASK)
!= (p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_PHYSMASK)
&& (p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_PHYSMASK)
== (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT) )
{
int i;
/* 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++;
}
if ( p_filter->output.i_physical_channels == AOUT_CHAN_CENTER )
if ( p_filter->fmt_out.audio.i_physical_channels == AOUT_CHAN_CENTER )
{
/* Mono mode */
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,
}
}
}
else if ( p_filter->output.i_original_channels
else if ( p_filter->fmt_out.audio.i_original_channels
& AOUT_CHAN_REVERSESTEREO )
{
/* Reverse-stereo mode */
......
......@@ -116,17 +116,17 @@ static int Open( vlc_object_t *p_this )
aout_filter_t *p_filter = (aout_filter_t*)p_this;
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" );
return VLC_EGENERIC;
}
if( p_filter->input.i_format != VLC_CODEC_FL32 ||
p_filter->output.i_format != VLC_CODEC_FL32 )
if( p_filter->fmt_in.audio.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->output.i_format = VLC_CODEC_FL32;
p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32;
msg_Warn( p_filter, "bad input or output format" );
}
......@@ -137,7 +137,7 @@ static int Open( vlc_object_t *p_this )
if( !p_sys )
return VLC_ENOMEM;
p_sys->i_channels = aout_FormatNbChannels( &p_filter->input );
p_sys->i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio );
p_sys->f_delayTime = var_CreateGetFloat( p_this, "delay-time" );
p_sys->f_sweepDepth = var_CreateGetFloat( p_this, "sweep-depth" );
p_sys->f_sweepRate = var_CreateGetFloat( p_this, "sweep-rate" );
......@@ -168,12 +168,12 @@ static int Open( vlc_object_t *p_this )
/* Max delay = delay + depth. Min = delay - depth */
p_sys->i_bufferLength = p_sys->i_channels * ( (int)( ( p_sys->f_delayTime
+ p_sys->f_sweepDepth ) * p_filter->input.i_rate/1000 ) + 1 );
+ p_sys->f_sweepDepth ) * p_filter->fmt_in.audio.i_rate/1000 ) + 1 );
msg_Dbg( p_filter , "Buffer length:%d, Channels:%d, Sweep Depth:%f, Delay "
"time:%f, Sweep Rate:%f, Sample Rate: %d", p_sys->i_bufferLength,
p_sys->i_channels, p_sys->f_sweepDepth, p_sys->f_delayTime,
p_sys->f_sweepRate, p_filter->input.i_rate );
p_sys->f_sweepRate, p_filter->fmt_in.audio.i_rate );
if( p_sys->i_bufferLength <= 0 )
{
msg_Err( p_filter, "Delay-time, Sampl rate or Channels was incorrect" );
......@@ -199,14 +199,14 @@ static int Open( vlc_object_t *p_this )
p_sys->pf_write = p_sys->pf_delayLineStart;
if( p_sys->f_sweepDepth < small_value() ||
p_filter->input.i_rate < small_value() ) {
p_filter->fmt_in.audio.i_rate < small_value() ) {
p_sys->f_sinMultiplier = 0.0;
}
else {
p_sys->f_sinMultiplier = 11 * p_sys->f_sweepRate /
( 7 * p_sys->f_sweepDepth * p_filter->input.i_rate ) ;
( 7 * p_sys->f_sweepDepth * p_filter->fmt_in.audio.i_rate ) ;
}
p_sys->i_sampleRate = p_filter->input.i_rate;
p_sys->i_sampleRate = p_filter->fmt_in.audio.i_rate;
return VLC_SUCCESS;
}
......
......@@ -122,17 +122,17 @@ static int Create( vlc_object_t *p_this )
filter_sys_t *p_sys;
int i_ret;
if ( p_filter->input.i_format != VLC_CODEC_A52
if ( p_filter->fmt_in.audio.i_format != VLC_CODEC_A52
#ifdef LIBA52_FIXED
|| p_filter->output.i_format != VLC_CODEC_FI32 )
|| p_filter->fmt_out.audio.i_format != VLC_CODEC_FI32 )
#else
|| p_filter->output.i_format != VLC_CODEC_FL32 )
|| p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
#endif
{
return -1;
}
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 -1;
}
......@@ -144,7 +144,7 @@ static int Create( vlc_object_t *p_this )
return -1;
i_ret = Open( VLC_OBJECT(p_filter), p_sys,
p_filter->input, p_filter->output );
p_filter->fmt_in.audio, p_filter->fmt_out.audio );
p_filter->pf_do_work = DoWork;
p_filter->b_in_place = 0;
......@@ -371,13 +371,13 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
if ( ((p_sys->i_flags & A52_CHANNEL_MASK) == A52_CHANNEL1
|| (p_sys->i_flags & A52_CHANNEL_MASK) == A52_CHANNEL2
|| (p_sys->i_flags & A52_CHANNEL_MASK) == A52_MONO)
&& (p_filter->output.i_physical_channels
&& (p_filter->fmt_out.audio.i_physical_channels
& (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT)) )
{
Duplicate( (sample_t *)(p_out_buf->p_buffer + i * i_bytes_per_block),
p_samples );
}
else if ( p_filter->output.i_original_channels
else if ( p_filter->fmt_out.audio.i_original_channels
& AOUT_CHAN_REVERSESTEREO )
{
Exchange( (sample_t *)(p_out_buf->p_buffer + i * i_bytes_per_block),
......@@ -488,10 +488,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
p_out->i_length = p_block->i_length;
aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys;
aout_filter.input = p_filter->fmt_in.audio;
aout_filter.input.i_format = p_filter->fmt_in.i_codec;
aout_filter.output = p_filter->fmt_out.audio;
aout_filter.output.i_format = p_filter->fmt_out.i_codec;
aout_filter.fmt_in.audio = p_filter->fmt_in.audio;
aout_filter.fmt_in.audio.i_format = p_filter->fmt_in.i_codec;
aout_filter.fmt_out.audio = p_filter->fmt_out.audio;
aout_filter.fmt_out.audio.i_format = p_filter->fmt_out.i_codec;
in_buf.p_buffer = p_block->p_buffer;
in_buf.i_buffer = p_block->i_buffer;
......
......@@ -64,9 +64,9 @@ static int Create( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
if ( p_filter->input.i_format != VLC_CODEC_A52 ||
( p_filter->output.i_format != VLC_CODEC_SPDIFB &&
p_filter->output.i_format != VLC_CODEC_SPDIFL ) )
if ( p_filter->fmt_in.audio.i_format != VLC_CODEC_A52 ||
( p_filter->fmt_out.audio.i_format != VLC_CODEC_SPDIFB &&
p_filter->fmt_out.audio.i_format != VLC_CODEC_SPDIFL ) )
{
return -1;
}
......@@ -95,7 +95,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
uint8_t * p_out = p_out_buf->p_buffer;
/* Copy the S/PDIF headers. */
if( p_filter->output.i_format == VLC_CODEC_SPDIFB )
if( p_filter->fmt_out.audio.i_format == VLC_CODEC_SPDIFB )
{
vlc_memcpy( p_out, p_sync_be, 6 );
p_out[4] = p_in[5] & 0x7; /* bsmod */
......
......@@ -112,13 +112,13 @@ static int Create( vlc_object_t *p_this )
filter_sys_t *p_sys;
int i_ret;
if ( p_filter->input.i_format != VLC_CODEC_DTS
|| p_filter->output.i_format != VLC_CODEC_FL32 )
if ( p_filter->fmt_in.audio.i_format != VLC_CODEC_DTS
|| p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
{
return -1;
}
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 -1;
}
......@@ -130,7 +130,7 @@ static int Create( vlc_object_t *p_this )
return -1;
i_ret = Open( VLC_OBJECT(p_filter), p_sys,
p_filter->input, p_filter->output );
p_filter->fmt_in.audio, p_filter->fmt_out.audio );
p_filter->pf_do_work = DoWork;
p_filter->b_in_place = 0;
......@@ -340,13 +340,13 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_samples = dca_samples( p_sys->p_libdca );
if ( (p_sys->i_flags & DCA_CHANNEL_MASK) == DCA_MONO
&& (p_filter->output.i_physical_channels
&& (p_filter->fmt_out.audio.i_physical_channels
& (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT)) )
{
Duplicate( (float *)(p_out_buf->p_buffer + i * i_bytes_per_block),
p_samples );
}
else if ( p_filter->output.i_original_channels
else if ( p_filter->fmt_out.audio.i_original_channels
& AOUT_CHAN_REVERSESTEREO )
{
Exchange( (float *)(p_out_buf->p_buffer + i * i_bytes_per_block),
......@@ -453,10 +453,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
p_out->i_length = p_block->i_length;
aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys;
aout_filter.input = p_filter->fmt_in.audio;
aout_filter.input.i_format = p_filter->fmt_in.i_codec;
aout_filter.output = p_filter->fmt_out.audio;
aout_filter.output.i_format = p_filter->fmt_out.i_codec;
aout_filter.fmt_in.audio = p_filter->fmt_in.audio;
aout_filter.fmt_in.audio.i_format = p_filter->fmt_in.i_codec;
aout_filter.fmt_out.audio = p_filter->fmt_out.audio;
aout_filter.fmt_out.audio.i_format = p_filter->fmt_out.i_codec;
in_buf.p_buffer = p_block->p_buffer;
in_buf.i_buffer = p_block->i_buffer;
......
......@@ -81,9 +81,9 @@ static int Create( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
if( p_filter->input.i_format != VLC_CODEC_DTS ||
( p_filter->output.i_format != VLC_CODEC_SPDIFL &&
p_filter->output.i_format != VLC_CODEC_SPDIFB ) )
if( p_filter->fmt_in.audio.i_format != VLC_CODEC_DTS ||
( p_filter->fmt_out.audio.i_format != VLC_CODEC_SPDIFL &&
p_filter->fmt_out.audio.i_format != VLC_CODEC_SPDIFB ) )
{
return -1;
}
......@@ -170,7 +170,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
}
/* Copy the S/PDIF headers. */
if( p_filter->output.i_format == VLC_CODEC_SPDIFB )
if( p_filter->fmt_out.audio.i_format == VLC_CODEC_SPDIFB )
{
vlc_memcpy( p_out, p_sync_be, 6 );
p_out[5] = i_ac5_spdif_type;
......@@ -185,8 +185,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out[7] = (( i_length ) >> 5 ) & 0xFF;
}
if( ( (p_in[0] == 0x1F || p_in[0] == 0x7F) && p_filter->output.i_format == VLC_CODEC_SPDIFL ) ||
( (p_in[0] == 0xFF || p_in[0] == 0xFE) && p_filter->output.i_format == VLC_CODEC_SPDIFB ) )
if( ( (p_in[0] == 0x1F || p_in[0] == 0x7F) && p_filter->fmt_out.audio.i_format == VLC_CODEC_SPDIFL ) ||
( (p_in[0] == 0xFF || p_in[0] == 0xFE) && p_filter->fmt_out.audio.i_format == VLC_CODEC_SPDIFB ) )
{
/* We are dealing with a big endian bitstream and a little endian output
* or a little endian bitstream and a big endian output.
......
......@@ -73,13 +73,13 @@ static int Create_F32ToS16( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
if ( p_filter->input.i_format != VLC_CODEC_FI32
|| p_filter->output.i_format != VLC_CODEC_S16N )
if ( p_filter->fmt_in.audio.i_format != VLC_CODEC_FI32
|| p_filter->fmt_out.audio.i_format != VLC_CODEC_S16N )
{
return -1;
}
if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
{
return -1;
}
......@@ -140,7 +140,7 @@ static void Do_F32ToS16( aout_instance_t * p_aout, aout_filter_t * p_filter,
int16_t * p_out = (int16_t *)p_out_buf->p_buffer;
for ( i = p_in_buf->i_nb_samples
* aout_FormatNbChannels( &p_filter->input ) ; i-- ; )
* aout_FormatNbChannels( &p_filter->fmt_in.audio ) ; i-- ; )
{
/* Fast Scaling */
*p_out++ = s24_to_s16_pcm(*p_in++);
......@@ -157,13 +157,13 @@ static int Create_S16ToF32( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
if ( p_filter->output.i_format != VLC_CODEC_FI32
|| p_filter->input.i_format != VLC_CODEC_S16N )
if ( p_filter->fmt_out.audio.i_format != VLC_CODEC_FI32
|| p_filter->fmt_in.audio.i_format != VLC_CODEC_S16N )
{
return -1;
}
if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
{
return -1;
}
......@@ -178,7 +178,7 @@ static void Do_S16ToF32( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
{
VLC_UNUSED(p_aout);
int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->fmt_in.audio );
/* We start from the end because b_in_place is true */
int16_t * p_in = (int16_t *)p_in_buf->p_buffer + i - 1;
......@@ -203,13 +203,13 @@ static int Create_U8ToF32( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
if ( p_filter->input.i_format != VLC_CODEC_U8
|| p_filter->output.i_format != VLC_CODEC_FI32 )
if ( p_filter->fmt_in.audio.i_format != VLC_CODEC_U8
|| p_filter->fmt_out.audio.i_format != VLC_CODEC_FI32 )
{
return -1;
}
if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
{
return -1;
}
......@@ -224,7 +224,7 @@ static void Do_U8ToF32( aout_instance_t * p_aout, aout_filter_t * p_filter,
aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
{
VLC_UNUSED(p_aout);
int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->fmt_in.audio );
/* We start from the end because b_in_place is true */
uint8_t * p_in = (uint8_t *)p_in_buf->p_buffer + i - 1;
......
This diff is collapsed.
......@@ -88,15 +88,15 @@ static int Create( vlc_object_t *p_this )
aout_filter_t *p_filter = (aout_filter_t *)p_this;
struct filter_sys_t *p_sys;
if ( (p_filter->input.i_format != VLC_CODEC_MPGA
&& p_filter->input.i_format != VLC_FOURCC('m','p','g','3'))
|| (p_filter->output.i_format != VLC_CODEC_FL32
&& p_filter->output.i_format != VLC_CODEC_FI32) )
if ( (p_filter->fmt_in.audio.i_format != VLC_CODEC_MPGA
&& p_filter->fmt_in.audio.i_format != VLC_FOURCC('m','p','g','3'))
|| (p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32
&& p_filter->fmt_out.audio.i_format != VLC_CODEC_FI32) )
{
return -1;
}
if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
{
return -1;
}
......@@ -130,7 +130,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_buffer = p_in_buf->i_nb_samples * sizeof(vlc_fixed_t) *
aout_FormatNbChannels( &p_filter->output );
aout_FormatNbChannels( &p_filter->fmt_out.audio );
/* Do the actual decoding now. */
mad_stream_buffer( &p_sys->mad_stream, p_in_buf->p_buffer,
......@@ -148,7 +148,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
if( p_sys->i_reject_count > 0 )
{
if( p_filter->output.i_format == VLC_CODEC_FL32 )
if( p_filter->fmt_out.audio.i_format == VLC_CODEC_FL32 )
{
int i;
int i_size = p_out_buf->i_buffer / sizeof(float);
......@@ -168,7 +168,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
mad_synth_frame( &p_sys->mad_synth, &p_sys->mad_frame );
if ( p_filter->output.i_format == VLC_CODEC_FI32 )
if ( p_filter->fmt_out.audio.i_format == VLC_CODEC_FI32 )
{
/* Interleave and keep buffers in mad_fixed_t format */
mad_fixed_t * p_samples = (mad_fixed_t *)p_out_buf->p_buffer;
......@@ -180,14 +180,14 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
switch ( p_pcm->channels )
{
case 2:
if ( p_filter->output.i_physical_channels == AOUT_CHAN_CENTER )
if ( p_filter->fmt_out.audio.i_physical_channels == AOUT_CHAN_CENTER )
{
while ( i_samples-- )
{
*p_samples++ = (*p_left++ >> 1) + (*p_right++ >> 1);
}
}
else if ( p_filter->output.i_original_channels == AOUT_CHAN_LEFT )
else if ( p_filter->fmt_out.audio.i_original_channels == AOUT_CHAN_LEFT )
{
while ( i_samples-- )
{
......@@ -195,7 +195,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
*p_samples++ = *p_left++;
}
}
else if ( p_filter->output.i_original_channels == AOUT_CHAN_RIGHT )
else if ( p_filter->fmt_out.audio.i_original_channels == AOUT_CHAN_RIGHT )
{
while ( i_samples-- )
{
......@@ -235,7 +235,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
switch ( p_pcm->channels )
{
case 2:
if ( p_filter->output.i_physical_channels == AOUT_CHAN_CENTER )
if ( p_filter->fmt_out.audio.i_physical_channels == AOUT_CHAN_CENTER )
{
while ( i_samples-- )
{
......@@ -243,7 +243,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
(float)*p_right++ / f_temp / 2;
}
}
else if ( p_filter->output.i_original_channels == AOUT_CHAN_LEFT )
else if ( p_filter->fmt_out.audio.i_original_channels == AOUT_CHAN_LEFT )
{
while ( i_samples-- )
{
......@@ -251,7 +251,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
*p_samples++ = (float)*p_left++ / f_temp;
}
}
else if ( p_filter->output.i_original_channels == AOUT_CHAN_RIGHT )
else if ( p_filter->fmt_out.audio.i_original_channels == AOUT_CHAN_RIGHT )
{
while ( i_samples-- )
{
......@@ -389,10 +389,10 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
p_out->i_length = p_block->i_length;
aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys;
aout_filter.input = p_filter->fmt_in.audio;
aout_filter.input.i_format = p_filter->fmt_in.i_codec;
aout_filter.output = p_filter->fmt_out.audio;
aout_filter.output.i_format = p_filter->fmt_out.i_codec;
aout_filter.fmt_in.audio = p_filter->fmt_in.audio;
aout_filter.fmt_in.audio.i_format = p_filter->fmt_in.i_codec;
aout_filter.fmt_out.audio = p_filter->fmt_out.audio;
aout_filter.fmt_out.audio.i_format = p_filter->fmt_out.i_codec;
in_buf.p_buffer = p_block->p_buffer;
in_buf.i_flags = 0;
......
......@@ -45,13 +45,13 @@ static int Open (vlc_object_t *obj)
{
aout_filter_t *filter = (aout_filter_t *)obj;
if (!AOUT_FMTS_SIMILAR (&filter->input, &filter->output))
if (!AOUT_FMTS_SIMILAR (&filter->fmt_in.audio, &filter->fmt_out.audio))
return VLC_EGENERIC;
switch (filter->input.i_format)
switch (filter->fmt_in.audio.i_format)
{
case VLC_CODEC_FL32:
switch (filter->output.i_format)
switch (filter->fmt_out.audio.i_format)
{
case VLC_CODEC_FI32:
filter->pf_do_work = Do_F32_S32;
......@@ -62,7 +62,7 @@ static int Open (vlc_object_t *obj)
break;
case VLC_CODEC_FI32:
switch (filter->output.i_format)
switch (filter->fmt_out.audio.i_format)
{
case VLC_CODEC_S16N:
filter->pf_do_work = Do_S32_S16;
......@@ -86,7 +86,7 @@ static void Do_F32_S32 (aout_instance_t *aout, aout_filter_t *filter,
aout_buffer_t *inbuf, aout_buffer_t *outbuf)
{
unsigned nb_samples = inbuf->i_nb_samples
* aout_FormatNbChannels (&filter->input);
* aout_FormatNbChannels (&filter->fmt_in.audio);
const float *inp = (float *)inbuf->p_buffer;
const float *endp = inp + nb_samples;
int32_t *outp = (int32_t *)outbuf->p_buffer;
......@@ -144,7 +144,7 @@ static void Do_S32_S16 (aout_instance_t *aout, aout_filter_t *filter,
aout_buffer_t *inbuf, aout_buffer_t *outbuf)
{
unsigned nb_samples = inbuf->i_nb_samples
* aout_FormatNbChannels (&filter->input);
* aout_FormatNbChannels (&filter->fmt_in.audio);
int32_t *inp = (int32_t *)inbuf->p_buffer;
const int32_t *endp = inp + nb_samples;
int16_t *outp = (int16_t *)outbuf->p_buffer;
......
......@@ -150,18 +150,18 @@ static int Open( vlc_object_t *p_this )
aout_filter_sys_t *p_sys;
bool b_fit = true;
if( p_filter->input.i_format != VLC_CODEC_FL32 ||
p_filter->output.i_format != VLC_CODEC_FL32 )
if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 ||
p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
{
b_fit = false;
p_filter->input.i_format = VLC_CODEC_FL32;
p_filter->output.i_format = VLC_CODEC_FL32;
p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32;
msg_Warn( p_filter, "bad input or output format" );
}
if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
{
b_fit = false;
memcpy( &p_filter->output, &p_filter->input,
memcpy( &p_filter->fmt_out.audio, &p_filter->fmt_in.audio,
sizeof(audio_sample_format_t) );
msg_Warn( p_filter, "input and output formats are not similar" );
}
......@@ -180,7 +180,7 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM;
vlc_mutex_init( &p_sys->lock );
if( EqzInit( p_filter, p_filter->input.i_rate ) != VLC_SUCCESS )
if( EqzInit( p_filter, p_filter->fmt_in.audio.i_rate ) != VLC_SUCCESS )
{
vlc_mutex_destroy( &p_sys->lock );
free( p_sys );
......@@ -217,7 +217,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
EqzFilter( p_filter, (float*)p_out_buf->p_buffer,
(float*)p_in_buf->p_buffer, p_in_buf->i_nb_samples,
aout_FormatNbChannels( &p_filter->input ) );
aout_FormatNbChannels( &p_filter->fmt_in.audio ) );
}
/*****************************************************************************
......
......@@ -103,19 +103,19 @@ static int Open( vlc_object_t *p_this )
int i_channels;
aout_filter_sys_t *p_sys;
if( p_filter->input.i_format != VLC_CODEC_FL32 ||
p_filter->output.i_format != VLC_CODEC_FL32 )
if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 ||
p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
{
b_fit = false;
p_filter->input.i_format = VLC_CODEC_FL32;
p_filter->output.i_format = VLC_CODEC_FL32;
p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32;
msg_Warn( p_filter, "bad input or output format" );
}
if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
{
b_fit = false;
memcpy( &p_filter->output, &p_filter->input,
memcpy( &p_filter->fmt_out.audio, &p_filter->fmt_in.audio,
sizeof(audio_sample_format_t) );
msg_Warn( p_filter, "input and output formats are not similar" );
}
......@@ -128,7 +128,7 @@ static int Open( vlc_object_t *p_this )
p_filter->pf_do_work = DoWork;
p_filter->b_in_place = true;
i_channels = aout_FormatNbChannels( &p_filter->input );
i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio );
p_sys = p_filter->p_sys = malloc( sizeof( aout_filter_sys_t ) );
if( !p_sys )
......@@ -161,7 +161,7 @@ static int Open( vlc_object_t *p_this )
int i, i_chan;
int i_samples = p_in_buf->i_nb_samples;
int i_channels = aout_FormatNbChannels( &p_filter->input );
int i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio );
float *p_out = (float*)p_out_buf->p_buffer;
float *p_in = (float*)p_in_buf->p_buffer;
......
......@@ -111,18 +111,18 @@ static int Open( vlc_object_t *p_this )
bool b_fit = true;
int i_samplerate;
if( p_filter->input.i_format != VLC_CODEC_FL32 ||
p_filter->output.i_format != VLC_CODEC_FL32 )
if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 ||
p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
{
b_fit = false;
p_filter->input.i_format = VLC_CODEC_FL32;
p_filter->output.i_format = VLC_CODEC_FL32;
p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32;
msg_Warn( p_filter, "bad input or output format" );
}
if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
{
b_fit = false;
memcpy( &p_filter->output, &p_filter->input,
memcpy( &p_filter->fmt_out.audio, &p_filter->fmt_in.audio,
sizeof(audio_sample_format_t) );
msg_Warn( p_filter, "input and output formats are not similar" );
}
......@@ -156,7 +156,7 @@ static int Open( vlc_object_t *p_this )
p_sys->f_gain3 = config_GetFloat( p_this, "param-eq-gain3");
i_samplerate = p_filter->input.i_rate;
i_samplerate = p_filter->fmt_in.audio.i_rate;
CalcPeakEQCoeffs(p_sys->f_f1, p_sys->f_Q1, p_sys->f_gain1,
i_samplerate, p_sys->coeffs+0*5);
CalcPeakEQCoeffs(p_sys->f_f2, p_sys->f_Q2, p_sys->f_gain2,
......@@ -167,7 +167,7 @@ static int Open( vlc_object_t *p_this )
i_samplerate, p_sys->coeffs+3*5);
CalcShelfEQCoeffs(p_sys->f_highf, 1, p_sys->f_highgain, 0,
i_samplerate, p_sys->coeffs+4*5);
p_sys->p_state = (float*)calloc( p_filter->input.i_channels*5*4,
p_sys->p_state = (float*)calloc( p_filter->fmt_in.audio.i_channels*5*4,
sizeof(float) );
return VLC_SUCCESS;
......@@ -194,7 +194,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
ProcessEQ( (float*)p_in_buf->p_buffer, (float*)p_out_buf->p_buffer,
p_filter->p_sys->p_state,
p_filter->input.i_channels, p_in_buf->i_nb_samples,
p_filter->fmt_in.audio.i_channels, p_in_buf->i_nb_samples,
p_filter->p_sys->coeffs, 5 );
}
......
......@@ -84,13 +84,13 @@ static int Create( vlc_object_t *p_this )
aout_filter_t * p_filter = (aout_filter_t *)p_this;
struct filter_sys_t * p_sys;
if ( p_filter->input.i_rate == p_filter->output.i_rate
|| p_filter->input.i_format != p_filter->output.i_format
|| p_filter->input.i_physical_channels
!= p_filter->output.i_physical_channels
|| p_filter->input.i_original_channels
!= p_filter->output.i_original_channels
|| p_filter->input.i_format != VLC_CODEC_FL32 )
if ( p_filter->fmt_in.audio.i_rate == p_filter->fmt_out.audio.i_rate
|| p_filter->fmt_in.audio.i_format != p_filter->fmt_out.audio.i_format
|| p_filter->fmt_in.audio.i_physical_channels
!= p_filter->fmt_out.audio.i_physical_channels
|| p_filter->fmt_in.audio.i_original_channels
!= p_filter->fmt_out.audio.i_original_channels
|| p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 )
{
return VLC_EGENERIC;
}
......@@ -101,13 +101,13 @@ static int Create( vlc_object_t *p_this )
if( p_sys == NULL )
return VLC_ENOMEM;
p_sys->p_prev_sample = malloc(
p_filter->input.i_channels * sizeof(int32_t) );
p_filter->fmt_in.audio.i_channels * sizeof(int32_t) );
if( p_sys->p_prev_sample == NULL )
{
free( p_sys );
return VLC_ENOMEM;
}
date_Init( &p_sys->end_date, p_filter->output.i_rate, 1 );
date_Init( &p_sys->end_date, p_filter->fmt_out.audio.i_rate, 1 );
p_filter->pf_do_work = DoWork;
......@@ -140,12 +140,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
float *p_out = (float *)p_out_buf->p_buffer;
float *p_prev_sample = (float *)p_sys->p_prev_sample;
int i_nb_channels = p_filter->input.i_channels;
int i_nb_channels = p_filter->fmt_in.audio.i_channels;
int i_in_nb = p_in_buf->i_nb_samples;
int i_chan, i_in, i_out = 0;
/* Check if we really need to run the resampler */
if( p_aout->mixer_format.i_rate == p_filter->input.i_rate )
if( p_aout->mixer_format.i_rate == p_filter->fmt_in.audio.i_rate )
{
#if 0 /* FIXME: needs audio filter2 for block_Realloc */
if( p_filter->b_continuity )
......@@ -172,11 +172,11 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
{
p_filter->b_continuity = true;
p_sys->i_remainder = 0;
date_Init( &p_sys->end_date, p_filter->output.i_rate, 1 );
date_Init( &p_sys->end_date, p_filter->fmt_out.audio.i_rate, 1 );
}
else
{
while( p_sys->i_remainder < p_filter->output.i_rate )
while( p_sys->i_remainder < p_filter->fmt_out.audio.i_rate )
{
for( i_chan = i_nb_channels ; i_chan ; )
{
......@@ -184,20 +184,20 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out[i_chan] = p_prev_sample[i_chan];
p_out[i_chan] += ( ( p_in[i_chan] - p_prev_sample[i_chan] )
* p_sys->i_remainder
/ p_filter->output.i_rate );
/ p_filter->fmt_out.audio.i_rate );
}
p_out += i_nb_channels;
i_out++;
p_sys->i_remainder += p_filter->input.i_rate;
p_sys->i_remainder += p_filter->fmt_in.audio.i_rate;
}
p_sys->i_remainder -= p_filter->output.i_rate;
p_sys->i_remainder -= p_filter->fmt_out.audio.i_rate;
}
/* Take care of the current input samples (minus last one) */
for( i_in = 0; i_in < i_in_nb - 1; i_in++ )
{
while( p_sys->i_remainder < p_filter->output.i_rate )
while( p_sys->i_remainder < p_filter->fmt_out.audio.i_rate )
{
for( i_chan = i_nb_channels ; i_chan ; )
{
......@@ -205,16 +205,16 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out[i_chan] = p_in[i_chan];
p_out[i_chan] += ( ( p_in[i_chan + i_nb_channels]
- p_in[i_chan] )
* p_sys->i_remainder / p_filter->output.i_rate );
* p_sys->i_remainder / p_filter->fmt_out.audio.i_rate );
}
p_out += i_nb_channels;
i_out++;
p_sys->i_remainder += p_filter->input.i_rate;
p_sys->i_remainder += p_filter->fmt_in.audio.i_rate;
}
p_in += i_nb_channels;
p_sys->i_remainder -= p_filter->output.i_rate;
p_sys->i_remainder -= p_filter->fmt_out.audio.i_rate;
}
/* Backup the last input sample for next time */
......@@ -333,8 +333,8 @@ static block_t *Resample( filter_t *p_filter, block_t *p_block )
p_out->i_length = p_block->i_length;
aout_filter.p_sys = (struct aout_filter_sys_t *)p_filter->p_sys;
aout_filter.input = p_filter->fmt_in.audio;
aout_filter.output = p_filter->fmt_out.audio;
aout_filter.fmt_in.audio = p_filter->fmt_in.audio;
aout_filter.fmt_out.audio = p_filter->fmt_out.audio;
aout_filter.b_continuity = false;
in_buf.p_buffer = p_block->p_buffer;
......
......@@ -59,14 +59,14 @@ static int Create( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
if ( p_filter->input.i_rate == p_filter->output.i_rate
|| p_filter->input.i_format != p_filter->output.i_format
|| p_filter->input.i_physical_channels
!= p_filter->output.i_physical_channels
|| p_filter->input.i_original_channels
!= p_filter->output.i_original_channels
|| (p_filter->input.i_format != VLC_CODEC_FL32
&& p_filter->input.i_format != VLC_CODEC_FI32) )
if ( p_filter->fmt_in.audio.i_rate == p_filter->fmt_out.audio.i_rate
|| p_filter->fmt_in.audio.i_format != p_filter->fmt_out.audio.i_format
|| p_filter->fmt_in.audio.i_physical_channels
!= p_filter->fmt_out.audio.i_physical_channels
|| p_filter->fmt_in.audio.i_original_channels
!= p_filter->fmt_out.audio.i_original_channels
|| (p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32
&& p_filter->fmt_in.audio.i_format != VLC_CODEC_FI32) )
{
return -1;
}
......@@ -84,13 +84,13 @@ 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 )
{
int i_in_nb = p_in_buf->i_nb_samples;
int i_out_nb = i_in_nb * p_filter->output.i_rate
/ p_filter->input.i_rate;
int i_sample_bytes = aout_FormatNbChannels( &p_filter->input )
int i_out_nb = i_in_nb * p_filter->fmt_out.audio.i_rate
/ p_filter->fmt_in.audio.i_rate;
int i_sample_bytes = aout_FormatNbChannels( &p_filter->fmt_in.audio )
* sizeof(int32_t);
/* Check if we really need to run the resampler */
if( p_aout->mixer_format.i_rate == p_filter->input.i_rate )
if( p_aout->mixer_format.i_rate == p_filter->fmt_in.audio.i_rate )
{
return;
}
......@@ -114,5 +114,5 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out_buf->i_buffer = i_out_nb * i_sample_bytes;
p_out_buf->i_pts = p_in_buf->i_pts;
p_out_buf->i_length = p_out_buf->i_nb_samples *
1000000 / p_filter->output.i_rate;
1000000 / p_filter->fmt_out.audio.i_rate;
}
......@@ -59,14 +59,14 @@ static int Create( vlc_object_t *p_this )
{
aout_filter_t * p_filter = (aout_filter_t *)p_this;
if ( p_filter->input.i_rate == p_filter->output.i_rate
|| p_filter->input.i_format != p_filter->output.i_format
|| p_filter->input.i_physical_channels
!= p_filter->output.i_physical_channels
|| p_filter->input.i_original_channels
!= p_filter->output.i_original_channels
|| (p_filter->input.i_format != VLC_CODEC_FL32
&& p_filter->input.i_format != VLC_CODEC_FI32) )
if ( p_filter->fmt_in.audio.i_rate == p_filter->fmt_out.audio.i_rate
|| p_filter->fmt_in.audio.i_format != p_filter->fmt_out.audio.i_format
|| p_filter->fmt_in.audio.i_physical_channels
!= p_filter->fmt_out.audio.i_physical_channels
|| p_filter->fmt_in.audio.i_original_channels
!= p_filter->fmt_out.audio.i_original_channels
|| (p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32
&& p_filter->fmt_in.audio.i_format != VLC_CODEC_FI32) )
{
return VLC_EGENERIC;
}
......@@ -88,15 +88,15 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
{
int32_t *p_out = (int32_t*)p_out_buf->p_buffer;
unsigned int i_nb_channels = aout_FormatNbChannels( &p_filter->input );
unsigned int i_nb_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio );
unsigned int i_in_nb = p_in_buf->i_nb_samples;
unsigned int i_out_nb = i_in_nb * p_filter->output.i_rate
/ p_filter->input.i_rate;
unsigned int i_out_nb = i_in_nb * p_filter->fmt_out.audio.i_rate
/ p_filter->fmt_in.audio.i_rate;
unsigned int i_sample_bytes = i_nb_channels * sizeof(int32_t);
unsigned int i_out, i_chan, i_remainder = 0;
/* Check if we really need to run the resampler */
if( p_aout->mixer_format.i_rate == p_filter->input.i_rate )
if( p_aout->mixer_format.i_rate == p_filter->fmt_in.audio.i_rate )
{
return;
}
......@@ -115,11 +115,11 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
}
p_out += i_nb_channels;
i_remainder += p_filter->input.i_rate;
while( i_remainder >= p_filter->output.i_rate )
i_remainder += p_filter->fmt_in.audio.i_rate;
while( i_remainder >= p_filter->fmt_out.audio.i_rate )
{
p_in += i_nb_channels;
i_remainder -= p_filter->output.i_rate;
i_remainder -= p_filter->fmt_out.audio.i_rate;
}
}
......@@ -127,5 +127,5 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
p_out_buf->i_buffer = i_out_nb * i_sample_bytes;
p_out_buf->i_pts = p_in_buf->i_pts;
p_out_buf->i_length = p_out_buf->i_nb_samples *
1000000 / p_filter->output.i_rate;
1000000 / p_filter->fmt_out.audio.i_rate;
}
......@@ -392,17 +392,17 @@ static int Open( vlc_object_t *p_this )
aout_filter_sys_t *p_sys;
bool b_fit = true;
if( p_filter->input.i_format != VLC_CODEC_FL32 ||
p_filter->output.i_format != VLC_CODEC_FL32 )
if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 ||
p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
{
b_fit = false;
p_filter->input.i_format = p_filter->output.i_format = VLC_CODEC_FL32;
p_filter->fmt_in.audio.i_format = p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32;
msg_Warn( p_filter, "bad input or output format" );
}
if( ! AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
if( ! AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
{
b_fit = false;
memcpy( &p_filter->output, &p_filter->input, sizeof(audio_sample_format_t) );
memcpy( &p_filter->fmt_out.audio, &p_filter->fmt_in.audio, sizeof(audio_sample_format_t) );
msg_Warn( p_filter, "input and output formats are not similar" );
}
......@@ -418,8 +418,8 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM;
p_sys->scale = 1.0;
p_sys->sample_rate = p_filter->input.i_rate;
p_sys->samples_per_frame = aout_FormatNbChannels( &p_filter->input );
p_sys->sample_rate = p_filter->fmt_in.audio.i_rate;
p_sys->samples_per_frame = aout_FormatNbChannels( &p_filter->fmt_in.audio );
p_sys->bytes_per_sample = 4;
p_sys->bytes_per_frame = p_sys->samples_per_frame * p_sys->bytes_per_sample;
......@@ -481,14 +481,14 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
VLC_UNUSED(p_aout);
aout_filter_sys_t *p = p_filter->p_sys;
if( p_filter->input.i_rate == p->sample_rate ) {
if( p_filter->fmt_in.audio.i_rate == p->sample_rate ) {
memcpy( p_out_buf->p_buffer, p_in_buf->p_buffer, p_in_buf->i_buffer );
p_out_buf->i_buffer = p_in_buf->i_buffer;
p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
return;
}
double scale = p_filter->input.i_rate / (double)p->sample_rate;
double scale = p_filter->fmt_in.audio.i_rate / (double)p->sample_rate;
if( scale != p->scale ) {
p->scale = scale;
p->bytes_stride_scaled = p->bytes_stride * p->scale;
......
......@@ -132,18 +132,18 @@ static int Open( vlc_object_t *p_this )
bool b_fit = true;
msg_Dbg( p_this, "Opening filter spatializer" );
if( p_filter->input.i_format != VLC_CODEC_FL32 ||
p_filter->output.i_format != VLC_CODEC_FL32 )
if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 ||
p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
{
b_fit = false;
p_filter->input.i_format = VLC_CODEC_FL32;
p_filter->output.i_format = VLC_CODEC_FL32;
p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32;
msg_Warn( p_filter, "bad input or output format" );
}
if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) )
{
b_fit = false;
memcpy( &p_filter->output, &p_filter->input,
memcpy( &p_filter->fmt_out.audio, &p_filter->fmt_in.audio,
sizeof(audio_sample_format_t) );
msg_Warn( p_filter, "input and output formats are not similar" );
}
......@@ -239,7 +239,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
SpatFilter( p_aout, p_filter, (float*)p_out_buf->p_buffer,
(float*)p_in_buf->p_buffer, p_in_buf->i_nb_samples,
aout_FormatNbChannels( &p_filter->input ) );
aout_FormatNbChannels( &p_filter->fmt_in.audio ) );
}
......
......@@ -137,13 +137,13 @@ static int Open( vlc_object_t *p_this )
video_format_t fmt;
if( p_filter->input.i_format != VLC_CODEC_FL32 ||
p_filter->output.i_format != VLC_CODEC_FL32 )
if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 ||
p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
{
msg_Warn( p_filter, "bad input or output format" );
return VLC_EGENERIC;
}
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_Warn( p_filter, "input and output formats are not similar" );
return VLC_EGENERIC;
......@@ -184,9 +184,9 @@ static int Open( vlc_object_t *p_this )
vlc_cond_init( &p_thread->wait );
p_thread->i_blocks = 0;
date_Init( &p_thread->date, p_filter->output.i_rate, 1 );
date_Init( &p_thread->date, p_filter->fmt_out.audio.i_rate, 1 );
date_Set( &p_thread->date, 0 );
p_thread->i_channels = aout_FormatNbChannels( &p_filter->input );
p_thread->i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio );
p_thread->psz_title = TitleGet( VLC_OBJECT( p_filter ) );
......
......@@ -162,13 +162,13 @@ static int Open( vlc_object_t * p_this )
projectm_thread_t *p_thread;
/* Test the audio format */
if( p_filter->input.i_format != VLC_CODEC_FL32 ||
p_filter->output.i_format != VLC_CODEC_FL32 )
if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 ||
p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
{
msg_Warn( p_filter, "bad input or output format" );
return VLC_EGENERIC;
}
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_Warn( p_filter, "input and outut are not similar" );
return VLC_EGENERIC;
......@@ -198,7 +198,7 @@ static int Open( vlc_object_t * p_this )
return i_ret;
}
p_thread->i_channels = aout_FormatNbChannels( &p_filter->input );
p_thread->i_channels = aout_FormatNbChannels( &p_filter->fmt_in.audio );
p_thread->psz_config = var_CreateGetString( p_filter, "projectm-config" );
vlc_mutex_init( &p_thread->lock );
p_thread->p_buffer = NULL;
......
......@@ -194,8 +194,8 @@ static int Open( vlc_object_t *p_this )
char *psz_effects, *psz_parser;
video_format_t fmt;
if( ( p_filter->input.i_format != VLC_CODEC_FL32 &&
p_filter->input.i_format != VLC_CODEC_FI32 ) )
if( ( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 &&
p_filter->fmt_in.audio.i_format != VLC_CODEC_FI32 ) )
{
return VLC_EGENERIC;
}
......@@ -229,7 +229,7 @@ static int Open( vlc_object_t *p_this )
break;
p_effect->i_width = p_sys->i_width;
p_effect->i_height= p_sys->i_height;
p_effect->i_nb_chans = aout_FormatNbChannels( &p_filter->input);
p_effect->i_nb_chans = aout_FormatNbChannels( &p_filter->fmt_in.audio);
p_effect->i_idx_left = 0;
p_effect->i_idx_right = __MIN( 1, p_effect->i_nb_chans-1 );
......@@ -344,8 +344,8 @@ 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_buffer = p_in_buf->i_buffer *
aout_FormatNbChannels( &p_filter->output ) /
aout_FormatNbChannels( &p_filter->input );
aout_FormatNbChannels( &p_filter->fmt_out.audio ) /
aout_FormatNbChannels( &p_filter->fmt_in.audio );
/* First, get a new picture */
while( ( p_outpic = vout_CreatePicture( p_sys->p_vout, 0, 0, 3 ) ) == NULL)
......
......@@ -53,8 +53,8 @@ static aout_filter_t * FindFilter( aout_instance_t * p_aout,
if ( p_filter == NULL ) return NULL;
vlc_object_attach( p_filter, p_aout );
memcpy( &p_filter->input, p_input_format, sizeof(audio_sample_format_t) );
memcpy( &p_filter->output, p_output_format,
memcpy( &p_filter->fmt_in.audio, p_input_format, sizeof(audio_sample_format_t) );
memcpy( &p_filter->fmt_out.audio, p_output_format,
sizeof(audio_sample_format_t) );
p_filter->p_module = module_need( p_filter, "audio filter", NULL, false );
if ( p_filter->p_module == NULL )
......@@ -206,12 +206,12 @@ int aout_FiltersCreatePipeline( aout_instance_t * p_aout,
AOUT_MAX_FILTERS );
return -1;
}
pp_filters[1] = FindFilter( p_aout, &pp_filters[0]->output,
pp_filters[1] = FindFilter( p_aout, &pp_filters[0]->fmt_out.audio,
p_output_format );
if ( pp_filters[1] == NULL )
{
/* Try to split the conversion. */
i_nb_conversions = SplitConversion( &pp_filters[0]->output,
i_nb_conversions = SplitConversion( &pp_filters[0]->fmt_out.audio,
p_output_format, &temp_format );
if ( !i_nb_conversions )
{
......@@ -229,7 +229,7 @@ int aout_FiltersCreatePipeline( aout_instance_t * p_aout,
AOUT_MAX_FILTERS );
return -1;
}
pp_filters[1] = FindFilter( p_aout, &pp_filters[0]->output,
pp_filters[1] = FindFilter( p_aout, &pp_filters[0]->fmt_out.audio,
&temp_format );
pp_filters[2] = FindFilter( p_aout, &temp_format,
p_output_format );
......@@ -298,12 +298,12 @@ void aout_FiltersHintBuffers( aout_instance_t * p_aout,
{
aout_filter_t * p_filter = pp_filters[i];
int i_output_size = p_filter->output.i_bytes_per_frame
* p_filter->output.i_rate * AOUT_MAX_INPUT_RATE
/ p_filter->output.i_frame_length;
int i_input_size = p_filter->input.i_bytes_per_frame
* p_filter->input.i_rate * AOUT_MAX_INPUT_RATE
/ p_filter->input.i_frame_length;
int i_output_size = p_filter->fmt_out.audio.i_bytes_per_frame
* p_filter->fmt_out.audio.i_rate * AOUT_MAX_INPUT_RATE
/ p_filter->fmt_out.audio.i_frame_length;
int i_input_size = p_filter->fmt_in.audio.i_bytes_per_frame
* p_filter->fmt_in.audio.i_rate * AOUT_MAX_INPUT_RATE
/ p_filter->fmt_in.audio.i_frame_length;
p_first_alloc->i_bytes_per_sec = __MAX( p_first_alloc->i_bytes_per_sec,
i_output_size );
......@@ -345,7 +345,7 @@ void aout_FiltersPlay( aout_instance_t * p_aout,
* slightly bigger buffers. */
p_output_buffer = aout_BufferAlloc( &p_filter->output_alloc,
((mtime_t)(*pp_input_buffer)->i_nb_samples + 2)
* 1000000 / p_filter->input.i_rate,
* 1000000 / p_filter->fmt_in.audio.i_rate,
*pp_input_buffer );
if( p_output_buffer == NULL )
return;
......
......@@ -288,9 +288,9 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
p_filter->p_owner->p_input = p_input;
/* request format */
memcpy( &p_filter->input, &chain_output_format,
memcpy( &p_filter->fmt_in.audio, &chain_output_format,
sizeof(audio_sample_format_t) );
memcpy( &p_filter->output, &chain_output_format,
memcpy( &p_filter->fmt_out.audio, &chain_output_format,
sizeof(audio_sample_format_t) );
......@@ -308,13 +308,13 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
if ( p_filter->p_module == NULL )
{
/* if the filter requested a special format, retry */
if ( !( AOUT_FMTS_IDENTICAL( &p_filter->input,
if ( !( AOUT_FMTS_IDENTICAL( &p_filter->fmt_in.audio,
&chain_input_format )
&& AOUT_FMTS_IDENTICAL( &p_filter->output,
&& AOUT_FMTS_IDENTICAL( &p_filter->fmt_out.audio,
&chain_output_format ) ) )
{
aout_FormatPrepare( &p_filter->input );
aout_FormatPrepare( &p_filter->output );
aout_FormatPrepare( &p_filter->fmt_in.audio );
aout_FormatPrepare( &p_filter->fmt_out.audio );
p_filter->p_module = module_need( p_filter,
"audio filter",
psz_parser, true );
......@@ -322,9 +322,9 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
/* try visual filters */
else
{
memcpy( &p_filter->input, &chain_output_format,
memcpy( &p_filter->fmt_in.audio, &chain_output_format,
sizeof(audio_sample_format_t) );
memcpy( &p_filter->output, &chain_output_format,
memcpy( &p_filter->fmt_out.audio, &chain_output_format,
sizeof(audio_sample_format_t) );
p_filter->p_module = module_need( p_filter,
"visualization",
......@@ -348,12 +348,13 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
}
/* complete the filter chain if necessary */
if ( !AOUT_FMTS_IDENTICAL( &chain_input_format, &p_filter->input ) )
if ( !AOUT_FMTS_IDENTICAL( &chain_input_format,
&p_filter->fmt_in.audio ) )
{
if ( aout_FiltersCreatePipeline( p_aout, p_input->pp_filters,
&p_input->i_nb_filters,
&chain_input_format,
&p_filter->input ) < 0 )
&p_filter->fmt_in.audio ) < 0 )
{
msg_Err( p_aout, "cannot add user filter %s (skipped)",
psz_parser );
......@@ -371,7 +372,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
/* success */
p_filter->b_continuity = false;
p_input->pp_filters[p_input->i_nb_filters++] = p_filter;
memcpy( &chain_input_format, &p_filter->output,
memcpy( &chain_input_format, &p_filter->fmt_out.audio,
sizeof( audio_sample_format_t ) );
if( i_visual == 0 ) /* scaletempo */
......@@ -428,7 +429,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input, const aout_
p_input->input_alloc.b_alloc = true;
/* Setup the initial rate of the resampler */
p_input->pp_resamplers[0]->input.i_rate = p_input->input.i_rate;
p_input->pp_resamplers[0]->fmt_in.audio.i_rate = p_input->input.i_rate;
}
p_input->i_resampling_type = AOUT_RESAMPLING_NONE;
......@@ -563,7 +564,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
/* Handle input rate change, but keep drift correction */
if( i_input_rate != p_input->i_last_input_rate )
{
unsigned int * const pi_rate = &p_input->p_playback_rate_filter->input.i_rate;
unsigned int * const pi_rate = &p_input->p_playback_rate_filter->fmt_in.audio.i_rate;
#define F(r,ir) ( INPUT_RATE_DEFAULT * (r) / (ir) )
const int i_delta = *pi_rate - F(p_input->input.i_rate,p_input->i_last_input_rate);
*pi_rate = F(p_input->input.i_rate + i_delta, i_input_rate);
......@@ -679,11 +680,11 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
if( p_input->i_resampling_type == AOUT_RESAMPLING_UP )
{
p_input->pp_resamplers[0]->input.i_rate += 2; /* Hz */
p_input->pp_resamplers[0]->fmt_in.audio.i_rate += 2; /* Hz */
}
else
{
p_input->pp_resamplers[0]->input.i_rate -= 2; /* Hz */
p_input->pp_resamplers[0]->fmt_in.audio.i_rate -= 2; /* Hz */
}
/* Check if everything is back to normal, in which case we can stop the
......@@ -692,7 +693,7 @@ int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
(p_input->pp_resamplers[0] == p_input->p_playback_rate_filter)
? INPUT_RATE_DEFAULT * p_input->input.i_rate / i_input_rate
: p_input->input.i_rate;
if( p_input->pp_resamplers[0]->input.i_rate == i_nominal_rate )
if( p_input->pp_resamplers[0]->fmt_in.audio.i_rate == i_nominal_rate )
{
p_input->i_resampling_type = AOUT_RESAMPLING_NONE;
msg_Warn( p_aout, "resampling stopped after %"PRIi64" usec "
......@@ -789,7 +790,7 @@ static void inputResamplingStop( aout_input_t *p_input )
p_input->i_resampling_type = AOUT_RESAMPLING_NONE;
if( p_input->i_nb_resamplers != 0 )
{
p_input->pp_resamplers[0]->input.i_rate =
p_input->pp_resamplers[0]->fmt_in.audio.i_rate =
( p_input->pp_resamplers[0] == p_input->p_playback_rate_filter )
? INPUT_RATE_DEFAULT * p_input->input.i_rate / p_input->i_last_input_rate
: p_input->input.i_rate;
......
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