[MPlayer-dev-eng] Feature patch
Sergei Golubchik
sergii at pisem.net
Sun Oct 7 23:28:26 CEST 2001
Hi.
So, here's a patch for MPlayer-0.50pre3 (not CVS!).
It adds -makesub (and -nomakesub) switch, which enables "makesub" mode.
In this mode subtitles are not changed in sync with the video stream.
Instead one should change them manually. 'c' and 'v' goes to the
prev/next sub. 'b' sets `start' time of the sub on the screen to current
frame. 'n' sets 'end' time of the sub on the screen to current frame and
moves to the next sub. On exit list_sub_file() is called.
An idea was to convert a film script (which is much easier to find than
subtitles) into simplified subtitle file - without precise time information -
and change subtitles manually with 'n' key. ('c' and 'b' are like FF
and REW). As 'n' key updates time marks for subtitles list_sub_file()
output (printed on exit) can be easily converted into real subtitle
file.
Regards,
Sergei
-------------- next part --------------
diff -ruBb MPlayer-0.50pre3/cfg-mplayer.h MPlayer-0.50pre3-new/cfg-mplayer.h
--- MPlayer-0.50pre3/cfg-mplayer.h Wed Oct 3 16:41:39 2001
+++ MPlayer-0.50pre3-new/cfg-mplayer.h Sun Oct 7 20:48:43 2001
@@ -122,6 +122,8 @@
{"subdelay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0},
{"subfps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0},
{"noautosub", &sub_auto, CONF_TYPE_FLAG, 0, 1, 0},
+ {"makesub", &sub_make, CONF_TYPE_FLAG, 0, 0, 1},
+ {"nomakesub", &sub_make, CONF_TYPE_FLAG, 0, 1, 0},
{"unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1},
{"nounicode", &sub_unicode, CONF_TYPE_FLAG, 0, 1, 0},
{"utf8", &sub_utf8, CONF_TYPE_FLAG, 0, 0, 1},
diff -ruBb MPlayer-0.50pre3/find_sub.c MPlayer-0.50pre3-new/find_sub.c
--- MPlayer-0.50pre3/find_sub.c Mon Jul 30 04:00:54 2001
+++ MPlayer-0.50pre3-new/find_sub.c Sun Oct 7 22:15:14 2001
@@ -20,6 +20,33 @@
void find_sub(subtitle* subtitles,int key){
int i,j;
+
+ // sub_make mode
+ switch (sub_make) {
+ case 0:
+ break; // normal - no sub_make - mode
+ case ' ': // do-nothing
+ return;
+ case 'b': // mark current
+ subtitles[current_sub].start=key;
+ sub_make=' ';
+ return;
+ case 'n': // save current, go next
+ subtitles[current_sub].end=key;
+ vo_sub=&subtitles[++current_sub];
+ sub_make=' ';
+ return;
+ case 'c': // go prev
+ if (current_sub>0) vo_sub=&subtitles[--current_sub];
+ sub_make=' ';
+ return;
+ case 'v': // go next
+ default:
+ if (current_sub+1<sub_num) vo_sub=&subtitles[++current_sub];
+ sub_make=' ';
+ return;
+ }
+
if(vo_sub){
if(key>=vo_sub->start && key<=vo_sub->end) return; // OK!
} else {
diff -ruBb MPlayer-0.50pre3/mplayer.c MPlayer-0.50pre3-new/mplayer.c
--- MPlayer-0.50pre3/mplayer.c Tue Oct 2 01:32:45 2001
+++ MPlayer-0.50pre3-new/mplayer.c Sun Oct 7 22:16:49 2001
@@ -271,6 +271,7 @@
float sub_delay=0;
float sub_fps=0;
int sub_auto = 1;
+int sub_make=0;
/*DSP!!char *dsp=NULL;*/
//float initial_pts_delay=0;
@@ -668,6 +669,7 @@
#endif
if(subtitles && stream_dump_type==3) list_sub_file(subtitles);
+ if(!subtitles) sub_make=0;
stream=NULL;
demuxer=NULL;
@@ -1670,7 +1672,9 @@
break;
// quit
case KEY_ESC: // ESC
- case 'q': exit_player(MSGTR_Exit_quit);
+ case 'q':
+ if(sub_make) list_sub_file(subtitles);
+ exit_player(MSGTR_Exit_quit);
case KEY_ENTER: // ESC
eof=1; // jump to next file
break;
@@ -1689,6 +1693,12 @@
case 'x':
sub_delay += 0.1;
break;
+ case 'c':
+ case 'v':
+ case 'b':
+ case 'n':
+ if(sub_make) sub_make=c;
+ break;
case '9':
case '0':
case '*':
@@ -1983,6 +1993,7 @@
goto play_next_file;
}
+if(sub_make) list_sub_file(subtitles);
exit_player(MSGTR_Exit_eof);
return 1;
diff -ruBb MPlayer-0.50pre3/subreader.c MPlayer-0.50pre3-new/subreader.c
--- MPlayer-0.50pre3/subreader.c Thu Aug 30 00:01:04 2001
+++ MPlayer-0.50pre3-new/subreader.c Sun Oct 7 20:34:07 2001
@@ -525,6 +525,7 @@
}
#if 0
+int sub_utf8;
int main(int argc, char **argv) { // for testing
int i,j;
diff -ruBb MPlayer-0.50pre3/subreader.h MPlayer-0.50pre3-new/subreader.h
--- MPlayer-0.50pre3/subreader.h Tue Oct 2 23:45:41 2001
+++ MPlayer-0.50pre3-new/subreader.h Sun Oct 7 21:36:21 2001
@@ -2,6 +2,7 @@
#ifndef __MPLAYER_SUBREADER_H
#define __MPLAYER_SUBREADER_H
+extern int sub_make;
extern int sub_uses_time;
extern int sub_errs;
extern int sub_num; // number of subtitle structs
More information about the MPlayer-dev-eng
mailing list