[MPlayer-dev-eng] 2 Patches: fix a GUI error, adds hiding subtitles option

Alexandr Kara karaa9am at ss1000.ms.mff.cuni.cz
Wed Jan 9 13:00:05 CET 2002


Hello, I am sending two very small patches.
Both are tested.

One fixes the behaviour of the Gui, because it
propagates key presses and key releases in
the same way to the lower level (mplayer.c).
The result is that when a user presses a key,
the message always arrives at least twice,
so enable/disable options are left inchanged.
The non-Gui player doesn't do that.

The second adds a possibility to show/hide
subtitles (usefull when you want to play
a movie you generally understand, but
sometimes you want to see the subtitles).
I added a shortcut 't' (as subTitles),
but I don't mind if it changes.

Have a nice day,
Alexandr Kara (Alexandr.Kara at seznam.cz)
-------------- next part --------------
diff -Naur MPlayer-20020109-old/Gui/mplayer/mw.h MPlayer-20020109/Gui/mplayer/mw.h
--- MPlayer-20020109-old/Gui/mplayer/mw.h	Wed Dec 19 17:55:31 2001
+++ MPlayer-20020109/Gui/mplayer/mw.h	Wed Jan  9 12:40:20 2002
@@ -612,7 +612,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 ) )
   {
-------------- next part --------------
diff -Naur MPlayer-20020109-old/mplayer.c MPlayer-20020109/mplayer.c
--- MPlayer-20020109-old/mplayer.c	Tue Jan  8 15:10:22 2002
+++ MPlayer-20020109/mplayer.c	Wed Jan  9 12:47:59 2002
@@ -248,6 +248,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;
@@ -1982,6 +1983,21 @@
       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 '9':
     case '0':
     case '*':
@@ -2272,6 +2288,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