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

Make resampler configurable with --audio-resampler

parent 11860310
......@@ -44,25 +44,33 @@
* FindFilter: find an audio filter for a specific transformation
*****************************************************************************/
static filter_t * FindFilter( vlc_object_t *obj,
const audio_sample_format_t * p_input_format,
const audio_sample_format_t * p_output_format )
const audio_sample_format_t *infmt,
const audio_sample_format_t *outfmt )
{
static const char typename[] = "audio filter";
const char *type = "audio filter", *name = NULL;
filter_t * p_filter;
p_filter = vlc_custom_create( obj, sizeof(*p_filter), typename );
if ( p_filter == NULL ) return NULL;
memcpy( &p_filter->fmt_in.audio, p_input_format,
sizeof(audio_sample_format_t) );
p_filter->fmt_in.i_codec = p_input_format->i_format;
memcpy( &p_filter->fmt_out.audio, p_output_format,
sizeof(audio_sample_format_t) );
p_filter->fmt_out.i_codec = p_output_format->i_format;
p_filter->fmt_in.audio = *infmt;
p_filter->fmt_in.i_codec = infmt->i_format;
p_filter->fmt_out.audio = *outfmt;
p_filter->fmt_out.i_codec = outfmt->i_format;
p_filter->p_owner = NULL;
p_filter->p_module = module_need( p_filter, "audio filter", NULL, false );
if( infmt->i_format == outfmt->i_format
&& infmt->i_physical_channels == outfmt->i_physical_channels
&& infmt->i_original_channels == outfmt->i_original_channels )
{
assert( infmt->i_rate != outfmt->i_rate );
type = "audio resampler";
name = "$audio-resampler";
}
p_filter->p_module = module_need( p_filter, type, name, false );
if ( p_filter->p_module == NULL )
{
vlc_object_release( p_filter );
......
......@@ -295,6 +295,10 @@ static const char *const ppsz_snap_formats[] =
"This delays the audio output. The delay must be given in milliseconds. " \
"This can be handy if you notice a lag between the video and the audio.")
#define AUDIO_RESAMPLER_TEXT N_("Audio resampler")
#define AUDIO_RESAMPLER_LONGTEXT N_( \
"This selects which plugin to use for audio resampling." )
#define MULTICHA_TEXT N_("Audio output channels mode")
#define MULTICHA_LONGTEXT N_( \
"This sets the audio output channels mode that will " \
......@@ -1605,6 +1609,9 @@ vlc_module_begin ()
DESYNC_LONGTEXT, true )
change_safe ()
add_module( "audio-resampler", "audio resampler", NULL,
AUDIO_RESAMPLER_TEXT, AUDIO_RESAMPLER_LONGTEXT, true )
/* FIXME TODO create a subcat replay gain ? */
add_string( "audio-replay-gain-mode", ppsz_replay_gain_mode[0], AUDIO_REPLAY_GAIN_MODE_TEXT,
AUDIO_REPLAY_GAIN_MODE_LONGTEXT, false )
......
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