annotate network.h @ 1132:80a0f8aa2360

Added for development only this is in pre-alpha state, do not use!
author atmosfear
date Fri, 15 Jun 2001 16:31:19 +0000
parents 92833c9472e8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
903
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
1 /*
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
2 * Network layer for MPlayer
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
3 * by Bertrand BAUDET <bertrand_baudet@yahoo.com>
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
4 * (C) 2001, MPlayer team.
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
5 */
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
6
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
7 #ifndef __NETWORK_H
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
8 #define __NETWORK_H
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
9
999
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
10 #include <pthread.h>
841
c906b7600fc6 Included "netdb.h" file needed.
bertrand
parents:
diff changeset
11
999
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
12 #include "stream.h"
841
c906b7600fc6 Included "netdb.h" file needed.
bertrand
parents:
diff changeset
13
903
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
14 #include "url.h"
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
15
999
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
16 #define BUFFER_SIZE 2048
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
17
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
18 typedef enum {
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
19 streaming_stopped_e,
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
20 streaming_playing_e
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
21 } streaming_status;
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
22
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
23 typedef struct {
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
24 char *buffer;
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
25 int length;
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
26 } Net_Fifo;
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
27
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
28 typedef struct streaming_control {
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
29 URL_t **url;
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
30 int fd_net;
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
31 int fd_pipe_in;
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
32 streaming_status status;
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
33 pthread_t thread_id;
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
34 Net_Fifo *buffer;
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
35 int buffering; // boolean
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
36 int prebuffer_size;
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
37 int (*streaming_read)( struct streaming_control *stream_ctrl );
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
38 } streaming_ctrl_t;
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
39
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
40 Net_Fifo* net_fifo_new( );
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
41 void net_fifo_free(Net_Fifo *net_fifo );
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
42 int net_fifo_pop(Net_Fifo *net_fifo, char *buffer, int length );
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
43 int net_fifo_push(Net_Fifo *net_fifo, char *buffer, int length );
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
44
841
c906b7600fc6 Included "netdb.h" file needed.
bertrand
parents:
diff changeset
45 int connect2Server(char *host, int port);
999
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
46 int readFromServer(int fd, char *buffer, int length );
903
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
47 int autodetectProtocol( URL_t *url, int *fd_out );
841
c906b7600fc6 Included "netdb.h" file needed.
bertrand
parents:
diff changeset
48
c906b7600fc6 Included "netdb.h" file needed.
bertrand
parents:
diff changeset
49 #endif