diff options
| author | phintuka <phintuka> | 2010-07-19 13:20:22 +0000 |
|---|---|---|
| committer | phintuka <phintuka> | 2010-07-19 13:20:22 +0000 |
| commit | e336c4af0b547ce604549077882b956e2d54e471 (patch) | |
| tree | ffde240f008ae7b77b9f00dc09acb55f64f47ed0 | |
| parent | 97f2f2c358cba97817a22ec3d5a37c37cde3bc20 (diff) | |
| download | xineliboutput-e336c4af0b547ce604549077882b956e2d54e471.tar.gz xineliboutput-e336c4af0b547ce604549077882b956e2d54e471.tar.bz2 | |
Added FreeBSD compability (Thanks to Juergen Lock)
| -rw-r--r-- | tools/backgroundwriter.c | 6 | ||||
| -rw-r--r-- | tools/cxsocket.c | 17 | ||||
| -rw-r--r-- | tools/cxsocket.h | 5 | ||||
| -rw-r--r-- | tools/rle.c | 5 | ||||
| -rw-r--r-- | tools/rtcp.h | 4 | ||||
| -rw-r--r-- | tools/rtp.h | 4 | ||||
| -rw-r--r-- | tools/sap.h | 4 | ||||
| -rw-r--r-- | tools/ts.c | 5 | ||||
| -rw-r--r-- | tools/vdrdiscovery.c | 5 |
9 files changed, 39 insertions, 16 deletions
diff --git a/tools/backgroundwriter.c b/tools/backgroundwriter.c index da16c18c..00d0e179 100644 --- a/tools/backgroundwriter.c +++ b/tools/backgroundwriter.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: backgroundwriter.c,v 1.22 2010-03-13 12:20:05 phintuka Exp $ + * $Id: backgroundwriter.c,v 1.23 2010-07-19 13:20:21 phintuka Exp $ * */ @@ -14,6 +14,10 @@ #include <stdint.h> #include <unistd.h> +#ifdef __FreeBSD__ +#include <sys/socket.h> +#include <netinet/in.h> +#endif #include <netinet/tcp.h> // CORK, NODELAY #include <vdr/tools.h> diff --git a/tools/cxsocket.c b/tools/cxsocket.c index e6a95a72..ecd7c50c 100644 --- a/tools/cxsocket.c +++ b/tools/cxsocket.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: cxsocket.c,v 1.11 2007-03-27 02:45:48 phintuka Exp $ + * $Id: cxsocket.c,v 1.12 2010-07-19 13:20:22 phintuka Exp $ * */ @@ -17,7 +17,7 @@ #include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__FreeBSD__) # include <sys/sendfile.h> #endif #include <netinet/tcp.h> @@ -119,7 +119,7 @@ bool cxSocket::set_multicast(int ttl) ssize_t cxSocket::sendfile(int fd_file, off_t *offset, size_t count) { int r; -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__FreeBSD__) r = ::sendfile(m_fd, fd_file, offset, count); if(r<0 && (errno == ENOSYS || errno == EINVAL)) { // fall back to read/write @@ -145,7 +145,7 @@ ssize_t cxSocket::sendfile(int fd_file, off_t *offset, size_t count) } } return done; -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__FreeBSD__) } return r; #endif @@ -153,7 +153,7 @@ ssize_t cxSocket::sendfile(int fd_file, off_t *offset, size_t count) bool cxSocket::set_cork(bool state) { -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__FreeBSD__) return false; #else int iCork = state ? 1 : 0; @@ -190,10 +190,17 @@ ssize_t cxSocket::tx_buffer_free(void) { int wmem = tx_buffer_size(); int size = -1; +#if defined(__FreeBSD__) && defined(FIONWRITE) + if(ioctl(m_fd, FIONWRITE, &size)) { + LOGERR("ioctl(FIONWRITE) failed"); + return (ssize_t)-1; + } +#else if(ioctl(m_fd, TIOCOUTQ, &size)) { LOGERR("ioctl(TIOCOUTQ) failed"); return (ssize_t)-1; } +#endif return (ssize_t)(wmem - size); } diff --git a/tools/cxsocket.h b/tools/cxsocket.h index 92954f3c..6825187d 100644 --- a/tools/cxsocket.h +++ b/tools/cxsocket.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: cxsocket.h,v 1.20 2007-01-20 17:24:40 phintuka Exp $ + * $Id: cxsocket.h,v 1.21 2010-07-19 13:20:22 phintuka Exp $ * */ @@ -14,6 +14,9 @@ #include <inttypes.h> #include <sys/types.h> #include <sys/socket.h> +#ifdef __FreeBSD__ +#include <netinet/in.h> +#endif #define CLOSESOCKET(fd) do { if(fd>=0) { ::close(fd); fd=-1; } } while(0) diff --git a/tools/rle.c b/tools/rle.c index 7aede06b..89a21879 100644 --- a/tools/rle.c +++ b/tools/rle.c @@ -4,12 +4,15 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: rle.c,v 1.4 2010-05-21 11:55:15 phintuka Exp $ + * $Id: rle.c,v 1.5 2010-07-19 13:20:22 phintuka Exp $ * */ #include <stdint.h> #include <stdlib.h> +#ifdef __FreeBSD__ +#include <sys/types.h> +#endif #include "../xine_osd_command.h" diff --git a/tools/rtcp.h b/tools/rtcp.h index 608f2daf..856bd9e6 100644 --- a/tools/rtcp.h +++ b/tools/rtcp.h @@ -4,14 +4,14 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: rtcp.h,v 1.3 2007-03-29 14:22:31 phintuka Exp $ + * $Id: rtcp.h,v 1.4 2010-07-19 13:20:22 phintuka Exp $ * */ #ifndef XINELIBOUTPUT_RTCP_H_ #define XINELIBOUTPUT_RTCP_H_ -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__FreeBSD__) # include <machine/endian.h> #else # include <endian.h> diff --git a/tools/rtp.h b/tools/rtp.h index fa2ccf63..c63df9da 100644 --- a/tools/rtp.h +++ b/tools/rtp.h @@ -4,14 +4,14 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: rtp.h,v 1.3 2007-03-29 14:22:31 phintuka Exp $ + * $Id: rtp.h,v 1.4 2010-07-19 13:20:22 phintuka Exp $ * */ #ifndef XINELIBOUTPUT_RTP_H_ #define XINELIBOUTPUT_RTP_H_ -#ifdef __APPLE__ +#if defined(__APPLE__) || defined (__FreeBSD__) # include <machine/endian.h> #else # include <endian.h> diff --git a/tools/sap.h b/tools/sap.h index 6b341efc..165ed45f 100644 --- a/tools/sap.h +++ b/tools/sap.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: sap.h,v 1.8 2007-03-29 14:22:30 phintuka Exp $ + * $Id: sap.h,v 1.9 2010-07-19 13:20:22 phintuka Exp $ * */ @@ -12,7 +12,7 @@ #define XINELIBOUTPUT_SAP_H_ #include <arpa/inet.h> -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__FreeBSD__) # include <machine/endian.h> #else # include <endian.h> @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: ts.c,v 1.27 2010-07-19 13:12:10 phintuka Exp $ + * $Id: ts.c,v 1.28 2010-07-19 13:20:22 phintuka Exp $ * */ @@ -14,6 +14,9 @@ #include <inttypes.h> #include <stdlib.h> #include <string.h> +#ifdef __FreeBSD__ +#include <sys/types.h> +#endif #ifndef LOG_MODULENAME # define LOG_MODULENAME "[mpeg-ts ] " diff --git a/tools/vdrdiscovery.c b/tools/vdrdiscovery.c index e301056d..1acb0630 100644 --- a/tools/vdrdiscovery.c +++ b/tools/vdrdiscovery.c @@ -7,12 +7,15 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: vdrdiscovery.c,v 1.9 2009-06-29 21:23:33 phintuka Exp $ + * $Id: vdrdiscovery.c,v 1.10 2010-07-19 13:20:22 phintuka Exp $ * */ #include <stdlib.h> #include <stdio.h> +#ifdef __FreeBSD__ +#include <string.h> +#endif #include <poll.h> #include <unistd.h> #include <netinet/in.h> |
