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

aout: partly rewrite and move filters initialization code

 - simplify "audio-filter" parser and fix a tautology
 - keep a single pointer for the resampler instead of a table
parent 714c9998
......@@ -51,15 +51,6 @@ struct aout_input_t
{
unsigned samplerate; /**< Input sample rate */
/* filters */
filter_t * pp_filters[AOUT_MAX_FILTERS];
unsigned i_nb_filters;
filter_t * p_playback_rate_filter;
/* Resampler + converter to mixer */
filter_t * pp_resamplers[5];
unsigned i_nb_resamplers;
int i_resampling_type;
mtime_t i_resamp_start_date;
int i_resamp_start_drift;
......@@ -69,10 +60,6 @@ struct aout_input_t
/* */
int i_buffer_lost;
/* */
bool b_recycle_vout;
aout_request_vout_t request_vout;
};
typedef struct
......@@ -87,12 +74,20 @@ typedef struct
date_t date;
} sync;
audio_sample_format_t mixer_format;
audio_sample_format_t input_format;
audio_sample_format_t mixer_format;
/* Filters between mixer and output */
filter_t *filters[5];
unsigned nb_filters;
filter_t *rate_filter; /**< The filter adjusting samples count
(either the scaletempo filter or a resampler) */
filter_t *resampler; /**< The resampler */
filter_t *filters[AOUT_MAX_FILTERS]; /**< Configured user filters
(e.g. equalization) and their conversions */
unsigned nb_filters;
unsigned nb_converters;
filter_t *converters[5]; /**< Converters to the output */
aout_request_vout_t request_vout;
bool recycle_vout;
vlc_atomic_t restart;
} aout_owner_t;
......@@ -128,6 +123,10 @@ int aout_FiltersCreatePipeline( vlc_object_t *, filter_t **, unsigned *,
void aout_FiltersDestroyPipeline( filter_t *const *, unsigned );
void aout_FiltersPlay( filter_t *const *, unsigned, block_t ** );
int aout_FiltersNew(audio_output_t *, const audio_sample_format_t *,
const audio_sample_format_t *, const aout_request_vout_t *);
void aout_FiltersDestroy(audio_output_t *);
/* From mixer.c : */
aout_volume_t *aout_volume_New(vlc_object_t *, const audio_replay_gain_t *);
#define aout_volume_New(o, g) aout_volume_New(VLC_OBJECT(o), g)
......
......@@ -138,7 +138,7 @@ static void aout_CheckRestart (audio_output_t *aout)
assert (restart & AOUT_RESTART_INPUT);
const aout_request_vout_t request_vout = owner->input->request_vout;
const aout_request_vout_t request_vout = owner->request_vout;
if (likely(owner->input != NULL))
aout_InputDelete (aout, owner->input);
......
This diff is collapsed.
This diff is collapsed.
......@@ -403,11 +403,11 @@ int aout_OutputNew (audio_output_t *aout, const audio_sample_format_t *fmtp)
aout_FormatPrepare (&owner->mixer_format);
aout_FormatPrint (aout, "mixer", &owner->mixer_format);
/* Create filters. */
owner->nb_filters = 0;
if (aout_FiltersCreatePipeline (aout, owner->filters, &owner->nb_filters,
sizeof (owner->filters)
/ sizeof (owner->filters[0]),
/* Create converters. */
owner->nb_converters = 0;
if (aout_FiltersCreatePipeline (aout, owner->converters,
&owner->nb_converters,
sizeof (owner->converters) / sizeof (owner->converters[0]),
&owner->mixer_format, &fmt) < 0)
{
msg_Err (aout, "couldn't create audio output pipeline");
......@@ -431,7 +431,7 @@ void aout_OutputDelete (audio_output_t *aout)
var_DelCallback (aout, "stereo-mode", aout_ChannelsRestart, NULL);
if (aout->stop != NULL)
aout->stop (aout);
aout_FiltersDestroyPipeline (owner->filters, owner->nb_filters);
aout_FiltersDestroyPipeline (owner->converters, owner->nb_converters);
}
/**
......@@ -446,7 +446,7 @@ void aout_OutputPlay (audio_output_t *aout, block_t *block)
aout_assert_locked (aout);
aout_FiltersPlay (owner->filters, owner->nb_filters, &block);
aout_FiltersPlay (owner->converters, owner->nb_converters, &block);
if (block == NULL)
return;
if (block->i_buffer == 0)
......
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