2001-05-29 19:03:17 +02:00
|
|
|
/*
|
|
|
|
* Network layer for MPlayer
|
|
|
|
* by Bertrand BAUDET <bertrand_baudet@yahoo.com>
|
|
|
|
* (C) 2001, MPlayer team.
|
|
|
|
*/
|
2001-05-20 14:58:41 +02:00
|
|
|
|
2008-02-22 10:09:46 +01:00
|
|
|
#ifndef MPLAYER_NETWORK_H
|
|
|
|
#define MPLAYER_NETWORK_H
|
2001-05-29 19:03:17 +02:00
|
|
|
|
2001-12-10 02:34:08 +01:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/types.h>
|
2003-06-11 18:48:09 +02:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#ifndef HAVE_WINSOCK2
|
|
|
|
#include <netdb.h>
|
|
|
|
#include <netinet/in.h>
|
2001-12-10 02:34:08 +01:00
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <arpa/inet.h>
|
2003-06-11 18:48:09 +02:00
|
|
|
#endif
|
2001-12-10 02:34:08 +01:00
|
|
|
|
2001-05-29 19:03:17 +02:00
|
|
|
#include "url.h"
|
2002-06-17 10:18:45 +02:00
|
|
|
#include "http.h"
|
2001-05-20 14:58:41 +02:00
|
|
|
|
2001-06-04 19:52:33 +02:00
|
|
|
#define BUFFER_SIZE 2048
|
|
|
|
|
2005-05-29 14:54:00 +02:00
|
|
|
typedef struct {
|
2006-07-27 19:35:06 +02:00
|
|
|
const char *mime_type;
|
2005-05-29 14:54:00 +02:00
|
|
|
int demuxer_type;
|
|
|
|
} mime_struct_t;
|
|
|
|
|
2001-06-04 19:52:33 +02:00
|
|
|
typedef enum {
|
|
|
|
streaming_stopped_e,
|
|
|
|
streaming_playing_e
|
|
|
|
} streaming_status;
|
|
|
|
|
|
|
|
typedef struct streaming_control {
|
2001-11-20 23:20:20 +01:00
|
|
|
URL_t *url;
|
2001-06-04 19:52:33 +02:00
|
|
|
streaming_status status;
|
|
|
|
int buffering; // boolean
|
2001-11-20 23:20:20 +01:00
|
|
|
unsigned int prebuffer_size;
|
|
|
|
char *buffer;
|
|
|
|
unsigned int buffer_size;
|
|
|
|
unsigned int buffer_pos;
|
2002-07-05 04:35:19 +02:00
|
|
|
unsigned int bandwidth; // The downstream available
|
2001-11-20 23:20:20 +01:00
|
|
|
int (*streaming_read)( int fd, char *buffer, int buffer_size, struct streaming_control *stream_ctrl );
|
|
|
|
int (*streaming_seek)( int fd, off_t pos, struct streaming_control *stream_ctrl );
|
2001-12-11 02:06:08 +01:00
|
|
|
void *data;
|
2001-06-04 19:52:33 +02:00
|
|
|
} streaming_ctrl_t;
|
|
|
|
|
2002-02-16 22:48:59 +01:00
|
|
|
//int streaming_start( stream_t *stream, int *demuxer_type, URL_t *url );
|
2006-02-09 15:08:03 +01:00
|
|
|
streaming_ctrl_t *streaming_ctrl_new(void);
|
2001-11-20 23:20:20 +01:00
|
|
|
int streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size);
|
2001-06-04 19:52:33 +02:00
|
|
|
|
2001-11-20 23:20:20 +01:00
|
|
|
int nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl );
|
|
|
|
int nop_streaming_seek( int fd, off_t pos, streaming_ctrl_t *stream_ctrl );
|
2005-05-29 14:54:00 +02:00
|
|
|
void streaming_ctrl_free( streaming_ctrl_t *streaming_ctrl );
|
2001-05-20 14:58:41 +02:00
|
|
|
|
2004-02-17 13:30:45 +01:00
|
|
|
int http_send_request(URL_t *url, off_t pos);
|
2002-06-17 10:18:45 +02:00
|
|
|
HTTP_header_t *http_read_response(int fd);
|
|
|
|
|
2002-10-29 10:18:53 +01:00
|
|
|
int http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry);
|
2005-05-29 14:54:00 +02:00
|
|
|
URL_t* check4proxies(URL_t *url);
|
2002-10-29 10:18:53 +01:00
|
|
|
|
2008-02-22 10:09:46 +01:00
|
|
|
#endif /* MPLAYER_NETWORK_H */
|