changeset 12877:e427e3cc26c1

skip ecc only if present, patch by Alexis Durelle <alexis.durelle@cen.cnamts.fr> (needed for the Aiptek DV3500 camera)
author alex
date Wed, 21 Jul 2004 08:54:39 +0000
parents b89bbda5d5fb
children ed7d73d336ad
files libmpdemux/demux_asf.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_asf.c	Tue Jul 20 18:03:10 2004 +0000
+++ b/libmpdemux/demux_asf.c	Wed Jul 21 08:54:39 2004 +0000
@@ -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];
@@ -173,6 +173,16 @@
                 printf("\n");
             }
             
+	    // skip ECC data if present by testing bit 7 of flags
+	    // 1xxxbbbb -> ecc data present, skip bbbb byte(s)
+	    // 0xxxxxxx -> payload parsing info starts
+	    if (flags & 0x80)
+	    {
+		p += (flags & 0x0f)+1;
+		flags = p[0];
+		segtype = p[1];
+	    }
+	    
             //if(segtype!=0x5d) printf("Warning! packet[4] != 0x5d  \n");
 
 	    p+=2; // skip flags & segtype