[vlc-commits] headphone: setup filter_t on success and rationalize
Rémi Denis-Courmont
git at videolan.org
Tue Nov 6 18:43:29 CET 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov 6 19:42:58 2012 +0200| [714c999844da1ef6be22c1cf25cc8f99b7c09bf5] | committer: Rémi Denis-Courmont
headphone: setup filter_t on success and rationalize
Use input rate rather than output rate to avoid extra resampling.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=714c999844da1ef6be22c1cf25cc8f99b7c09bf5
---
modules/audio_filter/channel_mixer/headphone.c | 50 ++++++------------------
1 file changed, 12 insertions(+), 38 deletions(-)
diff --git a/modules/audio_filter/channel_mixer/headphone.c b/modules/audio_filter/channel_mixer/headphone.c
index 8c2fc63..0d868ef 100644
--- a/modules/audio_filter/channel_mixer/headphone.c
+++ b/modules/audio_filter/channel_mixer/headphone.c
@@ -441,7 +441,6 @@ static int OpenFilter( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys;
- bool b_fit = true;
/* Activate this filter only with stereo devices */
if( p_filter->fmt_out.audio.i_physical_channels
@@ -451,42 +450,6 @@ static int OpenFilter( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- /* Request a specific format if not already compatible */
- if( p_filter->fmt_in.audio.i_original_channels
- != p_filter->fmt_out.audio.i_original_channels )
- {
- b_fit = false;
- p_filter->fmt_in.audio.i_original_channels =
- p_filter->fmt_out.audio.i_original_channels;
- }
- if( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32
- || p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
- {
- b_fit = false;
- p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
- p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32;
- }
- if( p_filter->fmt_in.audio.i_rate != p_filter->fmt_out.audio.i_rate )
- {
- b_fit = false;
- p_filter->fmt_in.audio.i_rate = p_filter->fmt_out.audio.i_rate;
- }
- if( p_filter->fmt_in.audio.i_physical_channels == (AOUT_CHAN_LEFT|AOUT_CHAN_RIGHT)
- && ( p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_DOLBYSTEREO )
- && !var_InheritBool( p_filter, "headphone-dolby" ) )
- {
- b_fit = false;
- p_filter->fmt_in.audio.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
- AOUT_CHAN_CENTER |
- AOUT_CHAN_REARLEFT |
- AOUT_CHAN_REARRIGHT;
- }
- if( !b_fit )
- {
- msg_Dbg( p_filter, "requesting specific format" );
- return VLC_EGENERIC;
- }
-
/* Allocate the memory needed to store the module's structure */
p_sys = p_filter->p_sys = malloc( sizeof(struct filter_sys_t) );
if( p_sys == NULL )
@@ -505,8 +468,19 @@ static int OpenFilter( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- p_filter->pf_audio_filter = Convert;
+ /* Request a specific format if not already compatible */
+ p_filter->fmt_in.audio.i_format = VLC_CODEC_FL32;
+ p_filter->fmt_out.audio.i_format = VLC_CODEC_FL32;
p_filter->fmt_out.audio.i_rate = p_filter->fmt_in.audio.i_rate;
+ p_filter->fmt_in.audio.i_original_channels =
+ p_filter->fmt_out.audio.i_original_channels;
+ if( p_filter->fmt_in.audio.i_physical_channels == AOUT_CHANS_STEREO
+ && (p_filter->fmt_in.audio.i_original_channels & AOUT_CHAN_DOLBYSTEREO)
+ && !var_InheritBool( p_filter, "headphone-dolby" ) )
+ {
+ p_filter->fmt_in.audio.i_physical_channels = AOUT_CHANS_5_0;
+ }
+ p_filter->pf_audio_filter = Convert;
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list