diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h index 5119ef4dff..c2d301b4a2 100644 --- a/libavcodec/qsv_internal.h +++ b/libavcodec/qsv_internal.h @@ -23,9 +23,9 @@ #include "config.h" -#if CONFIG_VAAPI +#if CONFIG_VAAPI && !defined(_WIN32) // Do not enable for libva-win32 on Windows #define AVCODEC_QSV_LINUX_SESSION_HANDLE -#endif //CONFIG_VAAPI +#endif //CONFIG_VAAPI && !defined(_WIN32) #ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE #include @@ -35,7 +35,6 @@ #endif #include #include -#include #include "libavutil/hwcontext_vaapi.h" #endif diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 6780428875..4ed4242ddf 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -2126,8 +2126,6 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, "\"%s\".\n", e->value); return AVERROR(EINVAL); } - } else if (CONFIG_VAAPI) { - child_device_type = AV_HWDEVICE_TYPE_VAAPI; #if QSV_ONEVPL } else if (CONFIG_D3D11VA) { // Use D3D11 by default if d3d11va is enabled av_log(ctx, AV_LOG_VERBOSE, @@ -2147,11 +2145,23 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device, } else if (CONFIG_D3D11VA) { child_device_type = AV_HWDEVICE_TYPE_D3D11VA; #endif + } else if (CONFIG_VAAPI) { + child_device_type = AV_HWDEVICE_TYPE_VAAPI; } else { av_log(ctx, AV_LOG_ERROR, "No supported child device type is enabled\n"); return AVERROR(ENOSYS); } +#if CONFIG_VAAPI && defined(_WIN32) + /* AV_HWDEVICE_TYPE_VAAPI on Windows/Libva-win32 not supported */ + /* Reject user specified child_device_type or CONFIG_VAAPI on Windows */ + if (child_device_type == AV_HWDEVICE_TYPE_VAAPI) { + av_log(ctx, AV_LOG_ERROR, "VAAPI child device type not supported for oneVPL on Windows" + "\"%s\".\n", e->value); + return AVERROR(EINVAL); + } +#endif + child_device_opts = NULL; switch (child_device_type) { #if CONFIG_VAAPI