]> git.sesse.net Git - vlc/commitdiff
avcodec: set default channel layout on encoding
authorIlkka Ollakka <ileoo@videolan.org>
Sun, 24 Mar 2013 09:39:15 +0000 (11:39 +0200)
committerIlkka Ollakka <ileoo@videolan.org>
Sun, 24 Mar 2013 12:11:39 +0000 (14:11 +0200)
modules/codec/avcodec/encoder.c

index 6d5de8b478d720532a3c2c7e156c4424290e56b6..54e34e4ae6744850df0b2f7437d39383e7e39854 100644 (file)
 #include "avcodec.h"
 #include "avcommon.h"
 
+#if LIBAVUTIL_VERSION_CHECK( 52,2,6,0,0 )
+# include <libavutil/channel_layout.h>
+#endif
+
 #define HURRY_UP_GUARD1 (450000)
 #define HURRY_UP_GUARD2 (300000)
 #define HURRY_UP_GUARD3 (100000)
@@ -635,6 +639,9 @@ int OpenEncoder( vlc_object_t *p_this )
         p_context->time_base.num = 1;
         p_context->time_base.den = p_context->sample_rate;
         p_context->channels    = p_enc->fmt_out.audio.i_channels;
+#if LIBAVUTIL_VERSION_CHECK( 52, 2, 6, 0, 0)
+        p_context->channel_layout = av_get_default_channel_layout( p_context->channels );
+#endif
 
         if ( p_enc->fmt_out.i_codec == VLC_CODEC_MP4A )
         {