Mercurial > mplayer.hg
annotate stream/asf_mmst_streaming.c @ 19814:dd6a38fdbcc8
Marillat packages binary codecs, not bitmap fonts.
author | diego |
---|---|
date | Wed, 13 Sep 2006 10:46:33 +0000 |
parents | 2a9d669e5ff6 |
children | 9ffae26c0add |
rev | line source |
---|---|
6092 | 1 // mmst implementation taken from the xine-mms plugin made by majormms (http://geocities.com/majormms/) |
2 // | |
3 // ported to mplayer by Abhijeet Phatak <abhijeetphatak@yahoo.com> | |
4 // date : 16 April 2002 | |
5 // | |
6 // information about the mms protocol can be find at http://get.to/sdp | |
7 // | |
8 | |
9 | |
10 #include <stdio.h> | |
11 #include <stdlib.h> | |
12 #include <string.h> | |
13 #include <unistd.h> | |
14 #include <errno.h> | |
7880 | 15 #include <inttypes.h> |
6092 | 16 |
17 #include "config.h" | |
18 | |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
19 #include "mp_msg.h" |
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
20 #include "help_mp.h" |
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
21 |
10281 | 22 #ifndef HAVE_WINSOCK2 |
23 #define closesocket close | |
24 #else | |
25 #include <winsock2.h> | |
26 #endif | |
27 | |
13600
a0bb374553a1
typo noticed by Shixin Zeng <shixinzeng at sjtu dot edu dot cn>
diego
parents:
12968
diff
changeset
|
28 #ifndef USE_SETLOCALE |
12675
7c5dee73a7dc
disable iconv in case setlocale is disabled - compile fix
alex
parents:
12674
diff
changeset
|
29 #undef USE_ICONV |
7c5dee73a7dc
disable iconv in case setlocale is disabled - compile fix
alex
parents:
12674
diff
changeset
|
30 #endif |
7c5dee73a7dc
disable iconv in case setlocale is disabled - compile fix
alex
parents:
12674
diff
changeset
|
31 |
11350
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
32 #ifdef USE_ICONV |
12674
0392f36045f4
user nl_langinfo if langinfo support present for proper chinese support, feature requested by Shixin Zheng <shixinzheng@sjtu.edu.cn>
alex
parents:
12545
diff
changeset
|
33 #include <iconv.h> |
0392f36045f4
user nl_langinfo if langinfo support present for proper chinese support, feature requested by Shixin Zheng <shixinzheng@sjtu.edu.cn>
alex
parents:
12545
diff
changeset
|
34 #ifdef USE_LANGINFO |
0392f36045f4
user nl_langinfo if langinfo support present for proper chinese support, feature requested by Shixin Zheng <shixinzheng@sjtu.edu.cn>
alex
parents:
12545
diff
changeset
|
35 #include <langinfo.h> |
0392f36045f4
user nl_langinfo if langinfo support present for proper chinese support, feature requested by Shixin Zheng <shixinzheng@sjtu.edu.cn>
alex
parents:
12545
diff
changeset
|
36 #endif |
11350
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
37 #endif |
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
38 |
6092 | 39 #include "url.h" |
19312
ab8d6b6deb63
proper inclusion of demuxer.h (including libmpdemux in Makefile only was to make previous split easier)
ben
parents:
19271
diff
changeset
|
40 #include "libmpdemux/asf.h" |
6092 | 41 |
42 #include "stream.h" | |
43 | |
44 #include "network.h" | |
19335
2a9d669e5ff6
isolated tcp socket code from network.c to a dedicated file
ben
parents:
19312
diff
changeset
|
45 #include "tcp.h" |
6092 | 46 |
47 #define BUF_SIZE 102400 | |
14163
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
48 #define HDR_BUF_SIZE 8192 |
15181
ed74657f25b1
Use define instead of hardcodec value for max streams number
rtognimp
parents:
15173
diff
changeset
|
49 #define MAX_STREAMS 20 |
6092 | 50 |
51 typedef struct | |
52 { | |
53 uint8_t buf[BUF_SIZE]; | |
54 int num_bytes; | |
55 | |
56 } command_t; | |
57 | |
7880 | 58 static int seq_num; |
59 static int num_stream_ids; | |
15181
ed74657f25b1
Use define instead of hardcodec value for max streams number
rtognimp
parents:
15173
diff
changeset
|
60 static int stream_ids[MAX_STREAMS]; |
6092 | 61 |
62 static int get_data (int s, char *buf, size_t count); | |
63 | |
64 static void put_32 (command_t *cmd, uint32_t value) | |
65 { | |
66 cmd->buf[cmd->num_bytes ] = value % 256; | |
67 value = value >> 8; | |
68 cmd->buf[cmd->num_bytes+1] = value % 256 ; | |
69 value = value >> 8; | |
70 cmd->buf[cmd->num_bytes+2] = value % 256 ; | |
71 value = value >> 8; | |
72 cmd->buf[cmd->num_bytes+3] = value % 256 ; | |
73 | |
74 cmd->num_bytes += 4; | |
75 } | |
76 | |
77 static uint32_t get_32 (unsigned char *cmd, int offset) | |
78 { | |
79 uint32_t ret; | |
80 | |
81 ret = cmd[offset] ; | |
82 ret |= cmd[offset+1]<<8 ; | |
83 ret |= cmd[offset+2]<<16 ; | |
84 ret |= cmd[offset+3]<<24 ; | |
85 | |
86 return ret; | |
87 } | |
88 | |
89 static void send_command (int s, int command, uint32_t switches, | |
90 uint32_t extra, int length, | |
91 char *data) | |
92 { | |
93 command_t cmd; | |
94 int len8; | |
95 | |
11225
48bb1fd37d2a
Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents:
10625
diff
changeset
|
96 len8 = (length + 7) / 8; |
6092 | 97 |
98 cmd.num_bytes = 0; | |
99 | |
100 put_32 (&cmd, 0x00000001); /* start sequence */ | |
101 put_32 (&cmd, 0xB00BFACE); /* #-)) */ | |
11225
48bb1fd37d2a
Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents:
10625
diff
changeset
|
102 put_32 (&cmd, len8*8 + 32); |
6092 | 103 put_32 (&cmd, 0x20534d4d); /* protocol type "MMS " */ |
104 put_32 (&cmd, len8 + 4); | |
105 put_32 (&cmd, seq_num); | |
106 seq_num++; | |
107 put_32 (&cmd, 0x0); /* unknown */ | |
108 put_32 (&cmd, 0x0); | |
109 put_32 (&cmd, len8+2); | |
110 put_32 (&cmd, 0x00030000 | command); /* dir | command */ | |
111 put_32 (&cmd, switches); | |
112 put_32 (&cmd, extra); | |
113 | |
114 memcpy (&cmd.buf[48], data, length); | |
11225
48bb1fd37d2a
Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents:
10625
diff
changeset
|
115 if (length & 7) |
48bb1fd37d2a
Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents:
10625
diff
changeset
|
116 memset(&cmd.buf[48 + length], 0, 8 - (length & 7)); |
6092 | 117 |
11225
48bb1fd37d2a
Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents:
10625
diff
changeset
|
118 if (send (s, cmd.buf, len8*8+48, 0) != (len8*8+48)) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
119 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_WriteError); |
6092 | 120 } |
121 } | |
122 | |
11350
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
123 #ifdef USE_ICONV |
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
124 static iconv_t url_conv; |
11403
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
125 #endif |
11350
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
126 |
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
127 static void string_utf16(char *dest, char *src, int len) { |
11403
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
128 int i; |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
129 #ifdef USE_ICONV |
11350
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
130 size_t len1, len2; |
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
131 char *ip, *op; |
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
132 |
11412 | 133 if (url_conv != (iconv_t)(-1)) |
11403
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
134 { |
11350
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
135 memset(dest, 0, 1000); |
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
136 len1 = len; len2 = 1000; |
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
137 ip = src; op = dest; |
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
138 |
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
139 iconv(url_conv, &ip, &len1, &op, &len2); |
11403
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
140 } |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
141 else |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
142 { |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
143 #endif |
15150
38ec64821910
Make string_utf16 code behave almost the same with or without iconv
rtognimp
parents:
14542
diff
changeset
|
144 if (len > 499) len = 499; |
11403
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
145 for (i=0; i<len; i++) { |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
146 dest[i*2] = src[i]; |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
147 dest[i*2+1] = 0; |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
148 } |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
149 /* trailing zeroes */ |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
150 dest[i*2] = 0; |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
151 dest[i*2+1] = 0; |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
152 #ifdef USE_ICONV |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
153 } |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
154 #endif |
11350
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
155 } |
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
156 |
6092 | 157 static void get_answer (int s) |
158 { | |
159 char data[BUF_SIZE]; | |
160 int command = 0x1b; | |
161 | |
162 while (command == 0x1b) { | |
163 int len; | |
164 | |
10206
35e306346e59
Using recv/send instead read/write for proper MinGW support (it's a 4.2BSD standard). Patch by FloDt <flodt8@yahoo.de>
alex
parents:
10183
diff
changeset
|
165 len = recv (s, data, BUF_SIZE, 0) ; |
6092 | 166 if (!len) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
167 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_EOFAlert); |
6092 | 168 return; |
169 } | |
170 | |
171 command = get_32 (data, 36) & 0xFFFF; | |
172 | |
173 if (command == 0x1b) | |
174 send_command (s, 0x1b, 0, 0, 0, data); | |
175 } | |
176 } | |
177 | |
178 static int get_data (int s, char *buf, size_t count) | |
179 { | |
7953 | 180 ssize_t len; |
181 size_t total = 0; | |
6092 | 182 |
183 while (total < count) { | |
184 | |
10206
35e306346e59
Using recv/send instead read/write for proper MinGW support (it's a 4.2BSD standard). Patch by FloDt <flodt8@yahoo.de>
alex
parents:
10183
diff
changeset
|
185 len = recv (s, &buf[total], count-total, 0); |
6092 | 186 |
12545 | 187 if (len<=0) { |
6092 | 188 perror ("read error:"); |
189 return 0; | |
190 } | |
191 | |
192 total += len; | |
193 | |
194 if (len != 0) { | |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
195 // mp_msg(MSGT_NETWORK,MSGL_INFO,"[%d/%d]", total, count); |
6092 | 196 fflush (stdout); |
197 } | |
198 | |
199 } | |
200 | |
201 return 1; | |
202 | |
203 } | |
204 | |
205 static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl) | |
206 { | |
207 unsigned char pre_header[8]; | |
7953 | 208 int header_len; |
6092 | 209 |
210 header_len = 0; | |
211 | |
212 while (1) { | |
213 if (!get_data (s, pre_header, 8)) { | |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
214 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_PreHeaderReadFailed); |
6092 | 215 return 0; |
216 } | |
217 if (pre_header[4] == 0x02) { | |
218 | |
219 int packet_len; | |
220 | |
221 packet_len = (pre_header[7] << 8 | pre_header[6]) - 8; | |
222 | |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
223 // mp_msg(MSGT_NETWORK,MSGL_INFO,"asf header packet detected, len=%d\n", packet_len); |
6092 | 224 |
14163
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
225 if (packet_len < 0 || packet_len > HDR_BUF_SIZE - header_len) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
226 mp_msg(MSGT_NETWORK, MSGL_FATAL, MSGTR_MPDEMUX_MMST_InvalidHeaderSize); |
14163
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
227 return 0; |
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
228 } |
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
229 |
6092 | 230 if (!get_data (s, &header[header_len], packet_len)) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
231 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_HeaderDataReadFailed); |
6092 | 232 return 0; |
233 } | |
234 | |
235 header_len += packet_len; | |
236 | |
237 if ( (header[header_len-1] == 1) && (header[header_len-2]==1)) { | |
238 | |
239 | |
240 if( streaming_bufferize( streaming_ctrl, header, header_len )<0 ) { | |
241 return -1; | |
242 } | |
243 | |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
244 // mp_msg(MSGT_NETWORK,MSGL_INFO,"get header packet finished\n"); |
6092 | 245 |
246 return (header_len); | |
247 | |
248 } | |
249 | |
250 } else { | |
251 | |
7953 | 252 int32_t packet_len; |
6092 | 253 int command; |
254 char data[BUF_SIZE]; | |
255 | |
7953 | 256 if (!get_data (s, (char*)&packet_len, 4)) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
257 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_packet_lenReadFailed); |
6092 | 258 return 0; |
259 } | |
260 | |
7953 | 261 packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4; |
6092 | 262 |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
263 // mp_msg(MSGT_NETWORK,MSGL_INFO,"command packet detected, len=%d\n", packet_len); |
14163
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
264 |
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
265 if (packet_len < 0 || packet_len > BUF_SIZE) { |
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
266 mp_msg(MSGT_NETWORK, MSGL_FATAL, |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
267 MSGTR_MPDEMUX_MMST_InvalidRTSPPacketSize); |
14163
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
268 return 0; |
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
269 } |
6092 | 270 |
271 if (!get_data (s, data, packet_len)) { | |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
272 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_CmdDataReadFailed); |
6092 | 273 return 0; |
274 } | |
275 | |
276 command = get_32 (data, 24) & 0xFFFF; | |
277 | |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
278 // mp_msg(MSGT_NETWORK,MSGL_INFO,"command: %02x\n", command); |
6092 | 279 |
280 if (command == 0x1b) | |
281 send_command (s, 0x1b, 0, 0, 0, data); | |
282 | |
283 } | |
284 | |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
285 // mp_msg(MSGT_NETWORK,MSGL_INFO,"get header packet succ\n"); |
6092 | 286 } |
287 } | |
288 | |
7880 | 289 static int interp_header (uint8_t *header, int header_len) |
6092 | 290 { |
291 int i; | |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7309
diff
changeset
|
292 int packet_length=-1; |
6092 | 293 |
294 /* | |
295 * parse header | |
296 */ | |
297 | |
298 i = 30; | |
299 while (i<header_len) { | |
300 | |
301 uint64_t guid_1, guid_2, length; | |
302 | |
303 guid_2 = (uint64_t)header[i] | ((uint64_t)header[i+1]<<8) | |
304 | ((uint64_t)header[i+2]<<16) | ((uint64_t)header[i+3]<<24) | |
305 | ((uint64_t)header[i+4]<<32) | ((uint64_t)header[i+5]<<40) | |
306 | ((uint64_t)header[i+6]<<48) | ((uint64_t)header[i+7]<<56); | |
307 i += 8; | |
308 | |
309 guid_1 = (uint64_t)header[i] | ((uint64_t)header[i+1]<<8) | |
310 | ((uint64_t)header[i+2]<<16) | ((uint64_t)header[i+3]<<24) | |
311 | ((uint64_t)header[i+4]<<32) | ((uint64_t)header[i+5]<<40) | |
312 | ((uint64_t)header[i+6]<<48) | ((uint64_t)header[i+7]<<56); | |
313 i += 8; | |
314 | |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
315 // mp_msg(MSGT_NETWORK,MSGL_INFO,"guid found: %016llx%016llx\n", guid_1, guid_2); |
6092 | 316 |
317 length = (uint64_t)header[i] | ((uint64_t)header[i+1]<<8) | |
318 | ((uint64_t)header[i+2]<<16) | ((uint64_t)header[i+3]<<24) | |
319 | ((uint64_t)header[i+4]<<32) | ((uint64_t)header[i+5]<<40) | |
320 | ((uint64_t)header[i+6]<<48) | ((uint64_t)header[i+7]<<56); | |
321 | |
322 i += 8; | |
323 | |
12121 | 324 if ( (guid_1 == 0x6cce6200aa00d9a6ULL) && (guid_2 == 0x11cf668e75b22630ULL) ) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
325 mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_HeaderObject); |
12121 | 326 } else if ((guid_1 == 0x6cce6200aa00d9a6ULL) && (guid_2 == 0x11cf668e75b22636ULL)) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
327 mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_DataObject); |
12121 | 328 } else if ((guid_1 == 0x6553200cc000e48eULL) && (guid_2 == 0x11cfa9478cabdca1ULL)) { |
6092 | 329 |
330 packet_length = get_32(header, i+92-24); | |
331 | |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
332 mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_FileObjectPacketLen, |
6092 | 333 packet_length, get_32(header, i+96-24)); |
334 | |
335 | |
12121 | 336 } else if ((guid_1 == 0x6553200cc000e68eULL) && (guid_2 == 0x11cfa9b7b7dc0791ULL)) { |
6092 | 337 |
338 int stream_id = header[i+48] | header[i+49] << 8; | |
339 | |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
340 mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_StreamObjectStreamID, stream_id); |
6092 | 341 |
15181
ed74657f25b1
Use define instead of hardcodec value for max streams number
rtognimp
parents:
15173
diff
changeset
|
342 if (num_stream_ids < MAX_STREAMS) { |
6092 | 343 stream_ids[num_stream_ids] = stream_id; |
344 num_stream_ids++; | |
15173
424386614ad5
Fix potential buffer overflow for urls with more than 20 streams
rtognimp
parents:
15150
diff
changeset
|
345 } else { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
346 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_2ManyStreamID); |
15173
424386614ad5
Fix potential buffer overflow for urls with more than 20 streams
rtognimp
parents:
15150
diff
changeset
|
347 } |
6092 | 348 |
349 } else { | |
15628 | 350 #if 0 |
351 int b = i; | |
352 printf ("unknown object (guid: %016llx, %016llx, len: %lld)\n", guid_1, guid_2, length); | |
353 for (; b < length; b++) | |
354 { | |
355 if (isascii(header[b]) || isalpha(header[b])) | |
356 printf("%c ", header[b]); | |
357 else | |
358 printf("%x ", header[b]); | |
359 } | |
360 printf("\n"); | |
361 #else | |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
362 mp_msg(MSGT_NETWORK,MSGL_WARN,MSGTR_MPDEMUX_MMST_UnknownObject); |
15628 | 363 #endif |
6092 | 364 } |
365 | |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
366 // mp_msg(MSGT_NETWORK,MSGL_INFO,"length : %lld\n", length); |
6092 | 367 |
368 i += length-24; | |
369 | |
370 } | |
371 | |
372 return packet_length; | |
373 | |
374 } | |
375 | |
376 | |
7880 | 377 static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl) { |
6092 | 378 unsigned char pre_header[8]; |
379 char data[BUF_SIZE]; | |
7880 | 380 |
381 if (!get_data (s, pre_header, 8)) { | |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
382 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_PreHeaderReadFailed); |
7880 | 383 return 0; |
384 } | |
385 | |
386 // for (i=0; i<8; i++) | |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
387 // mp_msg(MSGT_NETWORK,MSGL_INFO,"pre_header[%d] = %02x (%d)\n", |
7880 | 388 // i, pre_header[i], pre_header[i]); |
389 | |
390 if (pre_header[4] == 0x04) { | |
391 | |
392 int packet_len; | |
393 | |
394 packet_len = (pre_header[7] << 8 | pre_header[6]) - 8; | |
395 | |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
396 // mp_msg(MSGT_NETWORK,MSGL_INFO,"asf media packet detected, len=%d\n", packet_len); |
7880 | 397 |
14163
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
398 if (packet_len < 0 || packet_len > BUF_SIZE) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
399 mp_msg(MSGT_NETWORK, MSGL_FATAL, MSGTR_MPDEMUX_MMST_InvalidRTSPPacketSize); |
14163
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
400 return 0; |
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
401 } |
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
402 |
7880 | 403 if (!get_data (s, data, packet_len)) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
404 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_MediaDataReadFailed); |
7880 | 405 return 0; |
406 } | |
407 | |
408 streaming_bufferize(stream_ctrl, data, padding); | |
409 | |
410 } else { | |
411 | |
7953 | 412 int32_t packet_len; |
413 int command; | |
7880 | 414 |
7953 | 415 if (!get_data (s, (char*)&packet_len, 4)) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
416 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_packet_lenReadFailed); |
7880 | 417 return 0; |
418 } | |
419 | |
7953 | 420 packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4; |
7880 | 421 |
14163
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
422 if (packet_len < 0 || packet_len > BUF_SIZE) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
423 mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_MMST_InvalidRTSPPacketSize); |
14163
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
424 return 0; |
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
425 } |
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
426 |
7880 | 427 if (!get_data (s, data, packet_len)) { |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
428 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_CmdDataReadFailed); |
7880 | 429 return 0; |
430 } | |
431 | |
432 if ( (pre_header[7] != 0xb0) || (pre_header[6] != 0x0b) | |
433 || (pre_header[5] != 0xfa) || (pre_header[4] != 0xce) ) { | |
434 | |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
435 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_MissingSignature); |
7880 | 436 return -1; |
437 } | |
438 | |
439 command = get_32 (data, 24) & 0xFFFF; | |
440 | |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
441 // mp_msg(MSGT_NETWORK,MSGL_INFO,"\ncommand packet detected, len=%d cmd=0x%X\n", packet_len, command); |
7880 | 442 |
443 if (command == 0x1b) | |
444 send_command (s, 0x1b, 0, 0, 0, data); | |
445 else if (command == 0x1e) { | |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
446 mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_PatentedTechnologyJoke); |
7880 | 447 return 0; |
448 } | |
449 else if (command == 0x21 ) { | |
450 // Looks like it's new in WMS9 | |
451 // Unknown command, but ignoring it seems to work. | |
452 return 0; | |
453 } | |
454 else if (command != 0x05) { | |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
455 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_UnknownCmd,command); |
7880 | 456 return -1; |
457 } | |
458 } | |
459 | |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
460 // mp_msg(MSGT_NETWORK,MSGL_INFO,"get media packet succ\n"); |
7880 | 461 |
462 return 1; | |
463 } | |
6092 | 464 |
465 | |
7880 | 466 static int packet_length1; |
6092 | 467 |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
468 static int asf_mmst_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl ) |
6092 | 469 { |
7880 | 470 int len; |
471 | |
472 while( stream_ctrl->buffer_size==0 ) { | |
473 // buffer is empty - fill it! | |
474 int ret = get_media_packet( fd, packet_length1, stream_ctrl); | |
475 if( ret<0 ) { | |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
476 mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_GetMediaPacketErr,strerror(errno)); |
7880 | 477 return -1; |
12077 | 478 } else if (ret==0) //EOF? |
479 return ret; | |
7880 | 480 } |
481 | |
482 len = stream_ctrl->buffer_size-stream_ctrl->buffer_pos; | |
483 if(len>size) len=size; | |
6092 | 484 memcpy( buffer, (stream_ctrl->buffer)+(stream_ctrl->buffer_pos), len ); |
485 stream_ctrl->buffer_pos += len; | |
486 if( stream_ctrl->buffer_pos>=stream_ctrl->buffer_size ) { | |
487 free( stream_ctrl->buffer ); | |
488 stream_ctrl->buffer = NULL; | |
489 stream_ctrl->buffer_size = 0; | |
490 stream_ctrl->buffer_pos = 0; | |
491 } | |
7880 | 492 return len; |
6092 | 493 |
494 } | |
495 | |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
496 static int asf_mmst_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl ) |
6092 | 497 { |
498 return -1; | |
7953 | 499 // Shut up gcc warning |
500 fd++; | |
501 pos++; | |
502 streaming_ctrl=NULL; | |
6092 | 503 } |
504 | |
505 int asf_mmst_streaming_start(stream_t *stream) | |
506 { | |
507 char str[1024]; | |
10183 | 508 char data[BUF_SIZE]; |
14163
dd835e8f3698
fix a problem pointed out by iDEFENSE and several similar ones.
reimar
parents:
13600
diff
changeset
|
509 uint8_t asf_header[HDR_BUF_SIZE]; |
6092 | 510 int asf_header_len; |
511 int len, i, packet_length; | |
12751 | 512 char *path, *unescpath; |
6092 | 513 URL_t *url1 = stream->streaming_ctrl->url; |
7953 | 514 int s = stream->fd; |
6092 | 515 |
7250
27a1315d6af4
Checked if the connection succeeded before writing in the socket.
bertrand
parents:
6092
diff
changeset
|
516 if( s>0 ) { |
10281 | 517 closesocket( stream->fd ); |
7250
27a1315d6af4
Checked if the connection succeeded before writing in the socket.
bertrand
parents:
6092
diff
changeset
|
518 stream->fd = -1; |
27a1315d6af4
Checked if the connection succeeded before writing in the socket.
bertrand
parents:
6092
diff
changeset
|
519 } |
27a1315d6af4
Checked if the connection succeeded before writing in the socket.
bertrand
parents:
6092
diff
changeset
|
520 |
6092 | 521 /* parse url */ |
522 path = strchr(url1->file,'/') + 1; | |
523 | |
12751 | 524 /* mmst filename are not url_escaped by MS MediaPlayer and are expected as |
525 * "plain text" by the server, so need to decode it here | |
526 */ | |
527 unescpath=malloc(strlen(path)+1); | |
528 if (!unescpath) { | |
16906
75ccba4bd84b
Changed MSGTR_MPDEMUX_MMST_MallocFailed to MSGTR_MemAllocFailed (msg defined two times inhelp_mp-en.h)
ptt
parents:
16882
diff
changeset
|
529 mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed); |
12751 | 530 return -1; |
531 } | |
532 url_unescape_string(unescpath,path); | |
533 path=unescpath; | |
534 | |
535 | |
12968 | 536 if( url1->port==0 ) { |
537 url1->port=1755; | |
538 } | |
10625
620cc649f519
ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents:
10281
diff
changeset
|
539 s = connect2Server( url1->hostname, url1->port, 1); |
7250
27a1315d6af4
Checked if the connection succeeded before writing in the socket.
bertrand
parents:
6092
diff
changeset
|
540 if( s<0 ) { |
12751 | 541 free(path); |
7250
27a1315d6af4
Checked if the connection succeeded before writing in the socket.
bertrand
parents:
6092
diff
changeset
|
542 return s; |
27a1315d6af4
Checked if the connection succeeded before writing in the socket.
bertrand
parents:
6092
diff
changeset
|
543 } |
16882
dfbe8cd0e081
libmpdemux translatables to help_mp part 1 / mp_msg calls / try 2
reynaldo
parents:
16330
diff
changeset
|
544 mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_Connected); |
7880 | 545 |
546 seq_num=0; | |
6092 | 547 |
548 /* | |
549 * Send the initial connect info including player version no. Client GUID (random) and the host address being connected to. | |
550 * This command is sent at the very start of protocol initiation. It sends local information to the serve | |
551 * cmd 1 0x01 | |
552 * */ | |
553 | |
11350
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
554 /* prepare for the url encoding conversion */ |
11403
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
555 #ifdef USE_ICONV |
12674
0392f36045f4
user nl_langinfo if langinfo support present for proper chinese support, feature requested by Shixin Zheng <shixinzheng@sjtu.edu.cn>
alex
parents:
12545
diff
changeset
|
556 #ifdef USE_LANGINFO |
0392f36045f4
user nl_langinfo if langinfo support present for proper chinese support, feature requested by Shixin Zheng <shixinzheng@sjtu.edu.cn>
alex
parents:
12545
diff
changeset
|
557 url_conv = iconv_open("UTF-16LE",nl_langinfo(CODESET)); |
0392f36045f4
user nl_langinfo if langinfo support present for proper chinese support, feature requested by Shixin Zheng <shixinzheng@sjtu.edu.cn>
alex
parents:
12545
diff
changeset
|
558 #else |
14542
4a6b79a1ad52
remove all setlocale calls, they break the behaviour of sscanf and
reimar
parents:
14163
diff
changeset
|
559 url_conv = iconv_open("UTF-16LE", NULL); |
11403
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
560 #endif |
12674
0392f36045f4
user nl_langinfo if langinfo support present for proper chinese support, feature requested by Shixin Zheng <shixinzheng@sjtu.edu.cn>
alex
parents:
12545
diff
changeset
|
561 #endif |
11350
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
562 |
10183 | 563 snprintf (str, 1023, "\034\003NSPlayer/7.0.0.1956; {33715801-BAB3-9D85-24E9-03B90328270A}; Host: %s", url1->hostname); |
11225
48bb1fd37d2a
Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents:
10625
diff
changeset
|
564 string_utf16 (data, str, strlen(str)); |
6092 | 565 // send_command(s, commandno ....) |
11225
48bb1fd37d2a
Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents:
10625
diff
changeset
|
566 send_command (s, 1, 0, 0x0004000b, strlen(str)*2+2, data); |
6092 | 567 |
10206
35e306346e59
Using recv/send instead read/write for proper MinGW support (it's a 4.2BSD standard). Patch by FloDt <flodt8@yahoo.de>
alex
parents:
10183
diff
changeset
|
568 len = recv (s, data, BUF_SIZE, 0) ; |
6092 | 569 |
570 /*This sends details of the local machine IP address to a Funnel system at the server. | |
571 * Also, the TCP or UDP transport selection is sent. | |
572 * | |
11225
48bb1fd37d2a
Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents:
10625
diff
changeset
|
573 * here 192.168.0.1 is local ip address TCP/UDP states the tronsport we r using |
6092 | 574 * and 1037 is the local TCP or UDP socket number |
575 * cmd 2 0x02 | |
576 * */ | |
577 | |
11225
48bb1fd37d2a
Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents:
10625
diff
changeset
|
578 string_utf16 (&data[8], "\002\000\\\\192.168.0.1\\TCP\\1037", 24); |
6092 | 579 memset (data, 0, 8); |
11225
48bb1fd37d2a
Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents:
10625
diff
changeset
|
580 send_command (s, 2, 0, 0, 24*2+10, data); |
6092 | 581 |
10206
35e306346e59
Using recv/send instead read/write for proper MinGW support (it's a 4.2BSD standard). Patch by FloDt <flodt8@yahoo.de>
alex
parents:
10183
diff
changeset
|
582 len = recv (s, data, BUF_SIZE, 0) ; |
6092 | 583 |
584 /* This command sends file path (at server) and file name request to the server. | |
585 * 0x5 */ | |
586 | |
587 string_utf16 (&data[8], path, strlen(path)); | |
588 memset (data, 0, 8); | |
11225
48bb1fd37d2a
Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents:
10625
diff
changeset
|
589 send_command (s, 5, 0, 0, strlen(path)*2+10, data); |
12751 | 590 free(path); |
6092 | 591 |
592 get_answer (s); | |
593 | |
594 /* The ASF header chunk request. Includes ?session' variable for pre header value. | |
595 * After this command is sent, | |
596 * the server replies with 0x11 command and then the header chunk with header data follows. | |
597 * 0x15 */ | |
598 | |
599 memset (data, 0, 40); | |
600 data[32] = 2; | |
601 | |
602 send_command (s, 0x15, 1, 0, 40, data); | |
603 | |
604 num_stream_ids = 0; | |
605 /* get_headers(s, asf_header); */ | |
606 | |
607 asf_header_len = get_header (s, asf_header, stream->streaming_ctrl); | |
15626
941b1a71351f
printf converted to mp_msg; made static many unnecessarily global symbols
nicodvb
parents:
15181
diff
changeset
|
608 // mp_msg(MSGT_NETWORK,MSGL_INFO,"---------------------------------- asf_header %d\n",asf_header); |
12545 | 609 if (asf_header_len==0) return -1; //error reading header |
6092 | 610 packet_length = interp_header (asf_header, asf_header_len); |
611 | |
612 | |
613 /* | |
614 * This command is the media stream MBR selector. Switches are always 6 bytes in length. | |
615 * After all switch elements, data ends with bytes [00 00] 00 20 ac 40 [02]. | |
616 * Where: | |
617 * [00 00] shows 0x61 0x00 (on the first 33 sent) or 0xff 0xff for ASF files, and with no ending data for WMV files. | |
618 * It is not yet understood what all this means. | |
619 * And the last [02] byte is probably the header ?session' value. | |
620 * | |
621 * 0x33 */ | |
622 | |
623 memset (data, 0, 40); | |
624 | |
625 for (i=1; i<num_stream_ids; i++) { | |
626 data [ (i-1) * 6 + 2 ] = 0xFF; | |
627 data [ (i-1) * 6 + 3 ] = 0xFF; | |
628 data [ (i-1) * 6 + 4 ] = stream_ids[i]; | |
629 data [ (i-1) * 6 + 5 ] = 0x00; | |
630 } | |
631 | |
632 send_command (s, 0x33, num_stream_ids, 0xFFFF | stream_ids[0] << 16, (num_stream_ids-1)*6+2 , data); | |
633 | |
634 get_answer (s); | |
635 | |
636 /* Start sending file from packet xx. | |
637 * This command is also used for resume downloads or requesting a lost packet. | |
638 * Also used for seeking by sending a play point value which seeks to the media time point. | |
639 * Includes ?session' value in pre header and the maximum media stream time. | |
640 * 0x07 */ | |
641 | |
642 memset (data, 0, 40); | |
643 | |
644 for (i=8; i<16; i++) | |
645 data[i] = 0xFF; | |
646 | |
647 data[20] = 0x04; | |
648 | |
649 send_command (s, 0x07, 1, 0xFFFF | stream_ids[0] << 16, 24, data); | |
650 | |
7880 | 651 stream->fd = s; |
652 stream->streaming_ctrl->streaming_read = asf_mmst_streaming_read; | |
653 stream->streaming_ctrl->streaming_seek = asf_mmst_streaming_seek; | |
654 stream->streaming_ctrl->buffering = 1; | |
655 stream->streaming_ctrl->status = streaming_playing_e; | |
6092 | 656 |
7880 | 657 packet_length1 = packet_length; |
16930 | 658 mp_msg(MSGT_NETWORK,MSGL_INFO,"mmst packet_length = %d\n", packet_length); |
6092 | 659 |
11403
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
660 #ifdef USE_ICONV |
11412 | 661 if (url_conv != (iconv_t)(-1)) |
11403
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
662 iconv_close(url_conv); |
86ab7e0b2a65
fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents:
11402
diff
changeset
|
663 #endif |
11350
007ec48cf146
Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents:
11226
diff
changeset
|
664 |
6092 | 665 return 0; |
666 } |