#include "avformat.h"
#include <unistd.h>
#include <fcntl.h>
+#include "os_support.h"
-#ifndef HAVE_SYS_POLL_H
-#if defined(__MINGW32__)
+#ifdef CONFIG_NETWORK
+#ifndef HAVE_POLL_H
+#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
-#else
+#elif defined (HAVE_SYS_SELECT_H)
#include <sys/select.h>
#endif
#endif
-#ifdef CONFIG_NETWORK
#include "network.h"
#if !defined(HAVE_INET_ATON)
int ff_socket_nonblock(int socket, int enable)
{
-#ifdef __MINGW32__
+#ifdef HAVE_WINSOCK2_H
return ioctlsocket(socket, FIONBIO, &enable);
#else
if (enable)
#endif /* CONFIG_NETWORK */
#ifdef CONFIG_FFSERVER
-#ifndef HAVE_SYS_POLL_H
+#ifndef HAVE_POLL_H
int poll(struct pollfd *fds, nfds_t numfds, int timeout)
{
fd_set read_set;
int n;
int rc;
-#ifdef __MINGW32__
+#ifdef HAVE_WINSOCK2_H
if (numfds >= FD_SETSIZE) {
errno = EINVAL;
return -1;
for(i = 0; i < numfds; i++) {
if (fds[i].fd < 0)
continue;
-#ifndef __MINGW32__
+#ifndef HAVE_WINSOCK2_H
if (fds[i].fd >= FD_SETSIZE) {
errno = EINVAL;
return -1;
return rc;
}
-#endif /* HAVE_SYS_POLL_H */
+#endif /* HAVE_POLL_H */
#endif /* CONFIG_FFSERVER */