[MPlayer-dev-eng] [PATCH] "pausing" command prefix

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Fri Nov 12 15:28:24 CET 2004


Hi,
I'd like to get some comments from you on this patch, which introduces a
"pausing" command prefix. This prefix causes MPlayer to go into paused
mode as soon as possible after executing the command.
My main use for it currently is that allows me to have a very close look
at what MPlayer does step by step after executing a command (e.g. with
-vo x11 -zoom first the window will be resized and only after one
additional frame_step the video will have the right new size as
well...).
It's not much code, so tell me if I should commit it even though MPlayer
is not made to work too well with it (as said above, e.g. the fullscreen
command can take more than one frame to complete)...

Greetings,
Reimar Döffinger
-------------- next part --------------
diff -u input/input.c input/input.c
--- input/input.c	2004-10-30 13:45:23.000000000 +0200
+++ input/input.c	2004-11-12 14:57:17.970095861 +0100
@@ -542,6 +542,7 @@
 mp_cmd_t*
 mp_input_parse_cmd(char* str) {
   int i,l;
+  int pausing = 0;
   char *ptr,*e;
   mp_cmd_t *cmd, *cmd_def;
 
@@ -549,6 +550,11 @@
   assert(str != NULL);
 #endif
 
+  if (strncmp(str, "pausing ", 8) == 0) {
+    pausing = 1;
+    str = &str[8];
+  }
+
   for(ptr = str ; ptr[0] != '\0'  && ptr[0] != '\t' && ptr[0] != ' ' ; ptr++)
     /* NOTHING */;
   if(ptr[0] != '\0')
@@ -572,6 +578,7 @@
   cmd = (mp_cmd_t*)malloc(sizeof(mp_cmd_t));
   cmd->id = cmd_def->id;
   cmd->name = strdup(cmd_def->name);
+  cmd->pausing = pausing;
 
   ptr = str;
 
diff -u input/input.h input/input.h
--- input/input.h	2004-10-20 22:20:37.000000000 +0200
+++ input/input.h	2004-11-12 14:56:49.593989237 +0100
@@ -139,6 +139,7 @@
   char* name;
   int nargs;
   mp_cmd_arg_t args[MP_CMD_MAX_ARGS];
+  int pausing;
 } mp_cmd_t;
 
 
--- mplayer.c	2004-11-09 23:18:18.000000000 +0100
+++ mplayer.c	2004-11-12 15:09:33.809065871 +0100
@@ -2735,7 +2735,7 @@
     } break;
     case MP_CMD_FRAME_STEP :
     case MP_CMD_PAUSE : {
-      osd_function=OSD_PAUSE;
+      cmd->pausing = 1;
       brk_cmd = 1;
     } break;
     case MP_CMD_QUIT : {
@@ -3650,6 +3650,8 @@
       mp_msg(MSGT_CPLAYER, MSGL_V, "Received unknown cmd %s\n",cmd->name);
     }
     }
+    if (cmd->pausing)
+      osd_function = OSD_PAUSE;
     mp_cmd_free(cmd);
   }
 }


More information about the MPlayer-dev-eng mailing list