[MPlayer-dev-eng] [PATCH]seek proble with vob/spu subs

Alban Bedel albeu at free.fr
Sun May 26 04:24:49 CEST 2002


Hi ½ Ȼ,

on Sun, 26 May 2002 08:45:53 +0800 you wrote:

> Hi,
> 
> i found a problem in mplayer, it will always miss the last sub when seek 
> forward or backword, seems it appeared after Alban Bedel patched 
> mplayer.c:(, i made a patch to fix it, but i don't test it with much movie, 
> and i don't have a dvd, so i don't know if i break something, please test 
> it, thx
> 
This patch will break the vobsub on hw render and the dvd subtitles on sw render.
hw renders need timestamp related to sh_video->timer. That's why I put this calcul on
the timestamps and used sh_video->timer for the spu heartbeat.
But when you just seek sh_video->timer is near 0 so the last sub get a negative
timestamp and spudec throw it. The fix is simply :

diff -Nur -x CVS -x '.*' main/mplayer.c maindev/mplayer.c
--- main/mplayer.c	Sun May 26 07:52:28 2002
+++ maindev/mplayer.c	Sun May 26 08:13:34 2002
@@ -2940,7 +2933,7 @@
 	// The + next_frame_time is there because we'll display the sub at the next frame
 	len = vobsub_get_packet(vo_vobsub,d_video->pts+sub_delay+next_frame_time,(void**)&packet,&timestamp);
 	if(len > 0) {
	  timestamp -= (d_video->pts + sub_delay - sh_video->timer)*90000;
+	  if(timestamp < 0) timestamp = 0;
 	  mp_dbg(MSGT_CPLAYER,MSGL_V,"\rVOB sub: len=%d v_pts=%5.3f v_timer=%5.3f sub=%5.3f ts=%d \n",len,d_video->pts,sh_video->timer,timestamp / 90000.0);
 	}
       }

I'll commit this tomorow unless somebody have an objection to do. Also if somebody have
a vobsub sample _and the movie_ it would be nice as I do have vobsub sampled from mphq
but I don't have the movie so I'm not sure that the timming is perfect.
	Albeu



More information about the MPlayer-dev-eng mailing list