summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/mplayer.19
-rw-r--r--cfg-mplayer.h1
-rw-r--r--mplayer.c1
-rw-r--r--subreader.c49
4 files changed, 58 insertions, 2 deletions
diff --git a/DOCS/mplayer.1 b/DOCS/mplayer.1
index 8d7ee668a4..0711bf44fb 100644
--- a/DOCS/mplayer.1
+++ b/DOCS/mplayer.1
@@ -119,8 +119,8 @@ fullscreen.
MPlayer has an onscreen display (OSD) for status information, nice big
antialiased shaded subtitles and visual feedback for keyboard controls.
European/\:ISO 8859-1,2 (Hungarian, English, Czech, etc), Cyrillic and Korean
-fonts are supported along with 9 subtitle formats (MicroDVD, SubRip,
-SubViewer, Sami, VPlayer, RT, SSA, AQTitle and our own: MPsub) and DVD
+fonts are supported along with 10 subtitle formats (MicroDVD, SubRip,
+SubViewer, Sami, VPlayer, RT, SSA, AQTitle, JACOsub and our own: MPsub) and DVD
subtitles (SPU streams, VobSub and Closed Captions).
.PP
.B mencoder
@@ -718,6 +718,11 @@ Convert the given subtitle (specified with the \-sub switch) to the time-based
SubViewer (SRT) subtitle format.
Creates a dumpsub.srt file in the current directory.
.TP
+.B \-dumpjacosub (MPLAYER only)
+Convert the given subtitle (specified with the \-sub switch) to the time-based
+JACOsub subtitle format.
+Creates a dumpsub.js file in the current directory.
+.TP
.B \-dumpsub (MPLAYER only) (BETA CODE)
Dumps the subtitle substream from VOB streams.
See -dump*sub and -vobsubout* options too.
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index 7299572069..43c81b9338 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -373,6 +373,7 @@ static config_t mplayer_opts[]={
{"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},
diff --git a/mplayer.c b/mplayer.c
index 38a486d6db..e1138e4e55 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1198,6 +1198,7 @@ if(sh_video) {
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
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;