Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] os_support, network: Fix build failure on Windows with BZIP2
@ 2023-07-27 18:51 L. E. Segovia
  2023-07-29 18:48 ` [FFmpeg-devel] [PATCH v2] " L. E. Segovia
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: L. E. Segovia @ 2023-07-27 18:51 UTC (permalink / raw)
  To: ffmpeg-devel

Including winsock2.h without WIN32_LEAN_AND_MEAN causes bzlib.h to parse
as nonsense, due to an instance of #define char small in rpcndr.h
(included transitively from windows.h).

See: https://stackoverflow.com/a/27794577
Signed-off-by: L. E. Segovia <amy@amyspark.me>
---
 libavformat/network.h    | 1 +
 libavformat/os_support.c | 6 ++----
 libavformat/os_support.h | 1 +
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/network.h b/libavformat/network.h
index ca214087fc..06b6117fc7 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -35,6 +35,7 @@
 #endif
  #if HAVE_WINSOCK2_H
+#define WIN32_LEAN_AND_MEAN
 #include <winsock2.h>
 #include <ws2tcpip.h>
 diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index 15cea7fa5b..2de6a7c3d9 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -34,11 +34,9 @@
 #if HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif /* HAVE_SYS_TIME_H */
-#if HAVE_WINSOCK2_H
-#include <winsock2.h>
-#elif HAVE_SYS_SELECT_H
+#if HAVE_SYS_SELECT_H
 #include <sys/select.h>
-#endif /* HAVE_WINSOCK2_H */
+#endif /* HAVE_SYS_SELECT_H */
 #endif /* !HAVE_POLL_H */
  #include "network.h"
diff --git a/libavformat/os_support.h b/libavformat/os_support.h
index f2ff38e23b..5bdd275d70 100644
--- a/libavformat/os_support.h
+++ b/libavformat/os_support.h
@@ -140,6 +140,7 @@ typedef int socklen_t;
 typedef unsigned long nfds_t;
  #if HAVE_WINSOCK2_H
+#define WIN32_LEAN_AND_MEAN
 #include <winsock2.h>
 #endif
 #if !HAVE_STRUCT_POLLFD
-- 
2.41.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH v2] os_support, network: Fix build failure on Windows with BZIP2
  2023-07-27 18:51 [FFmpeg-devel] [PATCH] os_support, network: Fix build failure on Windows with BZIP2 L. E. Segovia
@ 2023-07-29 18:48 ` L. E. Segovia
  2023-08-04 12:36 ` [FFmpeg-devel] [PATCH] " Martin Storsjö
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: L. E. Segovia @ 2023-07-29 18:48 UTC (permalink / raw)
  To: ffmpeg-devel

Including winsock2.h without WIN32_LEAN_AND_MEAN causes bzlib.h to parse
as nonsense, due to an instance of #define char small in rpcndr.h
(included transitively from windows.h).

See: https://stackoverflow.com/a/27794577
Signed-off-by: L. E. Segovia <amy@amyspark.me>
---
 libavformat/network.h    | 1 +
 libavformat/os_support.c | 6 ++----
 libavformat/os_support.h | 1 +
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/network.h b/libavformat/network.h
index ca214087fc..06b6117fc7 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -35,6 +35,7 @@
 #endif
 
 #if HAVE_WINSOCK2_H
+#define WIN32_LEAN_AND_MEAN
 #include <winsock2.h>
 #include <ws2tcpip.h>
 
diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index 15cea7fa5b..2de6a7c3d9 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -34,11 +34,9 @@
 #if HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif /* HAVE_SYS_TIME_H */
-#if HAVE_WINSOCK2_H
-#include <winsock2.h>
-#elif HAVE_SYS_SELECT_H
+#if HAVE_SYS_SELECT_H
 #include <sys/select.h>
-#endif /* HAVE_WINSOCK2_H */
+#endif /* HAVE_SYS_SELECT_H */
 #endif /* !HAVE_POLL_H */
 
 #include "network.h"
diff --git a/libavformat/os_support.h b/libavformat/os_support.h
index f2ff38e23b..5bdd275d70 100644
--- a/libavformat/os_support.h
+++ b/libavformat/os_support.h
@@ -140,6 +140,7 @@ typedef int socklen_t;
 typedef unsigned long nfds_t;
 
 #if HAVE_WINSOCK2_H
+#define WIN32_LEAN_AND_MEAN
 #include <winsock2.h>
 #endif
 #if !HAVE_STRUCT_POLLFD
-- 
2.41.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH] os_support, network: Fix build failure on Windows with BZIP2
  2023-07-27 18:51 [FFmpeg-devel] [PATCH] os_support, network: Fix build failure on Windows with BZIP2 L. E. Segovia
  2023-07-29 18:48 ` [FFmpeg-devel] [PATCH v2] " L. E. Segovia
