38 #define CHUNK_HEADER_LENGTH 4 // 2bytes chunk type and 2bytes chunk length.
39 #define EXT_HEADER_LENGTH 8 // 4bytes sequence, 2bytes useless and 2bytes chunk length.
42 #define USERAGENT "User-Agent: NSPlayer/4.1.0.3856\r\n"
45 #define CLIENTGUID "Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}\r\n"
80 int chunk_len, res, ext_header_len;
87 chunk_type =
AV_RL16(chunk_header);
88 chunk_len =
AV_RL16(chunk_header + 2);
105 if (res != ext_header_len) {
109 *len = chunk_len - ext_header_len;
121 "Data packet length %d exceeds the in_buffer size %zu\n",
133 "Chunk length %d exceed packet length %d\n",len, mms->
asf_packet_len);
160 av_dlog(
NULL,
"Header len changed from %d to %d\n",
173 "Asf header packet len = %d exceed the asf header buf size %d\n",
180 "Recv asf header data len %d != expected len %d\n", res, len);
196 "Other packet len = %d exceed the in_buffer size %zu\n",
205 av_dlog(
NULL,
"Skip chunk type %d \n", chunk_type);
216 char httpname[256], path[256], host[128], location[1024];
217 char *stream_selection =
NULL;
227 host,
sizeof(host), &port, path,
sizeof(path), location);
230 ff_url_join(httpname,
sizeof(httpname),
"http",
NULL, host, port,
"%s", path);
237 snprintf(headers,
sizeof(headers),
241 "Pragma: no-cache,rate=1.000000,stream-time=0,"
242 "stream-offset=0:0,request-context=%u,max-duration=0\r\n"
244 "Connection: Close\r\n\r\n",
260 memset(headers, 0,
sizeof(headers));
266 if (!stream_selection)
270 err = snprintf(tmp,
sizeof(tmp),
"ffff:%d:0 ", mms->
streams[i].
id);
276 err = snprintf(headers,
sizeof(headers),
280 "Pragma: no-cache,rate=1.000000,request-context=%u\r\n"
281 "Pragma: xPlayStrm=1\r\n"
283 "Pragma: stream-switch-count=%d\r\n"
284 "Pragma: stream-switch-entry=%s\r\n"
285 "Connection: Close\r\n\r\n",
311 av_dlog(
NULL,
"Connection failed with error %d\n", err);
322 switch (chunk_type) {