annotate libmpdemux/asf_mmst_streaming.c @ 12670:aebedab0ecac

top/bottom mb row skipping
author michael
date Sat, 26 Jun 2004 02:23:51 +0000
parents 868376f81c30
children 0392f36045f4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
1 // mmst implementation taken from the xine-mms plugin made by majormms (http://geocities.com/majormms/)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
2 //
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
3 // ported to mplayer by Abhijeet Phatak <abhijeetphatak@yahoo.com>
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
4 // date : 16 April 2002
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
5 //
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
6 // information about the mms protocol can be find at http://get.to/sdp
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
7 //
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
8
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
9
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
10 #include <stdio.h>
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
11 #include <stdlib.h>
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
12 #include <string.h>
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
13 #include <unistd.h>
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
14 #include <errno.h>
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
15 #include <inttypes.h>
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
16
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
17 #include "config.h"
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
18
10281
54bcbf28698a Networking support under MinGW.
diego
parents: 10206
diff changeset
19 #ifndef HAVE_WINSOCK2
54bcbf28698a Networking support under MinGW.
diego
parents: 10206
diff changeset
20 #define closesocket close
54bcbf28698a Networking support under MinGW.
diego
parents: 10206
diff changeset
21 #else
54bcbf28698a Networking support under MinGW.
diego
parents: 10206
diff changeset
22 #include <winsock2.h>
54bcbf28698a Networking support under MinGW.
diego
parents: 10206
diff changeset
23 #endif
54bcbf28698a Networking support under MinGW.
diego
parents: 10206
diff changeset
24
11350
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
25 #ifdef USE_ICONV
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
26 #include <locale.h>
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
27 #include <iconv.h>
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
28 #endif
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
29
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
30 #include "url.h"
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
31 #include "asf.h"
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
32
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
33 #include "stream.h"
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
34
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
35 #include "network.h"
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
36
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
37 #define BUF_SIZE 102400
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
38
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
39 typedef struct
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
40 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
41 uint8_t buf[BUF_SIZE];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
42 int num_bytes;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
43
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
44 } command_t;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
45
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
46 static int seq_num;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
47 static int num_stream_ids;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
48 static int stream_ids[20];
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
49
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
50 static int get_data (int s, char *buf, size_t count);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
51
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
52 static void put_32 (command_t *cmd, uint32_t value)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
53 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
54 cmd->buf[cmd->num_bytes ] = value % 256;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
55 value = value >> 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
56 cmd->buf[cmd->num_bytes+1] = value % 256 ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
57 value = value >> 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
58 cmd->buf[cmd->num_bytes+2] = value % 256 ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
59 value = value >> 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
60 cmd->buf[cmd->num_bytes+3] = value % 256 ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
61
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
62 cmd->num_bytes += 4;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
63 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
64
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
65 static uint32_t get_32 (unsigned char *cmd, int offset)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
66 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
67 uint32_t ret;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
68
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
69 ret = cmd[offset] ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
70 ret |= cmd[offset+1]<<8 ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
71 ret |= cmd[offset+2]<<16 ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
72 ret |= cmd[offset+3]<<24 ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
73
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
74 return ret;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
75 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
76
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
77 static void send_command (int s, int command, uint32_t switches,
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
78 uint32_t extra, int length,
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
79 char *data)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
80 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
81 command_t cmd;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
82 int len8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
83
11225
48bb1fd37d2a Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents: 10625
diff changeset
84 len8 = (length + 7) / 8;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
85
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
86 cmd.num_bytes = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
87
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
88 put_32 (&cmd, 0x00000001); /* start sequence */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
89 put_32 (&cmd, 0xB00BFACE); /* #-)) */
11225
48bb1fd37d2a Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents: 10625
diff changeset
90 put_32 (&cmd, len8*8 + 32);
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
91 put_32 (&cmd, 0x20534d4d); /* protocol type "MMS " */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
92 put_32 (&cmd, len8 + 4);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
93 put_32 (&cmd, seq_num);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
94 seq_num++;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
95 put_32 (&cmd, 0x0); /* unknown */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
96 put_32 (&cmd, 0x0);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
97 put_32 (&cmd, len8+2);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
98 put_32 (&cmd, 0x00030000 | command); /* dir | command */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
99 put_32 (&cmd, switches);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
100 put_32 (&cmd, extra);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
101
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
102 memcpy (&cmd.buf[48], data, length);
11225
48bb1fd37d2a Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents: 10625
diff changeset
103 if (length & 7)
48bb1fd37d2a Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents: 10625
diff changeset
104 memset(&cmd.buf[48 + length], 0, 8 - (length & 7));
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
105
11225
48bb1fd37d2a Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents: 10625
diff changeset
106 if (send (s, cmd.buf, len8*8+48, 0) != (len8*8+48)) {
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
107 printf ("write error\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
108 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
109 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
110
11350
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
111 #ifdef USE_ICONV
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
112 static iconv_t url_conv;
11403
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
113 #endif
11350
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
114
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
115 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
116 int i;
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
117 #ifdef USE_ICONV
11350
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
118 size_t len1, len2;
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
119 char *ip, *op;
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
120
11412
ec3dac7d17a0 Warning fixes (approved by A'rpi).
rathann
parents: 11403
diff changeset
121 if (url_conv != (iconv_t)(-1))
11403
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
122 {
11350
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
123 memset(dest, 0, 1000);
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
124 len1 = len; len2 = 1000;
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
125 ip = src; op = dest;
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 iconv(url_conv, &ip, &len1, &op, &len2);
11403
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
128 }
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
129 else
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
130 {
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
131 #endif
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
132 for (i=0; i<len; i++) {
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
133 dest[i*2] = src[i];
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
134 dest[i*2+1] = 0;
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
135 }
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
136 /* trailing zeroes */
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
137 dest[i*2] = 0;
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
138 dest[i*2+1] = 0;
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
139 #ifdef USE_ICONV
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 #endif
11350
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
142 }
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
143
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
144 static void get_answer (int s)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
145 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
146 char data[BUF_SIZE];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
147 int command = 0x1b;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
148
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
149 while (command == 0x1b) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
150 int len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
151
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
152 len = recv (s, data, BUF_SIZE, 0) ;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
153 if (!len) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
154 printf ("\nalert! eof\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
155 return;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
156 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
157
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
158 command = get_32 (data, 36) & 0xFFFF;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
159
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
160 if (command == 0x1b)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
161 send_command (s, 0x1b, 0, 0, 0, data);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
162 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
163 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
164
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
165 static int get_data (int s, char *buf, size_t count)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
166 {
7953
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
167 ssize_t len;
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
168 size_t total = 0;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
169
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
170 while (total < count) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
171
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
172 len = recv (s, &buf[total], count-total, 0);
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
173
12545
868376f81c30 Fix hang on broken mmst streams
rtognimp
parents: 12121
diff changeset
174 if (len<=0) {
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
175 perror ("read error:");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
176 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
177 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
178
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
179 total += len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
180
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
181 if (len != 0) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
182 // printf ("[%d/%d]", total, count);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
183 fflush (stdout);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
184 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
185
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
186 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
187
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
188 return 1;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
189
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
190 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
191
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
192 static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
193 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
194 unsigned char pre_header[8];
7953
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
195 int header_len;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
196
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
197 header_len = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
198
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
199 while (1) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
200 if (!get_data (s, pre_header, 8)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
201 printf ("pre-header read failed\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
202 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
203 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
204 if (pre_header[4] == 0x02) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
205
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
206 int packet_len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
207
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
208 packet_len = (pre_header[7] << 8 | pre_header[6]) - 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
209
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
210 // printf ("asf header packet detected, len=%d\n", packet_len);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
211
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
212 if (!get_data (s, &header[header_len], packet_len)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
213 printf ("header data read failed\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
214 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
215 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
216
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
217 header_len += packet_len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
218
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
219 if ( (header[header_len-1] == 1) && (header[header_len-2]==1)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
220
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
221
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
222 if( streaming_bufferize( streaming_ctrl, header, header_len )<0 ) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
223 return -1;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
224 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
225
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
226 // printf ("get header packet finished\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
227
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
228 return (header_len);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
229
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
230 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
231
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
232 } else {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
233
7953
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
234 int32_t packet_len;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
235 int command;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
236 char data[BUF_SIZE];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
237
7953
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
238 if (!get_data (s, (char*)&packet_len, 4)) {
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
239 printf ("packet_len read failed\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
240 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
241 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
242
7953
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
243 packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
244
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
245 // printf ("command packet detected, len=%d\n", packet_len);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
246
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
247 if (!get_data (s, data, packet_len)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
248 printf ("command data read failed\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
249 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
250 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
251
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
252 command = get_32 (data, 24) & 0xFFFF;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
253
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
254 // printf ("command: %02x\n", command);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
255
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
256 if (command == 0x1b)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
257 send_command (s, 0x1b, 0, 0, 0, data);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
258
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
259 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
260
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
261 // printf ("get header packet succ\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
262 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
263 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
264
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
265 static int interp_header (uint8_t *header, int header_len)
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
266 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
267 int i;
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7309
diff changeset
268 int packet_length=-1;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
269
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
270 /*
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
271 * parse header
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
272 */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
273
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
274 i = 30;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
275 while (i<header_len) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
276
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
277 uint64_t guid_1, guid_2, length;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
278
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
279 guid_2 = (uint64_t)header[i] | ((uint64_t)header[i+1]<<8)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
280 | ((uint64_t)header[i+2]<<16) | ((uint64_t)header[i+3]<<24)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
281 | ((uint64_t)header[i+4]<<32) | ((uint64_t)header[i+5]<<40)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
282 | ((uint64_t)header[i+6]<<48) | ((uint64_t)header[i+7]<<56);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
283 i += 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
284
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
285 guid_1 = (uint64_t)header[i] | ((uint64_t)header[i+1]<<8)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
286 | ((uint64_t)header[i+2]<<16) | ((uint64_t)header[i+3]<<24)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
287 | ((uint64_t)header[i+4]<<32) | ((uint64_t)header[i+5]<<40)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
288 | ((uint64_t)header[i+6]<<48) | ((uint64_t)header[i+7]<<56);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
289 i += 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
290
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
291 // printf ("guid found: %016llx%016llx\n", guid_1, guid_2);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
292
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
293 length = (uint64_t)header[i] | ((uint64_t)header[i+1]<<8)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
294 | ((uint64_t)header[i+2]<<16) | ((uint64_t)header[i+3]<<24)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
295 | ((uint64_t)header[i+4]<<32) | ((uint64_t)header[i+5]<<40)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
296 | ((uint64_t)header[i+6]<<48) | ((uint64_t)header[i+7]<<56);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
297
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
298 i += 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
299
12121
6d4212840048 make gcc eating this under hurd
alex
parents: 12077
diff changeset
300 if ( (guid_1 == 0x6cce6200aa00d9a6ULL) && (guid_2 == 0x11cf668e75b22630ULL) ) {
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
301 printf ("header object\n");
12121
6d4212840048 make gcc eating this under hurd
alex
parents: 12077
diff changeset
302 } else if ((guid_1 == 0x6cce6200aa00d9a6ULL) && (guid_2 == 0x11cf668e75b22636ULL)) {
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
303 printf ("data object\n");
12121
6d4212840048 make gcc eating this under hurd
alex
parents: 12077
diff changeset
304 } else if ((guid_1 == 0x6553200cc000e48eULL) && (guid_2 == 0x11cfa9478cabdca1ULL)) {
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
305
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
306 packet_length = get_32(header, i+92-24);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
307
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
308 printf ("file object, packet length = %d (%d)\n",
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
309 packet_length, get_32(header, i+96-24));
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
310
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
311
12121
6d4212840048 make gcc eating this under hurd
alex
parents: 12077
diff changeset
312 } else if ((guid_1 == 0x6553200cc000e68eULL) && (guid_2 == 0x11cfa9b7b7dc0791ULL)) {
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
313
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
314 int stream_id = header[i+48] | header[i+49] << 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
315
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
316 printf ("stream object, stream id: %d\n", stream_id);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
317
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
318 stream_ids[num_stream_ids] = stream_id;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
319 num_stream_ids++;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
320
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
321 } else {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
322 printf ("unknown object\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
323 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
324
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
325 // printf ("length : %lld\n", length);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
326
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
327 i += length-24;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
328
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
329 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
330
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
331 return packet_length;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
332
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
333 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
334
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
335
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
336 static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl) {
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
337 unsigned char pre_header[8];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
338 char data[BUF_SIZE];
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
339
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
340 if (!get_data (s, pre_header, 8)) {
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
341 printf ("pre-header read failed\n");
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
342 return 0;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
343 }
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
344
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
345 // for (i=0; i<8; i++)
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
346 // printf ("pre_header[%d] = %02x (%d)\n",
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
347 // i, pre_header[i], pre_header[i]);
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
348
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
349 if (pre_header[4] == 0x04) {
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
350
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
351 int packet_len;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
352
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
353 packet_len = (pre_header[7] << 8 | pre_header[6]) - 8;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
354
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
355 // printf ("asf media packet detected, len=%d\n", packet_len);
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
356
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
357 if (!get_data (s, data, packet_len)) {
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
358 printf ("media data read failed\n");
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
359 return 0;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
360 }
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
361
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
362 streaming_bufferize(stream_ctrl, data, padding);
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
363
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
364 } else {
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
365
7953
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
366 int32_t packet_len;
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
367 int command;
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
368
7953
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
369 if (!get_data (s, (char*)&packet_len, 4)) {
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
370 printf ("packet_len read failed\n");
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
371 return 0;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
372 }
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
373
7953
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
374 packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4;
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
375
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
376 if (!get_data (s, data, packet_len)) {
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
377 printf ("command data read failed\n");
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
378 return 0;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
379 }
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
380
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
381 if ( (pre_header[7] != 0xb0) || (pre_header[6] != 0x0b)
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
382 || (pre_header[5] != 0xfa) || (pre_header[4] != 0xce) ) {
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
383
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
384 printf ("missing signature\n");
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
385 return -1;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
386 }
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
387
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
388 command = get_32 (data, 24) & 0xFFFF;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
389
7977
0c660f21e0e4 debug printf
arpi
parents: 7953
diff changeset
390 // printf ("\ncommand packet detected, len=%d cmd=0x%X\n", packet_len, command);
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
391
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
392 if (command == 0x1b)
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
393 send_command (s, 0x1b, 0, 0, 0, data);
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
394 else if (command == 0x1e) {
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
395 printf ("everything done. Thank you for downloading a media file containing proprietary and patentend technology.\n");
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
396 return 0;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
397 }
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
398 else if (command == 0x21 ) {
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
399 // Looks like it's new in WMS9
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
400 // Unknown command, but ignoring it seems to work.
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
401 return 0;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
402 }
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
403 else if (command != 0x05) {
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
404 printf ("unknown command %02x\n", command);
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
405 return -1;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
406 }
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
407 }
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
408
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
409 // printf ("get media packet succ\n");
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
410
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
411 return 1;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
412 }
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
413
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
414
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
415 static int packet_length1;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
416
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
417 int
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
418 asf_mmst_streaming_read( int fd, char *buffer, int size, streaming_ctrl_t *stream_ctrl )
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
419 {
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
420 int len;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
421
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
422 while( stream_ctrl->buffer_size==0 ) {
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
423 // buffer is empty - fill it!
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
424 int ret = get_media_packet( fd, packet_length1, stream_ctrl);
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
425 if( ret<0 ) {
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
426 printf("get_media_packet error : %s\n",strerror(errno));
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
427 return -1;
12077
e200b0e11e9c Fix hanging at end of mms:// streams.
rtognimp
parents: 11412
diff changeset
428 } else if (ret==0) //EOF?
e200b0e11e9c Fix hanging at end of mms:// streams.
rtognimp
parents: 11412
diff changeset
429 return ret;
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
430 }
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
431
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
432 len = stream_ctrl->buffer_size-stream_ctrl->buffer_pos;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
433 if(len>size) len=size;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
434 memcpy( buffer, (stream_ctrl->buffer)+(stream_ctrl->buffer_pos), len );
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
435 stream_ctrl->buffer_pos += len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
436 if( stream_ctrl->buffer_pos>=stream_ctrl->buffer_size ) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
437 free( stream_ctrl->buffer );
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
438 stream_ctrl->buffer = NULL;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
439 stream_ctrl->buffer_size = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
440 stream_ctrl->buffer_pos = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
441 }
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
442 return len;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
443
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
444 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
445
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
446 int
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
447 asf_mmst_streaming_seek( int fd, off_t pos, streaming_ctrl_t *streaming_ctrl )
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
448 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
449 return -1;
7953
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
450 // Shut up gcc warning
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
451 fd++;
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
452 pos++;
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
453 streaming_ctrl=NULL;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
454 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
455
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
456 int asf_mmst_streaming_start(stream_t *stream)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
457 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
458 char str[1024];
10183
2ffb9a8b0428 10l found by yepyep
alex
parents: 7977
diff changeset
459 char data[BUF_SIZE];
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
460 uint8_t asf_header[8192];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
461 int asf_header_len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
462 int len, i, packet_length;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
463 char *path;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
464 URL_t *url1 = stream->streaming_ctrl->url;
7953
60624e692b95 GCC warning fixes
bertrand
parents: 7880
diff changeset
465 int s = stream->fd;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
466
7250
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
467 if( s>0 ) {
10281
54bcbf28698a Networking support under MinGW.
diego
parents: 10206
diff changeset
468 closesocket( stream->fd );
7250
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
469 stream->fd = -1;
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
470 }
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
471
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
472 /* parse url */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
473 path = strchr(url1->file,'/') + 1;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
474
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
475 url1->port=1755;
10625
620cc649f519 ftp support. The change on connect2Server is needed bcs we need 2
albeu
parents: 10281
diff changeset
476 s = connect2Server( url1->hostname, url1->port, 1);
7250
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
477 if( s<0 ) {
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
478 return s;
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
479 }
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
480 printf ("connected\n");
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
481
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
482 seq_num=0;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
483
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
484 /*
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
485 * Send the initial connect info including player version no. Client GUID (random) and the host address being connected to.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
486 * This command is sent at the very start of protocol initiation. It sends local information to the serve
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
487 * cmd 1 0x01
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
488 * */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
489
11350
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
490 /* prepare for the url encoding conversion */
11403
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
491 #ifdef USE_ICONV
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
492 setlocale(LC_CTYPE, "");
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
493 url_conv = iconv_open("UTF-16LE",setlocale(LC_CTYPE, NULL));
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
494 #endif
11350
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
495
10183
2ffb9a8b0428 10l found by yepyep
alex
parents: 7977
diff changeset
496 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
497 string_utf16 (data, str, strlen(str));
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
498 // send_command(s, commandno ....)
11225
48bb1fd37d2a Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents: 10625
diff changeset
499 send_command (s, 1, 0, 0x0004000b, strlen(str)*2+2, data);
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
500
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
501 len = recv (s, data, BUF_SIZE, 0) ;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
502
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
503 /*This sends details of the local machine IP address to a Funnel system at the server.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
504 * Also, the TCP or UDP transport selection is sent.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
505 *
11225
48bb1fd37d2a Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents: 10625
diff changeset
506 * here 192.168.0.1 is local ip address TCP/UDP states the tronsport we r using
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
507 * and 1037 is the local TCP or UDP socket number
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
508 * cmd 2 0x02
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
509 * */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
510
11225
48bb1fd37d2a Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents: 10625
diff changeset
511 string_utf16 (&data[8], "\002\000\\\\192.168.0.1\\TCP\\1037", 24);
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
512 memset (data, 0, 8);
11225
48bb1fd37d2a Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents: 10625
diff changeset
513 send_command (s, 2, 0, 0, 24*2+10, data);
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
514
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
515 len = recv (s, data, BUF_SIZE, 0) ;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
516
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
517 /* This command sends file path (at server) and file name request to the server.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
518 * 0x5 */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
519
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
520 string_utf16 (&data[8], path, strlen(path));
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
521 memset (data, 0, 8);
11225
48bb1fd37d2a Fixing tons of 10ls. Patch by rgselk <rgselknospam@yahoo.com>
alex
parents: 10625
diff changeset
522 send_command (s, 5, 0, 0, strlen(path)*2+10, data);
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
523
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
524 get_answer (s);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
525
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
526 /* The ASF header chunk request. Includes ?session' variable for pre header value.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
527 * After this command is sent,
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
528 * the server replies with 0x11 command and then the header chunk with header data follows.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
529 * 0x15 */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
530
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
531 memset (data, 0, 40);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
532 data[32] = 2;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
533
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
534 send_command (s, 0x15, 1, 0, 40, data);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
535
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
536 num_stream_ids = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
537 /* get_headers(s, asf_header); */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
538
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
539 asf_header_len = get_header (s, asf_header, stream->streaming_ctrl);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
540 // printf("---------------------------------- asf_header %d\n",asf_header);
12545
868376f81c30 Fix hang on broken mmst streams
rtognimp
parents: 12121
diff changeset
541 if (asf_header_len==0) return -1; //error reading header
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
542 packet_length = interp_header (asf_header, asf_header_len);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
543
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
544
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
545 /*
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
546 * This command is the media stream MBR selector. Switches are always 6 bytes in length.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
547 * After all switch elements, data ends with bytes [00 00] 00 20 ac 40 [02].
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
548 * Where:
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
549 * [00 00] shows 0x61 0x00 (on the first 33 sent) or 0xff 0xff for ASF files, and with no ending data for WMV files.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
550 * It is not yet understood what all this means.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
551 * And the last [02] byte is probably the header ?session' value.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
552 *
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
553 * 0x33 */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
554
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
555 memset (data, 0, 40);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
556
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
557 for (i=1; i<num_stream_ids; i++) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
558 data [ (i-1) * 6 + 2 ] = 0xFF;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
559 data [ (i-1) * 6 + 3 ] = 0xFF;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
560 data [ (i-1) * 6 + 4 ] = stream_ids[i];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
561 data [ (i-1) * 6 + 5 ] = 0x00;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
562 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
563
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
564 send_command (s, 0x33, num_stream_ids, 0xFFFF | stream_ids[0] << 16, (num_stream_ids-1)*6+2 , data);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
565
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
566 get_answer (s);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
567
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
568 /* Start sending file from packet xx.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
569 * This command is also used for resume downloads or requesting a lost packet.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
570 * Also used for seeking by sending a play point value which seeks to the media time point.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
571 * Includes ?session' value in pre header and the maximum media stream time.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
572 * 0x07 */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
573
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
574 memset (data, 0, 40);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
575
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
576 for (i=8; i<16; i++)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
577 data[i] = 0xFF;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
578
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
579 data[20] = 0x04;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
580
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
581 send_command (s, 0x07, 1, 0xFFFF | stream_ids[0] << 16, 24, data);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
582
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
583 stream->fd = s;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
584 stream->streaming_ctrl->streaming_read = asf_mmst_streaming_read;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
585 stream->streaming_ctrl->streaming_seek = asf_mmst_streaming_seek;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
586 stream->streaming_ctrl->buffering = 1;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
587 stream->streaming_ctrl->status = streaming_playing_e;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
588
7880
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
589 packet_length1 = packet_length;
5bb4d8801a2c - fixed several 10l bugs
arpi
parents: 7472
diff changeset
590 printf("mmst packet_length = %d\n",packet_length);
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
591
11403
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
592 #ifdef USE_ICONV
11412
ec3dac7d17a0 Warning fixes (approved by A'rpi).
rathann
parents: 11403
diff changeset
593 if (url_conv != (iconv_t)(-1))
11403
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
594 iconv_close(url_conv);
86ab7e0b2a65 fallback to non-iconv dummy utf16 conversion if iconv failed
alex
parents: 11402
diff changeset
595 #endif
11350
007ec48cf146 Current mplayer (mine is mplayer-1.0-pre1cvs20031001) cannot play mms
attila
parents: 11226
diff changeset
596
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
597 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
598 }