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

Alexis Deruelle alexis.deruelle at cen.cnamts.fr
Thu Jun 24 12:29:45 CEST 2004


Hello,

The following patch is needed in order to play ASF from my digital
camera :

The error correction header in ASF files should be skipped only
if present.

Any comment appreciated.

Greatings,


--- ../../MPlayer-20040624/libmpdemux/demux_asf.c	2003-09-07 
03:41:09.000000000 +0200
+++ ./demux_asf.c	2004-06-24 11:39:39.452262959 +0200
@@ -152,11 +152,11 @@
     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];
+            unsigned char flags;
+            unsigned char segtype;
             int padding;
             int plen;
 	    int sequence;
@@ -172,10 +172,13 @@
                 for(i=0;i<16;i++) printf(" %02X",asf_packet[i]);
                 printf("\n");
             }
-            
-            //if(segtype!=0x5d) printf("Warning! packet[4] != 0x5d  \n");
-
-	    p+=2; // skip flags & segtype
+	    // skip ECC data if present
+	    if (*p & 0x80)
+	    	p += (*p & 0x0F) + 1;
+	    flags = *p; p++;
+	    segtype = *p; p++;
+	    
+	    //if(segtype!=0x5d) printf("Warning! packet[4] != 0x5d  \n");
 
             // Read packet size (plen):
 	    switch((flags>>5)&3){

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




More information about the MPlayer-dev-eng mailing list