[Mplayer-cvslog] CVS: main spudec.c,1.35,1.36

Arpi of Ize arpi at mplayerhq.hu
Tue Oct 15 02:47:34 CEST 2002


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

Modified Files:
	spudec.c 
Log Message:
All right: The patch adresses two issues which I found, when I analyzed
the input from some DVDs with known subtitle-dropouts:

1. The packet-size at the beginning of the packet, which is used to
check, whether we got all fragments, is sometimes one byte too long. It
seems to be always padded to an even number, while the actual size can
be odd.

2. The original algorythm used to assemble the fragments relies on the
timestamps to check, whether a new packet begins. This has proven to be
unrelieable on some disks. So instead, I use the timestamp only to
check, whether it's been too long (defined as 0,01sec) since the last
fragment, which is probably indicating a broken packet, and normaly
starting a new packet when the last one has been finished.

patch by Christof Buergi <christof at buergi.lugs.ch>


Index: spudec.c
===================================================================
RCS file: /cvsroot/mplayer/main/spudec.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- spudec.c	6 Aug 2002 13:32:55 -0000	1.35
+++ spudec.c	15 Oct 2002 00:47:17 -0000	1.36
@@ -419,10 +419,11 @@
       mp_msg(MSGT_SPUDEC,MSGL_WARN,"SPUasm: packet too short\n");
       return;
   }
-  if (spu->packet_pts < pts100) {
-    spu->packet_pts = pts100;
+  if ((spu->packet_pts + 10000) < pts100) {
+    // [cb] too long since last fragment: force new packet
     spu->packet_offset = 0;
   }
+  spu->packet_pts = pts100;
   if (spu->packet_offset == 0) {
     unsigned int len2 = get_be16(packet);
     // Start new fragment
@@ -456,7 +457,9 @@
 #if 1
   // check if we have a complete packet (unfortunatelly packet_size is bad
   // for some disks)
-  if (spu->packet_offset == spu->packet_size){
+  // [cb] packet_size is padded to be even -> may be one byte too long
+  if ((spu->packet_offset == spu->packet_size) ||
+      ((spu->packet_offset + 1) == spu->packet_size)){
     unsigned int x=0,y;
     while(x+4<=spu->packet_offset){
       y=get_be16(spu->packet+x+2); // next control pointer
@@ -475,6 +478,8 @@
       }
       x=y;
     }
+    // [cb] packet is done; start new packet
+    spu->packet_offset = 0;
   }
 #else
   if (spu->packet_offset == spu->packet_size) {




More information about the MPlayer-cvslog mailing list