[Mplayer-cvslog] CVS: main cfg-mplayer.h,1.184,1.185 mplayer.c,1.620,1.621 subreader.c,1.81,1.82

Arpi of Ize arpi at mplayerhq.hu
Thu Dec 5 01:08:01 CET 2002


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

Modified Files:
	cfg-mplayer.h mplayer.c subreader.c 
Log Message:
dump subtitles in SAMI 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.184
retrieving revision 1.185
diff -u -r1.184 -r1.185
--- cfg-mplayer.h	4 Dec 2002 23:58:30 -0000	1.184
+++ cfg-mplayer.h	5 Dec 2002 00:07:58 -0000	1.185
@@ -374,6 +374,7 @@
 	{"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},
+	{"dumpsami", &stream_dump_type, CONF_TYPE_FLAG, 0, 0, 9, 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.620
retrieving revision 1.621
diff -u -r1.620 -r1.621
--- mplayer.c	5 Dec 2002 00:03:26 -0000	1.620
+++ mplayer.c	5 Dec 2002 00:07:58 -0000	1.621
@@ -1200,6 +1200,7 @@
   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);
+  if(subtitles && stream_dump_type==9) dump_sami(subtitles, sh_video->fps);
 }
 #endif
 

Index: subreader.c
===================================================================
RCS file: /cvsroot/mplayer/main/subreader.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- subreader.c	5 Dec 2002 00:05:57 -0000	1.81
+++ subreader.c	5 Dec 2002 00:07:58 -0000	1.82
@@ -1512,6 +1512,59 @@
     mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Subtitles dumped in \'dumpsub.js\'.\n");
 }
 
+void dump_sami(subtitle* subs, float fps) {
+    int i,j;
+    FILE * fd;
+    subtitle * onesub;
+    unsigned long temp;
+
+    if (!sub_uses_time && sub_fps == 0)
+	sub_fps = fps;
+    fd=fopen("dumpsub.smi","w");
+    if(!fd)
+    { 
+	perror("dump_jacosub: fopen");
+	return;
+    }
+    fprintf(fd, "<SAMI>\n"
+		"<HEAD>\n"
+		"	<STYLE TYPE=\"Text/css\">\n"
+		"	<!--\n"
+		"	  P {margin-left: 29pt; margin-right: 29pt; font-size: 24pt; text-align: center; font-family: Tahoma; font-weight: bold; color: #FCDD03; background-color: #000000;}\n"
+		"	  .SUBTTL {Name: 'Subtitles'; Lang: en-US; SAMIType: CC;}\n"
+		"	-->\n"
+		"	</STYLE>\n"
+		"</HEAD>\n"
+		"<BODY>\n");
+    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;
+	fprintf(fd,"\t<SYNC Start=%lu>\n"
+		    "\t  <P>", temp * 10);
+	
+	for(j=0;j<onesub->lines;j++)
+	    fprintf(fd,"%s%s",j ? "<br>" : "", onesub->text[j]);
+
+	fprintf(fd,"\n");
+
+	temp=onesub->end;
+	if (!sub_uses_time)
+	    temp = temp * 100 / sub_fps;
+	temp -= sub_delay * 100;
+	fprintf(fd,"\t<SYNC Start=%lu>\n"
+		    "\t  <P>&nbsp;\n", temp * 10);
+    }
+    fprintf(fd, "</BODY>\n"
+		"</SAMI>\n");
+    fclose(fd);
+    mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Subtitles dumped in \'dumpsub.smi\'.\n");
+}
+
 void sub_free( subtitle * subs )
 {
  int i;




More information about the MPlayer-cvslog mailing list