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

aout: small cleanup

parent 37e6859a
......@@ -43,14 +43,11 @@
int aout_OutputNew( aout_instance_t * p_aout,
audio_sample_format_t * p_format )
{
p_aout->output.output = *p_format;
/* Retrieve user defaults. */
int i_rate = var_InheritInteger( p_aout, "aout-rate" );
vlc_value_t val, text;
/* kludge to avoid a fpu error when rate is 0... */
if( i_rate == 0 ) i_rate = -1;
memcpy( &p_aout->output.output, p_format, sizeof(audio_sample_format_t) );
if ( i_rate != -1 )
if ( i_rate != 0 )
p_aout->output.output.i_rate = i_rate;
aout_FormatPrepare( &p_aout->output.output );
......@@ -66,36 +63,34 @@ int aout_OutputNew( aout_instance_t * p_aout,
(VLC_VAR_INTEGER | VLC_VAR_HASCHOICE) )
{
/* The user may have selected a different channels configuration. */
var_Get( p_aout, "audio-channels", &val );
if ( val.i_int == AOUT_VAR_CHAN_RSTEREO )
{
p_aout->output.output.i_original_channels |=
AOUT_CHAN_REVERSESTEREO;
}
else if ( val.i_int == AOUT_VAR_CHAN_STEREO )
{
p_aout->output.output.i_original_channels =
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
}
else if ( val.i_int == AOUT_VAR_CHAN_LEFT )
switch( var_InheritInteger( p_aout, "audio-channels" ) )
{
p_aout->output.output.i_original_channels = AOUT_CHAN_LEFT;
}
else if ( val.i_int == AOUT_VAR_CHAN_RIGHT )
{
p_aout->output.output.i_original_channels = AOUT_CHAN_RIGHT;
}
else if ( val.i_int == AOUT_VAR_CHAN_DOLBYS )
{
p_aout->output.output.i_original_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_DOLBYSTEREO;
case AOUT_VAR_CHAN_RSTEREO:
p_aout->output.output.i_original_channels |=
AOUT_CHAN_REVERSESTEREO;
break;
case AOUT_VAR_CHAN_STEREO:
p_aout->output.output.i_original_channels =
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
break;
case AOUT_VAR_CHAN_LEFT:
p_aout->output.output.i_original_channels = AOUT_CHAN_LEFT;
break;
case AOUT_VAR_CHAN_RIGHT:
p_aout->output.output.i_original_channels = AOUT_CHAN_RIGHT;
break;
case AOUT_VAR_CHAN_DOLBYS:
p_aout->output.output.i_original_channels =
AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_DOLBYSTEREO;
break;
}
}
else if ( p_aout->output.output.i_physical_channels == AOUT_CHAN_CENTER
&& (p_aout->output.output.i_original_channels
& AOUT_CHAN_PHYSMASK) == (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT) )
{
vlc_value_t val, text;
/* Mono - create the audio-channels variable. */
var_Create( p_aout, "audio-channels",
VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
......@@ -122,6 +117,8 @@ int aout_OutputNew( aout_instance_t * p_aout,
&& (p_aout->output.output.i_original_channels &
(AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT)) )
{
vlc_value_t val, text;
/* Stereo - create the audio-channels variable. */
var_Create( p_aout, "audio-channels",
VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
......
......@@ -277,7 +277,7 @@ static const char *const ppsz_snap_formats[] =
#define AOUT_RATE_TEXT N_("Audio output frequency (Hz)")
#define AOUT_RATE_LONGTEXT N_( \
"You can force the audio output frequency here. Common values are " \
"-1 (default), 48000, 44100, 32000, 22050, 16000, 11025, 8000.")
"0 (undefined), 48000, 44100, 32000, 22050, 16000, 11025, 8000.")
#if !defined( __APPLE__ )
#define AOUT_RESAMP_TEXT N_("High quality audio resampling")
......@@ -1600,7 +1600,7 @@ vlc_module_begin ()
add_integer_with_range( "volume-step", AOUT_VOLUME_STEP, AOUT_VOLUME_MIN,
AOUT_VOLUME_MAX, VOLUME_STEP_TEXT,
VOLUME_STEP_LONGTEXT, true )
add_integer( "aout-rate", -1, AOUT_RATE_TEXT,
add_integer( "aout-rate", 0, AOUT_RATE_TEXT,
AOUT_RATE_LONGTEXT, true )
#if HAVE_FPU && !defined( __APPLE__ )
add_bool( "hq-resampling", 1, AOUT_RESAMP_TEXT,
......
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