annotate stream/network.h @ 33386:dc5d741dad9c

x264 version 0.115 is required now.
author cehoyos
date Fri, 20 May 2011 22:44:52 +0000
parents 80e4a267f6b8
children 4dc2b1261d29
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
30426
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
3 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
4 * Copyright (C) 2001 Bertrand Baudet <bertrand_baudet@yahoo.com>
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
5 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
6 * This file is part of MPlayer.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
7 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
8 * MPlayer is free software; you can redistribute it and/or modify
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
9 * it under the terms of the GNU General Public License as published by
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
11 * (at your option) any later version.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
12 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
13 * MPlayer is distributed in the hope that it will be useful,
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
16 * GNU General Public License for more details.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
17 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
18 * You should have received a copy of the GNU General Public License along
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 28402
diff changeset
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
903
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
21 */
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
22
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
23 #ifndef MPLAYER_NETWORK_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
24 #define MPLAYER_NETWORK_H
903
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
25
3424
1c2fb4764745 Moved the network related include files from network.c to network.h
bertrand
parents: 3042
diff changeset
26 #include <fcntl.h>
10281
54bcbf28698a Networking support under MinGW.
diego
parents: 9890
diff changeset
27 #include <sys/time.h>
54bcbf28698a Networking support under MinGW.
diego
parents: 9890
diff changeset
28 #include <sys/types.h>
54bcbf28698a Networking support under MinGW.
diego
parents: 9890
diff changeset
29
54bcbf28698a Networking support under MinGW.
diego
parents: 9890
diff changeset
30 #include "config.h"
28402
c884d17bd005 Convert HAVE_WINSOCK2_H into a 0/1 definition.
diego
parents: 28399
diff changeset
31 #if !HAVE_WINSOCK2_H
3424
1c2fb4764745 Moved the network related include files from network.c to network.h
bertrand
parents: 3042
diff changeset
32 #include <netdb.h>
1c2fb4764745 Moved the network related include files from network.c to network.h
bertrand
parents: 3042
diff changeset
33 #include <netinet/in.h>
1c2fb4764745 Moved the network related include files from network.c to network.h
bertrand
parents: 3042
diff changeset
34 #include <sys/socket.h>
1c2fb4764745 Moved the network related include files from network.c to network.h
bertrand
parents: 3042
diff changeset
35 #include <arpa/inet.h>
10281
54bcbf28698a Networking support under MinGW.
diego
parents: 9890
diff changeset
36 #endif
3424
1c2fb4764745 Moved the network related include files from network.c to network.h
bertrand
parents: 3042
diff changeset
37
30655
73d7c7884b0c Move struct streaming_control from network.h to stream.h, where it is used.
diego
parents: 30654
diff changeset
38 #include "stream.h"
903
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
39 #include "url.h"
6455
c4078c1f9d53 Added a function prototype for reuse outside of network.c
bertrand
parents: 4729
diff changeset
40 #include "http.h"
903
7f6641b1b0df Added autodetection of potential stream type.
bertrand
parents: 841
diff changeset
41
31500
b01f807eb183 Use MSG_NOSIGNAL flag if available for send().
reimar
parents: 31393
diff changeset
42 #ifdef MSG_NOSIGNAL
b01f807eb183 Use MSG_NOSIGNAL flag if available for send().
reimar
parents: 31393
diff changeset
43 #define DEFAULT_SEND_FLAGS MSG_NOSIGNAL
b01f807eb183 Use MSG_NOSIGNAL flag if available for send().
reimar
parents: 31393
diff changeset
44 #else
b01f807eb183 Use MSG_NOSIGNAL flag if available for send().
reimar
parents: 31393
diff changeset
45 #define DEFAULT_SEND_FLAGS 0
b01f807eb183 Use MSG_NOSIGNAL flag if available for send().
reimar
parents: 31393
diff changeset
46 #endif
b01f807eb183 Use MSG_NOSIGNAL flag if available for send().
reimar
parents: 31393
diff changeset
47
28399
28406057a982 Convert HAVE_CLOSESOCKET and HAVE_SOCKLEN_T into 0/1 definitions.
diego
parents: 27712
diff changeset
48 #if !HAVE_CLOSESOCKET
27473
ae5da477539e Move '#define closesocket close' preprocessor directive to a common place
diego
parents: 27472
diff changeset
49 #define closesocket close
ae5da477539e Move '#define closesocket close' preprocessor directive to a common place
diego
parents: 27472
diff changeset
50 #endif
28399
28406057a982 Convert HAVE_CLOSESOCKET and HAVE_SOCKLEN_T into 0/1 definitions.
diego
parents: 27712
diff changeset
51 #if !HAVE_SOCKLEN_T
27712
daff903e23e2 Move socklen_t typedef from config.h to stream/network.h.
diego
parents: 27473
diff changeset
52 typedef int socklen_t;
daff903e23e2 Move socklen_t typedef from config.h to stream/network.h.
diego
parents: 27473
diff changeset
53 #endif
27473
ae5da477539e Move '#define closesocket close' preprocessor directive to a common place
diego
parents: 27472
diff changeset
54
999
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
55 #define BUFFER_SIZE 2048
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
56
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents: 11965
diff changeset
57 typedef struct {
19194
5949a654e2d4 marks some read-only char* inside structs as const, patch by Stefan Huehner, stefan At huehner-org
reynaldo
parents: 17566
diff changeset
58 const char *mime_type;
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents: 11965
diff changeset
59 int demuxer_type;
281d155fb37f ported all network streams to the new API
nicodvb
parents: 11965
diff changeset
60 } mime_struct_t;
281d155fb37f ported all network streams to the new API
nicodvb
parents: 11965
diff changeset
61
32024
6c66a5ea013b Move mime_type_table extern declaration to network.h, where it belongs.
diego
parents: 31500
diff changeset
62 extern const mime_struct_t mime_type_table[];
6c66a5ea013b Move mime_type_table extern declaration to network.h, where it belongs.
diego
parents: 31500
diff changeset
63
31393
496c8a6d045b Move extern variable declarations for network.c to network.h.
diego
parents: 30656
diff changeset
64 extern char *cookies_file;
496c8a6d045b Move extern variable declarations for network.c to network.h.
diego
parents: 30656
diff changeset
65 extern char *network_password;
496c8a6d045b Move extern variable declarations for network.c to network.h.
diego
parents: 30656
diff changeset
66 extern char *network_referrer;
496c8a6d045b Move extern variable declarations for network.c to network.h.
diego
parents: 30656
diff changeset
67 extern char *network_useragent;
496c8a6d045b Move extern variable declarations for network.c to network.h.
diego
parents: 30656
diff changeset
68 extern char *network_username;
32995
80e4a267f6b8 Allow setting custom http header.
cehoyos
parents: 32024
diff changeset
69 extern char **network_http_header_fields;
31393
496c8a6d045b Move extern variable declarations for network.c to network.h.
diego
parents: 30656
diff changeset
70
496c8a6d045b Move extern variable declarations for network.c to network.h.
diego
parents: 30656
diff changeset
71 extern int network_bandwidth;
496c8a6d045b Move extern variable declarations for network.c to network.h.
diego
parents: 30656
diff changeset
72 extern int network_cookies_enabled;
496c8a6d045b Move extern variable declarations for network.c to network.h.
diego
parents: 30656
diff changeset
73 extern int network_ipv4_only_proxy;
496c8a6d045b Move extern variable declarations for network.c to network.h.
diego
parents: 30656
diff changeset
74
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 15585
diff changeset
75 streaming_ctrl_t *streaming_ctrl_new(void);
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2310
diff changeset
76 int streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size);
999
92833c9472e8 Continue implementation of the network streaming part.
bertrand
parents: 903
diff changeset
77
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2310
diff changeset
78 int nop_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl );
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2310
diff changeset
79 int nop_streaming_seek( int fd, off_t pos, streaming_ctrl_t *stream_ctrl );
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents: 11965
diff changeset
80 void streaming_ctrl_free( streaming_ctrl_t *streaming_ctrl );
841
c906b7600fc6 Included "netdb.h" file needed.
bertrand
parents:
diff changeset
81
11965
3d75bcc28231 enable seeking in http streams
attila
parents: 10625
diff changeset
82 int http_send_request(URL_t *url, off_t pos);
6455
c4078c1f9d53 Added a function prototype for reuse outside of network.c
bertrand
parents: 4729
diff changeset
83 HTTP_header_t *http_read_response(int fd);
c4078c1f9d53 Added a function prototype for reuse outside of network.c
bertrand
parents: 4729
diff changeset
84
7953
60624e692b95 GCC warning fixes
bertrand
parents: 7135
diff changeset
85 int http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry);
15585
281d155fb37f ported all network streams to the new API
nicodvb
parents: 11965
diff changeset
86 URL_t* check4proxies(URL_t *url);
7953
60624e692b95 GCC warning fixes
bertrand
parents: 7135
diff changeset
87
30656
11eebd7c8879 Declare functions from network.c in network.h.
diego
parents: 30655
diff changeset
88 void fixup_network_stream_cache(stream_t *stream);
11eebd7c8879 Declare functions from network.c in network.h.
diego
parents: 30655
diff changeset
89 int http_seek(stream_t *stream, off_t pos);
11eebd7c8879 Declare functions from network.c in network.h.
diego
parents: 30655
diff changeset
90
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
91 #endif /* MPLAYER_NETWORK_H */