[MPlayer-dev-eng] Fix in the GUI code + patch
Alexandr Kara
karaa9am at ss1000.ms.mff.cuni.cz
Wed Jan 2 11:15:12 CET 2002
Hello,
I fixed a bug in the GUI code where the
KeyPress and KeyRelease events were both
propagated to the next layer (so all
keys which swithed state were activated
twice - so the option didn't change).
I also added shortcut 't' for showing/hiding
the subtitles and 'r' to reload subtitles
(useful for repairing/creating subtitles on
the fly).
I am sorry, but I made the patch against
a 10 days old release so patch complains
a bit, but is seems OK with the current state.
Alexandr Kara (Alexandr.Kara at seznam.cz)
-------------- next part --------------
diff -Naur MP-orig/Gui/mplayer/mw.h MP-modified/Gui/mplayer/mw.h
--- MP-orig/Gui/mplayer/mw.h Thu Nov 22 19:52:25 2001
+++ MP-modified/Gui/mplayer/mw.h Wed Dec 26 14:51:50 2001
@@ -566,7 +567,10 @@
case wsS: msg=evStop; break;
case wsp:
case wsP: msg=evPlayList; break;
- default: vo_x11_putkey( Key ); return;
+ default:
+ if (Type == 1) // Only send KeyPress, not KeyRelease !
+ vo_x11_putkey( Key );
+ return;
}
if ( ( msg != evNone )&&( Type == wsKeyPressed ) )
{
diff -Naur MP-orig/mplayer.c MP-modified/mplayer.c
--- MP-orig/mplayer.c Tue Dec 4 22:04:17 2001
+++ MP-modified/mplayer.c Wed Dec 26 14:49:37 2001
@@ -238,6 +238,7 @@
float sub_delay=0;
float sub_fps=0;
int sub_auto = 1;
+int show_sub = 1; // Show/hide subtitles
/*DSP!!char *dsp=NULL;*/
extern char *vo_subdevice;
@@ -1838,6 +1839,32 @@
sub_delay += 0.1;
osd_show_sub_delay = 9; // show the subdelay in OSD
break;
+ case 't': // show/hide subtitles
+ {
+ static int press = 1;
+
+ if (press) {
+ show_sub = !show_sub;
+ }
+ else
+ press = 1;
+ /*
+ mp_msg(MSGT_CPLAYER,MSGL_INFO,"Subtitles: %d, use_stdin = %d, code = %d, %d, aux = %d\n",
+ show_sub, use_stdin, c, c, c - 't');
+ */
+ break;
+ }
+ case 'r': // reload subtitles
+ if(sub_name){
+ int l=strlen(sub_name);
+ if ((l>4) && ((0==strcmp(&sub_name[l-4],".utf"))
+ ||(0==strcmp(&sub_name[l-4],".UTF"))))
+ sub_utf8=1;
+ subtitles=sub_read_file(sub_name);
+ if(!subtitles || sub_num == 0)
+ mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,sub_name);
+ }
+ break;
case '9':
case '0':
case '*':
@@ -2125,6 +2152,8 @@
find_sub(subtitles,sub_uses_time?(100*(pts+sub_delay)):((pts+sub_delay)*sub_fps)); // FIXME! frame counter...
sub_last_pts = pts;
}
+ if (!show_sub)
+ vo_sub = NULL;
current_module=NULL;
}
#endif
More information about the MPlayer-dev-eng
mailing list