demux: take chapter/attachment name strings without 0-termination
[mplayer/glamo.git] / stream / network.h
blobc00bffd5e5a50ebd114687b3311eb41e51a0f908
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 // hacks for asf
57 int *audio_id_ptr;
58 int *video_id_ptr;
59 } streaming_ctrl_t;
61 //int streaming_start( stream_t *stream, int *demuxer_type, URL_t *url );
62 streaming_ctrl_t *streaming_ctrl_new(void);
63 int streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size);
65 int nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl );
66 int nop_streaming_seek( int fd, off_t pos, streaming_ctrl_t *stream_ctrl );
67 void streaming_ctrl_free( streaming_ctrl_t *streaming_ctrl );
69 int http_send_request(URL_t *url, off_t pos);
70 HTTP_header_t *http_read_response(int fd);
72 int http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry);
73 URL_t* check4proxies(URL_t *url);
75 #endif /* MPLAYER_NETWORK_H */