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

aout: small cleanup

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