# HG changeset patch # User atlka # Date 1010499022 0 # Node ID 505f206d80d1d9719d206b04a984c190aaae58c2 # Parent 0e7c382bc53acd12c5da032d1cf0e40407636cfd corrections to adjust_subs_time function which now uses fps if needed diff -r 0e7c382bc53a -r 505f206d80d1 mplayer.c --- a/mplayer.c Tue Jan 08 12:45:38 2002 +0000 +++ b/mplayer.c Tue Jan 08 14:10:22 2002 +0000 @@ -30,6 +30,7 @@ #ifdef USE_SUB #include "subreader.h" void find_sub(subtitle* subtitles,int key); +void adjust_subs_time(subtitle* subtitles, float subadj, float fps); #endif #ifdef USE_LIBVO2 @@ -1031,7 +1032,12 @@ /* display clip info */ demux_info_print(demuxer); - + +#ifdef USE_SUB +// we know fps so now we can adjust subtitles time to ~6 seconds AST +adjust_subs_time(subtitles, 6.0, sh_video->fps); +#endif + //================== Init AUDIO (codec) ========================== current_module="init_audio_codec"; diff -r 0e7c382bc53a -r 505f206d80d1 subreader.c --- a/subreader.c Tue Jan 08 12:45:38 2002 +0000 +++ b/subreader.c Tue Jan 08 14:10:22 2002 +0000 @@ -599,19 +599,20 @@ #endif -static void adjust_subs_time(subtitle* sub, unsigned long subtime){ +void adjust_subs_time(subtitle* sub, float subtime, float fps){ + subtitle* nextsub; int i = sub_num; - subtitle* nextsub; + unsigned long subfms = (sub_uses_time ? 100 : fps) * subtime; - for (;;){ + if (i) for (;;){ if (sub->end <= sub->start) - sub->end = sub->start + subtime; + sub->end = sub->start + subfms; if (!--i) return; nextsub = sub + 1; if (sub->end >= nextsub->start){ sub->end = nextsub->start - 1; - if (sub->end - sub->start > subtime) - sub->end = sub->start + subtime; + if (sub->end - sub->start > subfms) + sub->end = sub->start + subfms; } sub = nextsub; } @@ -682,11 +683,6 @@ return NULL; } -// if sub->end time is 0 set it to sub_>start + ~6 sec but not -// after next sub->start time -// correct also if sub->end time is below sub->start time -// maybe default subtime (150fms) should be a program option AST - adjust_subs_time(first, 150); return first; }