===================================================================
--- configure.in (revision 2781)
+++ configure.in (revision 2785)
echo " you will not hear any sound!"
-dnl If the warning below gets reported, then for further guidance:
-dnl vi +/REQUEST_CHANNELS decoder_plugins/ffmpeg/ffmpeg.c
-if test "x$want_ffmpeg" = "xyes" && \
- test "x$ac_cv_member_struct_AVCodecContext_request_channels" != "xyes"
- 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."
Index: decoder_plugins/ffmpeg/ffmpeg.m4
===================================================================
--- decoder_plugins/ffmpeg/ffmpeg.m4 (revision 2781)
+++ decoder_plugins/ffmpeg/ffmpeg.m4 (revision 2785)
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.])])
[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)
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>
+# include <libavutil/audioconvert.h>
/* FFmpeg also likes common names, without that, our common.h and log.h
- 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;
- data->enc->request_channel_layout = CH_LAYOUT_STEREO_DOWNMIX;