summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--stream/asf_mmst_streaming.c4
-rw-r--r--stream/asf_streaming.c4
-rw-r--r--stream/http.c1
-rw-r--r--stream/librtsp/rtsp_session.c2
-rw-r--r--stream/network.c4
-rw-r--r--stream/network.h4
-rw-r--r--stream/pnm.c3
-rw-r--r--stream/rtp.c2
-rw-r--r--stream/stream.c6
-rw-r--r--stream/stream_ftp.c2
-rw-r--r--stream/stream_netstream.c2
-rw-r--r--stream/stream_rtsp.c2
-rw-r--r--stream/tcp.c2
-rw-r--r--stream/udp.c2
14 files changed, 17 insertions, 23 deletions
diff --git a/stream/asf_mmst_streaming.c b/stream/asf_mmst_streaming.c
index 5874998199..36021af35c 100644
--- a/stream/asf_mmst_streaming.c
+++ b/stream/asf_mmst_streaming.c
@@ -39,9 +39,7 @@
#include "mp_msg.h"
#include "help_mp.h"
-#ifndef HAVE_WINSOCK2_H
-#define closesocket close
-#else
+#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
diff --git a/stream/asf_streaming.c b/stream/asf_streaming.c
index 67dc7278b8..a937c23432 100644
--- a/stream/asf_streaming.c
+++ b/stream/asf_streaming.c
@@ -9,9 +9,7 @@
#include "mp_msg.h"
#include "help_mp.h"
-#ifndef HAVE_WINSOCK2_H
-#define closesocket close
-#else
+#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
diff --git a/stream/http.c b/stream/http.c
index 048edeedca..2a6d07aee0 100644
--- a/stream/http.c
+++ b/stream/http.c
@@ -12,7 +12,6 @@
#include <unistd.h>
#ifndef HAVE_WINSOCK2_H
-#define closesocket close
#else
#include <winsock2.h>
#include <ws2tcpip.h>
diff --git a/stream/librtsp/rtsp_session.c b/stream/librtsp/rtsp_session.c
index 5e897ba777..ce68dd765f 100644
--- a/stream/librtsp/rtsp_session.c
+++ b/stream/librtsp/rtsp_session.c
@@ -31,7 +31,6 @@
#include <sys/types.h>
#include "config.h"
#ifndef HAVE_WINSOCK2_H
-#define closesocket close
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
@@ -51,6 +50,7 @@
#include "rtsp.h"
#include "rtsp_rtp.h"
#include "rtsp_session.h"
+#include "stream/network.h"
#include "stream/url.h"
#include "stream/rtp.h"
#include "stream/realrtsp/real.h"
diff --git a/stream/network.c b/stream/network.c
index 3f2391e60f..6e000c07f2 100644
--- a/stream/network.c
+++ b/stream/network.c
@@ -19,9 +19,7 @@
#include "mp_msg.h"
#include "help_mp.h"
-#ifndef HAVE_WINSOCK2_H
-#define closesocket close
-#else
+#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
diff --git a/stream/network.h b/stream/network.h
index b3d6abc8c4..76e2e6d520 100644
--- a/stream/network.h
+++ b/stream/network.h
@@ -22,6 +22,10 @@
#include "url.h"
#include "http.h"
+#ifndef HAVE_CLOSESOCKET
+#define closesocket close
+#endif
+
#define BUFFER_SIZE 2048
typedef struct {
diff --git a/stream/pnm.c b/stream/pnm.c
index d9d9513897..1ef86e620c 100644
--- a/stream/pnm.c
+++ b/stream/pnm.c
@@ -36,7 +36,6 @@
#include <sys/time.h>
#include <inttypes.h>
#ifndef HAVE_WINSOCK2_H
-#define closesocket close
#include <sys/socket.h>
//#include <netinet/in.h>
//#include <netdb.h>
@@ -50,7 +49,7 @@
#include "libmpdemux/demuxer.h"
#include "help_mp.h"
#include "osdep/timer.h"
-
+#include "network.h"
#include "pnm.h"
#include "tcp.h"
//#include "libreal/rmff.h"
diff --git a/stream/rtp.c b/stream/rtp.c
index f4b84fc3b4..624812a0fe 100644
--- a/stream/rtp.c
+++ b/stream/rtp.c
@@ -17,12 +17,12 @@
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
-#define closesocket close
#else
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
#include <errno.h>
+#include "network.h"
#include "stream.h"
/* MPEG-2 TS RTP stack */
diff --git a/stream/stream.c b/stream/stream.c
index 9b58c670f2..bcf4836717 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -14,16 +14,14 @@
#include "config.h"
-#ifndef HAVE_WINSOCK2_H
-#define closesocket close
-#else
+#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#include "mp_msg.h"
#include "help_mp.h"
#include "osdep/shmem.h"
-
+#include "network.h"
#include "stream.h"
#include "libmpdemux/demuxer.h"
diff --git a/stream/stream_ftp.c b/stream/stream_ftp.c
index 814d7d0083..95632e7375 100644
--- a/stream/stream_ftp.c
+++ b/stream/stream_ftp.c
@@ -11,12 +11,12 @@
#include <errno.h>
#ifndef HAVE_WINSOCK2_H
#include <sys/socket.h>
-#define closesocket close
#else
#include <winsock2.h>
#endif
#include "mp_msg.h"
+#include "network.h"
#include "stream.h"
#include "help_mp.h"
#include "m_option.h"
diff --git a/stream/stream_netstream.c b/stream/stream_netstream.c
index 4a3d2f04ed..5a3de1ce58 100644
--- a/stream/stream_netstream.c
+++ b/stream/stream_netstream.c
@@ -43,7 +43,6 @@
#include <errno.h>
#ifndef HAVE_WINSOCK2_H
-#define closesocket close
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -59,6 +58,7 @@
#include "libavutil/common.h"
#include "mpbswap.h"
+#include "network.h"
#include "netstream.h"
#include "tcp.h"
diff --git a/stream/stream_rtsp.c b/stream/stream_rtsp.c
index d5c02852c1..c45f3aad86 100644
--- a/stream/stream_rtsp.c
+++ b/stream/stream_rtsp.c
@@ -32,13 +32,13 @@
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
-#define closesocket close
#else
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
#include <errno.h>
+#include "network.h"
#include "stream.h"
#include "tcp.h"
#include "librtsp/rtsp.h"
diff --git a/stream/tcp.c b/stream/tcp.c
index 7eb5fc11b8..fd5a849cad 100644
--- a/stream/tcp.c
+++ b/stream/tcp.c
@@ -25,12 +25,12 @@
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
-#define closesocket close
#else
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
+#include "network.h"
#include "stream.h"
#include "tcp.h"
diff --git a/stream/udp.c b/stream/udp.c
index 52d47a0991..e7ac97f597 100644
--- a/stream/udp.c
+++ b/stream/udp.c
@@ -36,13 +36,13 @@
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
-#define closesocket close
#else
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
#include "mp_msg.h"
+#include "network.h"
#include "url.h"
#include "udp.h"