From 2afef344fb76f534426c047a3d5077e761a2e00a Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 11 Jan 2017 16:27:58 +0100 Subject: vaapi: support new libavcodec vaapi API The old API is deprecated, and libavcodec prints a warning at runtime. The new API is a bit nicer and does many things for you, such as managing the underlying hwaccel decoder. libavutil also provides code for managing surfaces (we use their surface pool). The new code does not contain any code from the original MPlayer VAAPI patch (that was used as base for some of the vaapi code in mpv). Thus the new code is LGPL. The new API actually does not add any visible symbols, so the only way to detect it is a version check. Of course, the versions overlap between FFmpeg and Libav, which requires additional care. The new API did not get merged into FFmpeg yet, so there's no check for FFmpeg. --- wscript | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'wscript') diff --git a/wscript b/wscript index 086b84fd28..891f975027 100644 --- a/wscript +++ b/wscript @@ -419,6 +419,13 @@ libav_dependencies = [ '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': 'is_ffmpeg', + 'desc': 'libav* is FFmpeg', + # FFmpeg <=> LIBAVUTIL_VERSION_MICRO>=100 + 'func': check_statement('libavutil/version.h', + 'int x[LIBAVUTIL_VERSION_MICRO >= 100 ? 1 : -1]', + use='libav') }, { 'name': '--libswresample', 'desc': 'libswresample', @@ -833,6 +840,20 @@ hwaccel_features = [ 'desc': 'libavcodec VAAPI hwaccel', 'deps': [ 'vaapi' ], 'func': check_headers('libavcodec/vaapi.h', use='libav'), + }, { + 'name': '--vaapi-hwaccel-new', + 'desc': 'libavcodec VAAPI hwaccel (new)', + 'deps': [ 'vaapi-hwaccel' ], + 'deps_neg': [ 'is_ffmpeg' ], + 'func': check_statement('libavcodec/version.h', + 'int x[LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 26, 0) ? 1 : -1]', + use='libav'), + }, { + 'name': '--vaapi-hwaccel-old', + 'desc': 'libavcodec VAAPI hwaccel (old)', + 'deps': [ 'vaapi-hwaccel' ], + 'deps_neg': [ 'vaapi-hwaccel-new' ], + 'func': check_true, }, { 'name': '--videotoolbox-hwaccel', 'desc': 'libavcodec videotoolbox hwaccel', -- cgit v1.2.3