diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-12-04 23:58:38 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-12-04 23:58:38 +0000 |
commit | 7228f67795c10a8e9a0bf633efa3bba7da79551f (patch) | |
tree | 6f6172cd36a427d84fa0363a51de49cd06b96bb3 /subreader.c | |
parent | 6624dcbec4360d0065d3294528c5ab7deea7c49f (diff) | |
download | mpv-7228f67795c10a8e9a0bf633efa3bba7da79551f.tar.bz2 mpv-7228f67795c10a8e9a0bf633efa3bba7da79551f.tar.xz |
dump in JACOsub format
patch by Salvatore Falco <sfalco@studenti.ing.uniroma1.it>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8361 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'subreader.c')
-rw-r--r-- | subreader.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/subreader.c b/subreader.c index 4d078c2791..3e374c26f9 100644 --- a/subreader.c +++ b/subreader.c @@ -1379,6 +1379,55 @@ void dump_microdvd(subtitle* subs, float fps) { 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; |