summaryrefslogtreecommitdiffstats
path: root/spudec.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-28 01:03:57 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-28 01:03:57 +0000
commit253eff648bf279488a2b9eb6f82adb054d447369 (patch)
treee07daa488b1c5da53951184461102ec34c011983 /spudec.c
parent1424f46727c65b15e48b568f7da5141483cfa9d2 (diff)
downloadmpv-253eff648bf279488a2b9eb6f82adb054d447369.tar.bz2
mpv-253eff648bf279488a2b9eb6f82adb054d447369.tar.xz
more stable and reliable spudec packet reassembler
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3821 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'spudec.c')
-rw-r--r--spudec.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/spudec.c b/spudec.c
index f7cf698c1b..904f9f53b5 100644
--- a/spudec.c
+++ b/spudec.c
@@ -292,10 +292,35 @@ void spudec_assemble(void *this, unsigned char *packet, int len, int pts100)
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