Revision 9ddd71fc

View differences:

ffmpeg.c
27 27
#include <termios.h>
28 28
#include <sys/resource.h>
29 29
#endif
30
#ifdef __BEOS__
31
/* for snooze() */
32
#include <OS.h>
33
#endif
34 30
#include <time.h>
35 31
#include <ctype.h>
36 32

  
......
227 223
    tcsetattr (0, TCSANOW, &tty);
228 224

  
229 225
    atexit(term_exit);
226
#ifdef CONFIG_BEOS_NETSERVER
227
    fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
228
#endif
230 229
}
231 230

  
232 231
/* read a key without blocking */
233 232
static int read_key(void)
234 233
{
235
    struct timeval tv;
236
    int n;
234
    int n = 1;
237 235
    unsigned char ch;
236
#ifndef CONFIG_BEOS_NETSERVER
237
    struct timeval tv;
238 238
    fd_set rfds;
239 239

  
240 240
    FD_ZERO(&rfds);
......
242 242
    tv.tv_sec = 0;
243 243
    tv.tv_usec = 0;
244 244
    n = select(1, &rfds, NULL, NULL, &tv);
245
#endif
245 246
    if (n > 0) {
246 247
        n = read(0, &ch, 1);
247 248
        if (n == 1)
libav/Makefile
31 31

  
32 32
ifeq ($(CONFIG_NETWORK),yes)
33 33
OBJS+= udp.o tcp.o http.o rtsp.o rtp.o rtpproto.o
34
# BeOS network stuff
35
ifeq ($(CONFIG_BEOS_NETSERVER),yes)
36
OBJS+= barpainet.o
37
endif
34 38
endif
35 39

  
36 40
ifeq ($(CONFIG_VORBIS),yes)
libav/barpainet.c
1

  
2
#include <stdlib.h>
3
#include <strings.h>
4
#include "barpainet.h"
5

  
6
int inet_aton (const char * str, struct in_addr * add) {
7
	const char * pch = str;
8
	unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0;
9
	
10
	add1 = atoi(pch);
11
	pch = strpbrk(pch,".");
12
	if (pch == 0 || ++pch == 0) goto done;
13
	add2 = atoi(pch);
14
	pch = strpbrk(pch,".");
15
	if (pch == 0 || ++pch == 0) goto done;
16
	add3 = atoi(pch);
17
	pch = strpbrk(pch,".");
18
	if (pch == 0 || ++pch == 0) goto done;
19
	add4 = atoi(pch);
20

  
21
done:
22
	add->s_addr=(add4<<24)+(add3<<16)+(add2<<8)+add1;
23
	
24
	return 1;	
25
}
libav/barpainet.h
1
#ifndef BARPA_INET_H
2
#define BARPA_INET_H
3

  
4
#include "../config.h"
5

  
6
#ifdef CONFIG_BEOS_NETSERVER
7

  
8
# include <socket.h>
9
int inet_aton (const char * str, struct in_addr * add);
10
# define PF_INET AF_INET
11
# define SO_SNDBUF 0x40000001
12

  
13
/* fake */
14
struct ip_mreq {
15
    struct in_addr imr_multiaddr;  /* IP multicast address of group */
16
    struct in_addr imr_interface;  /* local IP address of interface */
17
};
18

  
19
#else
20
# include <arpa/inet.h>
21
#endif
22

  
23
#endif /* BARPA_INET_H */
libav/http.c
22 22
#include <sys/types.h>
23 23
#include <sys/socket.h>
24 24
#include <netinet/in.h>
25
#include <arpa/inet.h>
25
#ifndef __BEOS__
26
# include <arpa/inet.h>
27
#else
28
# include "barpainet.h"
29
#endif
26 30
#include <netdb.h>
27 31

  
28 32

  
libav/rtp.c
22 22
#include <sys/types.h>
23 23
#include <sys/socket.h>
24 24
#include <netinet/in.h>
25
#include <arpa/inet.h>
25
#ifndef __BEOS__
26
# include <arpa/inet.h>
27
#else
28
# include "barpainet.h"
29
#endif
26 30
#include <netdb.h>
27 31

  
28 32
//#define DEBUG
libav/rtpproto.c
23 23
#include <sys/types.h>
24 24
#include <sys/socket.h>
25 25
#include <netinet/in.h>
26
#include <arpa/inet.h>
26
#ifndef __BEOS__
27
# include <arpa/inet.h>
28
#else
29
# include "barpainet.h"
30
#endif
27 31
#include <netdb.h>
28 32
#include <fcntl.h>
29 33

  
libav/rtsp.c
21 21
#include <sys/time.h>
22 22
#include <netinet/in.h>
23 23
#include <sys/socket.h>
24
#include <arpa/inet.h>
24
#ifndef __BEOS__
25
# include <arpa/inet.h>
26
#else
27
# include "barpainet.h"
28
#endif
25 29

  
26 30
//#define DEBUG
27 31

  
libav/tcp.c
22 22
#include <sys/types.h>
23 23
#include <sys/socket.h>
24 24
#include <netinet/in.h>
25
#include <arpa/inet.h>
25
#ifndef __BEOS__
26
# include <arpa/inet.h>
27
#else
28
# include "barpainet.h"
29
#endif
26 30
#include <netdb.h>
27 31

  
28 32
typedef struct TCPContext {
......
103 107

  
104 108
    size1 = size;
105 109
    while (size > 0) {
110
#ifdef CONFIG_BEOS_NETSERVER
111
        len = recv (s->fd, buf, size, 0);
112
#else
106 113
        len = read (s->fd, buf, size);
114
#endif
107 115
        if (len < 0) {
108 116
            if (errno != EINTR && errno != EAGAIN)
117
#ifdef __BEOS__
118
                return errno;
119
#else
109 120
                return -errno;
121
#endif
110 122
            else
111 123
                continue;
112 124
        } else if (len == 0) {
......
125 137

  
126 138
    size1 = size;
127 139
    while (size > 0) {
140
#ifdef CONFIG_BEOS_NETSERVER
141
        ret = send (s->fd, buf, size, 0);
142
#else
128 143
        ret = write (s->fd, buf, size);
144
#endif
129 145
        if (ret < 0 && errno != EINTR && errno != EAGAIN)
146
#ifdef __BEOS__
147
            return errno;
148
#else
130 149
            return -errno;
150
#endif
131 151
        size -= ret;
132 152
        buf += ret;
133 153
    }
......
137 157
static int tcp_close(URLContext *h)
138 158
{
139 159
    TCPContext *s = h->priv_data;
160
#ifdef CONFIG_BEOS_NETSERVER
161
    closesocket(s->fd);
162
#else
140 163
    close(s->fd);
164
#endif
141 165
    av_free(s);
142 166
    return 0;
143 167
}
libav/udp.c
21 21
#include <sys/types.h>
22 22
#include <sys/socket.h>
23 23
#include <netinet/in.h>
24
#include <arpa/inet.h>
24
#ifndef __BEOS__
25
# include <arpa/inet.h>
26
#else
27
# include "barpainet.h"
28
#endif
25 29
#include <netdb.h>
26 30

  
27 31
typedef struct {
......
154 158
    getsockname(udp_fd, (struct sockaddr *)&my_addr1, &len);
155 159
    s->local_port = ntohs(my_addr1.sin_port);
156 160

  
161
#ifndef CONFIG_BEOS_NETSERVER
157 162
    if (s->is_multicast) {
158 163
        if (h->flags & URL_WRONLY) {
159 164
            /* output */
......
174 179
            }
175 180
        }
176 181
    }
182
#endif
177 183

  
178 184
    if (is_output) {
179 185
        /* limit the tx buf size to limit latency */
......
189 195
    return 0;
190 196
 fail:
191 197
    if (udp_fd >= 0)
198
#ifdef CONFIG_BEOS_NETSERVER
199
        closesocket(udp_fd);
200
#else
192 201
        close(udp_fd);
202
#endif
193 203
    av_free(s);
194 204
    return -EIO;
195 205
}
......
237 247
{
238 248
    UDPContext *s = h->priv_data;
239 249

  
250
#ifndef CONFIG_BEOS_NETSERVER
240 251
    if (s->is_multicast && !(h->flags & URL_WRONLY)) {
241 252
        if (setsockopt(s->udp_fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, 
242 253
                       &s->mreq, sizeof(s->mreq)) < 0) {
......
244 255
        }
245 256
    }
246 257
    close(s->udp_fd);
258
#else
259
    closesocket(s->udp_fd);
260
#endif
247 261
    av_free(s);
248 262
    return 0;
249 263
}

Also available in: Unified diff