[FFmpeg-devel] [PATCH] qsv: Use the installed mfx include headers if possibile
Haihao Xiang
haihao.xiang at intel.com
Fri May 11 10:52:42 EEST 2018
Currently an extra copy of mfx include headers from {MSDK_INSTALL_PREFIX}/include
to {MSDK_INSTALL_PREFIX}/include/mfx is required when using pkg-config for
libmfx detection. This fix checks the installed mfx include headers first,
and falls back to the legacy way if that fails
Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>
---
configure | 3 ++-
fftools/ffmpeg_qsv.c | 5 +++++
libavcodec/qsv.c | 10 ++++++++++
libavcodec/qsv.h | 4 ++++
libavcodec/qsv_internal.h | 4 ++++
libavcodec/qsvdec.c | 4 ++++
libavcodec/qsvdec.h | 4 ++++
libavcodec/qsvdec_h2645.c | 4 ++++
libavcodec/qsvdec_other.c | 4 ++++
libavcodec/qsvenc.c | 5 +++++
libavcodec/qsvenc.h | 4 ++++
libavcodec/qsvenc_h264.c | 4 ++++
libavcodec/qsvenc_hevc.c | 4 ++++
libavcodec/qsvenc_jpeg.c | 4 ++++
libavcodec/qsvenc_mpeg2.c | 4 ++++
libavfilter/qsvvpp.h | 4 ++++
libavfilter/vf_deinterlace_qsv.c | 4 ++++
libavfilter/vf_scale_qsv.c | 4 ++++
libavutil/hwcontext_opencl.c | 4 ++++
libavutil/hwcontext_qsv.c | 4 ++++
libavutil/hwcontext_qsv.h | 4 ++++
21 files changed, 90 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index a1f13a7109..e1f72495fb 100755
--- a/configure
+++ b/configure
@@ -6007,7 +6007,8 @@ enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kv
# Media SDK or Intel Media Server Studio, these don't come with
# pkg-config support. Instead, users should make sure that the build
# can find the libraries and headers through other means.
-enabled libmfx && { check_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit ||
+enabled libmfx && { { check_pkg_config libmfx libmfx "mfxvideo.h" MFXInit && add_cflags -DMFX_DEFAULT_INC_PATH; } ||
+ { check_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit; } ||
{ require libmfx "mfx/mfxvideo.h" MFXInit "-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; } }
enabled libmodplug && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load
enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs
diff --git a/fftools/ffmpeg_qsv.c b/fftools/ffmpeg_qsv.c
index 7442750029..aa6f8d5270 100644
--- a/fftools/ffmpeg_qsv.c
+++ b/fftools/ffmpeg_qsv.c
@@ -16,7 +16,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
+
#include <stdlib.h>
#include "libavutil/dict.h"
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 45e1c25c68..88f68d6ab5 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -18,9 +18,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#include <mfxplugin.h>
+#include <mfxjpeg.h>
+#else
#include <mfx/mfxvideo.h>
#include <mfx/mfxplugin.h>
#include <mfx/mfxjpeg.h>
+#endif
#include <stdio.h>
#include <string.h>
@@ -36,8 +42,12 @@
#include "qsv_internal.h"
#if QSV_VERSION_ATLEAST(1, 12)
+#ifdef MFX_DEFAULT_INC_PATH
+#include "mfxvp8.h"
+#else
#include "mfx/mfxvp8.h"
#endif
+#endif
int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
{
diff --git a/libavcodec/qsv.h b/libavcodec/qsv.h
index b77158ec26..0116fe9422 100644
--- a/libavcodec/qsv.h
+++ b/libavcodec/qsv.h
@@ -21,7 +21,11 @@
#ifndef AVCODEC_QSV_H
#define AVCODEC_QSV_H
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "libavutil/buffer.h"
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 394c558883..f77ad63664 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -21,7 +21,11 @@
#ifndef AVCODEC_QSV_INTERNAL_H
#define AVCODEC_QSV_INTERNAL_H
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "libavutil/frame.h"
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 32f1fe79d7..9921158100 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -24,7 +24,11 @@
#include <string.h>
#include <sys/types.h>
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "libavutil/common.h"
#include "libavutil/hwcontext.h"
diff --git a/libavcodec/qsvdec.h b/libavcodec/qsvdec.h
index 5b7b03a48b..3b4541fff1 100644
--- a/libavcodec/qsvdec.h
+++ b/libavcodec/qsvdec.h
@@ -26,7 +26,11 @@
#include <stdint.h>
#include <sys/types.h>
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "libavutil/fifo.h"
#include "libavutil/frame.h"
diff --git a/libavcodec/qsvdec_h2645.c b/libavcodec/qsvdec_h2645.c
index 831252f2d7..e2b90afee9 100644
--- a/libavcodec/qsvdec_h2645.c
+++ b/libavcodec/qsvdec_h2645.c
@@ -25,7 +25,11 @@
#include <stdint.h>
#include <string.h>
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "libavutil/common.h"
#include "libavutil/fifo.h"
diff --git a/libavcodec/qsvdec_other.c b/libavcodec/qsvdec_other.c
index 3c872dcfc2..dd0082164b 100644
--- a/libavcodec/qsvdec_other.c
+++ b/libavcodec/qsvdec_other.c
@@ -24,7 +24,11 @@
#include <stdint.h>
#include <string.h>
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "libavutil/common.h"
#include "libavutil/fifo.h"
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 3ce5ffecd5..3dbb23716c 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -23,7 +23,12 @@
#include <string.h>
#include <sys/types.h>
+
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "libavutil/common.h"
#include "libavutil/hwcontext.h"
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index d48272224c..16cd74eccf 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -26,7 +26,11 @@
#include <stdint.h>
#include <sys/types.h>
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "libavutil/avutil.h"
#include "libavutil/fifo.h"
diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c
index 7aa65e96bc..6ba85ea50a 100644
--- a/libavcodec/qsvenc_h264.c
+++ b/libavcodec/qsvenc_h264.c
@@ -24,7 +24,11 @@
#include <stdint.h>
#include <sys/types.h>
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "libavutil/common.h"
#include "libavutil/opt.h"
diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
index 4339b316a3..a5ed2ef38b 100644
--- a/libavcodec/qsvenc_hevc.c
+++ b/libavcodec/qsvenc_hevc.c
@@ -22,7 +22,11 @@
#include <stdint.h>
#include <sys/types.h>
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "libavutil/common.h"
#include "libavutil/opt.h"
diff --git a/libavcodec/qsvenc_jpeg.c b/libavcodec/qsvenc_jpeg.c
index c18fe91940..b0300faa33 100644
--- a/libavcodec/qsvenc_jpeg.c
+++ b/libavcodec/qsvenc_jpeg.c
@@ -22,7 +22,11 @@
#include <stdint.h>
#include <sys/types.h>
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "libavutil/common.h"
#include "libavutil/opt.h"
diff --git a/libavcodec/qsvenc_mpeg2.c b/libavcodec/qsvenc_mpeg2.c
index a7427d8109..ff1907237b 100644
--- a/libavcodec/qsvenc_mpeg2.c
+++ b/libavcodec/qsvenc_mpeg2.c
@@ -22,7 +22,11 @@
#include <stdint.h>
#include <sys/types.h>
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "libavutil/common.h"
#include "libavutil/opt.h"
diff --git a/libavfilter/qsvvpp.h b/libavfilter/qsvvpp.h
index ff02b64c41..401bc45bd4 100644
--- a/libavfilter/qsvvpp.h
+++ b/libavfilter/qsvvpp.h
@@ -24,7 +24,11 @@
#ifndef AVFILTER_QSVVPP_H
#define AVFILTER_QSVVPP_H
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "avfilter.h"
diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c
index c9e76c6056..45db51b7cf 100644
--- a/libavfilter/vf_deinterlace_qsv.c
+++ b/libavfilter/vf_deinterlace_qsv.c
@@ -21,7 +21,11 @@
* deinterlace video filter - QSV
*/
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include <stdio.h>
#include <string.h>
diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c
index d1189942d1..f242a49f96 100644
--- a/libavfilter/vf_scale_qsv.c
+++ b/libavfilter/vf_scale_qsv.c
@@ -21,7 +21,11 @@
* scale video filter - QSV
*/
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include <stdio.h>
#include <string.h>
diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 43b5c5ae0c..ab105287d1 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -46,7 +46,11 @@
#endif
#if HAVE_OPENCL_VAAPI_INTEL_MEDIA
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxstructures.h>
+#else
#include <mfx/mfxstructures.h>
+#endif
#include <va/va.h>
#include <CL/va_ext.h>
#include "hwcontext_vaapi.h"
diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 250091c4e8..61e7a55e99 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -19,7 +19,11 @@
#include <stdint.h>
#include <string.h>
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
#include "config.h"
diff --git a/libavutil/hwcontext_qsv.h b/libavutil/hwcontext_qsv.h
index b98d611cfc..56180394fc 100644
--- a/libavutil/hwcontext_qsv.h
+++ b/libavutil/hwcontext_qsv.h
@@ -19,7 +19,11 @@
#ifndef AVUTIL_HWCONTEXT_QSV_H
#define AVUTIL_HWCONTEXT_QSV_H
+#ifdef MFX_DEFAULT_INC_PATH
+#include <mfxvideo.h>
+#else
#include <mfx/mfxvideo.h>
+#endif
/**
* @file
--
2.17.0
More information about the ffmpeg-devel
mailing list