2 * Network layer for MPlayer
3 * by Bertrand BAUDET <bertrand_baudet@yahoo.com>
4 * (C) 2001, MPlayer team.
7 #ifndef MPLAYER_NETWORK_H
8 #define MPLAYER_NETWORK_H
12 #include <sys/types.h>
17 #include <netinet/in.h>
18 #include <sys/socket.h>
19 #include <arpa/inet.h>
26 #define closesocket close
29 typedef int socklen_t
;
32 #define BUFFER_SIZE 2048
35 const char *mime_type
;
44 typedef struct streaming_control
{
46 streaming_status status
;
47 int buffering
; // boolean
48 unsigned int prebuffer_size
;
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
);
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 */