[Mplayer-cvslog] CVS: main mplayer.c,1.531,1.532 subreader.c,1.66,1.67 subreader.h,1.15,1.16
Kim Minh Kaplan CVS
kmkaplan at mplayerhq.hu
Thu Jul 25 20:05:11 CEST 2002
Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv18198
Modified Files:
mplayer.c subreader.c subreader.h
Log Message:
Correct dump_srt millisecond output
Add support for input from frame based subtitles to dump_srt.
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.531
retrieving revision 1.532
diff -u -r1.531 -r1.532
--- mplayer.c 25 Jul 2002 13:12:23 -0000 1.531
+++ mplayer.c 25 Jul 2002 18:05:08 -0000 1.532
@@ -1215,7 +1215,7 @@
}
if(subtitles && stream_dump_type==3) list_sub_file(subtitles);
if(subtitles && stream_dump_type==4) dump_mpsub(subtitles, sh_video->fps);
- if(subtitles && stream_dump_type==6) dump_srt(subtitles);
+ if(subtitles && stream_dump_type==6) dump_srt(subtitles, sh_video->fps);
}
#endif
Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- subreader.c 6 Jul 2002 15:19:08 -0000 1.66
+++ subreader.c 25 Jul 2002 18:05:08 -0000 1.67
@@ -915,13 +915,15 @@
printf ("Read %i subtitles, %i errors.\n", sub_num, sub_errs);
}
-void dump_srt(subtitle* subs){
+void dump_srt(subtitle* subs, float fps){
int i,j;
int h,m,s,ms;
FILE * fd;
subtitle * onesub;
unsigned long temp;
+ if (!sub_uses_time && sub_fps == 0)
+ sub_fps = fps;
fd=fopen("dumpsub.srt","w");
if(!fd)
{
@@ -934,17 +936,23 @@
fprintf(fd,"%d\n",i+1);//line number
temp=onesub->start;
+ if (!sub_uses_time)
+ temp = temp * 100 / sub_fps;
+ temp -= sub_delay * 100;
h=temp/360000;temp%=360000; //h =1*100*60*60
m=temp/6000; temp%=6000; //m =1*100*60
s=temp/100; temp%=100; //s =1*100
- ms=temp; //ms=1
+ ms=temp*10; //ms=1*10
fprintf(fd,"%02d:%02d:%02d,%03d --> ",h,m,s,ms);
temp=onesub->end;
+ if (!sub_uses_time)
+ temp = temp * 100 / sub_fps;
+ temp -= sub_delay * 100;
h=temp/360000;temp%=360000;
m=temp/6000; temp%=6000;
s=temp/100; temp%=100;
- ms=temp;
+ ms=temp*10;
fprintf(fd,"%02d:%02d:%02d,%03d\n",h,m,s,ms);
for(j=0;j<onesub->lines;j++)
Index: subreader.h
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- subreader.h 27 May 2002 17:20:55 -0000 1.15
+++ subreader.h 25 Jul 2002 18:05:08 -0000 1.16
@@ -38,7 +38,7 @@
subtitle* sub_read_file (char *filename, float pts);
char * sub_filename(char *path, char * fname);
void list_sub_file(subtitle* subs);
-void dump_srt(subtitle* subs);
+void dump_srt(subtitle* subs, float fps);
void dump_mpsub(subtitle* subs, float fps);
void sub_free( subtitle * subs );
void find_sub(subtitle* subtitles,int key);
More information about the MPlayer-cvslog
mailing list