diff options
author | François Revol <revol@free.fr> | 2002-11-02 10:35:07 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-11-02 10:35:07 +0000 |
commit | 9ddd71fc6063b357344f81a0f704c1d04f584ada (patch) | |
tree | 87e9377d16bd2a22727ca6f572ba312f167d258f /libav/tcp.c | |
parent | bbd8335b69b4960b2a6e830317f189748232c749 (diff) | |
download | ffmpeg-9ddd71fc6063b357344f81a0f704c1d04f584ada.tar.gz |
added BeOS net_server support (R5 network stack), basically the same
problems as with winsock (sockets != fd), and the broken select().
based on older patch by Andrew Bachmann.
patch by (François Revol <revol at free dot fr>)
Originally committed as revision 1144 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libav/tcp.c')
-rw-r--r-- | libav/tcp.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/libav/tcp.c b/libav/tcp.c index 644e139393..61d8665525 100644 --- a/libav/tcp.c +++ b/libav/tcp.c @@ -22,7 +22,11 @@ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> -#include <arpa/inet.h> +#ifndef __BEOS__ +# include <arpa/inet.h> +#else +# include "barpainet.h" +#endif #include <netdb.h> typedef struct TCPContext { @@ -103,10 +107,18 @@ static int tcp_read(URLContext *h, UINT8 *buf, int size) size1 = size; while (size > 0) { +#ifdef CONFIG_BEOS_NETSERVER + len = recv (s->fd, buf, size, 0); +#else len = read (s->fd, buf, size); +#endif if (len < 0) { if (errno != EINTR && errno != EAGAIN) +#ifdef __BEOS__ + return errno; +#else return -errno; +#endif else continue; } else if (len == 0) { @@ -125,9 +137,17 @@ static int tcp_write(URLContext *h, UINT8 *buf, int size) size1 = size; while (size > 0) { +#ifdef CONFIG_BEOS_NETSERVER + ret = send (s->fd, buf, size, 0); +#else ret = write (s->fd, buf, size); +#endif if (ret < 0 && errno != EINTR && errno != EAGAIN) +#ifdef __BEOS__ + return errno; +#else return -errno; +#endif size -= ret; buf += ret; } @@ -137,7 +157,11 @@ static int tcp_write(URLContext *h, UINT8 *buf, int size) static int tcp_close(URLContext *h) { TCPContext *s = h->priv_data; +#ifdef CONFIG_BEOS_NETSERVER + closesocket(s->fd); +#else close(s->fd); +#endif av_free(s); return 0; } |