2 * Network layer for MPlayer
4 * Copyright (C) 2001 Bertrand Baudet <bertrand_baudet@yahoo.com>
6 * This file is part of MPlayer.
8 * MPlayer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * MPlayer is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef MPLAYER_NETWORK_H
24 #define MPLAYER_NETWORK_H
28 #include <sys/types.h>
33 #include <netinet/in.h>
34 #include <sys/socket.h>
35 #include <arpa/inet.h>
42 #define closesocket close
45 typedef int socklen_t
;
48 #define BUFFER_SIZE 2048
51 const char *mime_type
;
60 typedef struct streaming_control
{
62 streaming_status status
;
63 int buffering
; // boolean
64 unsigned int prebuffer_size
;
66 unsigned int buffer_size
;
67 unsigned int buffer_pos
;
68 unsigned int bandwidth
; // The downstream available
69 int (*streaming_read
)( int fd
, char *buffer
, int buffer_size
, struct streaming_control
*stream_ctrl
);
70 int (*streaming_seek
)( int fd
, off_t pos
, struct streaming_control
*stream_ctrl
);
74 //int streaming_start( stream_t *stream, int *demuxer_type, URL_t *url );
75 streaming_ctrl_t
*streaming_ctrl_new(void);
76 int streaming_bufferize( streaming_ctrl_t
*streaming_ctrl
, char *buffer
, int size
);
78 int nop_streaming_read( int fd
, char *buffer
, int size
, streaming_ctrl_t
*stream_ctrl
);
79 int nop_streaming_seek( int fd
, off_t pos
, streaming_ctrl_t
*stream_ctrl
);
80 void streaming_ctrl_free( streaming_ctrl_t
*streaming_ctrl
);
82 int http_send_request(URL_t
*url
, off_t pos
);
83 HTTP_header_t
*http_read_response(int fd
);
85 int http_authenticate(HTTP_header_t
*http_hdr
, URL_t
*url
, int *auth_retry
);
86 URL_t
* check4proxies(URL_t
*url
);
88 #endif /* MPLAYER_NETWORK_H */