annotate libmpdemux/asf_mmst_streaming.c @ 7390:2357ee501582

fixed to comply with new loader
author alex
date Fri, 13 Sep 2002 21:55:55 +0000
parents 10f629e33ee6
children c4434bdf6e51
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>
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
15
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
16 #include "config.h"
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
17
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
18 #include "url.h"
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
19 #include "asf.h"
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
20
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
21 #include "stream.h"
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
22
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
23 #include "network.h"
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
24
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
25 int data_length = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
26 int packet_length1;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
27 int media_padding;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
28 int to_skip = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
29
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
30 #include <inttypes.h>
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
31
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
32 #define BUF_SIZE 102400
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
33 int checknum =1;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
34
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
35 typedef struct
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
36 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
37 uint8_t buf[BUF_SIZE];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
38 int num_bytes;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
39
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
40 } command_t;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
41
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
42 int seq_num;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
43 int num_stream_ids;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
44 int stream_ids[20];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
45 int output_fh;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
46
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
47 static int get_data (int s, char *buf, size_t count);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
48 int store_data(int s, int size, char *buffer)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
49 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
50 // printf("data_length %d, media_padding %d, size %d \n", data_length, media_padding, size );
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
51 if(data_length >= size)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
52 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
53 if (!get_data (s, buffer, size))
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
54 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
55 printf ("media data read failed\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
56 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
57 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
58 data_length -= size;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
59 return size;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
60 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
61 else
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
62 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
63 int temp_size, media_temp_padding;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
64 if(data_length)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
65 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
66 if (!get_data (s, buffer, data_length))
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
67 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
68 printf ("media data read failed\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
69 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
70 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
71 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
72 if(media_padding)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
73 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
74 if(media_padding > size - data_length)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
75 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
76 memset(buffer+data_length,0,(size - data_length));
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
77 media_padding -= (size - data_length);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
78 data_length = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
79 return size;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
80 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
81 else
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
82 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
83 memset(buffer+data_length,0,media_padding);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
84 media_temp_padding = media_padding;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
85 media_padding = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
86 temp_size =data_length;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
87 data_length = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
88 return (temp_size + media_temp_padding);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
89 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
90 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
91 temp_size = data_length;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
92 data_length = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
93 return temp_size;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
94 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
95 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
96
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
97 static void put_32 (command_t *cmd, uint32_t value)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
98 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
99 cmd->buf[cmd->num_bytes ] = value % 256;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
100 value = value >> 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
101 cmd->buf[cmd->num_bytes+1] = value % 256 ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
102 value = value >> 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
103 cmd->buf[cmd->num_bytes+2] = value % 256 ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
104 value = value >> 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
105 cmd->buf[cmd->num_bytes+3] = value % 256 ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
106
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
107 cmd->num_bytes += 4;
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 static uint32_t get_32 (unsigned char *cmd, int offset)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
111 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
112 uint32_t ret;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
113
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
114 ret = cmd[offset] ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
115 ret |= cmd[offset+1]<<8 ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
116 ret |= cmd[offset+2]<<16 ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
117 ret |= cmd[offset+3]<<24 ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
118
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
119 return ret;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
120 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
121
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
122 static void send_command (int s, int command, uint32_t switches,
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
123 uint32_t extra, int length,
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
124 char *data)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
125 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
126 command_t cmd;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
127 int len8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
128
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
129 len8 = (length + (length%8)) / 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
130
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
131 cmd.num_bytes = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
132
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
133 put_32 (&cmd, 0x00000001); /* start sequence */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
134 put_32 (&cmd, 0xB00BFACE); /* #-)) */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
135 put_32 (&cmd, length + 32);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
136 put_32 (&cmd, 0x20534d4d); /* protocol type "MMS " */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
137 put_32 (&cmd, len8 + 4);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
138 put_32 (&cmd, seq_num);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
139 seq_num++;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
140 put_32 (&cmd, 0x0); /* unknown */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
141 put_32 (&cmd, 0x0);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
142 put_32 (&cmd, len8+2);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
143 put_32 (&cmd, 0x00030000 | command); /* dir | command */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
144 put_32 (&cmd, switches);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
145 put_32 (&cmd, extra);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
146
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
147 memcpy (&cmd.buf[48], data, length);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
148
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
149 if (write (s, cmd.buf, length+48) != (length+48)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
150 printf ("write error\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
151 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
152 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
153
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
154 static void string_utf16(char *dest, char *src, int len)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
155 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
156 int i;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
157
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
158 memset (dest, 0, 1000);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
159
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
160 for (i=0; i<len; i++) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
161 dest[i*2] = src[i];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
162 dest[i*2+1] = 0;
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 dest[i*2] = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
166 dest[i*2+1] = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
167 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
168
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
169 static void get_answer (int s)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
170 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
171 char data[BUF_SIZE];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
172 int command = 0x1b;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
173
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
174 while (command == 0x1b) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
175 int len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
176
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
177 len = read (s, data, BUF_SIZE) ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
178 if (!len) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
179 printf ("\nalert! eof\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
180 return;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
181 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
182
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
183 command = get_32 (data, 36) & 0xFFFF;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
184
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
185 if (command == 0x1b)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
186 send_command (s, 0x1b, 0, 0, 0, data);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
187 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
188 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
189
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
190 static int get_data (int s, char *buf, size_t count)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
191 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
192 ssize_t len, total;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
193 total = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
194
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
195 while (total < count) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
196
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
197 len = read (s, &buf[total], count-total);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
198
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
199 if (len<0) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
200 perror ("read error:");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
201 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
202 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
203
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
204 total += len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
205
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
206 if (len != 0) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
207 // printf ("[%d/%d]", total, count);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
208 fflush (stdout);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
209 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
210
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
211 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
212
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
213 return 1;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
214
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 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
218 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
219 unsigned char pre_header[8];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
220 int header_len,i ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
221
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
222 header_len = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
223
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
224 while (1) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
225 if (!get_data (s, pre_header, 8)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
226 printf ("pre-header read failed\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
227 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
228 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
229 if (pre_header[4] == 0x02) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
230
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
231 int packet_len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
232
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
233 packet_len = (pre_header[7] << 8 | pre_header[6]) - 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
234
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
235 // printf ("asf header packet detected, len=%d\n", packet_len);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
236
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
237 if (!get_data (s, &header[header_len], packet_len)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
238 printf ("header data read failed\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
239 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
240 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
241
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
242 header_len += packet_len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
243
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
244 if ( (header[header_len-1] == 1) && (header[header_len-2]==1)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
245
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( streaming_bufferize( streaming_ctrl, header, header_len )<0 ) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
248 return -1;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
249 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
250
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
251 // printf ("get header packet finished\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
252
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
253 return (header_len);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
254
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
255 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
256
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
257 } else {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
258
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
259 char packet_len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
260 int command;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
261 char data[BUF_SIZE];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
262
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
263 if (!get_data (s, &packet_len, 4)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
264 printf ("packet_len read failed\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
265 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
266 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
267
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
268 packet_len = get_32 (&packet_len, 0) + 4;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
269
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
270 // printf ("command packet detected, len=%d\n", packet_len);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
271
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
272 if (!get_data (s, data, packet_len)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
273 printf ("command data read failed\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
274 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
275 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
276
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
277 command = get_32 (data, 24) & 0xFFFF;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
278
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
279 // printf ("command: %02x\n", command);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
280
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
281 if (command == 0x1b)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
282 send_command (s, 0x1b, 0, 0, 0, data);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
283
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
284 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
285
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
286 // printf ("get header packet succ\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
287 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
288 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
289
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
290 int interp_header (uint8_t *header, int header_len)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
291 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
292 int i;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
293 int packet_length;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
294
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
295 /*
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
296 * parse header
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
297 */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
298
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
299 i = 30;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
300 while (i<header_len) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
301
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
302 uint64_t guid_1, guid_2, length;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
303
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
304 guid_2 = (uint64_t)header[i] | ((uint64_t)header[i+1]<<8)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
305 | ((uint64_t)header[i+2]<<16) | ((uint64_t)header[i+3]<<24)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
306 | ((uint64_t)header[i+4]<<32) | ((uint64_t)header[i+5]<<40)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
307 | ((uint64_t)header[i+6]<<48) | ((uint64_t)header[i+7]<<56);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
308 i += 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
309
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
310 guid_1 = (uint64_t)header[i] | ((uint64_t)header[i+1]<<8)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
311 | ((uint64_t)header[i+2]<<16) | ((uint64_t)header[i+3]<<24)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
312 | ((uint64_t)header[i+4]<<32) | ((uint64_t)header[i+5]<<40)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
313 | ((uint64_t)header[i+6]<<48) | ((uint64_t)header[i+7]<<56);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
314 i += 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 ("guid found: %016llx%016llx\n", guid_1, guid_2);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
317
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
318 length = (uint64_t)header[i] | ((uint64_t)header[i+1]<<8)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
319 | ((uint64_t)header[i+2]<<16) | ((uint64_t)header[i+3]<<24)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
320 | ((uint64_t)header[i+4]<<32) | ((uint64_t)header[i+5]<<40)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
321 | ((uint64_t)header[i+6]<<48) | ((uint64_t)header[i+7]<<56);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
322
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
323 i += 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
324
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
325 if ( (guid_1 == 0x6cce6200aa00d9a6) && (guid_2 == 0x11cf668e75b22630) ) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
326 printf ("header object\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
327 } else if ((guid_1 == 0x6cce6200aa00d9a6) && (guid_2 == 0x11cf668e75b22636)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
328 printf ("data object\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
329 } else if ((guid_1 == 0x6553200cc000e48e) && (guid_2 == 0x11cfa9478cabdca1)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
330
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
331 packet_length = get_32(header, i+92-24);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
332
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
333 printf ("file object, packet length = %d (%d)\n",
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
334 packet_length, get_32(header, i+96-24));
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
335
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
336
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
337 } else if ((guid_1 == 0x6553200cc000e68e) && (guid_2 == 0x11cfa9b7b7dc0791)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
338
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
339 int stream_id = header[i+48] | header[i+49] << 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
340
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
341 printf ("stream object, stream id: %d\n", stream_id);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
342
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
343 stream_ids[num_stream_ids] = stream_id;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
344 num_stream_ids++;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
345
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
346 } else {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
347 printf ("unknown object\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
348 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
349
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
350 // printf ("length : %lld\n", length);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
351
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
352 i += length-24;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
353
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
354 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
355
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
356 return packet_length;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
357
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
358 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
359
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
360
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
361 static int get_media_packet (int s, int padding, char *buffer, int size)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
362 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
363 unsigned char pre_header[8];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
364 char data[BUF_SIZE];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
365 int CheckInnerData = 1;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
366 int CheckOuterData = 1;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
367
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
368
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
369 while(CheckOuterData)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
370 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
371 int a;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
372 if(media_padding ==0 && data_length == 0)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
373 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
374 while(CheckInnerData)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
375 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
376 if (!get_data (s, pre_header, 8)) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
377 printf ("pre-header read failed\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
378 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
379 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
380
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
381 if (pre_header[4] == 0x04)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
382 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
383 data_length = (pre_header[7] << 8 | pre_header[6]) - 8;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
384 media_padding = packet_length1 - data_length;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
385 if(to_skip)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
386 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
387 a = store_data(s, size - to_skip, buffer + to_skip);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
388 to_skip = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
389 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
390 else
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
391 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
392 a = store_data(s, size, buffer);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
393 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
394 // printf("a inner %d \n", size);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
395 return size;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
396 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
397 else
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
398 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
399 int command;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
400 char packet_len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
401 if (!get_data (s, &packet_len, 4))
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
402 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
403 printf ("packet_len read failed\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
404 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
405 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
406 packet_len = get_32 (&packet_len, 0) + 4;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
407
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
408 if (!get_data (s, data, packet_len))
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
409 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
410 printf ("command data read failed\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
411 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
412 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
413 if ( (pre_header[7] != 0xb0) || (pre_header[6] != 0x0b) || (pre_header[5] != 0xfa) || (pre_header[4] != 0xce) )
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
414 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
415 printf ("missing signature\n");
7309
10f629e33ee6 Fixed an unknown command. Looks like it's a new command from WMS9.
bertrand
parents: 7250
diff changeset
416 return -1;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
417 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
418 command = get_32 (data, 24) & 0xFFFF;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
419
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
420 if (command == 0x1b)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
421 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
422 send_command (s, 0x1b, 0, 0, 0, data);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
423 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
424 else if (command == 0x1e)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
425 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
426 printf ("everything done. Thank you for downloading a media file containing proprietary and patentend technology.\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
427 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
428 }
7309
10f629e33ee6 Fixed an unknown command. Looks like it's a new command from WMS9.
bertrand
parents: 7250
diff changeset
429 else if (command == 0x21 )
10f629e33ee6 Fixed an unknown command. Looks like it's a new command from WMS9.
bertrand
parents: 7250
diff changeset
430 {
10f629e33ee6 Fixed an unknown command. Looks like it's a new command from WMS9.
bertrand
parents: 7250
diff changeset
431 // Looks like it's new in WMS9
10f629e33ee6 Fixed an unknown command. Looks like it's a new command from WMS9.
bertrand
parents: 7250
diff changeset
432 // Unknown command, but ignoring it seems to work.
10f629e33ee6 Fixed an unknown command. Looks like it's a new command from WMS9.
bertrand
parents: 7250
diff changeset
433 return 0;
10f629e33ee6 Fixed an unknown command. Looks like it's a new command from WMS9.
bertrand
parents: 7250
diff changeset
434 }
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
435 else if (command != 0x05)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
436 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
437 printf ("unknown command %02x\n", command);
7309
10f629e33ee6 Fixed an unknown command. Looks like it's a new command from WMS9.
bertrand
parents: 7250
diff changeset
438 return -1;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
439 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
440 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
441 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
442 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
443 if(to_skip)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
444 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
445 a = store_data(s, size - to_skip, buffer+to_skip );
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
446 to_skip = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
447 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
448 else
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
449 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
450 a = store_data(s, size, buffer);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
451 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
452
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
453 if(a == size)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
454 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
455 // printf("a outer %d", a );
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
456 return a;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
457 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
458 else
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
459 to_skip = a;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
460
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
461 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
462
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
463 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
464
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
465 int
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
466 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
467 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
468 int len = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
469 if( stream_ctrl->buffer_size!=0 ) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
470 int buffer_len = stream_ctrl->buffer_size-stream_ctrl->buffer_pos;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
471 len = (size<buffer_len)?size:buffer_len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
472 memcpy( buffer, (stream_ctrl->buffer)+(stream_ctrl->buffer_pos), len );
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
473 stream_ctrl->buffer_pos += len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
474 if( stream_ctrl->buffer_pos>=stream_ctrl->buffer_size ) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
475 free( stream_ctrl->buffer );
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
476 stream_ctrl->buffer = NULL;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
477 stream_ctrl->buffer_size = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
478 stream_ctrl->buffer_pos = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
479 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
480
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
481 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
482
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
483 if( len<size ) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
484
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
485 int ret;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
486
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
487 ret = get_media_packet( fd, size - len, buffer+len, size-len );
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
488
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
489 if( ret<0 ) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
490
7309
10f629e33ee6 Fixed an unknown command. Looks like it's a new command from WMS9.
bertrand
parents: 7250
diff changeset
491 printf("get_media_packet error : %s\n",strerror(errno));
10f629e33ee6 Fixed an unknown command. Looks like it's a new command from WMS9.
bertrand
parents: 7250
diff changeset
492 return -1;
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
493
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
494 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
495
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
496 len += ret;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
497
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
498 //printf("read %d bytes from network\n", len );
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
499
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
500 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
501
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
502 return len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
503 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
504
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
505 int
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
506 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
507 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
508 return -1;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
509 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
510
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
511 int asf_mmst_streaming_start(stream_t *stream)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
512 {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
513 char str[1024];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
514 char data[1024];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
515 uint8_t asf_header[8192];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
516 int asf_header_len;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
517 int len, i, packet_length;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
518 char host[256];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
519 char *path;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
520 URL_t *url1 = stream->streaming_ctrl->url;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
521 int s = stream->fd;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
522
7250
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
523 if( s>0 ) {
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
524 close( stream->fd );
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
525 stream->fd = -1;
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
526 }
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
527
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
528 /* parse url */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
529 path = strchr(url1->file,'/') + 1;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
530
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
531 url1->port=1755;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
532 s = connect2Server( url1->hostname, url1->port );
7250
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
533 if( s<0 ) {
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
534 return s;
27a1315d6af4 Checked if the connection succeeded before writing in the socket.
bertrand
parents: 6092
diff changeset
535 }
6092
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
536 printf ("connected\n");
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
537
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
538 /*
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
539 * 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
540 * 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
541 * cmd 1 0x01
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
542 * */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
543
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
544 sprintf (str, "\034\003NSPlayer/7.0.0.1956; {33715801-BAB3-9D85-24E9-03B90328270A}; Host: %s", host);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
545 string_utf16 (data, str, strlen(str)+2);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
546 // send_command(s, commandno ....)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
547 send_command (s, 1, 0, 0x0004000b, strlen(str) * 2+8, data);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
548
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
549 len = read (s, data, BUF_SIZE) ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
550
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
551 /*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
552 * Also, the TCP or UDP transport selection is sent.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
553 *
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
554 * here 192.168.0.129 is local ip address TCP/UDP states the tronsport we r using
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
555 * and 1037 is the local TCP or UDP socket number
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
556 * cmd 2 0x02
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
557 * */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
558
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
559 string_utf16 (&data[8], "\002\000\\\\192.168.0.1\\TCP\\1037\0000",
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
560 28);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
561 memset (data, 0, 8);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
562 send_command (s, 2, 0, 0, 28*2+8, data);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
563
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
564 len = read (s, data, BUF_SIZE) ;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
565
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
566 /* 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
567 * 0x5 */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
568
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
569 string_utf16 (&data[8], path, strlen(path));
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
570 memset (data, 0, 8);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
571 send_command (s, 5, 0, 0, strlen(path)*2+12, data);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
572
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
573 get_answer (s);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
574
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
575 /* The ASF header chunk request. Includes ?session' variable for pre header value.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
576 * After this command is sent,
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
577 * 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
578 * 0x15 */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
579
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
580 memset (data, 0, 40);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
581 data[32] = 2;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
582
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
583 send_command (s, 0x15, 1, 0, 40, data);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
584
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
585 num_stream_ids = 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
586 /* get_headers(s, asf_header); */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
587
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
588 asf_header_len = get_header (s, asf_header, stream->streaming_ctrl);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
589 // printf("---------------------------------- asf_header %d\n",asf_header);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
590 packet_length = interp_header (asf_header, asf_header_len);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
591
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
592
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
593 /*
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
594 * 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
595 * 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
596 * Where:
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
597 * [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
598 * It is not yet understood what all this means.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
599 * And the last [02] byte is probably the header ?session' value.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
600 *
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
601 * 0x33 */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
602
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
603 memset (data, 0, 40);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
604
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
605 for (i=1; i<num_stream_ids; i++) {
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
606 data [ (i-1) * 6 + 2 ] = 0xFF;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
607 data [ (i-1) * 6 + 3 ] = 0xFF;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
608 data [ (i-1) * 6 + 4 ] = stream_ids[i];
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
609 data [ (i-1) * 6 + 5 ] = 0x00;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
610 }
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
611
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
612 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
613
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
614 get_answer (s);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
615
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
616 /* Start sending file from packet xx.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
617 * This command is also used for resume downloads or requesting a lost packet.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
618 * 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
619 * Includes ?session' value in pre header and the maximum media stream time.
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
620 * 0x07 */
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
621
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
622 memset (data, 0, 40);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
623
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
624 for (i=8; i<16; i++)
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
625 data[i] = 0xFF;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
626
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
627 data[20] = 0x04;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
628
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
629 send_command (s, 0x07, 1, 0xFFFF | stream_ids[0] << 16, 24, data);
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
630
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
631
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
632 stream->fd = s;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
633 stream->streaming_ctrl->streaming_read = asf_mmst_streaming_read;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
634 stream->streaming_ctrl->streaming_seek = asf_mmst_streaming_seek;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
635 stream->streaming_ctrl->buffering = 1;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
636
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
637 stream->streaming_ctrl->status = streaming_playing_e;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
638 stream->streaming_ctrl->buffering = 1;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
639
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
640 packet_length1 = packet_length;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
641
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
642 return 0;
1529f01e8108 Added support for asf mmst protocol.
bertrand
parents:
diff changeset
643 }