[MPlayer-dev-eng] Code to download an ASF Playlist and AMD 64 Compile fix

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Fri Dec 21 01:28:19 CET 2007


Hello,
On Thu, Dec 20, 2007 at 09:29:53PM +0000, iorrus mcdonnagh wrote:
> It currently only works if the asf stream is passed over http as I couldn't get a look at the mms bitstream using etheral or at least in a way that made sense.
> 
> I've attached the corrected diff.
> 
> It doesn't handle the end of stream correctly either mplayer just crashes this just needs to be found and sorted tho nothing too major. I simply did enough to get it working.

Attached is the absolute core part of the patch, enough to make mplayer
-dumpstream dump all parts. Further parts can by played by using the
right -sb parameter.
E.g.:
mplayer -dumpstream mmshttp://stream.onet.pl/media.wsx?/info/200512/cde5e3acbd.wmv
mplayer stream.dump -sb 203188

Greetings,
Reimar Döffinger
-------------- next part --------------
diff --git a/stream/asf_streaming.c b/stream/asf_streaming.c
index fc13db1..5767a0d 100644
--- a/stream/asf_streaming.c
+++ b/stream/asf_streaming.c
@@ -190,9 +190,12 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
 	// The ASF header can be in several network chunks. For example if the content description
 	// is big, the ASF header will be split in 2 network chunk.
 	// So we need to retrieve all the chunk before starting to parse the header.
+  r = 0;
   do {
+if (r == 0)
 	  if (asf_read_wrapper(fd, &chunk, sizeof(ASF_stream_chunck_t), streaming_ctrl) <= 0)
 	    return -1;
+r = 1;
 	  // Endian handling of the stream chunk
 	  le2me_ASF_stream_chunck_t(&chunk);
 	  size = asf_streaming( &chunk, &r) - sizeof(ASF_stream_chunck_t);
@@ -425,6 +428,26 @@ static int asf_http_streaming_read( int fd, char *buffer, int size, streaming_ct
       // Endian handling of the stream chunk
       le2me_ASF_stream_chunck_t(&chunk);
       chunk_size = asf_streaming( &chunk, &drop_chunk );
+
+      // Playlist File Handling
+      if (chunk.type == ASF_STREAMING_CLEAR && chunk.size == 4) {
+        chunk_size = chunk.size_confirm+4;
+        le2me_ASF_stream_chunck_t(&chunk); //reversal
+        //reinserts end of chunk that contains header information into the stream
+        streaming_bufferize(streaming_ctrl,(char*)(&chunk)+(sizeof(ASF_stream_chunck_t)-4),4);
+        le2me_ASF_stream_chunck_t(&chunk); //re-reversal
+
+        //puts the header into the buffer
+        if (chunk.unknown == ASF_STREAMING_HEADER) {
+          if (asf_read_wrapper(fd, buffer, chunk_size, streaming_ctrl) <= 0)
+            return -1;
+          streaming_bufferize(streaming_ctrl,buffer,chunk_size);
+          asf_streaming_parse_header( fd, streaming_ctrl);
+          streaming_bufferize(streaming_ctrl,buffer,chunk_size);
+        }
+        continue;
+      }
+
       if(chunk_size < 0) {
 	mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ErrorParsingChunkHeader);
 	return -1;


More information about the MPlayer-dev-eng mailing list