Mercurial > mplayer.hg
annotate libmpdemux/network.h @ 7569:5e956ff37e91
Moving lm to after laf
author | anders |
---|---|
date | Tue, 01 Oct 2002 08:42:47 +0000 |
parents | 2c34499ef4af |
children | 60624e692b95 |
rev | line source |
---|---|
903 | 1 /* |
2 * Network layer for MPlayer | |
3 * by Bertrand BAUDET <bertrand_baudet@yahoo.com> | |
4 * (C) 2001, MPlayer team. | |
5 */ | |
6 | |
7 #ifndef __NETWORK_H | |
8 #define __NETWORK_H | |
9 | |
3424
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
10 #include <fcntl.h> |
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
11 #include <netdb.h> |
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
12 #include <netinet/in.h> |
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
13 #include <sys/time.h> |
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
14 #include <sys/types.h> |
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
15 #include <sys/socket.h> |
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
16 #include <arpa/inet.h> |
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
17 |
903 | 18 #include "url.h" |
6455
c4078c1f9d53
Added a function prototype for reuse outside of network.c
bertrand
parents:
4729
diff
changeset
|
19 #include "http.h" |
4046
f732854e3d16
Kept the HTTP connection open after autodetect, so
bertrand
parents:
3453
diff
changeset
|
20 #include "stream.h" |
903 | 21 |
999
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
22 #define BUFFER_SIZE 2048 |
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
23 |
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
24 typedef enum { |
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
25 streaming_stopped_e, |
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
26 streaming_playing_e |
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
27 } streaming_status; |
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
28 |
3042 | 29 typedef struct streaming_control { |
30 URL_t *url; | |
31 streaming_status status; | |
32 int buffering; // boolean | |
33 unsigned int prebuffer_size; | |
999
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
34 char *buffer; |
3042 | 35 unsigned int buffer_size; |
36 unsigned int buffer_pos; | |
6641
2cdaadd779ac
Added the bandwidth variable. Used to set the max download bandwidth
bertrand
parents:
6455
diff
changeset
|
37 unsigned int bandwidth; // The downstream available |
3042 | 38 int (*streaming_read)( int fd, char *buffer, int buffer_size, struct streaming_control *stream_ctrl ); |
39 int (*streaming_seek)( int fd, off_t pos, struct streaming_control *stream_ctrl ); | |
3453
10577da4a7b1
Added a data field in the streaming_ctrl_t struct, to store any
bertrand
parents:
3428
diff
changeset
|
40 void *data; |
999
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
41 } streaming_ctrl_t; |
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
42 |
4729
f51bd827ed1c
fixed MP3 ICY detection, return detected file format for open_stream
alex
parents:
4251
diff
changeset
|
43 //int streaming_start( stream_t *stream, int *demuxer_type, URL_t *url ); |
4046
f732854e3d16
Kept the HTTP connection open after autodetect, so
bertrand
parents:
3453
diff
changeset
|
44 |
3042 | 45 int streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size); |
999
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
46 |
3042 | 47 int nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl ); |
48 int nop_streaming_seek( int fd, off_t pos, streaming_ctrl_t *stream_ctrl ); | |
841 | 49 |
3428 | 50 int connect2Server(char *host, int port); |
51 | |
6455
c4078c1f9d53
Added a function prototype for reuse outside of network.c
bertrand
parents:
4729
diff
changeset
|
52 int http_send_request(URL_t *url); |
c4078c1f9d53
Added a function prototype for reuse outside of network.c
bertrand
parents:
4729
diff
changeset
|
53 HTTP_header_t *http_read_response(int fd); |
c4078c1f9d53
Added a function prototype for reuse outside of network.c
bertrand
parents:
4729
diff
changeset
|
54 |
7135
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
55 /* |
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
56 * Joey Parrish <joey@yunamusic.com>: |
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
57 * |
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
58 * This define is to allow systems without inet_pton() to fallback on |
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
59 * inet_aton(). The difference between the two is that inet_aton() is |
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
60 * strictly for IPv4 networking, while inet_pton() is for IPv4 and IPv6 |
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
61 * both. Slightly limited network functionality seems better than no |
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
62 * network functionality to me, and as all systems (Cygwin) start to |
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
63 * implement inet_pton(), configure will decide not to use this code. |
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
64 */ |
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
65 #ifdef USE_ATON |
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
66 # define inet_pton(a, b, c) inet_aton(b, c) |
841 | 67 #endif |
7135
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
68 |
2c34499ef4af
inet_aton fallback support by Joey Parrish <joey@yunamusic.com>
bertrand
parents:
6641
diff
changeset
|
69 #endif |