diff options
-rw-r--r-- | audio/filter/af_lavrresample.c | 3 | ||||
-rw-r--r-- | common/av_log.c | 8 | ||||
-rw-r--r-- | wscript | 91 |
3 files changed, 59 insertions, 43 deletions
diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c index 828be66247..47c374b227 100644 --- a/audio/filter/af_lavrresample.c +++ b/audio/filter/af_lavrresample.c @@ -36,6 +36,9 @@ #include "common/common.h" #include "config.h" +#define HAVE_LIBSWRESAMPLE HAVE_IS_FFMPEG +#define HAVE_LIBAVRESAMPLE HAVE_IS_LIBAV + #if HAVE_LIBAVRESAMPLE #include <libavresample/avresample.h> #elif HAVE_LIBSWRESAMPLE diff --git a/common/av_log.c b/common/av_log.c index e2a4c3316e..c779fe9c8d 100644 --- a/common/av_log.c +++ b/common/av_log.c @@ -42,10 +42,10 @@ #include <libavdevice/avdevice.h> #endif -#if HAVE_LIBAVRESAMPLE +#if HAVE_IS_LIBAV #include <libavresample/avresample.h> #endif -#if HAVE_LIBSWRESAMPLE +#if HAVE_IS_FFMPEG #include <libswresample/swresample.h> #endif @@ -197,10 +197,10 @@ bool print_libav_versions(struct mp_log *log, int v) {"libavformat", LIBAVFORMAT_VERSION_INT, avformat_version()}, {"libswscale", LIBSWSCALE_VERSION_INT, swscale_version()}, {"libavfilter", LIBAVFILTER_VERSION_INT, avfilter_version()}, -#if HAVE_LIBAVRESAMPLE +#if HAVE_IS_LIBAV {"libavresample", LIBAVRESAMPLE_VERSION_INT, avresample_version()}, #endif -#if HAVE_LIBSWRESAMPLE +#if HAVE_IS_FFMPEG {"libswresample", LIBSWRESAMPLE_VERSION_INT, swresample_version()}, #endif }; @@ -386,55 +386,68 @@ iconv support use --disable-iconv.", } ] -# Libav 12: -# libavutil 55.20.0 -# libavcodec 57.25.0 -# libavformat 57.7.2 -# libswscale 4.0.0 -# libavfilter 6.7.0 -# libavresample 3.0.0 -# FFmpeg 3.2.2: -# libavutil 55.34.100 -# libavcodec 57.64.101 -# libavformat 57.56.100 -# libswscale 4.2.100 -# libavfilter 6.65.100 -# libswresample 2.3.100 - +ffmpeg_version = "3.2.2" +ffmpeg_pkg_config_checks = [ + 'libavutil', '>= 55.34.100', + 'libavcodec', '>= 57.64.100', + 'libavformat', '>= 57.56.100', + 'libswscale', '>= 4.2.100', + 'libavfilter', '>= 6.65.100', + 'libswresample', '>= 2.3.100', +] +libav_version = "12" libav_pkg_config_checks = [ - 'libavutil', '>= 55.20.0', - 'libavcodec', '>= 57.25.0', - 'libavformat', '>= 57.07.0', - 'libswscale', '>= 4.0.0', - 'libavfilter', '>= 6.7.0', + 'libavutil', '>= 55.20.0', + 'libavcodec', '>= 57.25.0', + 'libavformat', '>= 57.7.0', + 'libswscale', '>= 4.0.0', + 'libavfilter', '>= 6.7.0', + 'libavresample', '>= 3.0.0', ] -libav_versions_string = "FFmpeg 3.2.2 or Libav 12" + +libav_versions_string = "FFmpeg %s or Libav %s" % (ffmpeg_version, libav_version) + +def check_ffmpeg_or_libav_versions(): + def fn(ctx, dependency_identifier, **kw): + versions = ffmpeg_pkg_config_checks + if ctx.dependency_satisfied('is_libav'): + versions = libav_pkg_config_checks + return check_pkg_config(*versions)(ctx, dependency_identifier, **kw) + return fn libav_dependencies = [ { + 'name': 'libavcodec', + 'desc': 'FFmpeg/Libav present', + 'func': check_pkg_config('libavcodec'), + 'req': True, + 'fmsg': "FFmpeg/Libav development files not found.", + }, { + 'name': 'is_ffmpeg', + 'desc': 'libav* is FFmpeg', + # FFmpeg <=> LIBAVUTIL_VERSION_MICRO>=100 + 'func': check_statement('libavcodec/version.h', + 'int x[LIBAVCODEC_VERSION_MICRO >= 100 ? 1 : -1]', + use='libavcodec') + }, { + # This check should always result in the opposite of is_ffmpeg. + # Run it to make sure is_ffmpeg didn't fail for some other reason than + # the actual version check. + 'name': 'is_libav', + 'desc': 'libav* is Libav', + # FFmpeg <=> LIBAVUTIL_VERSION_MICRO>=100 + 'func': check_statement('libavcodec/version.h', + 'int x[LIBAVCODEC_VERSION_MICRO >= 100 ? -1 : 1]', + use='libavcodec') + }, { 'name': 'libav', - 'desc': 'libav/ffmpeg', - 'func': check_pkg_config(*libav_pkg_config_checks), + 'desc': 'Libav/FFmpeg library versions', + 'deps_any': [ 'is_ffmpeg', 'is_libav' ], + 'func': check_ffmpeg_or_libav_versions(), 'req': True, 'fmsg': "Unable to find development files for some of the required \ FFmpeg/Libav libraries. You need at least {0}. Aborting.".format(libav_versions_string) }, { - 'name': '--libswresample', - 'desc': 'libswresample', - 'func': check_pkg_config('libswresample', '>= 2.3.100'), - }, { - 'name': '--libavresample', - 'desc': 'libavresample', - 'func': check_pkg_config('libavresample', '>= 3.0.0'), - 'deps_neg': ['libswresample'], - }, { - 'name': 'resampler', - 'desc': 'usable resampler found', - 'deps_any': [ 'libavresample', 'libswresample' ], - 'func': check_true, - 'req': True, - 'fmsg': 'No resampler found. Install libavresample or libswresample (FFmpeg).' - }, { 'name': '--libavdevice', 'desc': 'libavdevice', 'func': check_pkg_config('libavdevice', '>= 57.0.0'), |