diff options
author | kmkaplan <kmkaplan@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-09-21 17:23:46 +0000 |
---|---|---|
committer | kmkaplan <kmkaplan@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-09-21 17:23:46 +0000 |
commit | 5f9adff3f6d3b807ee30003c6558bb74cb467592 (patch) | |
tree | e6cc2db37a936b40f973a99773c0a6061f336650 | |
parent | b9ce5ed76cd7afd6f9fefe89176c5e7b0201f3e4 (diff) | |
download | mpv-5f9adff3f6d3b807ee30003c6558bb74cb467592.tar.bz2 mpv-5f9adff3f6d3b807ee30003c6558bb74cb467592.tar.xz |
New option for mplayer: -dumpmicrodvdsub
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7461 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | cfg-mplayer.h | 1 | ||||
-rw-r--r-- | mplayer.c | 1 | ||||
-rw-r--r-- | subreader.c | 34 | ||||
-rw-r--r-- | subreader.h | 1 |
4 files changed, 37 insertions, 0 deletions
diff --git a/cfg-mplayer.h b/cfg-mplayer.h index 5f39883d42..e33fdc308d 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -328,6 +328,7 @@ static config_t mplayer_opts[]={ {"dumpmpsub", &stream_dump_type, CONF_TYPE_FLAG, 0, 0, 4, NULL}, {"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}, #ifdef HAVE_LIRC {"lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL}, @@ -1204,6 +1204,7 @@ if(sh_video) { if(subtitles && stream_dump_type==3) list_sub_file(subtitles); 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); } #endif diff --git a/subreader.c b/subreader.c index daa6673893..fa10c71393 100644 --- a/subreader.c +++ b/subreader.c @@ -1007,6 +1007,40 @@ void dump_mpsub(subtitle* subs, float fps){ mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Subtitles dumped in \'dump.mpsub\'.\n"); } +void dump_microdvd(subtitle* subs, float fps) { + int i, delay; + FILE *fd; + if (sub_fps == 0) + sub_fps = fps; + fd = fopen("dumpsub.txt", "w"); + if (!fd) { + perror("dumpsub.txt: fopen"); + return; + } + delay = sub_delay * sub_fps; + for (i = 0; i < sub_num; ++i) { + int j, start, end; + start = subs[i].start; + end = subs[i].end; + if (sub_uses_time) { + start = start * sub_fps / 100 ; + end = end * sub_fps / 100; + } + else { + start = start * sub_fps / fps; + end = end * sub_fps / fps; + } + start -= delay; + end -= delay; + fprintf(fd, "{%d}{%d}", start, end); + for (j = 0; j < subs[i].lines; ++j) + fprintf(fd, "%s%s", j ? "|" : "", subs[i].text[j]); + fprintf(fd, "\n"); + } + fclose(fd); + mp_msg(MSGT_SUBREADER,MSGL_INFO,"SUB: Subtitles dumped in \'dumpsub.txt\'.\n"); +} + void sub_free( subtitle * subs ) { int i; diff --git a/subreader.h b/subreader.h index 8e91f4991e..f4adbc7654 100644 --- a/subreader.h +++ b/subreader.h @@ -40,6 +40,7 @@ char * sub_filename(char *path, char * fname); void list_sub_file(subtitle* subs); void dump_srt(subtitle* subs, float fps); void dump_mpsub(subtitle* subs, float fps); +void dump_microdvd(subtitle* subs, float fps); void sub_free( subtitle * subs ); void find_sub(subtitle* subtitles,int key); #endif |