Fix:
[mplayer/glamo.git] / libmpdemux / network.h
blob0081c88256b8b0d9e901007d0fff816e57b9a58f
1 /*
2 * Network layer for MPlayer
3 * by Bertrand BAUDET <bertrand_baudet@yahoo.com>
4 * (C) 2001, MPlayer team.
5 */
7 #ifndef __NETWORK_H
8 #define __NETWORK_H
10 #include <fcntl.h>
11 #include <sys/time.h>
12 #include <sys/types.h>
14 #include "config.h"
15 #ifndef HAVE_WINSOCK2
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"
24 #include "stream.h"
26 #define BUFFER_SIZE 2048
28 typedef struct {
29 char *mime_type;
30 int demuxer_type;
31 } mime_struct_t;
33 typedef enum {
34 streaming_stopped_e,
35 streaming_playing_e
36 } streaming_status;
38 typedef struct streaming_control {
39 URL_t *url;
40 streaming_status status;
41 int buffering; // boolean
42 unsigned int prebuffer_size;
43 char *buffer;
44 unsigned int buffer_size;
45 unsigned int buffer_pos;
46 unsigned int bandwidth; // The downstream available
47 int (*streaming_read)( int fd, char *buffer, int buffer_size, struct streaming_control *stream_ctrl );
48 int (*streaming_seek)( int fd, off_t pos, struct streaming_control *stream_ctrl );
49 void *data;
50 } streaming_ctrl_t;
52 //int streaming_start( stream_t *stream, int *demuxer_type, URL_t *url );
53 streaming_ctrl_t *streaming_ctrl_new(void);
54 int streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size);
56 int nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl );
57 int nop_streaming_seek( int fd, off_t pos, streaming_ctrl_t *stream_ctrl );
58 void streaming_ctrl_free( streaming_ctrl_t *streaming_ctrl );
60 int connect2Server(char *host, int port,int verb);
62 int http_send_request(URL_t *url, off_t pos);
63 HTTP_header_t *http_read_response(int fd);
65 int http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry);
66 URL_t* check4proxies(URL_t *url);
68 #endif