[vlc-commits] mono: setup filter_t only when successful

Rémi Denis-Courmont git at videolan.org
Tue Nov 6 18:39:28 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov  6 19:34:40 2012 +0200| [7a0a53fce08d41c45a47215798a9f4a19a539a9c] | committer: Rémi Denis-Courmont

mono: setup filter_t only when successful

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7a0a53fce08d41c45a47215798a9f4a19a539a9c
---

 modules/audio_filter/channel_mixer/mono.c |   30 +++++++++++++----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/modules/audio_filter/channel_mixer/mono.c b/modules/audio_filter/channel_mixer/mono.c
index 3d1c6a9..3c09efd 100644
--- a/modules/audio_filter/channel_mixer/mono.c
+++ b/modules/audio_filter/channel_mixer/mono.c
@@ -368,23 +368,6 @@ static int OpenFilter( vlc_object_t *p_this )
     p_sys->i_channel_selected =
             (unsigned int) var_CreateGetInteger( p_this, MONO_CFG "channel" );
 
-    if( p_sys->b_downmix )
-    {
-        msg_Dbg( p_this, "using stereo to mono downmix" );
-        p_filter->fmt_out.audio.i_physical_channels = AOUT_CHAN_CENTER;
-        p_filter->fmt_out.audio.i_channels = 1;
-    }
-    else
-    {
-        msg_Dbg( p_this, "using pseudo mono" );
-        p_filter->fmt_out.audio.i_physical_channels =
-                            (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT);
-        p_filter->fmt_out.audio.i_channels = 2;
-    }
-
-    p_filter->fmt_out.audio.i_rate = p_filter->fmt_in.audio.i_rate;
-    p_filter->fmt_out.audio.i_format = p_filter->fmt_out.i_codec;
-
     p_sys->i_nb_channels = aout_FormatNbChannels( &(p_filter->fmt_in.audio) );
     p_sys->i_bitspersample = p_filter->fmt_out.audio.i_bitspersample;
 
@@ -404,6 +387,19 @@ static int OpenFilter( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
+    if( p_sys->b_downmix )
+    {
+        msg_Dbg( p_this, "using stereo to mono downmix" );
+        p_filter->fmt_out.audio.i_physical_channels = AOUT_CHAN_CENTER;
+        p_filter->fmt_out.audio.i_channels = 1;
+    }
+    else
+    {
+        msg_Dbg( p_this, "using pseudo mono" );
+        p_filter->fmt_out.audio.i_physical_channels = AOUT_CHANS_STEREO;
+        p_filter->fmt_out.audio.i_channels = 2;
+    }
+    p_filter->fmt_out.audio.i_rate = p_filter->fmt_in.audio.i_rate;
     p_filter->pf_audio_filter = Convert;
 
     msg_Dbg( p_this, "%4.4s->%4.4s, channels %d->%d, bits per sample: %i->%i",



More information about the vlc-commits mailing list