[MPlayer-dev-eng] [PATCH][BUG]asf_demux.c : ASF ecc header skipping logic fix

Alexis Deruelle alexis.deruelle at cen.cnamts.fr
Tue Jul 20 07:27:34 CEST 2004


Hi,

There's a bug in libmpdemux/demux_asf.c that prevents (SIGSEGV) playing back ASF videos shot with my digital camera (Aiptek DV3500).

AFAICS ecc header may not be present at all, in that case no skipping is needed in order to get to the actual packet data (see comment).

For testing purpose, a video shot with the camera might still sit in the incoming dir of the public ftp server, under the name img_xxxx.asf IIRC.

Please test and apply.

Greatings,

--- MPlayer-20040707/libmpdemux/demux_asf.c	2003-09-07 03:41:09.000000000 +0200
+++ MPlayer-1.0pre4/libmpdemux/demux_asf.c	2004-07-07 14:05:19.821853881 +0200
@@ -152,8 +152,8 @@
     stream_read(demux->stream,asf_packet,asf_packetsize);
     if(demux->stream->eof) return 0; // EOF
     
-    {	    unsigned char ecc_flags=asf_packet[0];
-	    unsigned char* p=&asf_packet[1+(ecc_flags&15)];
+    {
+            unsigned char* p=asf_packet;
             unsigned char* p_end=asf_packet+asf_packetsize;
             unsigned char flags=p[0];
             unsigned char segtype=p[1];
@@ -172,6 +172,15 @@
                 for(i=0;i<16;i++) printf(" %02X",asf_packet[i]);
                 printf("\n");
             }
+
+            // skip ECC data if present by testing bit 7 of flag
+            // 1xxxbbbb -> ecc data present, skip bbbb byte(s)
+            // 0xxxxxxx -> payload parsing info start
+            if (flags & 0x80) {
+                p += (flags & 0x0F) + 1; // adjust pointer, + 1 for the ecc 
flag itself
+                flags = p[0];            // then reassign payload info flags
+                segtype = p[1];          //
+            }
             
             //if(segtype!=0x5d) printf("Warning! packet[4] != 0x5d  \n");
 


> Hi,
> > 
> > The following patch is needed in order to play ASF from my digital
> > camera :
>
> Could you upload a sample file? ASAP so I can validate and commit.

-- 
Alexis Deruelle <alexis.deruelle at laposte.net>




More information about the MPlayer-dev-eng mailing list