summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
Diffstat (limited to 'stream')
-rw-r--r--stream/asf_mmst_streaming.c4
-rw-r--r--stream/asf_streaming.c4
-rw-r--r--stream/dvb_tune.c2
-rw-r--r--stream/http.c3
-rw-r--r--stream/librtsp/rtsp.c4
-rw-r--r--stream/librtsp/rtsp_rtp.c14
-rw-r--r--stream/librtsp/rtsp_session.c16
-rw-r--r--stream/netstream.h2
-rw-r--r--stream/network.c4
-rw-r--r--stream/network.h6
-rw-r--r--stream/pnm.c7
-rw-r--r--stream/realrtsp/real.c2
-rw-r--r--stream/realrtsp/real.h2
-rw-r--r--stream/realrtsp/rmff.h2
-rw-r--r--stream/realrtsp/sdpplin.c2
-rw-r--r--stream/realrtsp/sdpplin.h2
-rw-r--r--stream/rtp.c4
-rw-r--r--stream/stream.c10
-rw-r--r--stream/stream_cddb.c2
-rw-r--r--stream/stream_dvb.c2
-rw-r--r--stream/stream_dvd.c3
-rw-r--r--stream/stream_dvd.h16
-rw-r--r--stream/stream_dvd_common.c4
-rw-r--r--stream/stream_dvd_common.h4
-rw-r--r--stream/stream_ftp.c4
-rw-r--r--stream/stream_netstream.c8
-rw-r--r--stream/stream_pvr.c2
-rw-r--r--stream/stream_rtsp.c4
-rw-r--r--stream/tcp.c20
-rw-r--r--stream/tvi_v4l2.c1
-rw-r--r--stream/udp.c20
31 files changed, 89 insertions, 91 deletions
diff --git a/stream/asf_mmst_streaming.c b/stream/asf_mmst_streaming.c
index aaf43ff49a..ad9b3e97ee 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
-#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 1082ec374a..98859cfe9e 100644
--- a/stream/asf_streaming.c
+++ b/stream/asf_streaming.c
@@ -10,9 +10,7 @@
#include "help_mp.h"
#include "options.h"
-#ifndef HAVE_WINSOCK2
-#define closesocket close
-#else
+#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
diff --git a/stream/dvb_tune.c b/stream/dvb_tune.c
index 2235541fe1..64a2b0fb0a 100644
--- a/stream/dvb_tune.c
+++ b/stream/dvb_tune.c
@@ -27,7 +27,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <sys/ioctl.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
diff --git a/stream/http.c b/stream/http.c
index 3af0d47c4d..2a6d07aee0 100644
--- a/stream/http.c
+++ b/stream/http.c
@@ -11,8 +11,7 @@
#include <string.h>
#include <unistd.h>
-#ifndef HAVE_WINSOCK2
-#define closesocket close
+#ifndef HAVE_WINSOCK2_H
#else
#include <winsock2.h>
#include <ws2tcpip.h>
diff --git a/stream/librtsp/rtsp.c b/stream/librtsp/rtsp.c
index 89a3b47584..19477fe5b3 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
+#ifdef 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
+#ifndef 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 b582b1a700..fd01524d89 100644
--- a/stream/librtsp/rtsp_rtp.c
+++ b/stream/librtsp/rtsp_rtp.c
@@ -28,7 +28,7 @@
#include "config.h"
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
@@ -42,8 +42,8 @@
#include "rtsp.h"
#include "rtsp_rtp.h"
#include "rtsp_session.h"
-#include "../freesdp/common.h"
-#include "../freesdp/parser.h"
+#include "stream/freesdp/common.h"
+#include "stream/freesdp/parser.h"
#define RTSP_DEFAULT_PORT 31336
#define MAX_LENGTH 256
@@ -250,7 +250,7 @@ rtcp_connect (int client_port, int server_port, const char* server_hostname)
if (bind (s, (struct sockaddr *) &sin, sizeof (sin)))
{
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
if (errno != EINPROGRESS)
#else
if (WSAGetLastError() != WSAEINPROGRESS)
@@ -296,7 +296,7 @@ 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
+#ifndef HAVE_WINSOCK2_H
#ifdef HAVE_ATON
inet_aton (hostname, &sin.sin_addr);
#else
@@ -331,7 +331,7 @@ rtp_connect (char *hostname, int port)
/* datagram socket */
if (bind (s, (struct sockaddr *) &sin, sizeof (sin)))
{
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
if (errno != EINPROGRESS)
#else
if (WSAGetLastError() != WSAEINPROGRESS)
@@ -385,7 +385,7 @@ is_multicast_address (char *addr)
sin.sin_family = AF_INET;
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
#ifdef HAVE_ATON
inet_aton (addr, &sin.sin_addr);
#else
diff --git a/stream/librtsp/rtsp_session.c b/stream/librtsp/rtsp_session.c
index d999323fcd..ce68dd765f 100644
--- a/stream/librtsp/rtsp_session.c
+++ b/stream/librtsp/rtsp_session.c
@@ -30,8 +30,7 @@
#include <sys/types.h>
#include "config.h"
-#ifndef HAVE_WINSOCK2
-#define closesocket close
+#ifndef HAVE_WINSOCK2_H
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
@@ -48,15 +47,16 @@
#include <inttypes.h>
#include "mp_msg.h"
-#include "../url.h"
-#include "../rtp.h"
#include "rtsp.h"
#include "rtsp_rtp.h"
#include "rtsp_session.h"
-#include "../realrtsp/real.h"
-#include "../realrtsp/rmff.h"
-#include "../realrtsp/asmrp.h"
-#include "../realrtsp/xbuffer.h"
+#include "stream/network.h"
+#include "stream/url.h"
+#include "stream/rtp.h"
+#include "stream/realrtsp/real.h"
+#include "stream/realrtsp/rmff.h"
+#include "stream/realrtsp/asmrp.h"
+#include "stream/realrtsp/xbuffer.h"
/*
#define LOG
diff --git a/stream/netstream.h b/stream/netstream.h
index 4d61b01967..533e6a3b93 100644
--- a/stream/netstream.h
+++ b/stream/netstream.h
@@ -14,7 +14,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
#include <sys/socket.h>
#endif
#include "mp_msg.h"
diff --git a/stream/network.c b/stream/network.c
index 34f3905734..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
-#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 2d3b96166e..1f06a5ca14 100644
--- a/stream/network.h
+++ b/stream/network.h
@@ -12,7 +12,7 @@
#include <sys/types.h>
#include "config.h"
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.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 deb3ee8b4c..1ef86e620c 100644
--- a/stream/pnm.c
+++ b/stream/pnm.c
@@ -35,8 +35,7 @@
#include <stdlib.h>
#include <sys/time.h>
#include <inttypes.h>
-#ifndef HAVE_WINSOCK2
-#define closesocket close
+#ifndef HAVE_WINSOCK2_H
#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"
@@ -205,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
+#ifndef HAVE_WINSOCK2_H
if (timeout>0 && (errno == EAGAIN || errno == EINPROGRESS)) {
#else
if (timeout>0 && (errno == EAGAIN || WSAGetLastError() == WSAEINPROGRESS)) {
diff --git a/stream/realrtsp/real.c b/stream/realrtsp/real.c
index 62670f4726..6a7ef4e47b 100644
--- a/stream/realrtsp/real.c
+++ b/stream/realrtsp/real.c
@@ -38,7 +38,7 @@
#include "xbuffer.h"
#include "libavutil/md5.h"
#include "libavutil/intreadwrite.h"
-#include "../http.h"
+#include "stream/http.h"
#include "mp_msg.h"
/*
diff --git a/stream/realrtsp/real.h b/stream/realrtsp/real.h
index 37ac03b28e..0569a3db74 100644
--- a/stream/realrtsp/real.h
+++ b/stream/realrtsp/real.h
@@ -31,7 +31,7 @@
#define MPLAYER_REAL_H
#include "rmff.h"
-#include "../librtsp/rtsp.h"
+#include "stream/librtsp/rtsp.h"
#define HEADER_SIZE 4096
diff --git a/stream/realrtsp/rmff.h b/stream/realrtsp/rmff.h
index 639b8522bb..a58bb3ccdc 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
+#ifndef HAVE_WINSOCK2_H
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
diff --git a/stream/realrtsp/sdpplin.c b/stream/realrtsp/sdpplin.c
index 31514befeb..80dc49edaa 100644
--- a/stream/realrtsp/sdpplin.c
+++ b/stream/realrtsp/sdpplin.c
@@ -27,7 +27,7 @@
*/
#include "config.h"
-#include "../librtsp/rtsp.h"
+#include "stream/librtsp/rtsp.h"
#include "sdpplin.h"
#include "xbuffer.h"
#include "mp_msg.h"
diff --git a/stream/realrtsp/sdpplin.h b/stream/realrtsp/sdpplin.h
index ff79c49775..658aeaf0ed 100644
--- a/stream/realrtsp/sdpplin.h
+++ b/stream/realrtsp/sdpplin.h
@@ -30,7 +30,7 @@
#define MPLAYER_SDPPLIN_H
#include "rmff.h"
-#include "../librtsp/rtsp.h"
+#include "stream/librtsp/rtsp.h"
typedef struct {
diff --git a/stream/rtp.c b/stream/rtp.c
index 1c31bef4a1..624812a0fe 100644
--- a/stream/rtp.c
+++ b/stream/rtp.c
@@ -13,16 +13,16 @@
#include <sys/types.h>
#include <ctype.h>
#include "config.h"
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
#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 47d55be71f..1431fa123a 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -14,16 +14,14 @@
#include "config.h"
-#ifndef HAVE_WINSOCK2
-#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"
@@ -408,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
+#ifdef HAVE_WINSOCK2_H
{
WSADATA wsdata;
int temp = WSAStartup(0x0202, &wsdata); // there might be a better place for this (-> later)
@@ -443,7 +441,7 @@ void free_stream(stream_t *s){
closesocket(s->fd);
else close(s->fd);
}
-#ifdef HAVE_WINSOCK2
+#ifdef 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 ff12d94c17..5236a4ca9c 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
+#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#else
diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c
index 948bd70c81..5068fd0dbb 100644
--- a/stream/stream_dvb.c
+++ b/stream/stream_dvb.c
@@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <ctype.h>
#include <sys/ioctl.h>
#include <sys/time.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c
index 92b06c67bb..2c4d1b859a 100644
--- a/stream/stream_dvd.c
+++ b/stream/stream_dvd.c
@@ -860,6 +860,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
}
if (mp_msg_test(MSGT_IDENTIFY, MSGL_V))
{
+ char volid[32];
unsigned char discid [16]; ///< disk ID, a 128 bit MD5 sum
int vts_no; ///< video title set number
for (vts_no = 1; vts_no <= vmg_file->vts_atrt->nr_of_vtss; vts_no++)
@@ -872,6 +873,8 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
mp_msg(MSGT_IDENTIFY, MSGL_V, "%02X", discid[i]);
mp_msg(MSGT_IDENTIFY, MSGL_V, "\n");
}
+ if (DVDUDFVolumeInfo(dvd, volid, sizeof(volid), NULL, 0) >= 0)
+ mp_msg(MSGT_IDENTIFY, MSGL_V, "ID_DVD_VOLUME_ID=%s\n", volid);
}
/**
* Make sure our title number is valid.
diff --git a/stream/stream_dvd.h b/stream/stream_dvd.h
index 3532646dbb..9196ef04e0 100644
--- a/stream/stream_dvd.h
+++ b/stream/stream_dvd.h
@@ -4,15 +4,15 @@
#include "config.h"
#include <stdint.h>
#ifdef CONFIG_DVDREAD_INTERNAL
-#include "dvdread/dvd_reader.h"
-#include "dvdread/ifo_types.h"
-#include "dvdread/ifo_read.h"
-#include "dvdread/nav_read.h"
+#include "libdvdread/dvd_reader.h"
+#include "libdvdread/ifo_types.h"
+#include "libdvdread/ifo_read.h"
+#include "libdvdread/nav_read.h"
#else
-#include <libdvdread/dvd_reader.h>
-#include <libdvdread/ifo_types.h>
-#include <libdvdread/ifo_read.h>
-#include <libdvdread/nav_read.h>
+#include <dvdread/dvd_reader.h>
+#include <dvdread/ifo_types.h>
+#include <dvdread/ifo_read.h>
+#include <dvdread/nav_read.h>
#endif
#include "stream.h"
diff --git a/stream/stream_dvd_common.c b/stream/stream_dvd_common.c
index ffaf1d490c..e2cf3690ba 100644
--- a/stream/stream_dvd_common.c
+++ b/stream/stream_dvd_common.c
@@ -1,9 +1,9 @@
#include "config.h"
#include <inttypes.h>
#ifdef CONFIG_DVDREAD_INTERNAL
-#include <dvdread/ifo_types.h>
+#include "libdvdread/ifo_types.h"
#else
-#include <libdvdread/ifo_types.h>
+#include <dvdread/ifo_types.h>
#endif
#include "stream_dvd_common.h"
diff --git a/stream/stream_dvd_common.h b/stream/stream_dvd_common.h
index 5d7953571d..c79492e061 100644
--- a/stream/stream_dvd_common.h
+++ b/stream/stream_dvd_common.h
@@ -4,9 +4,9 @@
#include "config.h"
#include <inttypes.h>
#ifdef CONFIG_DVDREAD_INTERNAL
-#include <dvdread/ifo_types.h>
+#include "libdvdread/ifo_types.h"
#else
-#include <libdvdread/ifo_types.h>
+#include <dvdread/ifo_types.h>
#endif
int mp_dvdtimetomsec(dvd_time_t *dt);
diff --git a/stream/stream_ftp.c b/stream/stream_ftp.c
index 091fc4e35c..95632e7375 100644
--- a/stream/stream_ftp.c
+++ b/stream/stream_ftp.c
@@ -9,14 +9,14 @@
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
-#ifndef HAVE_WINSOCK2
+#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 a514a897c0..f9c70e72ba 100644
--- a/stream/stream_netstream.c
+++ b/stream/stream_netstream.c
@@ -42,8 +42,7 @@
#include <inttypes.h>
#include <errno.h>
-#ifndef HAVE_WINSOCK2
-#define closesocket close
+#ifndef HAVE_WINSOCK2_H
#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"
@@ -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
+#ifndef 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
+#ifndef HAVE_WINSOCK2_H
struct flock lock;
memset(&lock,0,sizeof(struct flock));
diff --git a/stream/stream_pvr.c b/stream/stream_pvr.c
index 562ce705b7..8cc0eef6a0 100644
--- a/stream/stream_pvr.c
+++ b/stream/stream_pvr.c
@@ -36,7 +36,7 @@
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <inttypes.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <linux/types.h>
#include <linux/videodev2.h>
diff --git a/stream/stream_rtsp.c b/stream/stream_rtsp.c
index 616fbf7b55..1edc172549 100644
--- a/stream/stream_rtsp.c
+++ b/stream/stream_rtsp.c
@@ -28,17 +28,17 @@
#include <sys/types.h>
#include <ctype.h>
#include "config.h"
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
#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 950c434886..fd5a849cad 100644
--- a/stream/tcp.c
+++ b/stream/tcp.c
@@ -20,17 +20,17 @@
#include "mp_msg.h"
#include "help_mp.h"
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
#include <netdb.h>
#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"
@@ -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
+#ifdef HAVE_WINSOCK2_H
u_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
+#ifdef HAVE_WINSOCK2_H
/* timeout in milliseconds */
to = 10 * 1000;
#else
@@ -115,7 +115,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
memset(&server_address, 0, sizeof(server_address));
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
#ifdef HAVE_ATON
if (inet_aton(host, our_s_addr)!=1)
#else
@@ -139,7 +139,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
+#ifdef HAVE_WINSOCK2_H
else {
unsigned long addr = inet_addr(host);
memcpy( our_s_addr, (void*)&addr, sizeof(addr) );
@@ -164,7 +164,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
return TCP_ERROR_FATAL;
}
-#if defined(HAVE_ATON) || defined(HAVE_WINSOCK2)
+#if defined(HAVE_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 +172,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
+#ifndef 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
+#ifndef HAVE_WINSOCK2_H
if( errno!=EINPROGRESS ) {
#else
if( (WSAGetLastError() != WSAEINPROGRESS) && (WSAGetLastError() != WSAEWOULDBLOCK) ) {
@@ -211,7 +211,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
+#ifndef HAVE_WINSOCK2_H
fcntl( socket_server_fd, F_SETFL, fcntl(socket_server_fd, F_GETFL) & ~O_NONBLOCK );
#else
val = 0;
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index fc23727f9f..7a15a9b0be 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -35,6 +35,7 @@ known issues:
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
+#include <math.h>
#ifdef HAVE_SYS_SYSINFO_H
#include <sys/sysinfo.h>
#endif
diff --git a/stream/udp.c b/stream/udp.c
index 759c5a9675..e7ac97f597 100644
--- a/stream/udp.c
+++ b/stream/udp.c
@@ -31,18 +31,18 @@
#include <sys/time.h>
#include <ctype.h>
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
#include <netdb.h>
#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"
@@ -74,7 +74,7 @@ udp_open_socket (URL_t *url)
if (isalpha (url->hostname[0]))
{
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
hp = (struct hostent *) gethostbyname (url->hostname);
if (!hp)
{
@@ -87,11 +87,11 @@ udp_open_socket (URL_t *url)
(void *) hp->h_addr_list[0], hp->h_length);
#else
server_address.sin_addr.s_addr = htonl (INADDR_ANY);
-#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK2_H */
}
else
{
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
#ifdef HAVE_ATON
inet_aton (url->hostname, &server_address.sin_addr);
#else
@@ -99,7 +99,7 @@ udp_open_socket (URL_t *url)
#endif /* HAVE_ATON */
#else
server_address.sin_addr.s_addr = htonl(INADDR_ANY);
-#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK2_H */
}
server_address.sin_family = AF_INET;
server_address.sin_port = htons (url->port);
@@ -110,11 +110,11 @@ udp_open_socket (URL_t *url)
if (bind (socket_server_fd, (struct sockaddr *) &server_address,
sizeof (server_address)) == -1)
{
-#ifndef HAVE_WINSOCK2
+#ifndef HAVE_WINSOCK2_H
if (errno != EINPROGRESS)
#else
if (WSAGetLastError () != WSAEINPROGRESS)
-#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK2_H */
{
mp_msg (MSGT_NETWORK, MSGL_ERR, "Failed to connect to server\n");
closesocket (socket_server_fd);
@@ -122,7 +122,7 @@ udp_open_socket (URL_t *url)
}
}
-#ifdef HAVE_WINSOCK2
+#ifdef HAVE_WINSOCK2_H
if (isalpha (url->hostname[0]))
{
hp = (struct hostent *) gethostbyname (url->hostname);
@@ -141,7 +141,7 @@ udp_open_socket (URL_t *url)
unsigned int addr = inet_addr (url->hostname);
memcpy ((void *) &server_address.sin_addr, (void *) &addr, sizeof (addr));
}
-#endif /* HAVE_WINSOCK2 */
+#endif /* HAVE_WINSOCK2_H */
/* Increase the socket rx buffer size to maximum -- this is UDP */
rxsockbufsz = 240 * 1024;