From 6ac4f2256749cc720d79317e8eb1a48a706e2db8 Mon Sep 17 00:00:00 2001 From: diego Date: Wed, 11 Jun 2003 16:48:09 +0000 Subject: Networking support under MinGW. Patch by flo/yepyep . git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10282 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/realrtsp/rmff.h | 5 +++++ libmpdemux/realrtsp/rtsp.c | 18 ++++++++++++++++-- libmpdemux/realrtsp/rtsp_session.c | 5 +++++ 3 files changed, 26 insertions(+), 2 deletions(-) (limited to 'libmpdemux/realrtsp') diff --git a/libmpdemux/realrtsp/rmff.h b/libmpdemux/realrtsp/rmff.h index d69674162f..7ea75a04aa 100644 --- a/libmpdemux/realrtsp/rmff.h +++ b/libmpdemux/realrtsp/rmff.h @@ -27,9 +27,14 @@ */ #include +#include "config.h" +#ifndef HAVE_WINSOCK2 #include #include #include +#else +#include +#endif #include #include #include diff --git a/libmpdemux/realrtsp/rtsp.c b/libmpdemux/realrtsp/rtsp.c index 153104f99a..5223d6bba1 100644 --- a/libmpdemux/realrtsp/rtsp.c +++ b/libmpdemux/realrtsp/rtsp.c @@ -29,9 +29,15 @@ #include #include #include +#include "config.h" +#ifndef HAVE_WINSOCK2 +#define closesocket close #include #include #include +#else +#include +#endif #include #include #include @@ -119,9 +125,13 @@ static int host_connect_attempt(struct in_addr ia, int port) { sin.sin_port = htons(port); if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 +#ifndef HAVE_WINSOCK2 && errno != EINPROGRESS) { +#else + && WSAGetLastError() == WSAEINPROGRESS) { +#endif printf ("rtsp: connect(): %s\n", strerror(errno)); - close(s); + closesocket(s); return -1; } @@ -163,7 +173,11 @@ static int write_stream(int s, const char *buf, int len) { if (n > 0) total += n; else if (n < 0) { +#ifndef HAVE_WINSOCK2 if ((timeout>0) && ((errno == EAGAIN) || (errno == EINPROGRESS))) { +#else + if ((timeout>0) && ((errno == EAGAIN) || (WSAGetLastError() == WSAEINPROGRESS))) { +#endif sleep (1); timeout--; } else return -1; @@ -641,7 +655,7 @@ rtsp_t *rtsp_connect(int fd, char* mrl, char *path, char *host, int port, char * void rtsp_close(rtsp_t *s) { - if (s->server_state) close(s->s); /* TODO: send a TEAROFF */ + if (s->server_state) closesocket(s->s); /* TODO: send a TEAROFF */ if (s->path) free(s->path); if (s->host) free(s->host); if (s->mrl) free(s->mrl); diff --git a/libmpdemux/realrtsp/rtsp_session.c b/libmpdemux/realrtsp/rtsp_session.c index 54b987b67b..9573dc24cb 100644 --- a/libmpdemux/realrtsp/rtsp_session.c +++ b/libmpdemux/realrtsp/rtsp_session.c @@ -26,9 +26,14 @@ */ #include +#include "config.h" +#ifndef HAVE_WINSOCK2 #include #include #include +#else +#include +#endif #include #include #include -- cgit v1.2.3