]> git.sesse.net Git - vlc/commitdiff
When specifying --sout-transcode-samplerate and --sout-transcode-channel, set the...
authorRafaël Carré <funman@videolan.org>
Tue, 8 Apr 2008 14:00:22 +0000 (16:00 +0200)
committerRafaël Carré <funman@videolan.org>
Tue, 8 Apr 2008 14:02:47 +0000 (16:02 +0200)
Fix resampling when using mp4a (faac is the only option atm)

modules/codec/ffmpeg/encoder.c

index 49960e638e0cc9bad28bc172d7d9e89fb20e9a17..8b9ffed17f3805bc8d0a47d6de76258a1b120a3d 100644 (file)
@@ -565,15 +565,20 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
             p_enc->fmt_in.audio.i_channels = 2;
 
         p_enc->fmt_in.i_codec  = AOUT_FMT_S16_NE;
-        p_context->sample_rate = p_enc->fmt_in.audio.i_rate;
-        p_context->channels    = p_enc->fmt_in.audio.i_channels;
+        p_context->sample_rate = p_enc->fmt_out.audio.i_rate;
+        p_context->channels    = p_enc->fmt_out.audio.i_channels;
 
+        if ( p_enc->fmt_out.i_codec == VLC_FOURCC('m','p','4','a') )
+        {
+            /* XXX: FAAC does resample only when setting the INPUT samplerate
+             * to the desired value (-R option of the faac frontend) */
+            p_enc->fmt_in.audio.i_rate = p_context->sample_rate;
 #if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
         /* Ignore FF_PROFILE_UNKNOWN */
-        if( ( p_sys->i_aac_profile >= FF_PROFILE_AAC_MAIN ) && 
-            ( p_enc->fmt_out.i_codec == VLC_FOURCC('m','p','4','a') ) )
+        if( p_sys->i_aac_profile >= FF_PROFILE_AAC_MAIN )
             p_context->profile = p_sys->i_aac_profile;
 #endif
+        }
     }
 
     /* Misc parameters */