Index: configure.in
===================================================================
--- configure.in	(revision 2781)
+++ configure.in	(revision 2785)
@@ -483,19 +483,3 @@
 	echo "         you will not hear any sound!"
 	echo
 fi
-
-dnl
-dnl  If the warning below gets reported, then for further guidance:
-dnl
-dnl         vi +/REQUEST_CHANNELS decoder_plugins/ffmpeg/ffmpeg.c
-dnl
-if test "x$want_ffmpeg" = "xyes" && \
-   test "x$ac_cv_member_struct_AVCodecContext_request_channels" != "xyes"
-then
-	echo "WARNING: It appears that the FFmpeg/LibAV API has changed and no longer"
-	echo "         supports downmixing to stereo as it did previously.  Report"
-	echo "         this message along with the output of 'ffmpeg -version' to"
-	echo "         <$PACKAGE_BUGREPORT>.  Meanwhile, you may have to live without"
-	echo "         stereo downmixing."
-	echo
-fi
Index: decoder_plugins/ffmpeg/ffmpeg.m4
===================================================================
--- decoder_plugins/ffmpeg/ffmpeg.m4	(revision 2781)
+++ decoder_plugins/ffmpeg/ffmpeg.m4	(revision 2785)
@@ -39,6 +39,8 @@
 		LIBS="$LIBS $ffmpeg_LIBS"
 		AC_CHECK_MEMBERS([struct AVCodecContext.request_channels], [], [],
 	                     [#include <libavcodec/avcodec.h>])
+		AC_CHECK_HEADERS([ffmpeg/avformat.h \
+		                  libavformat/avformat.h libavutil/channel_layout.h])
 		AC_SEARCH_LIBS(avcodec_open2, avcodec,
 			[AC_DEFINE([HAVE_AVCODEC_OPEN2], 1,
 				[Define to 1 if you have the `avcodec_open2' function.])])
@@ -46,6 +48,9 @@
 			[AC_DEFINE([HAVE_AVCODEC_DECODE_AUDIO4], 1,
 				[Define to 1 if you have the `avcodec_decode_audio4' function.])],
 			[AX_FUNC_POSIX_MEMALIGN])
+		AC_SEARCH_LIBS(av_packet_unref, avcodec,
+			[AC_DEFINE([HAVE_AV_PACKET_UNREF], 1,
+				[Define to 1 if you have the `av_packet_unref' function.])])
 		AC_SEARCH_LIBS(avformat_close_input, avformat,
 			[AC_DEFINE([HAVE_AVFORMAT_CLOSE_INPUT], 1,
 				[Define to 1 if you have the `avformat_close_input' function.])])
Index: decoder_plugins/ffmpeg/ffmpeg.c
===================================================================
--- decoder_plugins/ffmpeg/ffmpeg.c	(revision 2781)
+++ decoder_plugins/ffmpeg/ffmpeg.c	(revision 2785)
@@ -66,7 +66,11 @@
 GCC_DIAG_ON(deprecated-declarations)
 #include <libavutil/mathematics.h>
 #ifdef HAVE_AV_GET_CHANNEL_LAYOUT_NB_CHANNELS
-#include <libavutil/audioconvert.h>
+# if HAVE_LIBAVUTIL_CHANNEL_LAYOUT_H
+#  include <libavutil/channel_layout.h>
+# else
+#  include <libavutil/audioconvert.h>
+# endif
 #endif
 
 /* FFmpeg also likes common names, without that, our common.h and log.h
@@ -781,32 +785,11 @@
 		return;
 #endif
 
-	data->enc->channels = 2;
-
 #ifdef HAVE_STRUCT_AVCODECCONTEXT_REQUEST_CHANNELS
-
-	/*
-	 * When FFmpeg breaks its API (and it will), this code will be
-	 * disabled and users will complain that MOC no longer downmixes
-	 * to stereo.  This is because the 'request_channels' field in
-	 * AVCodecContext is marked as deprecated (and so will probably
-	 * be removed at some time) but FFmpeg requires it to be set to
-	 * trigger downmixing (go figure!).  Currently, there is no
-	 * guidance on how it will work in the future, but looking at
-	 * where 's->downmixed' is set near the end of 'ac3_decode_init()'
-	 * in the FFmpeg's source code file 'libavcodec/ac3dec.c' might
-	 * help (in the absence of proper documentation).
-	 */
-
 	set_request_channels (data->enc, 2);
-
-#ifdef AV_CH_LAYOUT_STEREO_DOWNMIX
-	data->enc->request_channel_layout = AV_CH_LAYOUT_STEREO_DOWNMIX;
 #else
-	data->enc->request_channel_layout = CH_LAYOUT_STEREO_DOWNMIX;
+	data->enc->request_channel_layout = AV_CH_LAYOUT_STEREO;
 #endif
-
-#endif
 }
 
 static void *ffmpeg_open (const char *file)
@@ -1076,7 +1059,12 @@
 {
 	assert (pkt);
 
+#if HAVE_AV_PACKET_UNREF
+	av_packet_unref (pkt);
+#else
 	av_free_packet (pkt);
+#endif
+
 	free (pkt);
 }
 
Index: decoder_plugins/ffmpeg/ffmpeg.m4
===================================================================
--- decoder_plugins/ffmpeg/ffmpeg.m4	(revision 2799)
+++ decoder_plugins/ffmpeg/ffmpeg.m4	(revision 2800)
@@ -39,8 +39,7 @@
 		LIBS="$LIBS $ffmpeg_LIBS"
 		AC_CHECK_MEMBERS([struct AVCodecContext.request_channels], [], [],
 	                     [#include <libavcodec/avcodec.h>])
-		AC_CHECK_HEADERS([ffmpeg/avformat.h \
-		                  libavformat/avformat.h libavutil/channel_layout.h])
+		AC_CHECK_HEADERS([libavutil/channel_layout.h])
 		AC_SEARCH_LIBS(avcodec_open2, avcodec,
 			[AC_DEFINE([HAVE_AVCODEC_OPEN2], 1,
 				[Define to 1 if you have the `avcodec_open2' function.])])
