diff --git a/configure b/configure
index 695976ee323c8e5d01b1c30628eb69ba28af3781..1a0ab6eafe73f0a321407bf8cc6262d3c7efdf78 100755
--- a/configure
+++ b/configure
@@ -638,11 +638,10 @@ print_config(){
 }
 
 print_enabled(){
-    test x"$1" = x-n && end=" " && shift || end="\n"
     suf=$1
     shift
     for v; do
-        enabled $v && printf "%s$end" ${v%$suf};
+        enabled $v && printf "%s\n" ${v%$suf};
     done
 }
 
diff --git a/libavcodec/ppc/h264_altivec.c b/libavcodec/ppc/h264_altivec.c
index 7c89b852a007f7215173b200d46dc5d43f2dbb3f..be54b48303fb695e146a2086f9dd4db71da603f3 100644
--- a/libavcodec/ppc/h264_altivec.c
+++ b/libavcodec/ppc/h264_altivec.c
@@ -19,6 +19,7 @@
  */
 
 #include "libavutil/cpu.h"
+#include "libavutil/intreadwrite.h"
 #include "libavutil/ppc/types_altivec.h"
 #include "libavutil/ppc/util_altivec.h"
 #include "libavcodec/dsputil.h"
@@ -788,7 +789,7 @@ static inline vec_u8 h264_deblock_q1(register vec_u8 p0,
     alphavec = vec_splat(alphavec, 0x0);                                                     \
     mask = h264_deblock_mask(p0, p1, q0, q1, alphavec, betavec); /*if in block */            \
                                                                                              \
-    *((int *)temp) = *((int *)tc0);                                                          \
+    AV_COPY32(temp, tc0);                                                                    \
     tc0vec = vec_ld(0, (signed char*)temp);                                                  \
     tc0vec = vec_mergeh(tc0vec, tc0vec);                                                     \
     tc0vec = vec_mergeh(tc0vec, tc0vec);                                                     \
diff --git a/libavcodec/ppc/h264_altivec_template.c b/libavcodec/ppc/h264_altivec_template.c
index 6121ea1f5488b096dc6742c9db61634a7cfb3228..5a08e0e27fef5904175c83bccb6ff1644a96d8de 100644
--- a/libavcodec/ppc/h264_altivec_template.c
+++ b/libavcodec/ppc/h264_altivec_template.c
@@ -322,7 +322,7 @@ static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, i
               pp1A, pp1B, pp2A, pp2B, pp3A, pp3B,
               psumA, psumB, sumA, sumB;
 
-    vec_u8 sum, vdst, fsum;
+    vec_u8 sum, fsum;
 
     for (i = 0 ; i < 16 ; i ++) {
         vec_u8 srcR1 = vec_ld(-2, src);
@@ -423,9 +423,8 @@ static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, i
         sum = vec_packsu(sumA, sumB);
 
         ASSERT_ALIGNED(dst);
-        vdst = vec_ld(0, dst);
 
-        OP_U8_ALTIVEC(fsum, sum, vdst);
+        OP_U8_ALTIVEC(fsum, sum, vec_ld(0, dst));
 
         vec_st(fsum, 0, dst);
 
@@ -486,7 +485,7 @@ static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, i
               srcP3ssA, srcP3ssB,
               sum1A, sum1B, sum2A, sum2B, sum3A, sum3B;
 
-    vec_u8 sum, vdst, fsum, srcP3a, srcP3b, srcP3;
+    vec_u8 sum, fsum, srcP3a, srcP3b, srcP3;
 
     for (i = 0 ; i < 16 ; i++) {
         srcP3a = vec_ld(0, srcbis += srcStride);
@@ -532,9 +531,8 @@ static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, i
         sum = vec_packsu(sumA, sumB);
 
         ASSERT_ALIGNED(dst);
-        vdst = vec_ld(0, dst);
 
-        OP_U8_ALTIVEC(fsum, sum, vdst);
+        OP_U8_ALTIVEC(fsum, sum, vec_ld(0, dst));
 
         vec_st(fsum, 0, dst);
 
@@ -582,7 +580,7 @@ static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp,
               pp3Ae, pp3Ao, pp3Be, pp3Bo, pp1cAe, pp1cAo, pp1cBe, pp1cBo,
               pp32Ae, pp32Ao, pp32Be, pp32Bo, sumAe, sumAo, sumBe, sumBo,
               ssumAe, ssumAo, ssumBe, ssumBo;
-    vec_u8 fsum, sumv, sum, vdst;
+    vec_u8 fsum, sumv, sum;
     vec_s16 ssume, ssumo;
 
     src -= (2 * srcStride);
@@ -766,9 +764,8 @@ static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp,
         sum = vec_perm(sumv, sumv, mperm);
 
         ASSERT_ALIGNED(dst);
-        vdst = vec_ld(0, dst);
 
-        OP_U8_ALTIVEC(fsum, sum, vdst);
+        OP_U8_ALTIVEC(fsum, sum, vec_ld(0, dst));
 
         vec_st(fsum, 0, dst);
 
diff --git a/libavformat/amr.c b/libavformat/amr.c
index 36ff9b036a862369f1ffaa41f24532d30e9c4f35..07ab1bac824e71940086d50462cca5ea64ede15a 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -25,7 +25,9 @@ Write and read amr data according to RFC3267, http://www.ietf.org/rfc/rfc3267.tx
 Only mono files are supported.
 
 */
+
 #include "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
 #include "avformat.h"
 #include "internal.h"
 
@@ -98,6 +100,7 @@ static int amr_read_header(AVFormatContext *s)
         st->codec->sample_rate = 8000;
     }
     st->codec->channels   = 1;
+    st->codec->channel_layout = AV_CH_LAYOUT_MONO;
     st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
     avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
 
diff --git a/libavformat/apc.c b/libavformat/apc.c
index 2ccf7946aac57c22cb673a8860cb28280f50d1da..bb28a628f7e41c3d2ccf284f0a9c14e1660ccc27 100644
--- a/libavformat/apc.c
+++ b/libavformat/apc.c
@@ -20,6 +20,8 @@
  */
 
 #include <string.h>
+
+#include "libavutil/channel_layout.h"
 #include "avformat.h"
 
 static int apc_probe(AVProbeData *p)
@@ -58,9 +60,13 @@ static int apc_read_header(AVFormatContext *s)
     /* initial predictor values for adpcm decoder */
     avio_read(pb, st->codec->extradata, 2 * 4);
 
-    st->codec->channels = 1;
-    if (avio_rl32(pb))
-        st->codec->channels = 2;
+    if (avio_rl32(pb)) {
+        st->codec->channels       = 2;
+        st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+    } else {
+        st->codec->channels       = 1;
+        st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+    }
 
     st->codec->bits_per_coded_sample = 4;
     st->codec->bit_rate = st->codec->bits_per_coded_sample * st->codec->channels
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 191f02944ee0ce20fc2db76d1540497e7e3a7f72..f17031a41fc4324daae036553406e7a12fbde3d7 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -27,6 +27,7 @@
  * @see http://www.svatopluk.com/andux/docs/dfvid.html
  */
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
@@ -240,6 +241,7 @@ static int vid_read_packet(AVFormatContext *s,
                 st->codec->codec_type            = AVMEDIA_TYPE_AUDIO;
                 st->codec->codec_id              = AV_CODEC_ID_PCM_U8;
                 st->codec->channels              = 1;
+                st->codec->channel_layout        = AV_CH_LAYOUT_MONO;
                 st->codec->bits_per_coded_sample = 8;
                 st->codec->sample_rate           = vid->sample_rate;
                 st->codec->bit_rate              = 8 * st->codec->sample_rate;
diff --git a/libavformat/bfi.c b/libavformat/bfi.c
index 446ef57fc9bfbd815292b6b5f9e31138b234db56..0f0ec006c0161e300f63af6411067447cc1019c0 100644
--- a/libavformat/bfi.c
+++ b/libavformat/bfi.c
@@ -26,6 +26,7 @@
  * @see http://wiki.multimedia.cx/index.php?title=BFI
  */
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
@@ -96,6 +97,7 @@ static int bfi_read_header(AVFormatContext * s)
     astream->codec->codec_type      = AVMEDIA_TYPE_AUDIO;
     astream->codec->codec_id        = AV_CODEC_ID_PCM_U8;
     astream->codec->channels        = 1;
+    astream->codec->channel_layout  = AV_CH_LAYOUT_MONO;
     astream->codec->bits_per_coded_sample = 8;
     astream->codec->bit_rate        =
         astream->codec->sample_rate * astream->codec->bits_per_coded_sample;
diff --git a/libavformat/bink.c b/libavformat/bink.c
index 9c90480c8d8f514559eefbfed229a0380b9dff83..74ef27d3b23df7df64e1c0b2edb660f7d3bea4f1 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -28,6 +28,7 @@
  *  http://wiki.multimedia.cx/index.php?title=Bink_Container
  */
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
@@ -143,7 +144,13 @@ static int read_header(AVFormatContext *s)
             flags = avio_rl16(pb);
             ast->codec->codec_id = flags & BINK_AUD_USEDCT ?
                                    AV_CODEC_ID_BINKAUDIO_DCT : AV_CODEC_ID_BINKAUDIO_RDFT;
-            ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1;
+            if (flags & BINK_AUD_STEREO) {
+                ast->codec->channels       = 2;
+                ast->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+            } else {
+                ast->codec->channels       = 1;
+                ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
+            }
             ast->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE);
             if (!ast->codec->extradata)
                 return AVERROR(ENOMEM);
diff --git a/libavformat/bmv.c b/libavformat/bmv.c
index fe5db3f004fa0a40d711a2af9d11900f78270898..ce157e842e281dbed6f5c751a8ec8018d3b8632a 100644
--- a/libavformat/bmv.c
+++ b/libavformat/bmv.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/channel_layout.h"
 #include "avformat.h"
 #include "internal.h"
 
@@ -58,6 +59,7 @@ static int bmv_read_header(AVFormatContext *s)
     ast->codec->codec_type      = AVMEDIA_TYPE_AUDIO;
     ast->codec->codec_id        = AV_CODEC_ID_BMV_AUDIO;
     ast->codec->channels        = 2;
+    ast->codec->channel_layout  = AV_CH_LAYOUT_STEREO;
     ast->codec->sample_rate     = 22050;
     avpriv_set_pts_info(ast, 16, 1, 22050);
 
diff --git a/libavformat/cdxl.c b/libavformat/cdxl.c
index fb2d2a40c3b5a682445c02f434e76243b3cec79b..76bca578fbfd0dc5fb8f8caf246510ec81ccf80d 100644
--- a/libavformat/cdxl.c
+++ b/libavformat/cdxl.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/opt.h"
@@ -143,7 +144,13 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
             st->codec->codec_type    = AVMEDIA_TYPE_AUDIO;
             st->codec->codec_tag     = 0;
             st->codec->codec_id      = AV_CODEC_ID_PCM_S8;
-            st->codec->channels      = cdxl->header[1] & 0x10 ? 2 : 1;
+            if (cdxl->header[1] & 0x10) {
+                st->codec->channels       = 2;
+                st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+            } else {
+                st->codec->channels       = 1;
+                st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+            }
             st->codec->sample_rate   = cdxl->sample_rate;
             st->start_time           = 0;
             cdxl->audio_stream_index = st->index;
diff --git a/libavformat/daud.c b/libavformat/daud.c
index bfbcf0a6b0289be3b301bae349e66c011ad7078e..fb62ab142c31cef252e60f720cd3e841cfb20628 100644
--- a/libavformat/daud.c
+++ b/libavformat/daud.c
@@ -18,6 +18,8 @@
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
+
+#include "libavutil/channel_layout.h"
 #include "avformat.h"
 
 static int daud_header(AVFormatContext *s) {
@@ -28,6 +30,7 @@ static int daud_header(AVFormatContext *s) {
     st->codec->codec_id = AV_CODEC_ID_PCM_S24DAUD;
     st->codec->codec_tag = MKTAG('d', 'a', 'u', 'd');
     st->codec->channels = 6;
+    st->codec->channel_layout = AV_CH_LAYOUT_5POINT1;
     st->codec->sample_rate = 96000;
     st->codec->bit_rate = 3 * 6 * 96000 * 8;
     st->codec->block_align = 3 * 6;
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
index afc010a16f73cc43ed7f068559582f6aebcfa702..b8ca57c0a4d0f97ad61f1eb31121e71c90f45e0d 100644
--- a/libavformat/dsicin.c
+++ b/libavformat/dsicin.c
@@ -24,6 +24,7 @@
  * Delphine Software International CIN file demuxer
  */
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
@@ -132,6 +133,7 @@ static int cin_read_header(AVFormatContext *s)
     st->codec->codec_id = AV_CODEC_ID_DSICINAUDIO;
     st->codec->codec_tag = 0;  /* no tag */
     st->codec->channels = 1;
+    st->codec->channel_layout = AV_CH_LAYOUT_MONO;
     st->codec->sample_rate = 22050;
     st->codec->bits_per_coded_sample = 8;
     st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample * st->codec->channels;
diff --git a/libavformat/dv.c b/libavformat/dv.c
index ae39816a015e2472d9ca426fe965e8774c1c2463..f3d88e457c001fdb13e2e6965d73667b92bbefb2 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -33,6 +33,7 @@
 #include "internal.h"
 #include "libavcodec/dv_profile.h"
 #include "libavcodec/dvdata.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/timecode.h"
@@ -252,6 +253,7 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame)
         }
         c->ast[i]->codec->sample_rate = dv_audio_frequency[freq];
         c->ast[i]->codec->channels    = 2;
+        c->ast[i]->codec->channel_layout = AV_CH_LAYOUT_STEREO;
         c->ast[i]->codec->bit_rate    = 2 * dv_audio_frequency[freq] * 16;
         c->ast[i]->start_time         = 0;
     }
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 24302f6b5309d1063f32c297bab4524b36b21e17..5bcc3fe2f347d80a66205fe98baec564cb0a0ce8 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -25,6 +25,7 @@
  */
 
 #include "libavutil/avstring.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/dict.h"
 #include "libavutil/opt.h"
 #include "libavutil/intfloat.h"
@@ -778,6 +779,8 @@ retry_duration:
         bits_per_coded_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;
         if(!st->codec->channels || !st->codec->sample_rate || !st->codec->bits_per_coded_sample) {
             st->codec->channels              = channels;
+            st->codec->channel_layout        = channels == 1 ? AV_CH_LAYOUT_MONO :
+                                                               AV_CH_LAYOUT_STEREO;
             st->codec->sample_rate           = sample_rate;
             st->codec->bits_per_coded_sample = bits_per_coded_sample;
         }
@@ -824,6 +827,7 @@ retry_duration:
                 if (avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata,
                                              st->codec->extradata_size * 8, 1) >= 0) {
                 st->codec->channels = cfg.channels;
+                st->codec->channel_layout = 0;
                 if (cfg.ext_sample_rate)
                     st->codec->sample_rate = cfg.ext_sample_rate;
                 else
diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c
index 7ec3df54c34e209c4c05db3d1d7a346249166ffc..98992661737ac3d5fbb8109d3bb5c807c28ceef4 100644
--- a/libavformat/gsmdec.c
+++ b/libavformat/gsmdec.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
@@ -63,6 +64,7 @@ static int gsm_read_header(AVFormatContext *s)
     st->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
     st->codec->codec_id    = s->iformat->raw_codec_id;
     st->codec->channels    = 1;
+    st->codec->channel_layout = AV_CH_LAYOUT_MONO;
     st->codec->sample_rate = c->sample_rate;
     st->codec->bit_rate    = GSM_BLOCK_SIZE * 8 * c->sample_rate / GSM_BLOCK_SAMPLES;
 
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index 4088088eef0c07db786074d2bdfc41d59407dc01..86e629135d910ec97e4d481429ffcbedfce253e9 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/common.h"
 #include "avformat.h"
 #include "internal.h"
@@ -141,6 +142,7 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
             st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
             st->codec->codec_id = AV_CODEC_ID_PCM_S24LE;
             st->codec->channels = 1;
+            st->codec->channel_layout = AV_CH_LAYOUT_MONO;
             st->codec->sample_rate = 48000;
             st->codec->bit_rate = 3 * 1 * 48000 * 8;
             st->codec->block_align = 3 * 1;
@@ -150,6 +152,7 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
             st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
             st->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
             st->codec->channels = 1;
+            st->codec->channel_layout = AV_CH_LAYOUT_MONO;
             st->codec->sample_rate = 48000;
             st->codec->bit_rate = 2 * 1 * 48000 * 8;
             st->codec->block_align = 2 * 1;
@@ -159,6 +162,7 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
             st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
             st->codec->codec_id = AV_CODEC_ID_AC3;
             st->codec->channels = 2;
+            st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
             st->codec->sample_rate = 48000;
             break;
         // timecode tracks:
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index 3b17ff420c431cce97c2b63590bb70eabb2bce27..6f843d7bc939f869915c4470a58e12bffc573513 100644
--- a/libavformat/idroqdec.c
+++ b/libavformat/idroqdec.c
@@ -27,6 +27,7 @@
  *   http://www.csse.monash.edu.au/~timf/
  */
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
@@ -178,7 +179,14 @@ static int roq_read_packet(AVFormatContext *s,
                 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
                 st->codec->codec_id = AV_CODEC_ID_ROQ_DPCM;
                 st->codec->codec_tag = 0;  /* no tag */
-                st->codec->channels = roq->audio_channels = chunk_type == RoQ_SOUND_STEREO ? 2 : 1;
+                if (chunk_type == RoQ_SOUND_STEREO) {
+                    st->codec->channels       = 2;
+                    st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+                } else {
+                    st->codec->channels       = 1;
+                    st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+                }
+                roq->audio_channels    = st->codec->channels;
                 st->codec->sample_rate = RoQ_AUDIO_SAMPLE_RATE;
                 st->codec->bits_per_coded_sample = 16;
                 st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
diff --git a/libavformat/iff.c b/libavformat/iff.c
index d559ad3c2ba138405d230a3472828954650ba869..c7213bc631255ccee3502422d1702e5d72c16396 100644
--- a/libavformat/iff.c
+++ b/libavformat/iff.c
@@ -28,10 +28,11 @@
  * http://wiki.multimedia.cx/index.php?title=IFF
  */
 
-#include "libavcodec/bytestream.h"
 #include "libavutil/avassert.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/dict.h"
+#include "libavcodec/bytestream.h"
 #include "avformat.h"
 #include "internal.h"
 
@@ -155,6 +156,7 @@ static int iff_read_header(AVFormatContext *s)
         return AVERROR(ENOMEM);
 
     st->codec->channels = 1;
+    st->codec->channel_layout = AV_CH_LAYOUT_MONO;
     avio_skip(pb, 8);
     // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content
     st->codec->codec_tag = avio_rl32(pb);
@@ -191,7 +193,13 @@ static int iff_read_header(AVFormatContext *s)
         case ID_CHAN:
             if (data_size < 4)
                 return AVERROR_INVALIDDATA;
-            st->codec->channels = (avio_rb32(pb) < 6) ? 1 : 2;
+            if (avio_rb32(pb) < 6) {
+                st->codec->channels       = 1;
+                st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+            } else {
+                st->codec->channels       = 2;
+                st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+            }
             break;
 
         case ID_CAMG:
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index 748f4a446755b3e3f88378ceb2b323751b2a0ee5..17ef7bb92f7bc0623874994faf4518a6462e3522 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -32,6 +32,7 @@
  * up and sending out the chunks.
  */
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
@@ -605,6 +606,8 @@ static int ipmovie_read_header(AVFormatContext *s)
         st->codec->codec_id = ipmovie->audio_type;
         st->codec->codec_tag = 0;  /* no tag */
         st->codec->channels = ipmovie->audio_channels;
+        st->codec->channel_layout = st->codec->channels == 1 ? AV_CH_LAYOUT_MONO :
+                                                               AV_CH_LAYOUT_STEREO;
         st->codec->sample_rate = ipmovie->audio_sample_rate;
         st->codec->bits_per_coded_sample = ipmovie->audio_bits;
         st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
diff --git a/libavformat/iss.c b/libavformat/iss.c
index 4268900840bc5d28ee3c4ad2336b495a0017d108..e4335b4cbfb0b1f96b7abb52b93f82f3aa12435f 100644
--- a/libavformat/iss.c
+++ b/libavformat/iss.c
@@ -26,6 +26,7 @@
  * @see http://wiki.multimedia.cx/index.php?title=FunCom_ISS
  */
 
+#include "libavutil/channel_layout.h"
 #include "avformat.h"
 #include "internal.h"
 #include "libavutil/avstring.h"
@@ -99,7 +100,13 @@ static av_cold int iss_read_header(AVFormatContext *s)
         return AVERROR(ENOMEM);
     st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
     st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_ISS;
-    st->codec->channels = stereo ? 2 : 1;
+    if (stereo) {
+        st->codec->channels       = 2;
+        st->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+    } else {
+        st->codec->channels       = 1;
+        st->codec->channel_layout = AV_CH_LAYOUT_MONO;
+    }
     st->codec->sample_rate = 44100;
     if(rate_divisor > 0)
          st->codec->sample_rate /= rate_divisor;
diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index 2eac265de7d5499e9fe12131d1a462611a5f7ac3..e94149276215dbed11ca682bc199357f0aac5481 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -25,6 +25,7 @@
  * @author Peter Ross <pross@xvid.org>
  */
 
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "internal.h"
@@ -91,6 +92,7 @@ static int read_header(AVFormatContext *s)
     ast->codec->codec_tag   = 0; /* no fourcc */
     ast->codec->sample_rate = avio_rl16(pb);
     ast->codec->channels    = 1;
+    ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
     avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
 
     avio_skip(pb, 10);