From 2fdbc24978f21f24c1312bcd7709b1121ee36940 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Mon, 31 May 2021 13:36:39 +0200
Subject: [PATCH] fix MediaFoundation compilation if WINVER was forced by the
 user

In mingw64 and Windows Kits the MF_MT_VIDEO_ROTATION is defined if WINVER is at
least 0x0602. Normally WINVER would default to _WIN32_WINNT but it may not
always be the case if WINVER is also set by the user, so we force it manually.
---
 libavcodec/mf_utils.c | 2 ++
 libavcodec/mfenc.c    | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libavcodec/mf_utils.c b/libavcodec/mf_utils.c
index eeabd0ce0b..9b82dacf41 100644
--- a/libavcodec/mf_utils.c
+++ b/libavcodec/mf_utils.c
@@ -19,7 +19,9 @@
 #define COBJMACROS
 #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602
 #undef _WIN32_WINNT
+#undef WINVER
 #define _WIN32_WINNT 0x0602
+#define WINVER 0x0602
 #endif
 
 #include "mf_utils.h"
diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c
index d70e49351a..335034b5d2 100644
--- a/libavcodec/mfenc.c
+++ b/libavcodec/mfenc.c
@@ -19,7 +19,9 @@
 #define COBJMACROS
 #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602
 #undef _WIN32_WINNT
+#undef WINVER
 #define _WIN32_WINNT 0x0602
+#define WINVER 0x0602
 #endif
 
 #include "encode.h"
-- 
2.27.0.windows.1

