X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fnetwork.h;h=7af77991d4d648ec75012ed564d547d8cc31ce44;hb=64ab5fa3df570aa94563d3ba3c8334b7e288254d;hp=b67b9b136420adf8ac4e98f474e0e7e0ad988d78;hpb=42572ef53f5199160ecc3e18bb549caece8b26dc;p=ffmpeg diff --git a/libavformat/network.h b/libavformat/network.h index b67b9b13642..7af77991d4d 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007 The FFmpeg Project. + * Copyright (c) 2007 The FFmpeg Project * * This file is part of FFmpeg. * @@ -18,13 +18,54 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef NETWORK_H -#define NETWORK_H +#ifndef AVFORMAT_NETWORK_H +#define AVFORMAT_NETWORK_H +#include "config.h" + +#if HAVE_WINSOCK2_H +#include +#include + +#define ff_neterrno() WSAGetLastError() +#define FF_NETERROR(err) WSA##err +#define WSAEAGAIN WSAEWOULDBLOCK +#else #include #include #include -#include #include +#define ff_neterrno() errno +#define FF_NETERROR(err) err +#endif + +#if HAVE_ARPA_INET_H +#include +#endif + +int ff_socket_nonblock(int socket, int enable); + +static inline int ff_network_init(void) +{ +#if HAVE_WINSOCK2_H + WSADATA wsaData; + if (WSAStartup(MAKEWORD(1,1), &wsaData)) + return 0; +#endif + return 1; +} + +static inline void ff_network_close(void) +{ +#if HAVE_WINSOCK2_H + WSACleanup(); #endif +} + +#if !HAVE_INET_ATON +/* in os_support.c */ +int inet_aton (const char * str, struct in_addr * add); +#endif + +#endif /* AVFORMAT_NETWORK_H */