########################################
# check if dxva2 is available.
-if test "$dxva2" = "yes" ; then
- dxva2="no"
-if test "$mingw32" = "yes" ; then
+check_dxva2() {
+
cat > $TMPC << EOF
#include <d3d9.h>
#include <dxva2api.h>
EOF
if compile_prog "" "" ; then
dxva2="yes"
-fi
else
- error_exit "DXVA2 is supported only on Windows"
+ dxva2="no"
fi
+
+}
+
+if test "$dxva2" != "no" ; then
+ if test "$mingw32" != "no" ; then
+ check_dxva2
+ if test "$dxva2" != "yes" ; then
+ feature_not_found "dxva2"
+ fi
+ else
+ error_exit "DXVA2 is supported only on Windows"
+ fi
+else
+ check_dxva2
fi
########################################
# check if vaapi is available.
-if test "$vaapi" = "yes" ; then
- vaapi="no"
-if test "$linux" = "yes" ; then
- if $pkg_config libva --exists; then
- if $pkg_config libva-x11 --exists; then
- libva_cflags=`$pkg_config --cflags libva`
- libva_libs=`$pkg_config --libs libva`
- libva_x11_cflags=`$pkg_config --cflags libva-x11`
- libva_x11_libs=`$pkg_config --libs libva-x11`
-
- libs_softmmu="$libva_libs $libva_x11_libs $libs_softmmu"
- vaapi="yes"
- fi
- fi
+check_vaapi() {
+
+if $pkg_config libva --exists; then
+ libva_cflags=`$pkg_config --cflags libva`
+ libva_libs=`$pkg_config --libs libva`
+ vaapi="yes"
else
- error_exit "VAAPI is supported only on Linux"
+ vaapi="no"
fi
+
+if $pkg_config libva-x11 --exists; then
+ libva_x11_cflags=`$pkg_config --cflags libva-x11`
+ libva_x11_libs=`$pkg_config --libs libva-x11`
+ libs_softmmu="$libva_libs $libva_x11_libs $libs_softmmu"
+ vaapi="yes"
+else
+ vaapi="no"
+fi
+
+}
+
+if test "$vaapi" != "no" ; then
+ if test "$linux" != "no" ; then
+ check_vaapi
+ if test "$vaapi" != "yes" ; then
+ feature_not_found "vaapi"
+ fi
+ else
+ error_exit "VAAPI is supported only on Linux"
+ fi
+else
+ check_vappi
fi
##########################################
# libav probe
+libavcodec_package="libavcodec"
+libavcodec_version="54.35.0"
+libavutil_package="libavutil"
+libavutil_version="52.3.0"
+libavformat_package="libavformat"
+libavformat_version="54.20.3"
+libavresample_package="libavresample"
+libavresample_version="1.0.1"
+
+check_libav() {
+echo "check $1"
+
+if $pkg_config --exists "$1 >= $2" ; then
+ libav_cflags=`$pkg_config --cflags $1`
+ libav_libs=`$pkg_config --libs $1`
+ libs_softmmu="$libav_libs $libs_softmmu"
+ libav="yes"
+else
+ libav="no"
+fi
+
+}
+
if test "$libav" != "no"; then
- libavcodec_package="libavcodec"
- libavcodec_version="54.35.0"
- libavutil_package="libavutil"
- libavutil_version="52.3.0"
- libavformat_package="libavformat"
- libavformat_version="54.20.3"
- libavresample_package="libavresample"
- libavresample_version="1.0.1"
-
- if $pkg_config --exists "$libavcodec_package >= $libavcodec_version" ; then
- libav_cflags=`$pkg_config --cflags $libavcodec_package`
- libav_libs=`$pkg_config --libs $libavcodec_package`
- libs_softmmu="$libav_libs $libs_softmmu"
- libav="yes"
- else
- #if test "$libav" = "yes" ; then
- # feature_not_found "libav"
- #fi
- libav="no"
- fi
+ check_libav $libavcodec_package $libavcodec_version
+ if test "$libav" != "yes"; then
+ feature_not_found "libav"
+ fi
- if $pkg_config --exists "$libavutil_package >= $libavutil_version" ; then
- libav_libs=`$pkg_config --libs-only-l $libavutil_package`
- libs_softmmu="$libav_libs $libs_softmmu"
- libav="yes"
- else
- #if test "$libav" = "yes" ; then
- # feature_not_found "libav"
- #fi
- libav="no"
- fi
+ check_libav $libavformat_package $libavformat_version
+ if test "$libav" != "yes"; then
+ feature_not_found "libav"
+ fi
- if $pkg_config --exists "$libavformat_package >= $libavformat_version" ; then
- libav_libs=`$pkg_config --libs-only-l $libavformat_package`
- libs_softmmu="$libav_libs $libs_softmmu"
- libav="yes"
- else
- #if test "$libav" = "yes" ; then
- # feature_not_found "libav"
- #fi
- libav="no"
- fi
+ check_libav $libavutil_package $libavutil_version
+ if test "$libav" != "yes"; then
+ feature_not_found "libav"
+ fi
- if $pkg_config --exists "$libavresample_package >= $libavresample_version" ; then
- libav_libs=`$pkg_config --libs-only-l $libavresample_package`
- libs_softmmu="$libav_libs $libs_softmmu"
- libav="yes"
- else
- #if test "$libav" = "yes" ; then
- # feature_not_found "libav"
- #fi
- libav="no"
- fi
+ check_libav $libavresample_package $libavresample_version
+ if test "$libav" != "yes"; then
+ feature_not_found "libav"
+ fi
+else
+ check_libav $libavcodec_package $libavcodec_version
+
+ check_libav $libavformat_package $libavformat_version
+
+ check_libav $libavutil_package $libavutil_version
+ check_libav $libavresample_package $libavresample_version
fi
##########################################