diff options
author | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-06-11 16:48:09 +0000 |
---|---|---|
committer | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-06-11 16:48:09 +0000 |
commit | 6ac4f2256749cc720d79317e8eb1a48a706e2db8 (patch) | |
tree | da82bb05e17c1456bbc891a1d47cb3bddee78c4f /libmpdemux/stream.c | |
parent | 5ccc705d9a256ee7b8297c605838fdc2708b1fd5 (diff) | |
download | mpv-6ac4f2256749cc720d79317e8eb1a48a706e2db8.tar.bz2 mpv-6ac4f2256749cc720d79317e8eb1a48a706e2db8.tar.xz |
Networking support under MinGW.
Patch by flo/yepyep <flodt8@yahoo.de>.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10282 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/stream.c')
-rw-r--r-- | libmpdemux/stream.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/libmpdemux/stream.c b/libmpdemux/stream.c index b9e04fe694..2dd11d27bc 100644 --- a/libmpdemux/stream.c +++ b/libmpdemux/stream.c @@ -14,6 +14,13 @@ #include <strings.h> #include "config.h" + +#ifndef HAVE_WINSOCK2 +#define closesocket close +#else +#include <winsock2.h> +#endif + #include "mp_msg.h" #include "help_mp.h" #include "../osdep/shmem.h" @@ -376,6 +383,14 @@ stream_t* new_stream(int fd,int type){ stream_t *s=malloc(sizeof(stream_t)); if(s==NULL) return NULL; memset(s,0,sizeof(stream_t)); + +#ifdef HAVE_WINSOCK2 + { + WSADATA wsdata; + int temp = WSAStartup(0x0202, &wsdata); // there might be a better place for this (-> later) + mp_msg(MSGT_STREAM,MSGL_V,"WINSOCK2 init: %i\n", temp); + } +#endif s->fd=fd; s->type=type; @@ -414,7 +429,11 @@ void free_stream(stream_t *s){ default: if(s->close) s->close(s); } - if(s->fd>0) close(s->fd); + if(s->fd>0) closesocket(s->fd); +#ifdef HAVE_WINSOCK2 + mp_msg(MSGT_STREAM,MSGL_V,"WINSOCK2 uninit\n"); + WSACleanup(); // there might be a better place for this (-> later) +#endif // Disabled atm, i don't like that. s->priv can be anything after all // streams should destroy their priv on close //if(s->priv) free(s->priv); |