Mercurial > mplayer.hg
comparison libmpdemux/network.h @ 3042:6b6fa2be9b97
Removed my buffer hack to use cache2.
Removed the network thread.
Changed the network layer to use cache2.
author | bertrand |
---|---|
date | Tue, 20 Nov 2001 22:20:20 +0000 |
parents | 9e059416eea6 |
children | 1c2fb4764745 |
comparison
equal
deleted
inserted
replaced
3041:6b31e121f36a | 3042:6b6fa2be9b97 |
---|---|
4 * (C) 2001, MPlayer team. | 4 * (C) 2001, MPlayer team. |
5 */ | 5 */ |
6 | 6 |
7 #ifndef __NETWORK_H | 7 #ifndef __NETWORK_H |
8 #define __NETWORK_H | 8 #define __NETWORK_H |
9 | |
10 #include <pthread.h> | |
11 | |
12 #include "stream.h" | |
13 | 9 |
14 #include "url.h" | 10 #include "url.h" |
15 | 11 |
16 #define BUFFER_SIZE 2048 | 12 #define BUFFER_SIZE 2048 |
17 | 13 |
18 typedef enum { | 14 typedef enum { |
19 streaming_stopped_e, | 15 streaming_stopped_e, |
20 streaming_playing_e | 16 streaming_playing_e |
21 } streaming_status; | 17 } streaming_status; |
22 | 18 |
23 typedef struct { | 19 typedef struct streaming_control { |
20 URL_t *url; | |
21 streaming_status status; | |
22 int buffering; // boolean | |
23 unsigned int prebuffer_size; | |
24 char *buffer; | 24 char *buffer; |
25 int length; | 25 unsigned int buffer_size; |
26 } Net_Fifo; | 26 unsigned int buffer_pos; |
27 | 27 int (*streaming_read)( int fd, char *buffer, int buffer_size, struct streaming_control *stream_ctrl ); |
28 typedef struct streaming_control { | 28 int (*streaming_seek)( int fd, off_t pos, struct streaming_control *stream_ctrl ); |
29 URL_t **url; | |
30 int fd_net; | |
31 int fd_pipe_in; | |
32 streaming_status status; | |
33 pthread_t thread_id; | |
34 Net_Fifo *buffer; | |
35 int buffering; // boolean | |
36 int prebuffer_size; | |
37 int (*streaming_read)( struct streaming_control *stream_ctrl ); | |
38 } streaming_ctrl_t; | 29 } streaming_ctrl_t; |
39 | 30 |
40 Net_Fifo* net_fifo_new( ); | 31 int streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size); |
41 void net_fifo_free(Net_Fifo *net_fifo ); | |
42 int net_fifo_pop(Net_Fifo *net_fifo, char *buffer, int length ); | |
43 int net_fifo_push(Net_Fifo *net_fifo, char *buffer, int length ); | |
44 | 32 |
45 int connect2Server(char *host, int port); | 33 int nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl ); |
46 int readFromServer(int fd, char *buffer, int length ); | 34 int nop_streaming_seek( int fd, off_t pos, streaming_ctrl_t *stream_ctrl ); |
47 int autodetectProtocol( URL_t *url, int *fd_out ); | |
48 | 35 |
49 #endif | 36 #endif |