[Mplayer-cvslog] CVS: main mplayer.c,1.360,1.361 subreader.c,1.47,1.48

Adam Tla/lka atlka at mplayer.dev.hu
Tue Jan 8 15:10:25 CET 2002


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

Modified Files:
	mplayer.c subreader.c 
Log Message:
corrections to adjust_subs_time function which now uses fps if needed


Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.360
retrieving revision 1.361
diff -u -r1.360 -r1.361
--- mplayer.c	8 Jan 2002 02:01:04 -0000	1.360
+++ mplayer.c	8 Jan 2002 14:10:22 -0000	1.361
@@ -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";

Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- subreader.c	8 Jan 2002 12:45:38 -0000	1.47
+++ subreader.c	8 Jan 2002 14:10:22 -0000	1.48
@@ -599,19 +599,20 @@
 
 #endif
 
-static void adjust_subs_time(subtitle* sub, unsigned long subtime){
-	int i = sub_num;
+void adjust_subs_time(subtitle* sub, float subtime, float fps){
 	subtitle* nextsub;
+	int i = sub_num;
+	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;
 }
 




More information about the MPlayer-cvslog mailing list