Mercurial > libavformat.hg
diff network.h @ 2351:b9a881c0967e libavformat
Add initialization and cleanup functions for Winsock
| author | ramiro |
|---|---|
| date | Thu, 09 Aug 2007 23:39:05 +0000 |
| parents | fb72d949bae3 |
| children | 792383dd085e |
line wrap: on
line diff
--- a/network.h Thu Aug 09 23:29:58 2007 +0000 +++ b/network.h Thu Aug 09 23:39:05 2007 +0000 @@ -44,6 +44,23 @@ int ff_socket_nonblock(int socket, int enable); +static inline int ff_network_init(void) +{ +#ifdef HAVE_WINSOCK2_H + WSADATA wsaData; + if (WSAStartup(MAKEWORD(1,1), &wsaData)) + return 0; +#endif + return 1; +} + +static inline void ff_network_close(void) +{ +#ifdef HAVE_WINSOCK2_H + WSACleanup(); +#endif +} + #if !defined(HAVE_INET_ATON) /* in os_support.c */ int inet_aton (const char * str, struct in_addr * add);
