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

Alexis Deruelle alexis.deruelle at cen.cnamts.fr
Wed Jul 7 14:18:42 CEST 2004


Hi,

Bellow is a somehow less intrusive version of the patch.

For testing purpose, a video shot with my camera 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