Commit d8ae3c5a authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Simple: fix comments and reorder functions

parent 165f575d
...@@ -52,13 +52,62 @@ vlc_module_end () ...@@ -52,13 +52,62 @@ vlc_module_end ()
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static bool IsSupported( const audio_format_t *p_input, const audio_format_t *p_output );
struct filter_sys_t struct filter_sys_t
{ {
void (*pf_dowork)(filter_t *, block_t *, block_t * ); void (*pf_dowork)(filter_t *, block_t *, block_t * );
}; };
/*****************************************************************************
* IsSupported: can we downmix?
*****************************************************************************/
static bool IsSupported( const audio_format_t *p_input, const audio_format_t *p_output )
{
if( p_input->i_format != VLC_CODEC_FL32 ||
p_input->i_format != p_output->i_format ||
p_input->i_rate != p_output->i_rate )
{
return false;
}
if( p_input->i_physical_channels == p_output->i_physical_channels &&
p_input->i_original_channels == p_output->i_original_channels )
{
return false;
}
/* Only conversion to Mono, Stereo, 4.0 and 5.1 */
if( p_output->i_physical_channels != AOUT_CHAN_CENTER &&
p_output->i_physical_channels != AOUT_CHANS_2_0 &&
p_output->i_physical_channels != AOUT_CHANS_4_0 &&
p_output->i_physical_channels != AOUT_CHANS_5_1 )
{
return false;
}
/* Only from 7.x/5.x/4.0/3.x/2.0
* NB 5.X rear and middle are handled the same way
* We don't support 2.1 -> 2.0 (trivial can do it)
* TODO: We don't support any 8.1 input
* TODO: We don't support any 6.x input
* TODO: We don't support 4.0 rear and 4.0 middle
* */
if( (p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_7_0 &&
(p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_5_0 &&
(p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_5_0_MIDDLE &&
(p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_4_CENTER_REAR &&
(p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_3_0 &&
p_input->i_physical_channels != AOUT_CHANS_2_0 )
{
return false;
}
/* Only downmixing */
if( aout_FormatNbChannels( p_input ) <= aout_FormatNbChannels( p_output ) )
return false;
return true;
}
static block_t *Filter( filter_t *, block_t * ); static block_t *Filter( filter_t *, block_t * );
static void DoWork_7_x_to_2_0( filter_t * p_filter, block_t * p_in_buf, block_t * p_out_buf ) { static void DoWork_7_x_to_2_0( filter_t * p_filter, block_t * p_in_buf, block_t * p_out_buf ) {
...@@ -352,47 +401,4 @@ static block_t *Filter( filter_t *p_filter, block_t *p_block ) ...@@ -352,47 +401,4 @@ static block_t *Filter( filter_t *p_filter, block_t *p_block )
return p_out; return p_out;
} }
/*****************************************************************************
* Helpers:
*****************************************************************************/
static bool IsSupported( const audio_format_t *p_input, const audio_format_t *p_output )
{
if( p_input->i_format != VLC_CODEC_FL32 ||
p_input->i_format != p_output->i_format ||
p_input->i_rate != p_output->i_rate )
return false;
if( p_input->i_physical_channels == p_output->i_physical_channels &&
p_input->i_original_channels == p_output->i_original_channels )
{
return false;
}
/* Only conversion to Mono, Stereo and 4.0 right now */
if( p_output->i_physical_channels != AOUT_CHAN_CENTER &&
p_output->i_physical_channels != AOUT_CHANS_2_0 &&
p_output->i_physical_channels != AOUT_CHANS_4_0 &&
p_output->i_physical_channels != AOUT_CHANS_5_1 )
{
return false;
}
/* Only from 7/7.1/5/5.1/3/3.1/2.0
* XXX 5.X rear and middle are handled the same way */
if( (p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_7_0 &&
(p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_5_0 &&
(p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_5_0_MIDDLE &&
(p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_3_0 &&
(p_input->i_physical_channels & ~AOUT_CHAN_LFE) != AOUT_CHANS_4_CENTER_REAR &&
p_input->i_physical_channels != AOUT_CHANS_2_0 )
{
return false;
}
/* Only if we downmix */
if( aout_FormatNbChannels( p_input ) <= aout_FormatNbChannels( p_output ) )
return false;
return true;
}
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