summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TOOLS/netstream/netstream.c8
-rwxr-xr-xconfigure27
-rw-r--r--libmpdemux/asf_mmst_streaming.c8
-rw-r--r--libmpdemux/asf_streaming.c10
-rw-r--r--libmpdemux/network.c62
-rw-r--r--libmpdemux/network.h8
-rw-r--r--libmpdemux/pnm.c19
-rw-r--r--libmpdemux/realrtsp/rmff.h5
-rw-r--r--libmpdemux/realrtsp/rtsp.c18
-rw-r--r--libmpdemux/realrtsp/rtsp_session.c5
-rw-r--r--libmpdemux/rtp.c8
-rw-r--r--libmpdemux/rtp.h5
-rw-r--r--libmpdemux/stream.c21
-rw-r--r--libmpdemux/stream_netstream.c15
-rw-r--r--libvo/vo_bl.c16
15 files changed, 205 insertions, 30 deletions
diff --git a/TOOLS/netstream/netstream.c b/TOOLS/netstream/netstream.c
index a79def31bf..0cf9e121b1 100644
--- a/TOOLS/netstream/netstream.c
+++ b/TOOLS/netstream/netstream.c
@@ -28,11 +28,17 @@
#include <inttypes.h>
#include <errno.h>
#include <signal.h>
-
#include <sys/types.h>
+
+#include "config.h"
+
+#ifndef HAVE_WINSOCK2
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#else
+#include <winsock2.h>
+#endif
#include <libmpdemux/stream.h>
#include <mp_msg.h>
diff --git a/configure b/configure
index 6a3cbbaec3..fec5f1ac4c 100755
--- a/configure
+++ b/configure
@@ -155,6 +155,7 @@ Optional features:
--disable-edl disable EDL (edit decision list) support [enable]
--disable-rtc disable RTC (/dev/rtc) on Linux [autodetect]
--disable-network disable network support (for: http/mms/rtp) [enable]
+ --enable-winsock2 enable winsock2 usage [autodetect]
--enable-smb enable Samba (SMB) input support [autodetect]
--enable-live enable LIVE.COM Streaming Media support [disable]
--enable-dvdnav enable dvdnav support [disable]
@@ -1058,6 +1059,7 @@ _tv_v4l=auto
_tv_bsdbt848=auto
_edl=yes
_network=yes
+_winsock2=auto
_smbsupport=auto
_vidix=auto
_joystick=no
@@ -1233,6 +1235,8 @@ for ac_option do
--disable-fastmemcpy) _fastmemcpy=no ;;
--enable-network) _network=yes ;;
--disable-network) _network=no ;;
+ --enable-winsock2) _winsock2=yes ;;
+ --disable-winsock2) _winsock2=no ;;
--enable-smb) _smbsupport=yes ;;
--disable-smb) _smbsupport=no ;;
--enable-vidix) _vidix=yes ;;
@@ -1807,6 +1811,14 @@ EOF
cc_check -lsocket && _ld_sock="-lsocket"
cc_check -lnsl && _ld_sock="-lnsl"
cc_check -lsocket -lnsl && _ld_sock="-lsocket -lnsl"
+if test $_winsock2 = auto && not cygwin ; then
+ _winsock2=no
+ cat > $TMPC << EOF
+#include <winsock2.h>
+int main(void) { (void) gethostbyname(0); return 0; }
+EOF
+ cc_check -lws2_32 && _ld_sock="-lws2_32" && _winsock2=yes
+fi
if test "$_ld_sock" ; then
echores "yes (using $_ld_sock)"
else
@@ -1814,6 +1826,14 @@ else
fi
+if test $_winsock2 = yes ; then
+ _ld_sock="-lws2_32"
+ _def_winsock2='#define HAVE_WINSOCK2 1'
+else
+ _def_winsock2='#undef HAVE_WINSOCK2'
+fi
+
+
_use_aton=no
echocheck "inet_pton()"
cat > $TMPC << EOF
@@ -1822,7 +1842,9 @@ cat > $TMPC << EOF
#include <arpa/inet.h>
int main(void) { (void) inet_pton(0, 0, 0); return 0; }
EOF
-if cc_check $_ld_sock ; then
+if test "$_winsock2" = yes ; then
+ echores "not needed (using winsock2 functions)"
+elif cc_check $_ld_sock ; then
# NOTE: Linux has libresolv but does not need it
:
echores "yes (using $_ld_sock)"
@@ -5791,6 +5813,9 @@ $_def_faad_version
/* enable network */
$_def_network
+/* enable winsock2 instead of Unix functions*/
+$_def_winsock2
+
/* define this to use inet_aton() instead of inet_pton() */
$_def_use_aton
diff --git a/libmpdemux/asf_mmst_streaming.c b/libmpdemux/asf_mmst_streaming.c
index 0e6b27ec59..4befcdc1fc 100644
--- a/libmpdemux/asf_mmst_streaming.c
+++ b/libmpdemux/asf_mmst_streaming.c
@@ -16,6 +16,12 @@
#include "config.h"
+#ifndef HAVE_WINSOCK2
+#define closesocket close
+#else
+#include <winsock2.h>
+#endif
+
#include "url.h"
#include "asf.h"
@@ -433,7 +439,7 @@ int asf_mmst_streaming_start(stream_t *stream)
int s = stream->fd;
if( s>0 ) {
- close( stream->fd );
+ closesocket( stream->fd );
stream->fd = -1;
}
diff --git a/libmpdemux/asf_streaming.c b/libmpdemux/asf_streaming.c
index 4fbe5fbda1..122cbb66e6 100644
--- a/libmpdemux/asf_streaming.c
+++ b/libmpdemux/asf_streaming.c
@@ -6,6 +6,12 @@
#include "config.h"
+#ifndef HAVE_WINSOCK2
+#define closesocket close
+#else
+#include <winsock2.h>
+#endif
+
#include "url.h"
#include "http.h"
#include "asf.h"
@@ -643,7 +649,7 @@ asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
do {
done = 1;
- if( fd>0 ) close( fd );
+ if( fd>0 ) closesocket( fd );
if( !strcasecmp( url->protocol, "http_proxy" ) ) {
if( url->port==0 ) url->port = 8080;
@@ -729,7 +735,7 @@ asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
case ASF_Unknown_e:
default:
mp_msg(MSGT_NETWORK,MSGL_ERR,"Unknown ASF streaming type\n");
- close(fd);
+ closesocket(fd);
http_free( http_hdr );
return -1;
}
diff --git a/libmpdemux/network.c b/libmpdemux/network.c
index 46d77be2ae..b0f0b42c69 100644
--- a/libmpdemux/network.c
+++ b/libmpdemux/network.c
@@ -16,6 +16,13 @@
#include "config.h"
+#ifndef HAVE_WINSOCK2
+#define closesocket close
+#else
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
+
#include "stream.h"
#include "demuxer.h"
#include "../m_config.h"
@@ -194,6 +201,10 @@ connect2Server_with_af(char *host, int port, int af) {
struct hostent *hp=NULL;
char buf[255];
+#ifdef HAVE_WINSOCK2
+ u_long val;
+#endif
+
socket_server_fd = socket(af, SOCK_STREAM, 0);
@@ -215,11 +226,15 @@ connect2Server_with_af(char *host, int port, int af) {
bzero(&server_address, sizeof(server_address));
+#ifndef HAVE_WINSOCK2
#ifdef USE_ATON
if (inet_aton(host, our_s_addr)!=1)
#else
if (inet_pton(af, host, our_s_addr)!=1)
#endif
+#else
+ if ( inet_addr(host)==INADDR_NONE )
+#endif
{
mp_msg(MSGT_NETWORK,MSGL_STATUS,"Resolving %s for %s...\n", host, af2String(af));
@@ -235,6 +250,12 @@ connect2Server_with_af(char *host, int port, int af) {
memcpy( our_s_addr, (void*)hp->h_addr, hp->h_length );
}
+#ifdef HAVE_WINSOCK2
+ else {
+ unsigned long addr = inet_addr(host);
+ memcpy( our_s_addr, (void*)&addr, sizeof(addr) );
+ }
+#endif
switch (af) {
case AF_INET:
@@ -254,7 +275,7 @@ connect2Server_with_af(char *host, int port, int af) {
return -2;
}
-#ifdef USE_ATON
+#if defined(USE_ATON) || defined(HAVE_WINSOCK2)
strncpy( buf, inet_ntoa( *((struct in_addr*)our_s_addr) ), 255);
#else
inet_ntop(af, our_s_addr, buf, 255);
@@ -262,11 +283,20 @@ connect2Server_with_af(char *host, int port, int af) {
mp_msg(MSGT_NETWORK,MSGL_STATUS,"Connecting to server %s[%s]:%d ...\n", host, buf , port );
// Turn the socket as non blocking so we can timeout on the connection
+#ifndef HAVE_WINSOCK2
fcntl( socket_server_fd, F_SETFL, fcntl(socket_server_fd, F_GETFL) | O_NONBLOCK );
+#else
+ val = 1;
+ ioctlsocket( socket_server_fd, FIONBIO, &val );
+#endif
if( connect( socket_server_fd, (struct sockaddr*)&server_address, server_address_size )==-1 ) {
+#ifndef HAVE_WINSOCK2
if( errno!=EINPROGRESS ) {
+#else
+ if( (WSAGetLastError() != WSAEINPROGRESS) && (WSAGetLastError() != WSAEWOULDBLOCK) ) {
+#endif
mp_msg(MSGT_NETWORK,MSGL_ERR,"Failed to connect to server with %s\n", af2String(af));
- close(socket_server_fd);
+ closesocket(socket_server_fd);
return -1;
}
}
@@ -293,7 +323,12 @@ connect2Server_with_af(char *host, int port, int af) {
}
// Turn back the socket as blocking
+#ifndef HAVE_WINSOCK2
fcntl( socket_server_fd, F_SETFL, fcntl(socket_server_fd, F_GETFL) & ~O_NONBLOCK );
+#else
+ val = 0;
+ ioctlsocket( socket_server_fd, FIONBIO, &val );
+#endif
// Check if there were any error
err_len = sizeof(int);
ret = getsockopt(socket_server_fd,SOL_SOCKET,SO_ERROR,&err,&err_len);
@@ -655,7 +690,7 @@ extension=NULL;
http_hdr = http_read_response( fd );
if( http_hdr==NULL ) {
- close( fd );
+ closesocket( fd );
http_free( http_hdr );
return -1;
}
@@ -734,7 +769,7 @@ extension=NULL;
// TODO: RFC 2616, recommand to detect infinite redirection loops
next_url = http_get_field( http_hdr, "Location" );
if( next_url!=NULL ) {
- close( fd );
+ closesocket( fd );
url_free( url );
streaming_ctrl->url = url = url_new( next_url );
http_free( http_hdr );
@@ -840,7 +875,7 @@ nop_streaming_start( stream_t *stream ) {
break;
default:
mp_msg(MSGT_NETWORK,MSGL_ERR,"Server return %d: %s\n", http_hdr->status_code, http_hdr->reason_phrase );
- close( fd );
+ closesocket( fd );
fd = -1;
}
stream->fd = fd;
@@ -938,7 +973,7 @@ realrtsp_streaming_start( stream_t *stream ) {
if ( redirected == 1 ) {
url_free(stream->streaming_ctrl->url);
stream->streaming_ctrl->url = url_new(mrl);
- close(fd);
+ closesocket(fd);
}
free(mrl);
@@ -988,19 +1023,28 @@ rtp_open_socket( URL_t *url ) {
}
memcpy( (void*)&server_address.sin_addr.s_addr, (void*)hp->h_addr, hp->h_length );
} else {
+#ifndef HAVE_WINSOCK2
#ifdef USE_ATON
inet_aton(url->hostname, &server_address.sin_addr);
#else
inet_pton(AF_INET, url->hostname, &server_address.sin_addr);
#endif
+#else
+ unsigned int addr = inet_addr(url->hostname);
+ memcpy( (void*)&server_address.sin_addr, (void*)&addr, sizeof(addr) );
+#endif
}
server_address.sin_family=AF_INET;
server_address.sin_port=htons(url->port);
if( bind( socket_server_fd, (struct sockaddr*)&server_address, sizeof(server_address) )==-1 ) {
+#ifndef HAVE_WINSOCK2
if( errno!=EINPROGRESS ) {
+#else
+ if( WSAGetLastError() != WSAEINPROGRESS ) {
+#endif
mp_msg(MSGT_NETWORK,MSGL_ERR,"Failed to connect to server\n");
- close(socket_server_fd);
+ closesocket(socket_server_fd);
return -1;
}
}
@@ -1032,7 +1076,7 @@ rtp_open_socket( URL_t *url ) {
if( err ) {
mp_msg(MSGT_NETWORK,MSGL_ERR,"Timeout! No data from host %s\n", url->hostname );
mp_msg(MSGT_NETWORK,MSGL_DBG2,"Socket error: %d\n", err );
- close(socket_server_fd);
+ closesocket(socket_server_fd);
return -1;
}
}
@@ -1091,7 +1135,7 @@ streaming_start(stream_t *stream, int *demuxer_type, URL_t *url) {
// For RTP streams, we usually don't know the stream type until we open it.
if( !strcasecmp( stream->streaming_ctrl->url->protocol, "rtp")) {
if(stream->fd >= 0) {
- if(close(stream->fd) < 0)
+ if(closesocket(stream->fd) < 0)
mp_msg(MSGT_NETWORK,MSGL_ERR,"streaming_start : Closing socket %d failed %s\n",stream->fd,strerror(errno));
}
stream->fd = -1;
diff --git a/libmpdemux/network.h b/libmpdemux/network.h
index e83b15c0ab..9bf614e0c0 100644
--- a/libmpdemux/network.h
+++ b/libmpdemux/network.h
@@ -8,12 +8,16 @@
#define __NETWORK_H
#include <fcntl.h>
-#include <netdb.h>
-#include <netinet/in.h>
#include <sys/time.h>
#include <sys/types.h>
+
+#include "config.h"
+#ifndef HAVE_WINSOCK2
+#include <netdb.h>
+#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
+#endif
#include "url.h"
#include "http.h"
diff --git a/libmpdemux/pnm.c b/libmpdemux/pnm.c
index 6a9b5ea38b..7699d31663 100644
--- a/libmpdemux/pnm.c
+++ b/libmpdemux/pnm.c
@@ -26,9 +26,6 @@
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
-#include <sys/socket.h>
-//#include <netinet/in.h>
-//#include <netdb.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -37,6 +34,16 @@
#include <sys/time.h>
#include <inttypes.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 "pnm.h"
//#include "libreal/rmff.h"
@@ -207,7 +214,11 @@ static int rm_write(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;
@@ -810,7 +821,7 @@ int pnm_peek_header (pnm_t *this, char *data) {
void pnm_close(pnm_t *p) {
- if (p->s >= 0) close(p->s);
+ if (p->s >= 0) closesocket(p->s);
free(p->path);
free(p);
}
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>
diff --git a/libmpdemux/rtp.c b/libmpdemux/rtp.c
index 780c982dd4..1311dd3192 100644
--- a/libmpdemux/rtp.c
+++ b/libmpdemux/rtp.c
@@ -2,12 +2,18 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <netinet/in.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
+#include "config.h"
+#ifndef HAVE_WINSOCK2
+#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
+#else
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
/* MPEG-2 TS RTP stack */
diff --git a/libmpdemux/rtp.h b/libmpdemux/rtp.h
index 3a37ced3dc..120c205358 100644
--- a/libmpdemux/rtp.h
+++ b/libmpdemux/rtp.h
@@ -1,7 +1,12 @@
#ifndef _RTP_H
#define _RTP_H
+#include "config.h"
+#ifndef HAVE_WINSOCK2
#include <sys/socket.h>
+#else
+#include <winsock2.h>
+#endif
struct rtpbits {
unsigned int v:2; /* version: 2 */
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);
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;
}
diff --git a/libvo/vo_bl.c b/libvo/vo_bl.c
index 13102f2d44..d0aaeb9611 100644
--- a/libvo/vo_bl.c
+++ b/libvo/vo_bl.c
@@ -19,17 +19,23 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
-#include <netdb.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/socket.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
-#include <netinet/in.h>
#include "config.h"
+#ifndef HAVE_WINSOCK2
+#define closesocket close
+#include <netdb.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#else
+#include <winsock2.h>
+#endif
+
#include "video_out.h"
#include "video_out_internal.h"
#include "../mp_msg.h"
@@ -168,7 +174,7 @@ static int udp_init(bl_host_t *h) {
if (connect(h->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
mp_msg(MSGT_VO, MSGL_ERR, "couldn't connect socket for %s\n",
h->name);
- close(h->fd);
+ closesocket(h->fd);
return 1;
}
return 0;
@@ -180,7 +186,7 @@ static void udp_send(bl_host_t *h) {
}
static void udp_close(bl_host_t *h) {
- close(h->fd);
+ closesocket(h->fd);
}
#define NO_BLS 2