[MPlayer-dev-eng] Fw: mingw network patch, again
Sascha Sommer
saschasommer at freenet.de
Mon May 26 19:26:17 CEST 2003
Here is the updated patch
----- Original Message -----
From: "flo/yepyep" <flodt8 at yahoo.de>
To: <alex at fsn.hu>
Cc: <saschasommer at freenet.de>
Sent: Monday, May 26, 2003 6:46 PM
Subject: mingw network patch, again
> the previous patch had some stupid bug, here's an updated version of
> the new patch. should work as expected now (i hope) :)
>
> flo/yepyep
> (whyever the attachment didnt work before)
>
> __________________________________________________________________
>
> Gesendet von Yahoo! Mail - http://mail.yahoo.de
> Logos und Klingeltöne fürs Handy bei http://sms.yahoo.de
----------------------------------------------------------------------------
----
> diff -Naur main.old/TOOLS/netstream/netstream.c
main/TOOLS/netstream/netstream.c
> --- main.old/TOOLS/netstream/netstream.c Sun Apr 6 18:16:11 2003
> +++ main/TOOLS/netstream/netstream.c Mon May 26 10:26:22 2003
> @@ -28,11 +28,18 @@
> #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
> +#undef DATADIR
> +#include <winsock2.h>
> +#endif
>
> #include <libmpdemux/stream.h>
> #include <mp_msg.h>
> diff -Naur main.old/configure main/configure
> --- main.old/configure Fri May 23 12:37:31 2003
> +++ main/configure Mon May 26 10:19:17 2003
> @@ -1809,12 +1809,24 @@
> cc_check -lsocket && _ld_sock="-lsocket"
> cc_check -lnsl && _ld_sock="-lnsl"
> cc_check -lsocket -lnsl && _ld_sock="-lsocket -lnsl"
> +cat > $TMPC << EOF
> +#include <winsock2.h>
> +int main(void) { (void) gethostbyname(0); return 0; }
> +EOF
> +cc_check -lws2_32 && _ld_sock="-lws2_32"
> if test "$_ld_sock" ; then
> echores "yes (using $_ld_sock)"
> else
> echores "no"
> fi
>
> +_winsock2=no
> +_def_winsock2='#undef HAVE_WINSOCK2'
> +if test "$_ld_sock" == "-lws2_32" ; then
> + _winsock2=yes
> + _def_winsock2='#define HAVE_WINSOCK2 1'
> +fi
> +
>
> _use_aton=no
> echocheck "inet_pton()"
> @@ -1824,7 +1836,9 @@
> #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)"
> @@ -5735,6 +5749,9 @@
>
> /* enable network */
> $_def_network
> +
> +/* enable WinSock2 usage instead of unix functions*/
> +$_def_winsock2
>
> /* define this to use inet_aton() instead of inet_pton() */
> $_def_use_aton
> diff -Naur main.old/libmpdemux/asf_mmst_streaming.c
main/libmpdemux/asf_mmst_streaming.c
> --- main.old/libmpdemux/asf_mmst_streaming.c Sat May 24 15:53:38 2003
> +++ main/libmpdemux/asf_mmst_streaming.c Mon May 26 10:38:27 2003
> @@ -16,6 +16,15 @@
>
> #include "config.h"
>
> +#ifdef __MINGW32__
> +typedef long ssize_t;
> +#endif
> +
> +#ifdef HAVE_WINSOCK2
> +#undef DATADIR
> +#include <winsock2.h>
> +#endif
> +
> #include "url.h"
> #include "asf.h"
>
> @@ -433,7 +442,11 @@
> int s = stream->fd;
>
> if( s>0 ) {
> +#ifndef HAVE_WINSOCK2
> close( stream->fd );
> +#else
> + closesocket( stream->fd );
> +#endif
> stream->fd = -1;
> }
>
> diff -Naur main.old/libmpdemux/asf_streaming.c
main/libmpdemux/asf_streaming.c
> --- main.old/libmpdemux/asf_streaming.c Sat May 24 15:43:03 2003
> +++ main/libmpdemux/asf_streaming.c Mon May 26 10:38:28 2003
> @@ -6,6 +6,11 @@
>
> #include "config.h"
>
> +#ifdef HAVE_WINSOCK2
> +#undef DATADIR
> +#include <winsock2.h>
> +#endif
> +
> #include "url.h"
> #include "http.h"
> #include "asf.h"
> @@ -643,7 +648,11 @@
>
> do {
> done = 1;
> +#ifndef HAVE_WINSOCK2
> if( fd>0 ) close( fd );
> +#else
> + if( fd>0 ) closesocket( fd );
> +#endif
>
> if( !strcasecmp( url->protocol, "http_proxy" ) ) {
> if( url->port==0 ) url->port = 8080;
> @@ -729,7 +738,11 @@
> case ASF_Unknown_e:
> default:
> mp_msg(MSGT_NETWORK,MSGL_ERR,"Unknown ASF streaming type\n");
> +#ifndef HAVE_WINSOCK2
> close(fd);
> +#else
> + closesocket(fd);
> +#endif
> http_free( http_hdr );
> return -1;
> }
> diff -Naur main.old/libmpdemux/network.c main/libmpdemux/network.c
> --- main.old/libmpdemux/network.c Sat May 24 15:43:58 2003
> +++ main/libmpdemux/network.c Mon May 26 16:30:51 2003
> @@ -16,6 +16,16 @@
>
> #include "config.h"
>
> +#ifdef HAVE_WINSOCK2
> +#undef DATADIR
> +#include <winsock2.h>
> +#define IP_ADD_MEMBERSHIP 12
> +struct ip_mreq {
> + struct in_addr imr_multiaddr;
> + struct in_addr imr_interface;
> +};
> +#endif
> +
> #include "stream.h"
> #include "demuxer.h"
> #include "../m_config.h"
> @@ -181,6 +191,9 @@
> int socket_server_fd;
> int err, err_len;
> int ret,count = 0;
> +#ifdef HAVE_WINSOCK2
> + int temp;
> +#endif
> fd_set set;
> struct timeval tv;
> union {
> @@ -194,6 +207,13 @@
> struct hostent *hp=NULL;
> char buf[255];
>
> +#ifdef HAVE_WINSOCK2
> + u_long val;
> + WSADATA wsdata;
> + temp = WSAStartup(0x0002, &wsdata);
> +// printf("winsock2 init returned %i\n", temp);
> +#endif
> +
> socket_server_fd = socket(af, SOCK_STREAM, 0);
>
>
> @@ -212,14 +232,17 @@
> return -2;
> }
>
> -
> - bzero(&server_address, sizeof(server_address));
> -
> + memset(&server_address,0x0,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 +258,12 @@
>
> 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 +283,7 @@
> 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 +291,24 @@
> 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));
> +#ifndef HAVE_WINSOCK2
> close(socket_server_fd);
> +#else
> + closesocket(socket_server_fd);
> +#endif
> return -1;
> }
> }
> @@ -293,7 +335,12 @@
> }
>
> // 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 +702,11 @@
>
> http_hdr = http_read_response( fd );
> if( http_hdr==NULL ) {
> +#ifndef HAVE_WINSOCK2
> close( fd );
> +#else
> + closesocket( fd );
> +#endif
> http_free( http_hdr );
> return -1;
> }
> @@ -734,7 +785,11 @@
> // TODO: RFC 2616, recommand to detect infinite redirection loops
> next_url = http_get_field( http_hdr, "Location" );
> if( next_url!=NULL ) {
> +#ifndef HAVE_WINSOCK2
> close( fd );
> +#else
> + closesocket( fd );
> +#endif
> url_free( url );
> streaming_ctrl->url = url = url_new( next_url );
> http_free( http_hdr );
> @@ -840,7 +895,11 @@
> break;
> default:
> mp_msg(MSGT_NETWORK,MSGL_ERR,"Server return %d: %s\n",
http_hdr->status_code, http_hdr->reason_phrase );
> +#ifndef HAVE_WINSOCK2
> close( fd );
> +#else
> + closesocket( fd );
> +#endif
> fd = -1;
> }
> stream->fd = fd;
> @@ -948,6 +1007,9 @@
> rtp_open_socket( URL_t *url ) {
> int socket_server_fd, rxsockbufsz;
> int err, err_len;
> +#ifdef HAVE_WINSOCK2
> + int temp;
> +#endif
> fd_set set;
> struct sockaddr_in server_address;
> struct ip_mreq mcast;
> @@ -970,19 +1032,32 @@
> }
> 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
> + temp = sizeof(struct sockaddr_in);
> +
WSAStringToAddress(url->hostname,AF_INET,NULL,(LPSOCKADDR)&server_address.si
n_addr,&temp);
> +#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");
> +#ifndef HAVE_WINSOCK2
> close(socket_server_fd);
> +#else
> + closesocket(socket_server_fd);
> +#endif
> return -1;
> }
> }
> @@ -1014,7 +1089,11 @@
> 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 );
> +#ifndef HAVE_WINSOCK2
> close(socket_server_fd);
> +#else
> + closesocket(socket_server_fd);
> +#endif
> return -1;
> }
> }
> @@ -1073,7 +1152,11 @@
> // 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) {
> +#ifndef HAVE_WINSOCK2
> if(close(stream->fd) < 0)
> +#else
> + if(closesocket(stream->fd) < 0)
> +#endif
> mp_msg(MSGT_NETWORK,MSGL_ERR,"streaming_start : Closing socket %d failed
%s\n",stream->fd,strerror(errno));
> }
> stream->fd = -1;
> diff -Naur main.old/libmpdemux/network.h main/libmpdemux/network.h
> --- main.old/libmpdemux/network.h Wed Apr 9 16:21:42 2003
> +++ main/libmpdemux/network.h Mon May 26 10:41:14 2003
> @@ -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 -Naur main.old/libmpdemux/pnm.c main/libmpdemux/pnm.c
> --- main.old/libmpdemux/pnm.c Sat May 24 15:46:04 2003
> +++ main/libmpdemux/pnm.c Mon May 26 11:04:51 2003
> @@ -36,6 +36,14 @@
> #include <stdlib.h>
> #include <sys/time.h>
> #include <inttypes.h>
> +#ifdef __MINGW32__
> +typedef long ssize_t;
> +#endif
> +#include "config.h"
> +#ifdef HAVE_WINSOCK2
> +#undef DATADIR
> +#include <winsock2.h>
> +#endif
>
> #include "pnm.h"
> //#include "libreal/rmff.h"
> @@ -207,7 +215,11 @@
> 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 +822,11 @@
>
> void pnm_close(pnm_t *p) {
>
> +#ifndef HAVE_WINSOCK2
> if (p->s >= 0) close(p->s);
> +#else
> + if (p->s >= 0) closesocket(p->s);
> +#endif
> free(p->path);
> free(p);
> }
> diff -Naur main.old/libmpdemux/realrtsp/rmff.h
main/libmpdemux/realrtsp/rmff.h
> --- main.old/libmpdemux/realrtsp/rmff.h Sun Apr 20 14:40:38 2003
> +++ main/libmpdemux/realrtsp/rmff.h Mon May 26 11:07:47 2003
> @@ -27,9 +27,15 @@
> */
>
> #include <sys/types.h>
> +#include "config.h"
> +#ifndef HAVE_WINSOCK2
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <netdb.h>
> +#else
> +#undef DATADIR
> +#include <winsock2.h>
> +#endif
> #include <unistd.h>
> #include <stdio.h>
> #include <fcntl.h>
> diff -Naur main.old/libmpdemux/realrtsp/rtsp.c
main/libmpdemux/realrtsp/rtsp.c
> --- main.old/libmpdemux/realrtsp/rtsp.c Sat May 24 15:46:44 2003
> +++ main/libmpdemux/realrtsp/rtsp.c Mon May 26 10:49:26 2003
> @@ -29,9 +29,15 @@
> #include <unistd.h>
> #include <stdio.h>
> #include <assert.h>
> +#include "config.h"
> +#ifndef HAVE_WINSOCK2
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <netdb.h>
> +#else
> +#undef DATADIR
> +#include <winsock2.h>
> +#endif
> #include <string.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> @@ -44,6 +50,9 @@
>
> #include "rtsp.h"
>
> +#ifdef __MINGW32__
> +typedef long ssize_t;
> +#endif
> /*
> #define LOG
> */
> @@ -119,9 +128,17 @@
> 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));
> +#ifndef HAVE_WINSOCK2
> close(s);
> +#else
> + closesocket(s);
> +#endif
> return -1;
> }
>
> @@ -163,7 +180,11 @@
> 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 +662,11 @@
>
> void rtsp_close(rtsp_t *s) {
>
> +#ifndef HAVE_WINSOCK2
> if (s->server_state) close(s->s); /* TODO: send a TEAROFF */
> +#else
> + if (s->server_state) closesocket(s->s); /* TODO: send a TEAROFF */
> +#endif
> if (s->path) free(s->path);
> if (s->host) free(s->host);
> if (s->mrl) free(s->mrl);
> diff -Naur main.old/libmpdemux/realrtsp/rtsp_session.c
main/libmpdemux/realrtsp/rtsp_session.c
> --- main.old/libmpdemux/realrtsp/rtsp_session.c Thu Apr 17 20:38:57 2003
> +++ main/libmpdemux/realrtsp/rtsp_session.c Mon May 26 10:50:13 2003
> @@ -26,9 +26,15 @@
> */
>
> #include <sys/types.h>
> +#include "config.h"
> +#ifndef HAVE_WINSOCK2
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <netdb.h>
> +#else
> +#undef DATADIR
> +#include <winsock2.h>
> +#endif
> #include <unistd.h>
> #include <stdio.h>
> #include <fcntl.h>
> diff -Naur main.old/libmpdemux/rtp.c main/libmpdemux/rtp.c
> --- main.old/libmpdemux/rtp.c Sun Sep 22 02:33:26 2002
> +++ main/libmpdemux/rtp.c Mon May 26 10:51:16 2003
> @@ -2,17 +2,33 @@
> #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
> +#undef DATADIR
> +#include <winsock2.h>
> +#endif
>
> /* MPEG-2 TS RTP stack */
>
> #define DEBUG 1
> #include "rtp.h"
> +
> +#ifdef HAVE_WINSOCK2
> +#define IP_MULTICAST_TTL 10
> +#define IP_MULTICAST_LOOP 11
> +#define IP_ADD_MEMBERSHIP 12
> +struct ip_mreq {
> + struct in_addr imr_multiaddr;
> + struct in_addr imr_interface;
> +};
> +#endif
>
> void initrtp(struct rtpheader *foo) { /* fill in the MPEG-2 TS deefaults
*/
> /* Note: MPEG-2 TS defines a timestamping base frequency of 90000 Hz.
*/
> diff -Naur main.old/libmpdemux/rtp.h main/libmpdemux/rtp.h
> --- main.old/libmpdemux/rtp.h Sun Dec 23 21:09:02 2001
> +++ main/libmpdemux/rtp.h Mon May 26 10:52:06 2003
> @@ -1,7 +1,13 @@
> #ifndef _RTP_H
> #define _RTP_H
>
> +#include "config.h"
> +#ifndef HAVE_WINSOCK2
> #include <sys/socket.h>
> +#else
> +#undef DATADIR
> +#include <winsock2.h>
> +#endif
>
> struct rtpbits {
> unsigned int v:2; /* version: 2 */
> diff -Naur main.old/libmpdemux/stream.c main/libmpdemux/stream.c
> --- main.old/libmpdemux/stream.c Sat May 17 12:24:01 2003
> +++ main/libmpdemux/stream.c Mon May 26 13:37:20 2003
> @@ -14,6 +14,12 @@
> #include <strings.h>
>
> #include "config.h"
> +
> +#ifdef HAVE_WINSOCK2
> +#undef DATADIR
> +#include <winsock.h>
> +#endif
> +
> #include "mp_msg.h"
> #include "help_mp.h"
> #include "../osdep/shmem.h"
> @@ -413,7 +419,11 @@
> default:
> if(s->close) s->close(s);
> }
> +#ifndef HAVE_WINSOCK2
> if(s->fd>0) close(s->fd);
> +#else
> + if(s->fd>0) closesocket(s->fd);
> +#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 -Naur main.old/libmpdemux/stream_netstream.c
main/libmpdemux/stream_netstream.c
> --- main.old/libmpdemux/stream_netstream.c Sat May 17 12:24:01 2003
> +++ main/libmpdemux/stream_netstream.c Mon May 26 11:39:44 2003
> @@ -48,9 +48,14 @@
> #include <inttypes.h>
> #include <errno.h>
>
> +#ifndef HAVE_WINSOCK2
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <arpa/inet.h>
> +#else
> +#undef DATADIR
> +#include <winsock2.h>
> +#endif
>
> #include "mp_msg.h"
> #include "stream.h"
> @@ -89,6 +94,7 @@
> //// 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 @@
> }
> } 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 @@
> strerror(errno));
> return 0;
> }
> +#else
> +printf("FIXME: should unlock here\n");
> +#endif
> return 1;
> }
>
> @@ -280,7 +293,11 @@
> return STREAM_OK;
>
> error:
> +#ifndef HAVE_WINSOCK2
> close(f);
> +#else
> + closesocket(f);
> +#endif
> m_struct_free(&stream_opts,opts);
> return STREAM_ERROR;
> }
> diff -Naur main.old/libvo/vo_bl.c main/libvo/vo_bl.c
> --- main.old/libvo/vo_bl.c Sat May 24 15:59:47 2003
> +++ main/libvo/vo_bl.c Mon May 26 10:56:02 2003
> @@ -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
> +#include <netdb.h>
> +#include <sys/socket.h>
> +#include <netinet/in.h>
> +#else
> +#undef DATADIR
> +#include <winsock2.h>
> +#endif
> +
> #include "video_out.h"
> #include "video_out_internal.h"
> #include "../mp_msg.h"
> @@ -168,7 +174,11 @@
> 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);
> +#ifndef HAVE_WINSOCK2
> close(h->fd);
> +#else
> + closesocket(h->fd);
> +#endif
> return 1;
> }
> return 0;
> @@ -180,7 +190,11 @@
> }
>
> static void udp_close(bl_host_t *h) {
> +#ifndef HAVE_WINSOCK2
> close(h->fd);
> +#else
> + closesocket(h->fd);
> +#endif
> }
>
> #define NO_BLS 2
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mingwnetwork2a.diff
Type: application/octet-stream
Size: 17877 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20030526/b72b2517/attachment.obj>
More information about the MPlayer-dev-eng
mailing list