summaryrefslogtreecommitdiffstats
path: root/libmpdemux/realrtsp
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/realrtsp
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/realrtsp')
-rw-r--r--libmpdemux/realrtsp/rmff.h5
-rw-r--r--libmpdemux/realrtsp/rtsp.c18
-rw-r--r--libmpdemux/realrtsp/rtsp_session.c5
3 files changed, 26 insertions, 2 deletions
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 <sys/types.h>
+#include "config.h"
+#ifndef HAVE_WINSOCK2
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
+#else
+#include <winsock2.h>
+#endif
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
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 <unistd.h>
#include <stdio.h>
#include <assert.h>
+#include "config.h"
+#ifndef HAVE_WINSOCK2
+#define closesocket close
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
+#else
+#include <winsock2.h>
+#endif
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -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 <sys/types.h>
+#include "config.h"
+#ifndef HAVE_WINSOCK2
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
+#else
+#include <winsock2.h>
+#endif
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>