sync with en/mplayer.1 r28991
[mplayer/glamo.git] / stream / network.h
blobbc4ec598efb916ab25dd15e3d60b2a9bea3603af
1 /*
2 * Network layer for MPlayer
3 * by Bertrand BAUDET <bertrand_baudet@yahoo.com>
4 * (C) 2001, MPlayer team.
5 */
7 #ifndef MPLAYER_NETWORK_H
8 #define MPLAYER_NETWORK_H
10 #include <fcntl.h>
11 #include <sys/time.h>
12 #include <sys/types.h>
14 #include "config.h"
15 #if !HAVE_WINSOCK2_H
16 #include <netdb.h>
17 #include <netinet/in.h>
18 #include <sys/socket.h>
19 #include <arpa/inet.h>
20 #endif
22 #include "url.h"
23 #include "http.h"
25 #if !HAVE_CLOSESOCKET
26 #define closesocket close
27 #endif
28 #if !HAVE_SOCKLEN_T
29 typedef int socklen_t;
30 #endif
32 #define BUFFER_SIZE 2048
34 typedef struct {
35 const char *mime_type;
36 int demuxer_type;
37 } mime_struct_t;
39 typedef enum {
40 streaming_stopped_e,
41 streaming_playing_e
42 } streaming_status;
44 typedef struct streaming_control {
45 URL_t *url;
46 streaming_status status;
47 int buffering; // boolean
48 unsigned int prebuffer_size;
49 char *buffer;
50 unsigned int buffer_size;
51 unsigned int buffer_pos;
52 unsigned int bandwidth; // The downstream available
53 int (*streaming_read)( int fd, char *buffer, int buffer_size, struct streaming_control *stream_ctrl );
54 int (*streaming_seek)( int fd, off_t pos, struct streaming_control *stream_ctrl );
55 void *data;
56 } streaming_ctrl_t;
58 //int streaming_start( stream_t *stream, int *demuxer_type, URL_t *url );
59 streaming_ctrl_t *streaming_ctrl_new(void);
60 int streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size);
62 int nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl );
63 int nop_streaming_seek( int fd, off_t pos, streaming_ctrl_t *stream_ctrl );
64 void streaming_ctrl_free( streaming_ctrl_t *streaming_ctrl );
66 int http_send_request(URL_t *url, off_t pos);
67 HTTP_header_t *http_read_response(int fd);
69 int http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry);
70 URL_t* check4proxies(URL_t *url);
72 #endif /* MPLAYER_NETWORK_H */