@ 2023-08-04 12:36 ` Martin Storsjö
  2023-08-04 12:39   ` Martin Storsjö
  2023-08-05 20:47 ` [FFmpeg-devel] [PATCH v3 0/1] configure: Set WIN32_LEAN_AND_MEAN at configure time L. E. Segovia
       [not found] ` <cover.1691268056.git.amy@amyspark.me>
  3 siblings, 1 reply; 13+ messages in thread
From: Martin Storsjö @ 2023-08-04 12:36 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Thu, 27 Jul 2023, L. E. Segovia wrote:

> Including winsock2.h without WIN32_LEAN_AND_MEAN causes bzlib.h to parse
> as nonsense, due to an instance of #define char small in rpcndr.h
> (included transitively from windows.h).
>
> See: https://stackoverflow.com/a/27794577
> Signed-off-by: L. E. Segovia <amy@amyspark.me>
> ---
> libavformat/network.h    | 1 +
> libavformat/os_support.c | 6 ++----
> libavformat/os_support.h | 1 +
> 3 files changed, 4 insertions(+), 4 deletions(-)

The change looks mostly reasonable to me I think, and WIN32_LEAN_AND_MEAN 
is generally beneficial. I've got a couple comments below though.

> diff --git a/libavformat/network.h b/libavformat/network.h
> index ca214087fc..06b6117fc7 100644
> --- a/libavformat/network.h
> +++ b/libavformat/network.h
> @@ -35,6 +35,7 @@
> #endif
>  #if HAVE_WINSOCK2_H
> +#define WIN32_LEAN_AND_MEAN
> #include <winsock2.h>
> #include <ws2tcpip.h>

The diff seems very hard to apply. The diff stat above says that this 
shows a snippet of 6 lines originally, 7 lines after the modification - 
but in fact the diff only shows 4 lines originally and 5 lines after the 
modification. I don't know what has happened to the patch, but it makes it 
hard to apply automatically.

> diff --git a/libavformat/os_support.c b/libavformat/os_support.c
> index 15cea7fa5b..2de6a7c3d9 100644
> --- a/libavformat/os_support.c
> +++ b/libavformat/os_support.c
> @@ -34,11 +34,9 @@
> #if HAVE_SYS_TIME_H
> #include <sys/time.h>
> #endif /* HAVE_SYS_TIME_H */
> -#if HAVE_WINSOCK2_H
> -#include <winsock2.h>
> -#elif HAVE_SYS_SELECT_H
> +#if HAVE_SYS_SELECT_H
> #include <sys/select.h>
> -#endif /* HAVE_WINSOCK2_H */
> +#endif /* HAVE_SYS_SELECT_H */
> #endif /* !HAVE_POLL_H */
>  #include "network.h"

I presume this is done to avoid touching winsock2.h here, as the headers 
that we've included already define this?

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH] os_support, network: Fix build failure on Windows with BZIP2
  2023-08-04 12:36 ` [FFmpeg-devel] [PATCH] " Martin Storsjö
@ 2023-08-04 12:39   ` Martin Storsjö
  2023-08-05 13:00     ` L. E. Segovia
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Storsjö @ 2023-08-04 12:39 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Fri, 4 Aug 2023, Martin Storsjö wrote:

> On Thu, 27 Jul 2023, L. E. Segovia wrote:
>
>> Including winsock2.h without WIN32_LEAN_AND_MEAN causes bzlib.h to parse
>> as nonsense, due to an instance of #define char small in rpcndr.h
>> (included transitively from windows.h).
>> 
>> See: https://stackoverflow.com/a/27794577
>> Signed-off-by: L. E. Segovia <amy@amyspark.me>
>> ---
>> libavformat/network.h    | 1 +
>> libavformat/os_support.c | 6 ++----
>> libavformat/os_support.h | 1 +
>> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> The change looks mostly reasonable to me I think, and WIN32_LEAN_AND_MEAN is 
> generally beneficial. I've got a couple comments below though.

Alternatively, I guess we could consider adding WIN32_LEAN_AND_MEAN in 
configure somewhere instead? That way we don't need to hunt down any 
potential stray includes of windows.h/winsock2.h if they are added 
elsewhere.

// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH] os_support, network: Fix build failure on Windows with BZIP2
  2023-08-04 12:39   ` Martin Storsjö
