diff --git a/configure b/configure
index 1290369f1573c6638d29fe81a156c462682e8698..a7ac43fa0751af3cdc053e565b7c3378f33361dc 100755
--- a/configure
+++ b/configure
@@ -1140,6 +1140,7 @@ HAVE_LIST="
     struct_group_source_req
     struct_ip_mreq_source
     struct_ipv6_mreq
+    struct_pollfd
     struct_rusage_ru_maxrss
     struct_sockaddr_in6
     struct_sockaddr_sa_len
@@ -2818,6 +2819,7 @@ if enabled network; then
     check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
     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
@@ -2834,6 +2836,7 @@ if enabled network; then
         check_type ws2tcpip.h "struct group_source_req"
         check_type ws2tcpip.h "struct ip_mreq_source"
         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 3db20a9aa887de20ee90a77a164783eefd84a9be..cda84b0296ede007d03479bcb8deb03d27b6ce40 100644
--- a/libavformat/os_support.h
+++ b/libavformat/os_support.h
@@ -75,6 +75,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 */
@@ -94,6 +98,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);