[MPlayer-dev-eng] [PATCH] "staying" and "aletrnating" input prefixes
Oded Shimon
ods15 at ods15.dyndns.org
Sun Dec 25 07:52:22 CET 2005
along with "pausing", this patch bring 2 new input prefixes, "staying" and
"alternating". "staying" causes mplayer to pause if it was already paused
when command was given, and not otherwise. "alternating" does the exact
opposite.
Addmittedly, "alternating" is rather odd, but believe it or not I actually
do have a use for it... And it's not a big deal to implement, so why not. :)
If noone objects I'll commit tommorrow. Documenters, you might want to
improove what I wrote in slave.txt ...
- ods15
-------------- next part --------------
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.894
diff -u -r1.894 mplayer.c
--- mplayer.c 7 Dec 2005 05:12:07 -0000 1.894
+++ mplayer.c 25 Dec 2005 06:46:41 -0000
@@ -2449,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,
@@ -3048,6 +3048,7 @@
guiGetEvent( guiCEvent,(char *)guiSetPlay );
}
#endif
+ was_paused = 1;
}
// handle -sstep
@@ -4130,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: // "alternating"
+ was_paused = !was_paused;
+ // fall through
+ case 2: // "staying"
+ if (was_paused) osd_function = OSD_PAUSE;
+ }
mp_cmd_free(cmd);
}
}
+ was_paused = 0;
if (seek_to_sec) {
int a,b; float d;
Index: input/input.c
===================================================================
RCS file: /cvsroot/mplayer/main/input/input.c,v
retrieving revision 1.128
diff -u -r1.128 input.c
--- input/input.c 11 Nov 2005 13:25:48 -0000 1.128
+++ input/input.c 25 Dec 2005 06:46:47 -0000
@@ -600,6 +600,12 @@
if (strncmp(str, "pausing ", 8) == 0) {
pausing = 1;
str = &str[8];
+ } else if (strncmp(str, "staying ", 8) == 0) {
+ pausing = 2;
+ str = &str[8];
+ } else if (strncmp(str, "alternating ", 12) == 0) {
+ pausing = 3;
+ str = &str[12];
}
for(ptr = str ; ptr[0] != '\0' && ptr[0] != '\t' && ptr[0] != ' ' ; ptr++)
Index: DOCS/tech/slave.txt
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/tech/slave.txt,v
retrieving revision 1.50
diff -u -r1.50 slave.txt
--- DOCS/tech/slave.txt 12 Dec 2005 01:34:41 -0000 1.50
+++ DOCS/tech/slave.txt 25 Dec 2005 06:46:47 -0000
@@ -15,9 +15,11 @@
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 "pausing ", "staying ", or "alternating "
+causing MPlayer to pause as soon as possible after processing the command,
+or only if player was already in paused mode, or only if MPlayer was not in
+paused mode, respectively. Please note that this can be before the command
+is fully executed.
Available commands ('mplayer -input cmdlist' will print a list):
More information about the MPlayer-dev-eng
mailing list