@ 2023-08-05 13:00     ` L. E. Segovia
  0 siblings, 0 replies; 13+ messages in thread
From: L. E. Segovia @ 2023-08-05 13:00 UTC (permalink / raw)
  To: ffmpeg-devel

Hey,

Yes, doing so directly in the configure script could be more useful. In fact, while I was doing further internal testing, I found two more instances that needed patching up.

I'll update this set and let you know.

amyspark

On 04/08/2023 09:39, Martin Storsjö wrote:
> On Fri, 4 Aug 2023, Martin Storsjö wrote:
> 
>> On Thu, 27 Jul 2023, L. E. Segovia wrote:
>>
>>> Including winsock2.h without WIN32_LEAN_AND_MEAN causes bzlib.h to parse
>>> as nonsense, due to an instance of #define char small in rpcndr.h
>>> (included transitively from windows.h).
>>>
>>> See: https://stackoverflow.com/a/27794577
>>> Signed-off-by: L. E. Segovia <amy@amyspark.me>
>>> ---
>>> libavformat/network.h    | 1 +
>>> libavformat/os_support.c | 6 ++----
>>> libavformat/os_support.h | 1 +
>>> 3 files changed, 4 insertions(+), 4 deletions(-)
>>
>> The change looks mostly reasonable to me I think, and WIN32_LEAN_AND_MEAN is generally beneficial. I've got a couple comments below though.
> 
> Alternatively, I guess we could consider adding WIN32_LEAN_AND_MEAN in configure somewhere instead? That way we don't need to hunt down any potential stray includes of windows.h/winsock2.h if they are added elsewhere.
> 
> // Martin
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

-- 
amyspark 🌸 https://www.amyspark.me
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH v3 0/1] configure: Set WIN32_LEAN_AND_MEAN at configure time
  2023-07-27 18:51 [FFmpeg-devel] [PATCH] os_support, network: Fix build failure on Windows with BZIP2 L. E. Segovia
  2023-07-29 18:48 ` [FFmpeg-devel] [PATCH v2] " L. E. Segovia
  2023-08-04 12:36 ` [FFmpeg-devel] [PATCH] " Martin Storsjö
@ 2023-08-05 20:47 ` L. E. Segovia
  2023-08-14 11:53   ` [FFmpeg-devel] [PATCH v4 " L. E. Segovia
       [not found]   ` <cover.1692013786.git.amy@amyspark.me>
       [not found] ` <cover.1691268056.git.amy@amyspark.me>
  3 siblings, 2 replies; 13+ messages in thread
From: L. E. Segovia @ 2023-08-05 20:47 UTC (permalink / raw)
  To: ffmpeg-devel

Thanks Martin for the suggestion, I've implemented it in this version.

As for the changes to os_support.c, the removal was intended to avoid
duplicating the logic that already exists in os_support.h. I've kept
it in this version for consistency.

L. E. Segovia (1):
  configure: Set WIN32_LEAN_AND_MEAN at configure time

 compat/atomics/win32/stdatomic.h | 1 -
 compat/w32pthreads.h             | 1 -
 configure                        | 1 +
 libavdevice/dshow_capture.h      | 1 -
 libavdevice/opengl_enc.c         | 1 -
 libavfilter/vsrc_ddagrab.c       | 1 -
 libavformat/os_support.c         | 6 ++----
 libavutil/wchar_filename.h       | 1 -
 libswscale/utils.c               | 1 -
 9 files changed, 3 insertions(+), 11 deletions(-)

-- 
2.41.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH v3 1/1] configure: Set WIN32_LEAN_AND_MEAN at configure time
       [not found] ` <cover.1691268056.git.amy@amyspark.me>
@ 2023-08-05 20:47   ` L. E. Segovia
  2023-08-14 11:30     ` Martin Storsjö
  0 siblings, 1 reply; 13+ messages in thread
