mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
initial mingw networking support
Originally committed as revision 9029 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
124bed6fb2
commit
5676d140a9
@ -21,16 +21,26 @@
|
|||||||
#ifndef NETWORK_H
|
#ifndef NETWORK_H
|
||||||
#define NETWORK_H
|
#define NETWORK_H
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <ws2tcpip.h>
|
||||||
|
|
||||||
|
#define ff_neterrno() WSAGetLastError()
|
||||||
|
#define FF_NETERROR(err) WSA##err
|
||||||
|
#define WSAEAGAIN WSAEWOULDBLOCK
|
||||||
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#ifdef HAVE_ARPA_INET_H
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#endif
|
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
#define ff_neterrno() errno
|
#define ff_neterrno() errno
|
||||||
#define FF_NETERROR(err) err
|
#define FF_NETERROR(err) err
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_ARPA_INET_H
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int ff_socket_nonblock(int socket, int enable);
|
int ff_socket_nonblock(int socket, int enable);
|
||||||
|
|
||||||
|
@ -117,10 +117,14 @@ int resolve_host(struct in_addr *sin_addr, const char *hostname)
|
|||||||
|
|
||||||
int ff_socket_nonblock(int socket, int enable)
|
int ff_socket_nonblock(int socket, int enable)
|
||||||
{
|
{
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
return ioctlsocket(socket, FIONBIO, &enable);
|
||||||
|
#else
|
||||||
if (enable)
|
if (enable)
|
||||||
return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK);
|
return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK);
|
||||||
else
|
else
|
||||||
return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK);
|
return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_NETWORK */
|
#endif /* CONFIG_NETWORK */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user