We need to include winsock2.h here, to make sure we have the
real pollfd struct definition, if one exists, before defining the
fallback poll function.
---
 configure                |    3 +++
 libavformat/os_support.h |    5 +++++
 2 files changed, 8 insertions(+)

diff --git a/configure b/configure
index 7b52b2f..ded1f08 100755
--- a/configure
+++ b/configure
@@ -1138,6 +1138,7 @@ HAVE_LIST="
     strtok_r
     struct_addrinfo
     struct_ipv6_mreq
+    struct_pollfd
     struct_rusage_ru_maxrss
     struct_sockaddr_in6
     struct_sockaddr_sa_len
@@ -2814,6 +2815,7 @@ if enabled network; then
     check_type netdb.h "struct addrinfo"
     check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
     check_type netinet/in.h "struct sockaddr_in6"
+    check_type poll.h "struct pollfd"
     check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
     check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
     check_header netinet/sctp.h
@@ -2828,6 +2830,7 @@ if enabled network; then
         check_type ws2tcpip.h socklen_t
         check_type ws2tcpip.h "struct addrinfo"
         check_type ws2tcpip.h "struct ipv6_mreq"
+        check_type winsock2.h "struct pollfd"
         check_type ws2tcpip.h "struct sockaddr_in6"
         check_type ws2tcpip.h "struct sockaddr_storage"
         check_struct winsock2.h "struct sockaddr" sa_len
diff --git a/libavformat/os_support.h b/libavformat/os_support.h
index d6bd15b..d57c2ee 100644
--- a/libavformat/os_support.h
+++ b/libavformat/os_support.h
@@ -78,6 +78,10 @@ typedef int socklen_t;
 #if !HAVE_POLL_H
 typedef unsigned long nfds_t;
 
+#if HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+#if !HAVE_STRUCT_POLLFD
 struct pollfd {
     int fd;
     short events;  /* events to look for */
@@ -97,6 +101,7 @@ struct pollfd {
 #define POLLERR    0x0004  /* errors pending */
 #define POLLHUP    0x0080  /* disconnected */
 #define POLLNVAL   0x1000  /* invalid file descriptor */
+#endif
 
 
 int poll(struct pollfd *fds, nfds_t numfds, int timeout);
-- 
1.7.9.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to