From: L. E. Segovia @ 2023-08-05 20:47 UTC (permalink / raw)
  To: ffmpeg-devel

Including winsock2.h or windows.h without WIN32_LEAN_AND_MEAN cause
bzlib.h to parse as nonsense, due to an instance of #define char small
in rpcndr.h.

See:

https://stackoverflow.com/a/27794577

Signed-off-by: L. E. Segovia <amy@amyspark.me>
---
 compat/atomics/win32/stdatomic.h | 1 -
 compat/w32pthreads.h             | 1 -
 configure                        | 1 +
 libavdevice/dshow_capture.h      | 1 -
 libavdevice/opengl_enc.c         | 1 -
 libavfilter/vsrc_ddagrab.c       | 1 -
 libavformat/os_support.c         | 6 ++----
 libavutil/wchar_filename.h       | 1 -
 libswscale/utils.c               | 1 -
 9 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/compat/atomics/win32/stdatomic.h b/compat/atomics/win32/stdatomic.h
index 28a627bfd3..4f8ac2bb60 100644
--- a/compat/atomics/win32/stdatomic.h
+++ b/compat/atomics/win32/stdatomic.h
@@ -19,7 +19,6 @@
 #ifndef COMPAT_ATOMICS_WIN32_STDATOMIC_H
 #define COMPAT_ATOMICS_WIN32_STDATOMIC_H
 
-#define WIN32_LEAN_AND_MEAN
 #include <stddef.h>
 #include <stdint.h>
 #include <windows.h>
diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
index 6405e72b64..4ea0ce1ff4 100644
--- a/compat/w32pthreads.h
+++ b/compat/w32pthreads.h
@@ -35,7 +35,6 @@
  * As most functions here are used without checking return values,
  * only implement return values as necessary. */
 
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <process.h>
 #include <time.h>
diff --git a/configure b/configure
index 99388e7664..881a10bc0c 100755
--- a/configure
+++ b/configure
@@ -5716,6 +5716,7 @@ case $target_os in
         fi
         ! enabled small && test_cmd $windres --version && enable gnu_windres
         enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
+        add_cppflags -DWIN32_LEAN_AND_MEAN
         shlibdir_default="$bindir_default"
         SLIBPREF=""
         SLIBSUF=".dll"
diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
index b548cd7afc..81e684b9be 100644
--- a/libavdevice/dshow_capture.h
+++ b/libavdevice/dshow_capture.h
@@ -27,7 +27,6 @@
 #include "avdevice.h"
 
 #define COBJMACROS
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #define NO_DSHOW_STRSAFE
 #include <dshow.h>
diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
index f9dc846bf1..1b0cf5aa8f 100644
--- a/libavdevice/opengl_enc.c
+++ b/libavdevice/opengl_enc.c
@@ -30,7 +30,6 @@
 #include "config.h"
 
 #if HAVE_WINDOWS_H
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #endif
 #if HAVE_OPENGL_GL3_H
diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c
index 525d48110a..9093b89c5b 100644
--- a/libavfilter/vsrc_ddagrab.c
+++ b/libavfilter/vsrc_ddagrab.c
@@ -22,7 +22,6 @@
 #undef _WIN32_WINNT
 #define _WIN32_WINNT 0x0A00
 #endif
-#define WIN32_LEAN_AND_MEAN
 
 #include <windows.h>
 
diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index 15cea7fa5b..2de6a7c3d9 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -34,11 +34,9 @@
 #if HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif /* HAVE_SYS_TIME_H */
-#if HAVE_WINSOCK2_H
-#include <winsock2.h>
-#elif HAVE_SYS_SELECT_H
+#if HAVE_SYS_SELECT_H
 #include <sys/select.h>
-#endif /* HAVE_WINSOCK2_H */
+#endif /* HAVE_SYS_SELECT_H */
 #endif /* !HAVE_POLL_H */
 
 #include "network.h"
diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h
index fbc0a55146..4f87e6f88b 100644
--- a/libavutil/wchar_filename.h
+++ b/libavutil/wchar_filename.h
@@ -21,7 +21,6 @@
 
 #ifdef _WIN32
 
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include "mem.h"
 
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 8fe34a3437..8e74c6603e 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -34,7 +34,6 @@
 #endif
 #endif
 #if HAVE_VIRTUALALLOC
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #endif
 
