[Mplayer-cvslog] CVS: main cfg-mplayer.h,1.183,1.184 mplayer.c,1.618,1.619 subreader.c,1.78,1.79

Arpi of Ize arpi at mplayerhq.hu
Thu Dec 5 00:59:10 CET 2002


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

Modified Files:
	cfg-mplayer.h mplayer.c subreader.c 
Log Message:
dump in JACOsub format
patch by Salvatore Falco <sfalco at studenti.ing.uniroma1.it>


Index: cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -r1.183 -r1.184
--- cfg-mplayer.h	14 Nov 2002 23:49:05 -0000	1.183
+++ cfg-mplayer.h	4 Dec 2002 23:58:30 -0000	1.184
@@ -373,6 +373,7 @@
 	{"dumpstream", &stream_dump_type, CONF_TYPE_FLAG, 0, 0, 5, NULL},
 	{"dumpsrtsub", &stream_dump_type, CONF_TYPE_FLAG, 0, 0, 6, NULL},
 	{"dumpmicrodvdsub", &stream_dump_type, CONF_TYPE_FLAG, 0, 0, 7, NULL},
+	{"dumpjacosub", &stream_dump_type, CONF_TYPE_FLAG, 0, 0, 8, NULL},
 
 #ifdef HAVE_LIRC
 	{"lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.618
retrieving revision 1.619
diff -u -r1.618 -r1.619
--- mplayer.c	29 Nov 2002 00:58:06 -0000	1.618
+++ mplayer.c	4 Dec 2002 23:58:30 -0000	1.619
@@ -1198,6 +1198,7 @@
   if(subtitles && stream_dump_type==4) dump_mpsub(subtitles, sh_video->fps);
   if(subtitles && stream_dump_type==6) dump_srt(subtitles, sh_video->fps);
   if(subtitles && stream_dump_type==7) dump_microdvd(subtitles, sh_video->fps);
+  if(subtitles && stream_dump_type==8) dump_jacosub(subtitles, sh_video->fps);
 }
 #endif
 

Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- subreader.c	16 Nov 2002 03:25:37 -0000	1.78
+++ subreader.c	4 Dec 2002 23:58:31 -0000	1.79
@@ -1379,6 +1379,55 @@
     mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Subtitles dumped in \'dumpsub.txt\'.\n");
 }
 
+void dump_jacosub(subtitle* subs, float fps) {
+    int i,j;
+    int h,m,s,cs;
+    FILE * fd;
+    subtitle * onesub;
+    unsigned long temp;
+
+    if (!sub_uses_time && sub_fps == 0)
+	sub_fps = fps;
+    fd=fopen("dumpsub.js","w");
+    if(!fd)
+    { 
+	perror("dump_jacosub: fopen");
+	return;
+    }
+    fprintf(fd, "#TIMERES %d\n", (sub_uses_time) ? 100 : (int)sub_fps);    
+    for(i=0;i<sub_num;i++)
+    {
+        onesub=subs+i;    //=&subs[i];
+
+	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
+	cs=temp;			//cs=1*10
+	fprintf(fd,"%02d:%02d:%02d.%02d ",h,m,s,cs);
+
+	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;
+	cs=temp;
+	fprintf(fd,"%02d:%02d:%02d.%02d {~} ",h,m,s,cs);
+	
+	for(j=0;j<onesub->lines;j++)
+	    fprintf(fd,"%s%s",j ? "\\n" : "", onesub->text[j]);
+
+	fprintf(fd,"\n");
+    }
+    fclose(fd);
+    mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Subtitles dumped in \'dumpsub.js\'.\n");
+}
+
 void sub_free( subtitle * subs )
 {
  int i;




More information about the MPlayer-cvslog mailing list