1dnl ffmpeg/libav 2 3AC_ARG_WITH(ffmpeg, AS_HELP_STRING([--without-ffmpeg], 4 [Compile without ffmpeg/libav])) 5 6if test "x$with_ffmpeg" != "xno" 7then 8 PKG_CHECK_MODULES(ffmpeg, libavutil libavcodec libavformat, 9 [ffmpeg_CPPFLAGS=`$PKG_CONFIG --cflags-only-I libavutil libavcodec libavformat` 10 AC_SUBST(ffmpeg_CPPFLAGS) 11 AC_SUBST(ffmpeg_CFLAGS) 12 AC_SUBST(ffmpeg_LIBS) 13 want_ffmpeg="yes"], 14 [AC_CHECK_PROG([FFMPEG_CONFIG], [ffmpeg-config], [yes]) 15 if test "x$FFMPEG_CONFIG" = "xyes" 16 then 17 ffmpeg_CPPFLAGS=`ffmpeg-config --cflags` 18 ffmpeg_CFLAGS=`ffmpeg-config --cflags` 19 avformat_LIBS=`ffmpeg-config --plugin-libs avformat` 20 avcodec_LIBS=`ffmpeg-config --plugin-libs avcodec` 21 avutil_LIBS=`ffmpeg-config --plugin-libs avutil` 22 ffmpeg_LIBS="$avformat_LIBS $avcodec_LIBS $avutil_LIBS" 23 AC_SUBST(ffmpeg_CPPFLAGS) 24 AC_SUBST(ffmpeg_CFLAGS) 25 AC_SUBST(ffmpeg_LIBS) 26 want_ffmpeg="yes" 27 fi]) 28 if test "x$want_ffmpeg" = "xyes" 29 then 30 if $PKG_CONFIG --max-version 53.47.99 libavcodec 31 then 32 FFMPEG_DEPRECATED="yes" 33 DECODER_PLUGINS="$DECODER_PLUGINS ffmpeg/libav" 34 elif test "`$PKG_CONFIG --modversion libavcodec | awk -F. '{ print $3; }'`" -gt 99 35 then 36 if ! $PKG_CONFIG --atleast-version 54.59.100 libavcodec 37 then 38 FFMPEG_DEPRECATED="yes" 39 fi 40 DECODER_PLUGINS="$DECODER_PLUGINS ffmpeg" 41 AC_DEFINE([HAVE_FFMPEG], 1, 42 [Define to 1 if you know you have FFmpeg.]) 43 else 44 if ! $PKG_CONFIG --atleast-version 55.34.1 libavcodec 45 then 46 FFMPEG_DEPRECATED="yes" 47 fi 48 DECODER_PLUGINS="$DECODER_PLUGINS ffmpeg(libav)" 49 AC_DEFINE([HAVE_LIBAV], 1, 50 [Define to 1 if you know you have LibAV.]) 51 fi 52 save_CPPFLAGS="$CPPFLAGS" 53 CPPFLAGS="$CPPFLAGS $ffmpeg_CPPFLAGS" 54 save_CFLAGS="$CFLAGS" 55 CFLAGS="$CFLAGS $ffmpeg_CFLAGS" 56 save_LIBS="$LIBS" 57 LIBS="$LIBS $ffmpeg_LIBS" 58 AC_CHECK_HEADERS(ffmpeg/avformat.h libavformat/avformat.h) 59 if test "x$ac_cv_header_ffmpeg_avformat_h" = "xyes" 60 then 61 AC_CHECK_MEMBERS([struct AVCodecContext.request_channels], [], [], 62 [#include <ffmpeg/avcodec.h>]) 63 else 64 AC_CHECK_MEMBERS([struct AVCodecContext.request_channels], [], [], 65 [#include <libavcodec/avcodec.h>]) 66 fi 67 AC_CHECK_HEADERS([ffmpeg/avformat.h \ 68 libavformat/avformat.h libavutil/channel_layout.h]) 69 AC_SEARCH_LIBS(avcodec_open2, avcodec, 70 [AC_DEFINE([HAVE_AVCODEC_OPEN2], 1, 71 [Define to 1 if you have the `avcodec_open2' function.])]) 72 AC_SEARCH_LIBS(avcodec_decode_audio2, avcodec, 73 [AC_DEFINE([HAVE_AVCODEC_DECODE_AUDIO2], 1, 74 [Define to 1 if you have the `avcodec_decode_audio2' function.])]) 75 AC_SEARCH_LIBS(avcodec_decode_audio3, avcodec, 76 [AC_DEFINE([HAVE_AVCODEC_DECODE_AUDIO3], 1, 77 [Define to 1 if you have the `avcodec_decode_audio3' function.])]) 78 AC_SEARCH_LIBS(avcodec_decode_audio4, avcodec, 79 [AC_DEFINE([HAVE_AVCODEC_DECODE_AUDIO4], 1, 80 [Define to 1 if you have the `avcodec_decode_audio4' function.])], 81 [AX_FUNC_POSIX_MEMALIGN]) 82 AC_SEARCH_LIBS(av_packet_unref, avcodec, 83 [AC_DEFINE([HAVE_AV_PACKET_UNREF], 1, 84 [Define to 1 if you have the `av_packet_unref' function.])]) 85 AC_SEARCH_LIBS(avformat_open_input, avformat, 86 [AC_DEFINE([HAVE_AVFORMAT_OPEN_INPUT], 1, 87 [Define to 1 if you have the `avformat_open_input' function.])]) 88 AC_SEARCH_LIBS(avformat_close_input, avformat, 89 [AC_DEFINE([HAVE_AVFORMAT_CLOSE_INPUT], 1, 90 [Define to 1 if you have the `avformat_close_input' function.])]) 91 AC_SEARCH_LIBS(avformat_find_stream_info, avformat, 92 [AC_DEFINE([HAVE_AVFORMAT_FIND_STREAM_INFO], 1, 93 [Define to 1 if you have the `avformat_find_stream_info' function.])]) 94 AC_SEARCH_LIBS(avio_size, avformat, 95 [AC_DEFINE([HAVE_AVIO_SIZE], 1, 96 [Define to 1 if you have the `avio_size' function.])]) 97 AC_CHECK_MEMBERS([AVIOContext.seekable], , , 98 [#include <libavformat/avformat.h>]) 99 AC_SEARCH_LIBS(av_metadata_get, avformat, 100 [AC_DEFINE([HAVE_AV_METADATA_GET], 1, 101 [Define to 1 if you have the `av_metadata_get' function.])]) 102 AC_SEARCH_LIBS(av_dict_get, avutil, 103 [AC_DEFINE([HAVE_AV_DICT_GET], 1, 104 [Define to 1 if you have the `av_dict_get' function.])]) 105 AC_SEARCH_LIBS(av_get_channel_layout_nb_channels, avutil, 106 [AC_DEFINE([HAVE_AV_GET_CHANNEL_LAYOUT_NB_CHANNELS], 1, 107 [Define to 1 if you have the `av_get_channel_layout_nb_channels' function.])]) 108 AC_CHECK_DECLS([CODEC_ID_MP2], , , 109 [#include <libavcodec/avcodec.h>]) 110 AC_CHECK_DECLS([AV_CODEC_ID_MP2], , , 111 [#include <libavcodec/avcodec.h>]) 112 AC_CHECK_DECLS([CODEC_ID_OPUS], , , 113 [#include <libavcodec/avcodec.h>]) 114 AC_CHECK_DECLS([AV_CODEC_ID_OPUS], , , 115 [#include <libavcodec/avcodec.h>]) 116 AC_CHECK_DECLS([CODEC_ID_SPEEX], , , 117 [#include <libavcodec/avcodec.h>]) 118 AC_CHECK_DECLS([AV_CODEC_ID_SPEEX], , , 119 [#include <libavcodec/avcodec.h>]) 120 AC_CHECK_DECLS([CODEC_ID_THEORA], , , 121 [#include <libavcodec/avcodec.h>]) 122 AC_CHECK_DECLS([AV_CODEC_ID_THEORA], , , 123 [#include <libavcodec/avcodec.h>]) 124 AC_CHECK_DECLS([CODEC_ID_VORBIS], , , 125 [#include <libavcodec/avcodec.h>]) 126 AC_CHECK_DECLS([AV_CODEC_ID_VORBIS], , , 127 [#include <libavcodec/avcodec.h>]) 128 AC_SEARCH_LIBS(av_frame_alloc, avutil, 129 [AC_DEFINE([HAVE_AV_FRAME_ALLOC], 1, 130 [Define to 1 if you have the `av_frame_alloc' function.])]) 131 AC_SEARCH_LIBS(av_frame_unref, avutil, 132 [AC_DEFINE([HAVE_AV_FRAME_UNREF], 1, 133 [Define to 1 if you have the `av_frame_unref' function.])]) 134 AC_SEARCH_LIBS(av_frame_free, avutil, 135 [AC_DEFINE([HAVE_AV_FRAME_FREE], 1, 136 [Define to 1 if you have the `av_frame_free' function.])]) 137 AC_SEARCH_LIBS(avcodec_free_frame, avcodec, 138 [AC_DEFINE([HAVE_AVCODEC_FREE_FRAME], 1, 139 [Define to 1 if you have the `avcodec_free_frame' function.])]) 140 AC_CHECK_DECLS([CODEC_ID_PCM_S8], , , 141 [#include <libavcodec/avcodec.h>]) 142 AC_CHECK_DECLS([CODEC_ID_PCM_S8_PLANAR], , , 143 [#include <libavcodec/avcodec.h>]) 144 AC_CHECK_DECLS([AV_CODEC_ID_PCM_S8_PLANAR], , , 145 [#include <libavcodec/avcodec.h>]) 146 AC_CHECK_DECLS([CODEC_ID_PCM_U8], , , 147 [#include <libavcodec/avcodec.h>]) 148 AC_CHECK_DECLS([CODEC_ID_PCM_S16LE], , , 149 [#include <libavcodec/avcodec.h>]) 150 AC_CHECK_DECLS([CODEC_ID_PCM_S16LE_PLANAR], , , 151 [#include <libavcodec/avcodec.h>]) 152 AC_CHECK_DECLS([AV_CODEC_ID_PCM_S16LE_PLANAR], , , 153 [#include <libavcodec/avcodec.h>]) 154 AC_CHECK_DECLS([CODEC_ID_PCM_S16BE], , , 155 [#include <libavcodec/avcodec.h>]) 156 AC_CHECK_DECLS([CODEC_ID_PCM_U16LE], , , 157 [#include <libavcodec/avcodec.h>]) 158 AC_CHECK_DECLS([CODEC_ID_PCM_U16BE], , , 159 [#include <libavcodec/avcodec.h>]) 160 AC_CHECK_DECLS([CODEC_ID_PCM_S24LE], , , 161 [#include <libavcodec/avcodec.h>]) 162 AC_CHECK_DECLS([CODEC_ID_PCM_S24BE], , , 163 [#include <libavcodec/avcodec.h>]) 164 AC_CHECK_DECLS([CODEC_ID_PCM_U24LE], , , 165 [#include <libavcodec/avcodec.h>]) 166 AC_CHECK_DECLS([CODEC_ID_PCM_U24BE], , , 167 [#include <libavcodec/avcodec.h>]) 168 AC_CHECK_DECLS([CODEC_ID_PCM_S32LE], , , 169 [#include <libavcodec/avcodec.h>]) 170 AC_CHECK_DECLS([CODEC_ID_PCM_S32BE], , , 171 [#include <libavcodec/avcodec.h>]) 172 AC_CHECK_DECLS([CODEC_ID_PCM_U32LE], , , 173 [#include <libavcodec/avcodec.h>]) 174 AC_CHECK_DECLS([CODEC_ID_PCM_U32BE], , , 175 [#include <libavcodec/avcodec.h>]) 176 AC_CHECK_DECLS([AV_SAMPLE_FMT_U8], , , 177 [#include <libavcodec/avcodec.h>]) 178 AC_CHECK_DECLS([AV_SAMPLE_FMT_U8P], , , 179 [#include <libavcodec/avcodec.h>]) 180 AC_CHECK_DECLS([AV_SAMPLE_FMT_S16P], , , 181 [#include <libavcodec/avcodec.h>]) 182 AC_CHECK_DECLS([AV_SAMPLE_FMT_U16LE], , , 183 [#include <libavcodec/avcodec.h>]) 184 AC_CHECK_DECLS([AV_SAMPLE_FMT_U16BE], , , 185 [#include <libavcodec/avcodec.h>]) 186 AC_CHECK_DECLS([AV_SAMPLE_FMT_U24LE], , , 187 [#include <libavcodec/avcodec.h>]) 188 AC_CHECK_DECLS([AV_SAMPLE_FMT_U24BE], , , 189 [#include <libavcodec/avcodec.h>]) 190 AC_CHECK_DECLS([AV_SAMPLE_FMT_S32P], , , 191 [#include <libavcodec/avcodec.h>]) 192 AC_CHECK_DECLS([AV_SAMPLE_FMT_U32LE], , , 193 [#include <libavcodec/avcodec.h>]) 194 AC_CHECK_DECLS([AV_SAMPLE_FMT_U32BE], , , 195 [#include <libavcodec/avcodec.h>]) 196 AC_CHECK_DECLS([AV_SAMPLE_FMT_FLTP], , , 197 [#include <libavcodec/avcodec.h>]) 198 AC_CHECK_DECLS([CODEC_CAP_EXPERIMENTAL], , , 199 [#include <libavcodec/avcodec.h>]) 200 AC_SEARCH_LIBS(av_get_sample_fmt_name, avutil, 201 [AC_DEFINE([HAVE_AV_GET_SAMPLE_FMT_NAME], 1, 202 [Define to 1 if you have the `av_get_sample_fmt_name' function.])]) 203 AC_SEARCH_LIBS(av_lockmgr_register, avcodec, 204 [AC_DEFINE([HAVE_LOCKMGR_REGISTER], 1, 205 [Define to 1 if you have the `av_lockmgr_register' function.])]) 206 CPPFLAGS="$save_CPPFLAGS" 207 CFLAGS="$save_CFLAGS" 208 LIBS="$save_LIBS" 209 fi 210fi 211 212AM_CONDITIONAL([BUILD_ffmpeg], [test "$want_ffmpeg"]) 213AC_CONFIG_FILES([decoder_plugins/ffmpeg/Makefile]) 214