-- 
2.41.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3 1/1] configure: Set WIN32_LEAN_AND_MEAN at configure time
  2023-08-05 20:47   ` [FFmpeg-devel] [PATCH v3 " L. E. Segovia
@ 2023-08-14 11:30     ` Martin Storsjö
  0 siblings, 0 replies; 13+ messages in thread
From: Martin Storsjö @ 2023-08-14 11:30 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Sat, 5 Aug 2023, L. E. Segovia wrote:

> Including winsock2.h or windows.h without WIN32_LEAN_AND_MEAN cause
> bzlib.h to parse as nonsense, due to an instance of #define char small
> in rpcndr.h.
>
> See:
>
> https://stackoverflow.com/a/27794577
>
> Signed-off-by: L. E. Segovia <amy@amyspark.me>
> ---
> compat/atomics/win32/stdatomic.h | 1 -
> compat/w32pthreads.h             | 1 -
> configure                        | 1 +
> libavdevice/dshow_capture.h      | 1 -
> libavdevice/opengl_enc.c         | 1 -
> libavfilter/vsrc_ddagrab.c       | 1 -
> libavformat/os_support.c         | 6 ++----
> libavutil/wchar_filename.h       | 1 -
> libswscale/utils.c               | 1 -
> 9 files changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/configure b/configure
> index 99388e7664..881a10bc0c 100755
> --- a/configure
> +++ b/configure
> @@ -5716,6 +5716,7 @@ case $target_os in
>         fi
>         ! enabled small && test_cmd $windres --version && enable gnu_windres
>         enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
> +        add_cppflags -DWIN32_LEAN_AND_MEAN
>         shlibdir_default="$bindir_default"
>         SLIBPREF=""
>         SLIBSUF=".dll"

This is in the block for target_os = win32/win64 - but that's only used 
for MSVC (or clang-cl) based builds - not for mingw or cygwin.

We'd want this define set for mingw and cygwin too.

Cygwin itself doesn't define _WIN32 and generally is mostly treated as 
unix, but there are some codepaths that check for HAVE_WINDOWS_H and 
include that header, and that's true in Cygwin too, so we'd like to keep 
the WIN32_LEAN_AND_MEAN there too.

Other than that, this looks fine to me!

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH v4 0/1] configure: Set WIN32_LEAN_AND_MEAN at configure time
  2023-08-05 20:47 ` [FFmpeg-devel] [PATCH v3 0/1] configure: Set WIN32_LEAN_AND_MEAN at configure time L. E. Segovia
@ 2023-08-14 11:53   ` L. E. Segovia
       [not found]   ` <cover.1692013786.git.amy@amyspark.me>
  1 sibling, 0 replies; 13+ messages in thread
From: L. E. Segovia @ 2023-08-14 11:53 UTC (permalink / raw)
  To: ffmpeg-devel

Now adapted to insert WIN32_LEAN_AND_MEAN for MinGW and Cygwin too.

L. E. Segovia (1):
  configure: Set WIN32_LEAN_AND_MEAN at configure time

 compat/atomics/win32/stdatomic.h | 1 -
 compat/w32pthreads.h             | 1 -
 configure                        | 3 +++
 libavdevice/dshow_capture.h      | 1 -
 libavdevice/opengl_enc.c         | 1 -
 libavfilter/vsrc_ddagrab.c       | 1 -
 libavformat/os_support.c         | 6 ++----
 libavutil/wchar_filename.h       | 1 -
 libswscale/utils.c               | 1 -
 9 files changed, 5 insertions(+), 11 deletions(-)

-- 
2.41.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [FFmpeg-devel] [PATCH v4 1/1] configure: Set WIN32_LEAN_AND_MEAN at configure time
       [not found]   ` <cover.1692013786.git.amy@amyspark.me>
@ 2023-08-14 11:53     ` L. E. Segovia
  2023-08-14 19:58       ` Martin Storsjö
  0 siblings, 1 reply; 13+ messages in thread
From: L. E. Segovia @ 2023-08-14 11:53 UTC (permalink / raw)
  To: ffmpeg-devel

Including winsock2.h or windows.h without WIN32_LEAN_AND_MEAN cause
bzlib.h to parse as nonsense, due to an instance of #define char small
in rpcndr.h.

See:

