diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-02-04 00:28:17 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-02-04 00:28:17 +0200 |
commit | 9790f4e6e72cdc8093be966d3d6e007c8f44a035 (patch) | |
tree | 3d4a19a910d34be6ee7cd4841876a4318d5c243d /stream | |
parent | ccf4d9e96cd7aa8506e6632d2a7352ec89b2b9e3 (diff) | |
parent | 09bf506c34a73d587c999ce161a0714159e1e5b6 (diff) | |
download | mpv-9790f4e6e72cdc8093be966d3d6e007c8f44a035.tar.bz2 mpv-9790f4e6e72cdc8093be966d3d6e007c8f44a035.tar.xz |
Merge svn changes up to r28461
Diffstat (limited to 'stream')
-rw-r--r-- | stream/asf_mmst_streaming.c | 2 | ||||
-rw-r--r-- | stream/asf_streaming.c | 2 | ||||
-rw-r--r-- | stream/http.c | 2 | ||||
-rw-r--r-- | stream/librtsp/rtsp.c | 4 | ||||
-rw-r--r-- | stream/librtsp/rtsp_rtp.c | 26 | ||||
-rw-r--r-- | stream/librtsp/rtsp_session.c | 2 | ||||
-rw-r--r-- | stream/network.c | 2 | ||||
-rw-r--r-- | stream/network.h | 6 | ||||
-rw-r--r-- | stream/pnm.c | 4 | ||||
-rw-r--r-- | stream/realrtsp/rmff.h | 2 | ||||
-rw-r--r-- | stream/rtp.c | 2 | ||||
-rw-r--r-- | stream/stream.c | 6 | ||||
-rw-r--r-- | stream/stream_cddb.c | 2 | ||||
-rw-r--r-- | stream/stream_ftp.c | 2 | ||||
-rw-r--r-- | stream/stream_netstream.c | 6 | ||||
-rw-r--r-- | stream/stream_netstream.h | 2 | ||||
-rw-r--r-- | stream/stream_rtsp.c | 2 | ||||
-rw-r--r-- | stream/tcp.c | 26 | ||||
-rw-r--r-- | stream/udp.c | 20 |
19 files changed, 56 insertions, 64 deletions
diff --git a/stream/asf_mmst_streaming.c b/stream/asf_mmst_streaming.c index ad9b3e97ee..f19ffe50a7 100644 --- a/stream/asf_mmst_streaming.c +++ b/stream/asf_mmst_streaming.c @@ -39,7 +39,7 @@ #include "mp_msg.h" #include "help_mp.h" -#ifdef HAVE_WINSOCK2_H +#if HAVE_WINSOCK2_H #include <winsock2.h> #endif diff --git a/stream/asf_streaming.c b/stream/asf_streaming.c index 98859cfe9e..73cff872b5 100644 --- a/stream/asf_streaming.c +++ b/stream/asf_streaming.c @@ -10,7 +10,7 @@ #include "help_mp.h" #include "options.h" -#ifdef HAVE_WINSOCK2_H +#if HAVE_WINSOCK2_H #include <winsock2.h> #endif diff --git a/stream/http.c b/stream/http.c index 67b719269f..3286591943 100644 --- a/stream/http.c +++ b/stream/http.c @@ -11,7 +11,7 @@ #include <string.h> #include <unistd.h> -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H #else #include <winsock2.h> #include <ws2tcpip.h> diff --git a/stream/librtsp/rtsp.c b/stream/librtsp/rtsp.c index 19477fe5b3..8012174d99 100644 --- a/stream/librtsp/rtsp.c +++ b/stream/librtsp/rtsp.c @@ -42,7 +42,7 @@ #include <sys/time.h> #include <sys/types.h> #include <inttypes.h> -#ifdef HAVE_WINSOCK2_H +#if HAVE_WINSOCK2_H #include <winsock2.h> #else #include <sys/socket.h> @@ -72,7 +72,7 @@ static int write_stream(int s, const char *buf, int len) { if (n > 0) total += n; else if (n < 0) { -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H if ((timeout>0) && ((errno == EAGAIN) || (errno == EINPROGRESS))) { #else if ((timeout>0) && ((errno == EAGAIN) || (WSAGetLastError() == WSAEINPROGRESS))) { diff --git a/stream/librtsp/rtsp_rtp.c b/stream/librtsp/rtsp_rtp.c index b782b59cd5..54a2180375 100644 --- a/stream/librtsp/rtsp_rtp.c +++ b/stream/librtsp/rtsp_rtp.c @@ -28,7 +28,7 @@ #include "config.h" -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H #include <netdb.h> #include <netinet/in.h> #include <sys/socket.h> @@ -251,7 +251,7 @@ rtcp_connect (int client_port, int server_port, const char* server_hostname) if (bind (s, (struct sockaddr *) &sin, sizeof (sin))) { -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H if (errno != EINPROGRESS) #else if (WSAGetLastError() != WSAEINPROGRESS) @@ -297,13 +297,11 @@ rtp_connect (char *hostname, int port) if (!hostname || !strcmp (hostname, "0.0.0.0")) sin.sin_addr.s_addr = htonl (INADDR_ANY); else -#ifndef HAVE_WINSOCK2_H -#ifdef HAVE_ATON - inet_aton (hostname, &sin.sin_addr); -#else +#if HAVE_INET_PTON inet_pton (AF_INET, hostname, &sin.sin_addr); -#endif -#else +#elif HAVE_INET_ATON + inet_aton (hostname, &sin.sin_addr); +#elif HAVE_WINSOCK2_H sin.sin_addr.s_addr = htonl (INADDR_ANY); #endif sin.sin_port = htons (port); @@ -332,7 +330,7 @@ rtp_connect (char *hostname, int port) /* datagram socket */ if (bind (s, (struct sockaddr *) &sin, sizeof (sin))) { -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H if (errno != EINPROGRESS) #else if (WSAGetLastError() != WSAEINPROGRESS) @@ -386,13 +384,11 @@ is_multicast_address (char *addr) sin.sin_family = AF_INET; -#ifndef HAVE_WINSOCK2_H -#ifdef HAVE_ATON - inet_aton (addr, &sin.sin_addr); -#else +#if HAVE_INET_PTON inet_pton (AF_INET, addr, &sin.sin_addr); -#endif -#else +#elif HAVE_INET_ATON + inet_aton (addr, &sin.sin_addr); +#elif HAVE_WINSOCK2_H sin.sin_addr.s_addr = htonl (INADDR_ANY); #endif diff --git a/stream/librtsp/rtsp_session.c b/stream/librtsp/rtsp_session.c index ce68dd765f..c196e5305d 100644 --- a/stream/librtsp/rtsp_session.c +++ b/stream/librtsp/rtsp_session.c @@ -30,7 +30,7 @@ #include <sys/types.h> #include "config.h" -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> diff --git a/stream/network.c b/stream/network.c index 5cfe4a461e..19a87ea2a9 100644 --- a/stream/network.c +++ b/stream/network.c @@ -19,7 +19,7 @@ #include "mp_msg.h" #include "help_mp.h" -#ifdef HAVE_WINSOCK2_H +#if HAVE_WINSOCK2_H #include <winsock2.h> #include <ws2tcpip.h> #endif diff --git a/stream/network.h b/stream/network.h index 2f8d4123ab..c00bffd5e5 100644 --- a/stream/network.h +++ b/stream/network.h @@ -12,7 +12,7 @@ #include <sys/types.h> #include "config.h" -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H #include <netdb.h> #include <netinet/in.h> #include <sys/socket.h> @@ -22,10 +22,10 @@ #include "url.h" #include "http.h" -#ifndef HAVE_CLOSESOCKET +#if !HAVE_CLOSESOCKET #define closesocket close #endif -#ifndef HAVE_SOCKLEN_T +#if !HAVE_SOCKLEN_T typedef int socklen_t; #endif diff --git a/stream/pnm.c b/stream/pnm.c index 1ef86e620c..437ad8b0cb 100644 --- a/stream/pnm.c +++ b/stream/pnm.c @@ -35,7 +35,7 @@ #include <stdlib.h> #include <sys/time.h> #include <inttypes.h> -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H #include <sys/socket.h> //#include <netinet/in.h> //#include <netdb.h> @@ -204,7 +204,7 @@ static int rm_write(int s, const char *buf, int len) { if (n > 0) total += n; else if (n < 0) { -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H if (timeout>0 && (errno == EAGAIN || errno == EINPROGRESS)) { #else if (timeout>0 && (errno == EAGAIN || WSAGetLastError() == WSAEINPROGRESS)) { diff --git a/stream/realrtsp/rmff.h b/stream/realrtsp/rmff.h index a58bb3ccdc..3699723f9b 100644 --- a/stream/realrtsp/rmff.h +++ b/stream/realrtsp/rmff.h @@ -31,7 +31,7 @@ #include <sys/types.h> #include "config.h" -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> diff --git a/stream/rtp.c b/stream/rtp.c index 624812a0fe..cdfdc28f7b 100644 --- a/stream/rtp.c +++ b/stream/rtp.c @@ -13,7 +13,7 @@ #include <sys/types.h> #include <ctype.h> #include "config.h" -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H #include <netinet/in.h> #include <sys/socket.h> #include <arpa/inet.h> diff --git a/stream/stream.c b/stream/stream.c index 1431fa123a..7688006896 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -14,7 +14,7 @@ #include "config.h" -#ifdef HAVE_WINSOCK2_H +#if HAVE_WINSOCK2_H #include <winsock2.h> #endif @@ -406,7 +406,7 @@ stream_t* new_stream(int fd,int type){ if(s==NULL) return NULL; memset(s,0,sizeof(stream_t)); -#ifdef HAVE_WINSOCK2_H +#if HAVE_WINSOCK2_H { WSADATA wsdata; int temp = WSAStartup(0x0202, &wsdata); // there might be a better place for this (-> later) @@ -441,7 +441,7 @@ void free_stream(stream_t *s){ closesocket(s->fd); else close(s->fd); } -#ifdef HAVE_WINSOCK2_H +#if HAVE_WINSOCK2_H mp_msg(MSGT_STREAM,MSGL_V,"WINSOCK2 uninit\n"); WSACleanup(); // there might be a better place for this (-> later) #endif diff --git a/stream/stream_cddb.c b/stream/stream_cddb.c index 4702f86d8c..55620a8b2d 100644 --- a/stream/stream_cddb.c +++ b/stream/stream_cddb.c @@ -27,7 +27,7 @@ #define mkdir(a,b) mkdir(a) #endif #include <windows.h> -#ifdef HAVE_WINSOCK2_H +#if HAVE_WINSOCK2_H #include <winsock2.h> #endif #else diff --git a/stream/stream_ftp.c b/stream/stream_ftp.c index 95632e7375..bb833688aa 100644 --- a/stream/stream_ftp.c +++ b/stream/stream_ftp.c @@ -9,7 +9,7 @@ #include <fcntl.h> #include <unistd.h> #include <errno.h> -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H #include <sys/socket.h> #else #include <winsock2.h> diff --git a/stream/stream_netstream.c b/stream/stream_netstream.c index 5c68defe73..593e60bd97 100644 --- a/stream/stream_netstream.c +++ b/stream/stream_netstream.c @@ -42,7 +42,7 @@ #include <inttypes.h> #include <errno.h> -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -90,7 +90,7 @@ static const 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_H +#if !HAVE_WINSOCK2_H struct flock lock; memset(&lock,0,sizeof(struct flock)); @@ -113,7 +113,7 @@ printf("FIXME? should lock here\n"); } static int unlock_fd(int fd) { -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H struct flock lock; memset(&lock,0,sizeof(struct flock)); diff --git a/stream/stream_netstream.h b/stream/stream_netstream.h index 533e6a3b93..6ae46cabef 100644 --- a/stream/stream_netstream.h +++ b/stream/stream_netstream.h @@ -14,7 +14,7 @@ #include <stdlib.h> #include <string.h> #include <errno.h> -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H #include <sys/socket.h> #endif #include "mp_msg.h" diff --git a/stream/stream_rtsp.c b/stream/stream_rtsp.c index 1edc172549..94599c2b4a 100644 --- a/stream/stream_rtsp.c +++ b/stream/stream_rtsp.c @@ -28,7 +28,7 @@ #include <sys/types.h> #include <ctype.h> #include "config.h" -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H #include <netinet/in.h> #include <sys/socket.h> #include <arpa/inet.h> diff --git a/stream/tcp.c b/stream/tcp.c index 69072f80fa..ac3165b1a7 100644 --- a/stream/tcp.c +++ b/stream/tcp.c @@ -20,7 +20,7 @@ #include "mp_msg.h" #include "help_mp.h" -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H #include <netdb.h> #include <netinet/in.h> #include <sys/socket.h> @@ -75,7 +75,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) { struct hostent *hp=NULL; char buf[255]; -#ifdef HAVE_WINSOCK2_H +#if HAVE_WINSOCK2_H unsigned long val; int to; #else @@ -91,7 +91,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) { } #if defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO) -#ifdef HAVE_WINSOCK2_H +#if HAVE_WINSOCK2_H /* timeout in milliseconds */ to = 10 * 1000; #else @@ -115,13 +115,11 @@ connect2Server_with_af(char *host, int port, int af,int verb) { memset(&server_address, 0, sizeof(server_address)); -#ifndef HAVE_WINSOCK2_H -#ifdef HAVE_ATON - if (inet_aton(host, our_s_addr)!=1) -#else +#if HAVE_INET_PTON if (inet_pton(af, host, our_s_addr)!=1) -#endif -#else +#elif HAVE_INET_ATON + if (inet_aton(host, our_s_addr)!=1) +#elif HAVE_WINSOCK2_H if ( inet_addr(host)==INADDR_NONE ) #endif { @@ -139,7 +137,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) { memcpy( our_s_addr, (void*)hp->h_addr_list[0], hp->h_length ); } -#ifdef HAVE_WINSOCK2_H +#if HAVE_WINSOCK2_H else { unsigned long addr = inet_addr(host); memcpy( our_s_addr, (void*)&addr, sizeof(addr) ); @@ -164,7 +162,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) { return TCP_ERROR_FATAL; } -#if defined(HAVE_ATON) || defined(HAVE_WINSOCK2_H) +#if HAVE_INET_ATON || defined(HAVE_WINSOCK2_H) strncpy( buf, inet_ntoa( *((struct in_addr*)our_s_addr) ), 255); #else inet_ntop(af, our_s_addr, buf, 255); @@ -172,14 +170,14 @@ connect2Server_with_af(char *host, int port, int af,int verb) { if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ConnectingToServer, host, buf , port ); // Turn the socket as non blocking so we can timeout on the connection -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H 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_H +#if !HAVE_WINSOCK2_H if( errno!=EINPROGRESS ) { #else if( (WSAGetLastError() != WSAEINPROGRESS) && (WSAGetLastError() != WSAEWOULDBLOCK) ) { @@ -211,7 +209,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) { if (ret < 0) mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_SelectFailed); // Turn back the socket as blocking -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H fcntl( socket_server_fd, F_SETFL, fcntl(socket_server_fd, F_GETFL) & ~O_NONBLOCK ); #else val = 0; diff --git a/stream/udp.c b/stream/udp.c index e7ac97f597..84769ce403 100644 --- a/stream/udp.c +++ b/stream/udp.c @@ -31,7 +31,7 @@ #include <sys/time.h> #include <ctype.h> -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H #include <netdb.h> #include <netinet/in.h> #include <sys/socket.h> @@ -74,7 +74,7 @@ udp_open_socket (URL_t *url) if (isalpha (url->hostname[0])) { -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H hp = (struct hostent *) gethostbyname (url->hostname); if (!hp) { @@ -91,15 +91,13 @@ udp_open_socket (URL_t *url) } else { -#ifndef HAVE_WINSOCK2_H -#ifdef HAVE_ATON - inet_aton (url->hostname, &server_address.sin_addr); -#else +#if HAVE_INET_PTON inet_pton (AF_INET, url->hostname, &server_address.sin_addr); -#endif /* HAVE_ATON */ -#else +#elif HAVE_INET_ATON + inet_aton (url->hostname, &server_address.sin_addr); +#elif !HAVE_WINSOCK2_H server_address.sin_addr.s_addr = htonl(INADDR_ANY); -#endif /* HAVE_WINSOCK2_H */ +#endif } server_address.sin_family = AF_INET; server_address.sin_port = htons (url->port); @@ -110,7 +108,7 @@ udp_open_socket (URL_t *url) if (bind (socket_server_fd, (struct sockaddr *) &server_address, sizeof (server_address)) == -1) { -#ifndef HAVE_WINSOCK2_H +#if !HAVE_WINSOCK2_H if (errno != EINPROGRESS) #else if (WSAGetLastError () != WSAEINPROGRESS) @@ -122,7 +120,7 @@ udp_open_socket (URL_t *url) } } -#ifdef HAVE_WINSOCK2_H +#if HAVE_WINSOCK2_H if (isalpha (url->hostname[0])) { hp = (struct hostent *) gethostbyname (url->hostname); |