Re: [FFmpeg-devel] [PATCH] qsv: Use the installed mfx include headers if possibile

2018-05-14 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Xiang, Haihao
> Sent: Monday, May 14, 2018 10:38 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH] qsv: Use the installed mfx include
> headers if possibile
> 
> On Mon, 2018-05-14 at 00:50 +, Xiang, Haihao wrote:
> > > On 11/05/18 08:52, Haihao Xiang wrote:
> > > > 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.xi...@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(-)
> > >
> > > I don't think it's a good idea to put an #ifdef like this in every file.
> > >
> > > >
> > > > 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
> > >
> > > So in the current code, the first test is for the open-source
> > > dispatcher (), which gets
> > > used everywhere that pkgconfig is supported, including mingw on
> > > Windows.  The second test is for Windows cases where you can't make
> > > make pkgconfig work.
> > >
> > > What installs the headers directly in $PREFIX/include?  Presumably
> > > this is a new change - can we ask them not to do that?  (Because
> > > organising them in a subdirectory is I think much more sensible.)
> > >
> >
> > Link below is the open-source version of MediaSDK which installs the
> > headers directly in $PREFIX/include. User needn't the open-source
> > dispatcher any more on Linux
> >
> > https://github.com/Intel-Media-SDK/MediaSDK
> >
> 
> I filed https://github.com/Intel-Media-SDK/MediaSDK/issues/199, hope they
> can change the install path for mfx headers.

Changing it in open source MSDK should be a better solution.

> 
> Thanks
> Haihao

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] qsv: Use the installed mfx include headers if possibile

2018-05-13 Thread Xiang, Haihao
On Mon, 2018-05-14 at 00:50 +, Xiang, Haihao wrote:
> > On 11/05/18 08:52, Haihao Xiang wrote:
> > > 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 
> > > ---
> > >  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(-)
> > 
> > I don't think it's a good idea to put an #ifdef like this in every file.
> > 
> > > 
> > > 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
> > 
> > So in the current code, the first test is for the open-source dispatcher
> > ( > ps://github.com/lu-zero/mfx_dispatch>), which gets used everywhere that
> > pkgconfig is supported, including mingw on Windows.  The second test is for
> > Windows cases where you can't make make pkgconfig work.
> > 
> > What installs the headers directly in $PREFIX/include?  Presumably this is a
> > new change - can we ask them not to do that?  (Because organising them in a
> > subdirectory is I think much more sensible.)
> > 
> 
> Link below is the open-source version of MediaSDK which installs the headers
> directly in $PREFIX/include. User needn't the open-source dispatcher any more
> on
> Linux
> 
> https://github.com/Intel-Media-SDK/MediaSDK
> 

I filed https://github.com/Intel-Media-SDK/MediaSDK/issues/199, hope they can
change the install path for mfx headers.

Thanks
Haihao


> > - Mark
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] qsv: Use the installed mfx include headers if possibile

2018-05-13 Thread Xiang, Haihao

> On 11/05/18 08:52, Haihao Xiang wrote:
> > 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 
> > ---
> >  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(-)
> 
> I don't think it's a good idea to put an #ifdef like this in every file.
> 
> > 
> > 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
> 
> So in the current code, the first test is for the open-source dispatcher ( ps://github.com/lu-zero/mfx_dispatch>), which gets used everywhere that
> pkgconfig is supported, including mingw on Windows.  The second test is for
> Windows cases where you can't make make pkgconfig work.
> 
> What installs the headers directly in $PREFIX/include?  Presumably this is a
> new change - can we ask them not to do that?  (Because organising them in a
> subdirectory is I think much more sensible.)
> 

Link below is the open-source version of MediaSDK which installs the headers
directly in $PREFIX/include. User needn't the open-source dispatcher any more on
Linux

https://github.com/Intel-Media-SDK/MediaSDK

> - Mark
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] qsv: Use the installed mfx include headers if possibile

2018-05-11 Thread wm4
On Fri, 11 May 2018 11:38:52 +0100
Mark Thompson  wrote:

> On 11/05/18 08:52, Haihao Xiang wrote:
> > 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 
> > ---
> >  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(-)  
> 
> I don't think it's a good idea to put an #ifdef like this in every file.

+1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] qsv: Use the installed mfx include headers if possibile

2018-05-11 Thread Mark Thompson
On 11/05/18 08:52, Haihao Xiang wrote:
> 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 
> ---
>  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(-)

I don't think it's a good idea to put an #ifdef like this in every file.

> 
> 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
So in the current code, the first test is for the open-source dispatcher 
(), which gets used everywhere that 
pkgconfig is supported, including mingw on Windows.  The second test is for 
Windows cases where you can't make make pkgconfig work.

What installs the headers directly in $PREFIX/include?  Presumably this is a 
new change - can we ask them not to do that?  (Because organising them in a 
subdirectory is I think much more sensible.)

- Mark
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] qsv: Use the installed mfx include headers if possibile

2018-05-11 Thread Haihao Xiang
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 
---
 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 
+#else
 #include 
+#endif
+
 #include 
 
 #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 
+#include 
+#include 
+#else
 #include 
 #include 
 #include 
+#endif
 
 #include 
 #include 
@@ -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 
+#else
 #include 
+#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 
+#else
 #include 
+#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 
 #include 
 
+#ifdef MFX_DEFAULT_INC_PATH
+#include 
+#else
 #include 
+#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 
 #include 
 
+#ifdef MFX_DEFAULT_INC_PATH
+#include 
+#else
 #include 
+#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 
 #include 
 
+#ifdef MFX_DEFAULT_INC_PATH
+#include 
+#else
 #include 
+#endif
 
 #include "libavutil/common.h"
 #include