https://stackoverflow.com/a/27794577

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: L. E. Segovia <amy@amyspark.me>
---
 compat/atomics/win32/stdatomic.h | 1 -
 compat/w32pthreads.h             | 1 -
 configure                        | 3 +++
 libavdevice/dshow_capture.h      | 1 -
 libavdevice/opengl_enc.c         | 1 -
 libavfilter/vsrc_ddagrab.c       | 1 -
 libavformat/os_support.c         | 6 ++----
 libavutil/wchar_filename.h       | 1 -
 libswscale/utils.c               | 1 -
 9 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/compat/atomics/win32/stdatomic.h b/compat/atomics/win32/stdatomic.h
index 28a627bfd3..4f8ac2bb60 100644
--- a/compat/atomics/win32/stdatomic.h
+++ b/compat/atomics/win32/stdatomic.h
@@ -19,7 +19,6 @@
 #ifndef COMPAT_ATOMICS_WIN32_STDATOMIC_H
 #define COMPAT_ATOMICS_WIN32_STDATOMIC_H
 
-#define WIN32_LEAN_AND_MEAN
 #include <stddef.h>
 #include <stdint.h>
 #include <windows.h>
diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h
index dae8d9420d..2ff9735227 100644
--- a/compat/w32pthreads.h
+++ b/compat/w32pthreads.h
@@ -35,7 +35,6 @@
  * As most functions here are used without checking return values,
  * only implement return values as necessary. */
 
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <process.h>
 #include <time.h>
diff --git a/configure b/configure
index 932998b8d6..ff6a5c3600 100755
--- a/configure
+++ b/configure
@@ -5666,6 +5666,7 @@ case $target_os in
         fi
         ! enabled small && test_cmd $windres --version && enable gnu_windres
         enabled x86_32 && check_ldflags -Wl,--large-address-aware
+        add_cppflags -DWIN32_LEAN_AND_MEAN
         shlibdir_default="$bindir_default"
         SLIBPREF=""
         SLIBSUF=".dll"
@@ -5716,6 +5717,7 @@ case $target_os in
         fi
         ! enabled small && test_cmd $windres --version && enable gnu_windres
         enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
+        add_cppflags -DWIN32_LEAN_AND_MEAN
         shlibdir_default="$bindir_default"
         SLIBPREF=""
         SLIBSUF=".dll"
@@ -5745,6 +5747,7 @@ case $target_os in
         enabled x86_64 && objformat="win64" || objformat="win32"
         enable dos_paths
         ! enabled small && test_cmd $windres --version && enable gnu_windres
+        add_cppflags -DWIN32_LEAN_AND_MEAN
         add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
         ;;
     *-dos|freedos|opendos)
diff --git a/libavdevice/dshow_capture.h b/libavdevice/dshow_capture.h
index b548cd7afc..81e684b9be 100644
--- a/libavdevice/dshow_capture.h
+++ b/libavdevice/dshow_capture.h
@@ -27,7 +27,6 @@
 #include "avdevice.h"
 
 #define COBJMACROS
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #define NO_DSHOW_STRSAFE
 #include <dshow.h>
diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
index f9dc846bf1..1b0cf5aa8f 100644
--- a/libavdevice/opengl_enc.c
+++ b/libavdevice/opengl_enc.c
@@ -30,7 +30,6 @@
 #include "config.h"
 
 #if HAVE_WINDOWS_H
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #endif
 #if HAVE_OPENGL_GL3_H
diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c
index b65261f685..c3107e11b4 100644
--- a/libavfilter/vsrc_ddagrab.c
+++ b/libavfilter/vsrc_ddagrab.c
@@ -22,7 +22,6 @@
 #undef _WIN32_WINNT
 #define _WIN32_WINNT 0x0A00
 #endif
-#define WIN32_LEAN_AND_MEAN
 
 #include <windows.h>
 
diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index 15cea7fa5b..2de6a7c3d9 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -34,11 +34,9 @@
 #if HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif /* HAVE_SYS_TIME_H */
-#if HAVE_WINSOCK2_H
-#include <winsock2.h>
-#elif HAVE_SYS_SELECT_H
+#if HAVE_SYS_SELECT_H
 #include <sys/select.h>
-#endif /* HAVE_WINSOCK2_H */
+#endif /* HAVE_SYS_SELECT_H */
 #endif /* !HAVE_POLL_H */
 
 #include "network.h"
diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h
index fbc0a55146..4f87e6f88b 100644
--- a/libavutil/wchar_filename.h
+++ b/libavutil/wchar_filename.h
@@ -21,7 +21,6 @@
 
 #ifdef _WIN32
 
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include "mem.h"
 
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 8fe34a3437..8e74c6603e 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -34,7 +34,6 @@
 #endif
 #endif
 #if HAVE_VIRTUALALLOC
-#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #endif
 
-- 
2.41.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH v4 1/1] configure: Set WIN32_LEAN_AND_MEAN at configure time
  2023-08-14 11:53     ` [FFmpeg-devel] [PATCH v4 1/1] " L. E. Segovia
@ 2023-08-14 19:58       ` Martin Storsjö
  2023-08-19 15:31         ` Gyan Doshi
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Storsjö @ 2023-08-14 19:58 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Mon, 14 Aug 2023, L. E. Segovia wrote:

> Including winsock2.h or windows.h without WIN32_LEAN_AND_MEAN cause
> bzlib.h to parse as nonsense, due to an instance of #define char small
> in rpcndr.h.
>
> See:
>
> https://stackoverflow.com/a/27794577
>
> Reviewed-by: Martin Storsjö <martin@martin.st>
> Signed-off-by: L. E. Segovia <amy@amyspark.me>
> ---

Thanks, pushed!

// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH v4 1/1] configure: Set WIN32_LEAN_AND_MEAN at configure time
  2023-08-14 19:58       ` Martin Storsjö
@ 2023-08-19 15:31         ` Gyan Doshi
  2023-08-19 21:12           ` Martin Storsjö
  0 siblings, 1 reply; 13+ messages in thread
From: Gyan Doshi @ 2023-08-19 15:31 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


ddc1cd5cdd breaks the checks for ole32 and thus prevents detection of DXVA2.

@ 
https://github.com/FFmpeg/FFmpeg/commit/ddc1cd5cdd2570bf3d6ab807ee0ecfacdf09431d

Regards,
Gyan

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [FFmpeg-devel] [PATCH v4 1/1] configure: Set WIN32_LEAN_AND_MEAN at configure time
  2023-08-19 15:31         ` Gyan Doshi
@ 2023-08-19 21:12           ` Martin Storsjö
  0 siblings, 0 replies; 13+ messages in thread
From: Martin Storsjö @ 2023-08-19 21:12 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Sat, 19 Aug 2023, Gyan Doshi wrote:

>
> ddc1cd5cdd breaks the checks for ole32 and thus prevents detection of DXVA2.
>
> @ 
> https://github.com/FFmpeg/FFmpeg/commit/ddc1cd5cdd2570bf3d6ab807ee0ecfacdf09431d

Thanks for noticing this, and sorry for the breakage. It seems like this 
is fixable by adjusting the check for ole32 to include the right header 
explicitly - I'll send a patch.

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-08-19 21:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-27 18:51 [FFmpeg-devel] [PATCH] os_support, network: Fix build failure on Windows with BZIP2 L. E. Segovia
2023-07-29 18:48 ` [FFmpeg-devel] [PATCH v2] " L. E. Segovia
2023-08-04 12:36 ` [FFmpeg-devel] [PATCH] " Martin Storsjö
2023-08-04 12:39   ` Martin Storsjö
2023-08-05 13:00     ` L. E. Segovia
2023-08-05 20:47 ` [FFmpeg-devel] [PATCH v3 0/1] configure: Set WIN32_LEAN_AND_MEAN at configure time L. E. Segovia
2023-08-14 11:53   ` [FFmpeg-devel] [PATCH v4 " L. E. Segovia
     [not found]   ` <cover.1692013786.git.amy@amyspark.me>
2023-08-14 11:53     ` [FFmpeg-devel] [PATCH v4 1/1] " L. E. Segovia
2023-08-14 19:58       ` Martin Storsjö
2023-08-19 15:31         ` Gyan Doshi
2023-08-19 21:12           ` Martin Storsjö
     [not found] ` <cover.1691268056.git.amy@amyspark.me>
2023-08-05 20:47   ` [FFmpeg-devel] [PATCH v3 " L. E. Segovia
2023-08-14 11:30     ` Martin Storsjö

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git