annotate libmpdemux/asf_streaming.c @ 3217:20dbdbce507d

fixed DGA detection
author arpi
date Thu, 29 Nov 2001 23:12:19 +0000
parents 6b6fa2be9b97
children 78057c7120f6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
1 #include <stdio.h>
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
2 #include <stdlib.h>
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
3 #include <string.h>
1430
1728d249c783 missing unistd.h (requires for off_t under freebsd)
arpi
parents: 1340
diff changeset
4 #include <unistd.h>
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
5
2555
66837325b929 config.h cleanup, few things added to steram/demuxer headers
arpi
parents: 2489
diff changeset
6 #include "config.h"
66837325b929 config.h cleanup, few things added to steram/demuxer headers
arpi
parents: 2489
diff changeset
7
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
8 #include "url.h"
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
9 #include "http.h"
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
10 #include "asf.h"
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
11 #include "network.h"
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
12
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
13 #include "stream.h"
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
14
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
15 static ASF_StreamType_e streaming_type = ASF_Unknown_e;
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
16
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
17 // ASF streaming support several network protocol.
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
18 // One use UDP, not known, yet!
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
19 // Another is HTTP, this one is known.
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
20 // So for now, we use the HTTP protocol.
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
21 int
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
22 asf_streaming_start( stream_t *stream ) {
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
23 return asf_http_streaming_start( stream );
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
24 }
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
25
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
26
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
27 int
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
28 asf_http_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *streaming_ctrl ) {
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
29 int drop_packet;
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
30 int ret;
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
31 //printf("asf_http_streaming_read\n");
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
32
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
33 ret = nop_streaming_read( fd, buffer, size, streaming_ctrl );
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
34 //printf("Read %d bytes\n", ret);
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
35
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
36 ret = asf_streaming( buffer, size, &drop_packet );
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
37 //printf("Streaming packet size=%d\n", ret);
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
38 if( ret<0 ) return -1;
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
39 if( !drop_packet ) {
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
40 memmove( buffer, buffer+sizeof(ASF_stream_chunck_t), ret-sizeof(ASF_stream_chunck_t) );
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
41 }
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
42 return ret-sizeof(ASF_stream_chunck_t);
2489
0ecc1b4f7cf8 Added ASF http server streaming (Not mms streaming).
bertrand
parents: 2310
diff changeset
43 }
0ecc1b4f7cf8 Added ASF http server streaming (Not mms streaming).
bertrand
parents: 2310
diff changeset
44
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
45 int
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
46 asf_streaming(char *data, int length, int *drop_packet ) {
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
47 ASF_stream_chunck_t *stream_chunck=(ASF_stream_chunck_t*)data;
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
48 /*
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
49 printf("ASF stream chunck size=%d\n", stream_chunck->size);
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
50 printf("length: %d\n", length );
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
51 printf("0x%02X\n", stream_chunck->type );
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
52 */
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
53 if( data==NULL || length<=0 ) return -1;
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
54 if( drop_packet!=NULL ) *drop_packet = 0;
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
55
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
56 if( stream_chunck->size<8 ) {
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
57 printf("Ahhhh, stream_chunck size is too small: %d\n", stream_chunck->size);
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
58 return -1;
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
59 }
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
60 if( stream_chunck->size!=stream_chunck->size_confirm ) {
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
61 printf("size_confirm mismatch!: %d %d\n", stream_chunck->size, stream_chunck->size_confirm);
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
62 return -1;
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
63 }
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
64 /*
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
65 printf(" type: 0x%02X\n", stream_chunck->type );
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
66 printf(" size: %d (0x%02X)\n", stream_chunck->size, stream_chunck->size );
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
67 printf(" sequence_number: 0x%04X\n", stream_chunck->sequence_number );
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
68 printf(" unknown: 0x%02X\n", stream_chunck->unknown );
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
69 printf(" size_confirm: 0x%02X\n", stream_chunck->size_confirm );
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
70 */
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
71 switch(stream_chunck->type) {
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
72 case 0x4324: // $C Clear ASF configuration
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
73 printf("=====> Clearing ASF stream configuration!\n");
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
74 if( drop_packet!=NULL ) *drop_packet = 1;
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
75 return stream_chunck->size;
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
76 break;
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
77 case 0x4424: // $D Data follows
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
78 // printf("=====> Data follows\n");
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
79 break;
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
80 case 0x4524: // $E Transfer complete
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
81 printf("=====> Transfer complete\n");
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
82 if( drop_packet!=NULL ) *drop_packet = 1;
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
83 return stream_chunck->size;
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
84 break;
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
85 case 0x4824: // $H ASF header chunk follows
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
86 printf("=====> ASF header chunk follows\n");
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
87 break;
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
88 default:
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
89 printf("=====> Unknown stream type 0x%x\n", stream_chunck->type );
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
90 }
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
91 return stream_chunck->size+4;
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
92 }
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
93
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
94 int
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
95 asf_http_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl ) {
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
96 return -1;
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
97 }
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
98
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
99 int
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
100 asf_http_streaming_type(char *content_type, char *features) {
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
101 if( content_type==NULL ) return ASF_Unknown_e;
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
102 if( !strcasecmp(content_type, "application/octet-stream") ) {
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
103 if( features==NULL ) {
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
104 printf("=====> ASF Prerecorded\n");
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
105 return ASF_Prerecorded_e;
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
106 } else if( strstr(features, "broadcast")) {
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
107 printf("=====> ASF Live stream\n");
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
108 return ASF_Live_e;
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
109 } else {
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
110 printf("=====> ASF Prerecorded\n");
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
111 return ASF_Prerecorded_e;
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
112 }
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
113 } else {
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
114 if( (!strcasecmp(content_type, "audio/x-ms-wax")) ||
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
115 (!strcasecmp(content_type, "audio/x-ms-wma")) ||
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
116 (!strcasecmp(content_type, "video/x-ms-asf")) ||
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
117 (!strcasecmp(content_type, "video/x-ms-afs")) ||
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
118 (!strcasecmp(content_type, "video/x-ms-wvx")) ||
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
119 (!strcasecmp(content_type, "video/x-ms-wmv")) ||
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
120 (!strcasecmp(content_type, "video/x-ms-wma")) ) {
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
121 printf("=====> ASF Redirector\n");
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
122 return ASF_Redirector_e;
2489
0ecc1b4f7cf8 Added ASF http server streaming (Not mms streaming).
bertrand
parents: 2310
diff changeset
123 } else if( !strcasecmp(content_type, "text/plain") ) {
0ecc1b4f7cf8 Added ASF http server streaming (Not mms streaming).
bertrand
parents: 2310
diff changeset
124 printf("=====> ASF Plain text\n");
0ecc1b4f7cf8 Added ASF http server streaming (Not mms streaming).
bertrand
parents: 2310
diff changeset
125 return ASF_PlainText_e;
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
126 } else {
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
127 printf("=====> ASF unknown content-type: %s\n", content_type );
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
128 return ASF_Unknown_e;
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
129 }
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
130 }
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
131 return ASF_Unknown_e;
833
b8cecdc0c67f Starting implementation of ASF network streaming.
bertrand
parents:
diff changeset
132 }
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
133
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
134 HTTP_header_t *
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
135 asf_http_request(URL_t *url) {
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
136 HTTP_header_t *http_hdr;
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
137 char str[250];
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
138 char *ptr;
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
139 char *request;
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
140 int i;
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
141
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
142 int offset_hi=0, offset_lo=0, req_nb=1, length=0;
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
143 int asf_nb_stream;
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
144
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
145 // Common header for all requests.
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
146 http_hdr = http_new_header();
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
147 http_set_uri( http_hdr, url->file );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
148 http_set_field( http_hdr, "Accept: */*" );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
149 http_set_field( http_hdr, "User-Agent: NSPlayer/4.1.0.3856" );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
150 sprintf( str, "Host: %s:%d", url->hostname, url->port );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
151 http_set_field( http_hdr, str );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
152 http_set_field( http_hdr, "Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}" );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
153 sprintf(str,
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
154 "Pragma: no-cache,rate=1.000000,stream-time=0,stream-offset=%u:%u,request-context=%d,max-duration=%u",
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
155 offset_hi, offset_lo, req_nb, length );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
156 http_set_field( http_hdr, str );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
157
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
158 switch( streaming_type ) {
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
159 case ASF_Live_e:
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
160 case ASF_Prerecorded_e:
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
161 http_set_field( http_hdr, "Pragma: xPlayStrm=1" );
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
162 ptr = str;
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
163 ptr += sprintf( ptr, "Pragma: stream-switch-entry=");
1340
d4f1e8d0e591 demuxer struct access code temporary disabled - FIXME
arpi
parents: 1001
diff changeset
164
d4f1e8d0e591 demuxer struct access code temporary disabled - FIXME
arpi
parents: 1001
diff changeset
165 #if 0
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
166 for( i=0, asf_nb_stream=0 ; i<256 ; i++ ) {
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
167 // FIXME START
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
168 if( demuxer==NULL ) {
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
169 ptr += sprintf( ptr, " ffff:1:0" );
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
170 asf_nb_stream = 1;
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
171 break;
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
172 }
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
173 // FIXME END
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
174 if( demuxer->a_streams[i] ) {
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
175 ptr += sprintf( ptr, " ffff:%d:0", i );
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
176 asf_nb_stream++;
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
177 }
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
178 if( demuxer->v_streams[i] ) {
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
179 ptr += sprintf( ptr, " ffff:%d:0", i );
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
180 asf_nb_stream++;
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
181 }
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
182 }
1340
d4f1e8d0e591 demuxer struct access code temporary disabled - FIXME
arpi
parents: 1001
diff changeset
183 #endif
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
184 http_set_field( http_hdr, str );
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
185 sprintf( str, "Pragma: stream-switch-count=%d", asf_nb_stream );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
186 http_set_field( http_hdr, str );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
187 break;
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
188 case ASF_Redirector_e:
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
189 break;
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
190 case ASF_Unknown_e:
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
191 // First request goes here.
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
192 break;
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
193 default:
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
194 printf("Unknown asf stream type\n");
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
195 }
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
196
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
197 http_set_field( http_hdr, "Connection: Close" );
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
198 http_build_request( http_hdr );
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
199
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
200 return http_hdr;
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
201 }
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
202
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
203 int
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
204 asf_http_parse_response( HTTP_header_t *http_hdr ) {
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
205 char *content_type, *pragma;
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
206 char features[64] = "\0";
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
207 int len;
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
208 if( http_response_parse(http_hdr)<0 ) {
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
209 printf("Failed to parse HTTP response\n");
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
210 return -1;
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
211 }
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
212 if( http_hdr->status_code!=200 ) {
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
213 printf("Server return %d:%s\n", http_hdr->status_code, http_hdr->reason_phrase);
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
214 return -1;
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
215 }
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
216
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
217 content_type = http_get_field( http_hdr, "Content-Type");
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
218 //printf("Content-Type: [%s]\n", content_type);
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
219
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
220 pragma = http_get_field( http_hdr, "Pragma");
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
221 while( pragma!=NULL ) {
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
222 char *comma_ptr=NULL;
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
223 char *end;
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
224 //printf("Pragma: [%s]\n", pragma );
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
225 // The pragma line can get severals attributes
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
226 // separeted with a comma ','.
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
227 do {
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
228 if( !strncasecmp( pragma, "features=", 9) ) {
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
229 pragma += 9;
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
230 end = strstr( pragma, "," );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
231 if( end==NULL ) {
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
232 len = strlen(pragma);
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
233 }
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
234 len = MIN(end-pragma,sizeof(features));
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
235 strncpy( features, pragma, len );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
236 features[len]='\0';
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
237 break;
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
238 }
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
239 comma_ptr = strstr( pragma, "," );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
240 if( comma_ptr!=NULL ) {
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
241 pragma = comma_ptr+1;
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
242 if( pragma[0]==' ' ) pragma++;
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
243 }
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
244 } while( comma_ptr!=NULL );
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
245 pragma = http_get_next_field( http_hdr );
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
246 }
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
247
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
248 streaming_type = asf_http_streaming_type( content_type, features );
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
249
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
250 return 0;
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
251 }
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
252
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
253 URL_t *
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
254 asf_http_ASX_redirect( HTTP_header_t *http_hdr ) {
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
255 URL_t *url_redirect=NULL;
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
256 printf("=========>> ASX parser not yet implemented <<==========\n");
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
257
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
258 printf("ASX=[%s]\n", http_hdr->body );
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
259
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
260 return url_redirect;
871
ab94c4cf96d8 Continue implementation of ASF streaming.
bertrand
parents: 833
diff changeset
261 }
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
262
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
263 int
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
264 asf_http_streaming_start( stream_t *stream ) {
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
265 HTTP_header_t *http_hdr=NULL;
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
266 URL_t *url_next=NULL;
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
267 URL_t *url = stream->streaming_ctrl->url;
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
268 char buffer[BUFFER_SIZE];
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
269 int i;
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
270 int fd = stream->fd;
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
271 int done=1;
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
272
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
273 streaming_type = ASF_Live_e;
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
274 do {
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
275 if( fd>0 ) close( fd );
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
276
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
277 fd = connect2Server( url->hostname, url->port );
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
278 if( fd<0 ) return -1;
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
279
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
280 http_hdr = asf_http_request( url );
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
281 printf("Request [%s]\n", http_hdr->buffer );
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
282 write( fd, http_hdr->buffer, http_hdr->buffer_size );
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
283 http_free( http_hdr );
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
284
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
285 http_hdr = http_new_header();
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
286 do {
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
287 i = read( fd, buffer, BUFFER_SIZE );
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
288 printf("read: %d\n", i );
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
289 if( i<0 ) {
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
290 perror("read");
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
291 http_free( http_hdr );
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
292 return -1;
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
293 }
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
294 http_response_append( http_hdr, buffer, i );
2489
0ecc1b4f7cf8 Added ASF http server streaming (Not mms streaming).
bertrand
parents: 2310
diff changeset
295 } while( !http_is_header_entire( http_hdr ) );
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
296 http_hdr->buffer[http_hdr->buffer_size]='\0';
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
297 printf("Response [%s]\n", http_hdr->buffer );
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
298 if( asf_http_parse_response(http_hdr)<0 ) {
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
299 printf("Failed to parse header\n");
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
300 http_free( http_hdr );
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
301 return -1;
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
302 }
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
303 switch( streaming_type ) {
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
304 case ASF_Live_e:
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
305 case ASF_Prerecorded_e:
2489
0ecc1b4f7cf8 Added ASF http server streaming (Not mms streaming).
bertrand
parents: 2310
diff changeset
306 case ASF_PlainText_e:
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
307 if( http_hdr->body_size>0 ) {
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
308 if( streaming_bufferize( stream->streaming_ctrl, http_hdr->body, http_hdr->body_size )<0 ) {
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
309 http_free( http_hdr );
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
310 return -1;
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
311 }
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
312 }
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
313 break;
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
314 case ASF_Redirector_e:
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
315 url_next = asf_http_ASX_redirect( http_hdr );
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
316 if( url_next==NULL ) {
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
317 printf("Failed to parse ASX file\n");
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
318 close(fd);
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
319 http_free( http_hdr );
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
320 return -1;
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
321 }
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
322 if( url_next->port==0 ) url_next->port=80;
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
323 url_free( stream->streaming_ctrl->url );
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
324 stream->streaming_ctrl->url = url_next;
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
325 url = url_next;
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
326 done = 0;
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
327 break;
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
328 case ASF_Unknown_e:
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
329 default:
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
330 printf("Unknown ASF streaming type\n");
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
331 close(fd);
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
332 http_free( http_hdr );
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
333 return -1;
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
334 }
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
335
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
336 // Check if we got a redirect.
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
337 } while(!done);
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
338
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
339 stream->fd= fd;
2489
0ecc1b4f7cf8 Added ASF http server streaming (Not mms streaming).
bertrand
parents: 2310
diff changeset
340 if( streaming_type==ASF_PlainText_e ) {
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
341 stream->streaming_ctrl->streaming_read = nop_streaming_read;
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
342 stream->streaming_ctrl->streaming_seek = nop_streaming_seek;
2489
0ecc1b4f7cf8 Added ASF http server streaming (Not mms streaming).
bertrand
parents: 2310
diff changeset
343 } else {
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
344 stream->streaming_ctrl->streaming_read = asf_http_streaming_read;
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
345 stream->streaming_ctrl->streaming_seek = asf_http_streaming_seek;
2489
0ecc1b4f7cf8 Added ASF http server streaming (Not mms streaming).
bertrand
parents: 2310
diff changeset
346 }
3042
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
347 stream->streaming_ctrl->prebuffer_size = 20000;
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
348 stream->streaming_ctrl->buffering = 1;
6b6fa2be9b97 Removed my buffer hack to use cache2.
bertrand
parents: 2555
diff changeset
349 stream->streaming_ctrl->status = streaming_playing_e;
1001
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
350
876c3edc2fa9 Continue implementation of ASF streaming.
bertrand
parents: 905
diff changeset
351 http_free( http_hdr );
905
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
352 return fd;
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
353 }
4b6f81dbb2da Continue implementation.
bertrand
parents: 871
diff changeset
354