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"
81 int chunk_len,
res, ext_header_len;
88 chunk_type =
AV_RL16(chunk_header);
89 chunk_len =
AV_RL16(chunk_header + 2);
106 if (res != ext_header_len) {
110 *len = chunk_len - ext_header_len;
122 "Data packet length %d exceeds the in_buffer size %zu\n",
127 av_dlog(NULL,
"Data packet len = %d\n", len);
134 "Chunk length %d exceed packet length %d\n",len, mms->
asf_packet_len);
161 av_dlog(NULL,
"Header len changed from %d to %d\n",
174 "Asf header packet len = %d exceed the asf header buf size %d\n",
181 "Recv asf header data len %d != expected len %d\n", res, len);
197 "Other packet len = %d exceed the in_buffer size %zu\n",
206 av_dlog(NULL,
"Skip chunk type %d \n", chunk_type);
217 char httpname[256], path[256], host[128];
218 char *stream_selection = NULL;
228 host,
sizeof(host), &port, path,
sizeof(path), mmsh->
location);
231 ff_url_join(httpname,
sizeof(httpname),
"http", NULL, host, port,
"%s", path);
242 "Pragma: no-cache,rate=1.000000,stream-time=0,"
243 "stream-offset=0:0,request-context=%u,max-duration=0\r\n"
245 "Connection: Close\r\n",
261 memset(headers, 0,
sizeof(headers));
267 if (!stream_selection)
277 err =
snprintf(headers,
sizeof(headers),
281 "Pragma: no-cache,rate=1.000000,request-context=%u\r\n"
282 "Pragma: xPlayStrm=1\r\n"
284 "Pragma: stream-switch-count=%d\r\n"
285 "Pragma: stream-switch-entry=%s\r\n"
286 "Pragma: no-cache,rate=1.000000,stream-time=%u"
287 "Connection: Close\r\n",
294 av_dlog(NULL,
"out_buffer is %s", headers);
308 av_dlog(NULL,
"Connection successfully open\n");
313 av_dlog(NULL,
"Connection failed with error %d\n", err);
329 switch (chunk_type) {
369 int64_t timestamp,
int flags)
399 if(pos == 0 && whence == SEEK_CUR)