[vlc-devel] commit: When specifying --sout-transcode-samplerate and --sout-transcode-channel, set the OUTPUT format instead of the INPUT ( Rafaël Carré )

git version control git at videolan.org
Tue Apr 8 16:09:25 CEST 2008


vlc | branch: 0.8.6-bugfix | Rafaël Carré <funman at videolan.org> | Tue Apr  8 16:00:22 2008 +0200| [1fbde99ac89673cbfb864d68fe390e96ef40335f]

When specifying --sout-transcode-samplerate and --sout-transcode-channel, set the OUTPUT format instead of the INPUT

Fix resampling when using mp4a (faac is the only option atm)

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

 modules/codec/ffmpeg/encoder.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/codec/ffmpeg/encoder.c b/modules/codec/ffmpeg/encoder.c
index 6c047e3..5bac74a 100644
--- a/modules/codec/ffmpeg/encoder.c
+++ b/modules/codec/ffmpeg/encoder.c
@@ -539,8 +539,15 @@ 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;
+        }
     }
 
     /* Misc parameters */




More information about the vlc-devel mailing list