mirror of
https://github.com/mpv-player/mpv
synced 2024-12-28 06:03:45 +01:00
New option for mplayer: -dumpmicrodvdsub
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7461 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
b9ce5ed76c
commit
5f9adff3f6
@ -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
|
||||
|
||||
|
34
subreader.c
34
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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user