summaryrefslogtreecommitdiffstats
path: root/subreader.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-05 00:07:59 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-05 00:07:59 +0000
commit919f3710b113c284aef73eeddff53c700c5fc6dc (patch)
tree7404f7f15e488141c0bc8a36c30a3b4556d23419 /subreader.c
parenta3243d226503d57d693f35ad96cb74dad78b0fd4 (diff)
downloadmpv-919f3710b113c284aef73eeddff53c700c5fc6dc.tar.bz2
mpv-919f3710b113c284aef73eeddff53c700c5fc6dc.tar.xz
dump subtitles in SAMI format
patch by Salvatore Falco <sfalco@studenti.ing.uniroma1.it> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8364 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'subreader.c')
-rw-r--r--subreader.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/subreader.c b/subreader.c
index 074403e10a..019e1fc4b8 100644
--- a/subreader.c
+++ b/subreader.c
@@ -1512,6 +1512,59 @@ void dump_jacosub(subtitle* subs, float fps) {
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;