[Mplayer-cvslog] CVS: main spudec.c,1.12,1.13

Arpi of Ize arpi at mplayer.dev.hu
Fri Dec 28 02:04:03 CET 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv11787

Modified Files:
	spudec.c 
Log Message:
more stable and reliable spudec packet reassembler

Index: spudec.c
===================================================================
RCS file: /cvsroot/mplayer/main/spudec.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- spudec.c	25 Dec 2001 20:32:02 -0000	1.12
+++ spudec.c	28 Dec 2001 01:03:57 -0000	1.13
@@ -292,10 +292,35 @@
       spu->packet_offset += len;
     }
   }
+#if 1
+  // check if we have a complete packet (unfortunatelly packet_size is bad
+  // for some disks)
+//  if (spu->packet_offset == spu->packet_size)
+  { int x=0,y;
+    while(x>=0 && x+4<=spu->packet_offset){
+      y=get_be16(spu->packet+x+2); // next control pointer
+      printf("SPUtest: x=%d y=%d off=%d size=%d\n",x,y,spu->packet_offset,spu->packet_size);
+      if(x>=4 && x==y){		// if it points to self - we're done!
+        // we got it!
+	printf("SPUgot: off=%d  size=%d \n",spu->packet_offset,spu->packet_size);
+	spudec_decode(spu);
+	spu->packet_offset = 0;
+	break;
+      }
+      if(y<=x || y>=spu->packet_size){ // invalid?
+	printf("SPUtest: broken packet!!!!! y=%d < x=%d\n",y,x);
+        spu->packet_size = spu->packet_offset = 0;
+        break;
+      }
+      x=y;
+    }
+  }
+#else
   if (spu->packet_offset == spu->packet_size) {
     spudec_decode(spu);
     spu->packet_offset = 0;
   }
+#endif
 }
 
 void spudec_reset(void *this)	// called after seek




More information about the MPlayer-cvslog mailing list