Mercurial > mplayer.hg
annotate stream/network.h @ 27634:9d0094f6cdf6
Since the pause loop now also runs commands, set mpctx->was_paused
before entering it for more consistency.
author | reimar |
---|---|
date | Thu, 25 Sep 2008 17:42:56 +0000 |
parents | ae5da477539e |
children | daff903e23e2 |
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 | |
26029 | 7 #ifndef MPLAYER_NETWORK_H |
8 #define MPLAYER_NETWORK_H | |
903 | 9 |
3424
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
10 #include <fcntl.h> |
10281 | 11 #include <sys/time.h> |
12 #include <sys/types.h> | |
13 | |
14 #include "config.h" | |
27461
5a30f5bc23a0
Rename HAVE_WINSOCK preprocessor condition to HAVE_WINSOCK_H.
diego
parents:
26183
diff
changeset
|
15 #ifndef HAVE_WINSOCK2_H |
3424
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
16 #include <netdb.h> |
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
17 #include <netinet/in.h> |
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
18 #include <sys/socket.h> |
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
19 #include <arpa/inet.h> |
10281 | 20 #endif |
3424
1c2fb4764745
Moved the network related include files from network.c to network.h
bertrand
parents:
3042
diff
changeset
|
21 |
903 | 22 #include "url.h" |
6455
c4078c1f9d53
Added a function prototype for reuse outside of network.c
bertrand
parents:
4729
diff
changeset
|
23 #include "http.h" |
903 | 24 |
27473
ae5da477539e
Move '#define closesocket close' preprocessor directive to a common place
diego
parents:
27472
diff
changeset
|
25 #ifndef HAVE_CLOSESOCKET |
ae5da477539e
Move '#define closesocket close' preprocessor directive to a common place
diego
parents:
27472
diff
changeset
|
26 #define closesocket close |
ae5da477539e
Move '#define closesocket close' preprocessor directive to a common place
diego
parents:
27472
diff
changeset
|
27 #endif |
ae5da477539e
Move '#define closesocket close' preprocessor directive to a common place
diego
parents:
27472
diff
changeset
|
28 |
999
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
29 #define BUFFER_SIZE 2048 |
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
30 |
15585 | 31 typedef struct { |
19194
5949a654e2d4
marks some read-only char* inside structs as const, patch by Stefan Huehner, stefan At huehner-org
reynaldo
parents:
17566
diff
changeset
|
32 const char *mime_type; |
15585 | 33 int demuxer_type; |
34 } mime_struct_t; | |
35 | |
999
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
36 typedef enum { |
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
37 streaming_stopped_e, |
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
38 streaming_playing_e |
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
39 } streaming_status; |
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
40 |
3042 | 41 typedef struct streaming_control { |
42 URL_t *url; | |
43 streaming_status status; | |
44 int buffering; // boolean | |
45 unsigned int prebuffer_size; | |
999
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
46 char *buffer; |
3042 | 47 unsigned int buffer_size; |
48 unsigned int buffer_pos; | |
6641
2cdaadd779ac
Added the bandwidth variable. Used to set the max download bandwidth
bertrand
parents:
6455
diff
changeset
|
49 unsigned int bandwidth; // The downstream available |
3042 | 50 int (*streaming_read)( int fd, char *buffer, int buffer_size, struct streaming_control *stream_ctrl ); |
51 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
|
52 void *data; |
999
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
53 } streaming_ctrl_t; |
92833c9472e8
Continue implementation of the network streaming part.
bertrand
parents:
903
diff
changeset
|
54 |
4729
f51bd827ed1c
fixed MP3 ICY detection, return detected file format for open_stream
alex
parents:
4251
diff
changeset
|
55 //int streaming_start( stream_t *stream, int *demuxer_type, URL_t *url ); |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
15585
diff
changeset
|
56 streaming_ctrl_t *streaming_ctrl_new(void); |
3042 | 57 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
|
58 |
3042 | 59 int nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl ); |
60 int nop_streaming_seek( int fd, off_t pos, streaming_ctrl_t *stream_ctrl ); | |
15585 | 61 void streaming_ctrl_free( streaming_ctrl_t *streaming_ctrl ); |
841 | 62 |
11965 | 63 int http_send_request(URL_t *url, off_t pos); |
6455
c4078c1f9d53
Added a function prototype for reuse outside of network.c
bertrand
parents:
4729
diff
changeset
|
64 HTTP_header_t *http_read_response(int fd); |
c4078c1f9d53
Added a function prototype for reuse outside of network.c
bertrand
parents:
4729
diff
changeset
|
65 |
7953 | 66 int http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry); |
15585 | 67 URL_t* check4proxies(URL_t *url); |
7953 | 68 |
26029 | 69 #endif /* MPLAYER_NETWORK_H */ |