[01/10] dxva2/d3d11va: Set _WIN32_WINNT to 0x0602 instead of 0x0600

Message ID 1437904678-19444-1-git-send-email-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö July 26, 2015, 9:57 a.m.
If _WIN32_WINNT is unset, we force it to a new enough value to
make sure the necessary definitions are visible.

When targeting Windows Phone or Windows RT, _WIN32_WINNT should
be at least 0x0602 - otherwise the windows headers themselves
can cause errors (which technically are bugs in the headers).

Raising this value here shouldn't hurt; the alternative would
be to not touch it at all if WINAPI_FAMILY is set to phone/app,
or to force setting it to 0x0602 in configure if unset (for phone/app).
---
 libavcodec/d3d11va.h | 2 +-
 libavcodec/dxva2.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Jean-Baptiste Kempf July 26, 2015, 10:57 a.m. | #1
On 26 Jul, Martin Storsjö wrote :
> If _WIN32_WINNT is unset, we force it to a new enough value to
> make sure the necessary definitions are visible.

Yes.

> When targeting Windows Phone or Windows RT, _WIN32_WINNT should
> be at least 0x0602 - otherwise the windows headers themselves
> can cause errors (which technically are bugs in the headers).

In theory, those API should work in 601, but as far as headers, it's
probably OK.

With my kindest regards,
Hendrik Leppkes July 26, 2015, 11:06 a.m. | #2
On Sun, Jul 26, 2015 at 11:57 AM, Martin Storsjö <martin@martin.st> wrote:
> If _WIN32_WINNT is unset, we force it to a new enough value to
> make sure the necessary definitions are visible.
>
> When targeting Windows Phone or Windows RT, _WIN32_WINNT should
> be at least 0x0602 - otherwise the windows headers themselves
> can cause errors (which technically are bugs in the headers).
>
> Raising this value here shouldn't hurt; the alternative would
> be to not touch it at all if WINAPI_FAMILY is set to phone/app,
> or to force setting it to 0x0602 in configure if unset (for phone/app).
> ---
>  libavcodec/d3d11va.h | 2 +-
>  libavcodec/dxva2.h   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/d3d11va.h b/libavcodec/d3d11va.h
> index 2163b35..5237119 100644
> --- a/libavcodec/d3d11va.h
> +++ b/libavcodec/d3d11va.h
> @@ -32,7 +32,7 @@
>
>  #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600

Shouldnt these checks also be updated to increment it if its 0x0600 right now?

>  #undef _WIN32_WINNT
> -#define _WIN32_WINNT 0x0600
> +#define _WIN32_WINNT 0x0602
>  #endif
>
>  #include <stdint.h>
> diff --git a/libavcodec/dxva2.h b/libavcodec/dxva2.h
> index d9017c6..a40e2a5 100644
> --- a/libavcodec/dxva2.h
> +++ b/libavcodec/dxva2.h
> @@ -31,7 +31,7 @@
>
>  #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600
>  #undef _WIN32_WINNT
> -#define _WIN32_WINNT 0x0600
> +#define _WIN32_WINNT 0x0602
>  #endif
>
>  #include <stdint.h>
> --
> 1.8.1.2
>
> _______________________________________________
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel
Martin Storsjö July 26, 2015, 11:19 a.m. | #3
On Sun, 26 Jul 2015, Hendrik Leppkes wrote:

> On Sun, Jul 26, 2015 at 11:57 AM, Martin Storsjö <martin@martin.st> wrote:
>> If _WIN32_WINNT is unset, we force it to a new enough value to
>> make sure the necessary definitions are visible.
>>
>> When targeting Windows Phone or Windows RT, _WIN32_WINNT should
>> be at least 0x0602 - otherwise the windows headers themselves
>> can cause errors (which technically are bugs in the headers).
>>
>> Raising this value here shouldn't hurt; the alternative would
>> be to not touch it at all if WINAPI_FAMILY is set to phone/app,
>> or to force setting it to 0x0602 in configure if unset (for phone/app).
>> ---
>>  libavcodec/d3d11va.h | 2 +-
>>  libavcodec/dxva2.h   | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/d3d11va.h b/libavcodec/d3d11va.h
>> index 2163b35..5237119 100644
>> --- a/libavcodec/d3d11va.h
>> +++ b/libavcodec/d3d11va.h
>> @@ -32,7 +32,7 @@
>>
>>  #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600
>
> Shouldnt these checks also be updated to increment it if its 0x0600 right now?

It does indeed look strange this way.

Strictly it shouldn't be needed, but we could do that as well just for 
consistency. Or scrap this, and hardcode it to 0x0602 in patch 2/10, but I 
see you agree with my reasoning there.

So I can change this to consistently use 0x0602 just to make sure it 
doesn't look strange. Perhaps also change configure to test with version 
0x0602 for the test where it is overridden?

// Martin
Steve Lhomme July 26, 2015, 2:56 p.m. | #4
On Sun, Jul 26, 2015 at 12:57 PM, Jean-Baptiste Kempf <jb@videolan.org> wrote:
> On 26 Jul, Martin Storsjö wrote :
>> If _WIN32_WINNT is unset, we force it to a new enough value to
>> make sure the necessary definitions are visible.
>
> Yes.
>
>> When targeting Windows Phone or Windows RT, _WIN32_WINNT should
>> be at least 0x0602 - otherwise the windows headers themselves
>> can cause errors (which technically are bugs in the headers).
>
> In theory, those API should work in 601, but as far as headers, it's
> probably OK.

Yes it works. I did most of the work on D3D11VA on Windows 7.

> With my kindest regards,
>
> --
> Jean-Baptiste Kempf
> http://www.jbkempf.com/ - +33 672 704 734
> Sent from my Electronic Device
> _______________________________________________
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel

Patch

diff --git a/libavcodec/d3d11va.h b/libavcodec/d3d11va.h
index 2163b35..5237119 100644
--- a/libavcodec/d3d11va.h
+++ b/libavcodec/d3d11va.h
@@ -32,7 +32,7 @@ 
 
 #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600
 #undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0600
+#define _WIN32_WINNT 0x0602
 #endif
 
 #include <stdint.h>
diff --git a/libavcodec/dxva2.h b/libavcodec/dxva2.h
index d9017c6..a40e2a5 100644
--- a/libavcodec/dxva2.h
+++ b/libavcodec/dxva2.h
@@ -31,7 +31,7 @@ 
 
 #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600
 #undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0600
+#define _WIN32_WINNT 0x0602
 #endif
 
 #include <stdint.h>