[MPlayer-dev-eng] [PATCH] pause handling

Andreas Hess jaska at gmx.net
Thu Dec 19 10:46:57 CET 2002


Hi!

Because no one reacted to my question how pause should work, I've fixed
it with my perceptions.


Andreas
-------------- next part --------------
Index: input/input.c
===================================================================
RCS file: /cvsroot/mplayer/main/input/input.c,v
retrieving revision 1.62
diff -u -r1.62 input.c
--- input/input.c	5 Dec 2002 00:15:56 -0000	1.62
+++ input/input.c	19 Dec 2002 10:13:39 -0000
@@ -107,6 +107,7 @@
   { MP_CMD_CRUN, "run", 1, { {MP_CMD_ARG_STRING,{0}}, {-1,{0}} } },
 #endif
   
+  { MP_CMD_ANYKEY, "anykey", 0, { {-1,{0}} } },
   { 0, NULL, 0, {} }
 };
 
@@ -733,10 +734,14 @@
   char* cmd = NULL;
   mp_cmd_t* ret;
 
-  if(cmd_binds)
-    cmd = mp_input_find_bind_for_key(cmd_binds,n,keys);
-  if(cmd == NULL)
-    cmd = mp_input_find_bind_for_key(def_cmd_binds,n,keys);
+  if(paused)
+    cmd = "anykey";
+  else {
+    if(cmd_binds)
+      cmd = mp_input_find_bind_for_key(cmd_binds,n,keys);
+    if(cmd == NULL)
+      cmd = mp_input_find_bind_for_key(def_cmd_binds,n,keys);
+  }
 
   if(cmd == NULL) {
     mp_msg(MSGT_INPUT,MSGL_WARN,"No bind found for key %s",mp_input_get_key_name(keys[0]));
Index: input/input.h
===================================================================
RCS file: /cvsroot/mplayer/main/input/input.h,v
retrieving revision 1.26
diff -u -r1.26 input.h
--- input/input.h	5 Dec 2002 00:15:56 -0000	1.26
+++ input/input.h	19 Dec 2002 10:13:39 -0000
@@ -37,6 +37,8 @@
 #define MP_CMD_GET_PERCENT_POS 35
 #define MP_CMD_SUB_STEP 36
 
+#define MP_CMD_ANYKEY 31337
+
 #define MP_CMD_GUI_EVENTS       5000
 #define MP_CMD_GUI_LOADFILE     5001
 #define MP_CMD_GUI_LOADSUBTITLE 5002
Index: libmenu/vf_menu.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmenu/vf_menu.c,v
retrieving revision 1.4
diff -u -r1.4 vf_menu.c
--- libmenu/vf_menu.c	22 Nov 2002 12:01:59 -0000	1.4
+++ libmenu/vf_menu.c	19 Dec 2002 10:13:39 -0000
@@ -25,7 +25,7 @@
 static struct vf_priv_s* st_priv = NULL;
 
 static mp_image_t* pause_mpi = NULL;
-static int go2pause = 0;
+//static int go2pause = 0;
 
 struct vf_priv_s {
   menu_t* root;
@@ -81,6 +81,11 @@
 static int cmd_filter(mp_cmd_t* cmd, int paused, struct vf_priv_s * priv) {
 
   switch(cmd->id) {
+/*
+ * Buggy!  Using pause in menu messes up pause handling with menu switched
+ * off.  For example you have to hit 'p' two times, and it displays an old
+ * frame, that was saved in the last menu-pause.
+ * 
   case MP_CMD_PAUSE :
     if(!paused && !go2pause) { // Initial pause cmd -> wait the next put_image
       go2pause = 1;
@@ -89,6 +94,7 @@
     if(go2pause == 2) // Msg resent by put_image after saving the image
       go2pause = 0;
     break;
+*/
   case MP_CMD_MENU : {  // Convert txt cmd from the users into libmenu stuff
     char* arg = cmd->args[0].v.s;
     
@@ -174,6 +180,11 @@
     menu_close(m);
   }
 
+/*
+ * Buggy!  Using pause in menu messes up pause handling with menu switched
+ * off.  For example you have to hit 'p' two times, and it displays an old
+ * frame, that was saved in the last menu-pause.
+ *
   // Step 1 : save the picture
   while(go2pause == 1) {
     static char delay = 0; // Hack : wait the 2 frame to be sure to show the right picture
@@ -192,6 +203,7 @@
     go2pause = 2;
     break;
   }
+*/
 
   // Grab // Ungrab the keys
   if(!mp_input_key_cb && vf->priv->current->show)
@@ -263,7 +275,7 @@
   vf->get_image = get_image;
   vf->uninit=uninit;
   vf->priv=st_priv;
-  go2pause=0;
+//  go2pause=0;
 
   return 1;
 }


More information about the MPlayer-dev-eng mailing list