changeset 17241:3ab613cdf96a

add "pausing_keep" and "pausing_toggle" input cmd prefixes
author ods15
date Sun, 25 Dec 2005 19:22:48 +0000
parents 11459d1ff17c
children c38832db3aba
files DOCS/tech/slave.txt input/input.c mplayer.c
diffstat 3 files changed, 25 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/tech/slave.txt	Sun Dec 25 18:26:35 2005 +0000
+++ b/DOCS/tech/slave.txt	Sun Dec 25 19:22:48 2005 +0000
@@ -15,9 +15,12 @@
 necessarily under the same name. Detailed descriptions can be found in the
 man page.
 
-All commands can be prefixed with "pausing ", causing MPlayer to pause as soon
-as possible after processing the command. Please note that this can be before
-the command is fully executed.
+All commands can be prefixed with one of "pausing ", "pausing_keep ", or
+"pausing_toggle ". "pausing " tells MPlayer to pause as soon as possible
+after processing the command. "pausing_keep " tells MPlayer to do so only if
+it was already in paused mode. "pausing_toggle " tells MPlayer to do so
+only if it was not already in paused mode. Please note that "as soon as
+possible" can be before the command is fully executed.
 
 
 Available commands ('mplayer -input cmdlist' will print a list):
--- a/input/input.c	Sun Dec 25 18:26:35 2005 +0000
+++ b/input/input.c	Sun Dec 25 19:22:48 2005 +0000
@@ -600,6 +600,12 @@
   if (strncmp(str, "pausing ", 8) == 0) {
     pausing = 1;
     str = &str[8];
+  } else if (strncmp(str, "pausing_keep ", 13) == 0) {
+    pausing = 2;
+    str = &str[13];
+  } else if (strncmp(str, "pausing_toggle ", 15) == 0) {
+    pausing = 3;
+    str = &str[15];
   }
 
   for(ptr = str ; ptr[0] != '\0'  && ptr[0] != '\t' && ptr[0] != ' ' ; ptr++)
--- a/mplayer.c	Sun Dec 25 18:26:35 2005 +0000
+++ b/mplayer.c	Sun Dec 25 19:22:48 2005 +0000
@@ -2448,6 +2448,7 @@
 float next_frame_time=0;
 int frame_time_remaining=0; // flag
 int blit_frame=0;
+int was_paused=0;
 
 osd_text_buffer[0]=0;
 // make sure OSD old does not stay around,
@@ -3047,6 +3048,7 @@
         guiGetEvent( guiCEvent,(char *)guiSetPlay );
        }
 #endif
+      was_paused = 1;
   }
 
 // handle -sstep
@@ -4129,11 +4131,20 @@
       mp_msg(MSGT_CPLAYER, MSGL_V, "Received unknown cmd %s\n",cmd->name);
     }
     }
-    if (cmd->pausing)
-      osd_function = OSD_PAUSE;
+    switch (cmd->pausing) {
+      case 1: // "pausing"
+        osd_function = OSD_PAUSE;
+        break;
+      case 3: // "pausing_toggle"
+        was_paused = !was_paused;
+        // fall through
+      case 2: // "pausing_keep"
+        if (was_paused) osd_function = OSD_PAUSE;
+    }
     mp_cmd_free(cmd);
   }
 }
+  was_paused = 0;
 
   if (seek_to_sec) {
     int a,b; float d;