summaryrefslogtreecommitdiffstats
path: root/libmpdemux/stream_netstream.c
diff options
context:
space:
mode:
authordiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-06-11 16:48:09 +0000
committerdiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-06-11 16:48:09 +0000
commit6ac4f2256749cc720d79317e8eb1a48a706e2db8 (patch)
treeda82bb05e17c1456bbc891a1d47cb3bddee78c4f /libmpdemux/stream_netstream.c
parent5ccc705d9a256ee7b8297c605838fdc2708b1fd5 (diff)
downloadmpv-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_netstream.c')
-rw-r--r--libmpdemux/stream_netstream.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libmpdemux/stream_netstream.c b/libmpdemux/stream_netstream.c
index 573571e07d..b6b3e7bae5 100644
--- a/libmpdemux/stream_netstream.c
+++ b/libmpdemux/stream_netstream.c
@@ -48,9 +48,14 @@
#include <inttypes.h>
#include <errno.h>
+#ifndef HAVE_WINSOCK2
+#define closesocket close
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#else
+#include <winsock2.h>
+#endif
#include "mp_msg.h"
#include "stream.h"
@@ -89,6 +94,7 @@ static struct m_struct_st stream_opts = {
//// When the cache is running we need a lock as
//// fill_buffer is called from another proccess
static int lock_fd(int fd) {
+#ifndef HAVE_WINSOCK2
struct flock lock;
memset(&lock,0,sizeof(struct flock));
@@ -104,10 +110,14 @@ static int lock_fd(int fd) {
}
} while(0);
mp_msg(MSGT_STREAM,MSGL_DBG2, "Locked (%d)\n",getpid());
+#else
+printf("FIXME? should lock here\n");
+#endif
return 1;
}
static int unlock_fd(int fd) {
+#ifndef HAVE_WINSOCK2
struct flock lock;
memset(&lock,0,sizeof(struct flock));
@@ -119,6 +129,9 @@ static int unlock_fd(int fd) {
strerror(errno));
return 0;
}
+#else
+printf("FIXME? should unlock here\n");
+#endif
return 1;
}
@@ -280,7 +293,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
return STREAM_OK;
error:
- close(f);
+ closesocket(f);
m_struct_free(&stream_opts,opts);
return STREAM_ERROR;
}