[MPlayer-dev-eng] [PATCH] Patch for better pause support.

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Tue Aug 26 19:57:31 CEST 2008


On Mon, Aug 25, 2008 at 02:09:18PM -0400, Robert Cummings wrote:
> On Thu, 2008-08-07 at 12:39 +0200, Reimar Doeffinger wrote:
> >
> > The basic idea seems sound, the implementation has a few rough edges though
> > like duplicating some of the code in the while(). I am also unsure if/how
> > this could be extended to handle get_property/set_property etc. properly.
> > Unless someone else steps up to work on it, you will have to wait until
> > I again have internet at home (probably around August 12th).
> 
> *bump* :)

Ok, my problem is do not know what exactly 90 % of the code is there
for, how much of it is possibly workarounds for bugs elsewhere etc.
That's what attached patch is for, I'd like to know what problems
there are with it (someone testing the dvdnav mouse support with that
change probably is a good idea), particularly if you consider any
critical (if not, I'd find it preferable to apply that and work forward
from there).
Also I think it might be better to let the user always select this
"mode" explicitly (possibly with another pausing_... prefix).

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: input/input.c
===================================================================
--- input/input.c	(revision 27416)
+++ input/input.c	(working copy)
@@ -46,6 +46,8 @@
 /// Then comes the definition of each argument, terminated with an arg of type -1.
 /// A command can take a maximum of MP_CMD_MAX_ARGS-1 arguments (-1 because of
 /// the last one) which is actually 9.
+/// Finally, a fifth field can optionally be set to 1 to indicate that the command
+/// can remain in the pause loop (if mplayer is paused) after having been processed.
 
 /// For the args, the first field is the type (actually int, float or string), the second
 /// is the default value wich is used for optional arguments
@@ -103,7 +106,7 @@
   { MP_CMD_ASS_USE_MARGINS, "ass_use_margins", 0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } },
 #endif
   { MP_CMD_GET_PERCENT_POS, "get_percent_pos", 0, { {-1,{0}} } },
-  { MP_CMD_GET_TIME_POS, "get_time_pos", 0, { {-1,{0}} } },
+  { MP_CMD_GET_TIME_POS, "get_time_pos", 0, { {-1,{0}} }, 1 },
   { MP_CMD_GET_TIME_LENGTH, "get_time_length", 0, { {-1,{0}} } },
   { MP_CMD_GET_FILENAME, "get_file_name", 0, { {-1,{0}} } },
   { MP_CMD_GET_VIDEO_CODEC, "get_video_codec", 0, { {-1,{0}} } },
@@ -190,7 +192,7 @@
   { MP_CMD_STEP_PROPERTY, "step_property", 1, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
   
   { MP_CMD_SEEK_CHAPTER, "seek_chapter", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
-  { MP_CMD_SET_MOUSE_POS, "set_mouse_pos", 2, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
+  { MP_CMD_SET_MOUSE_POS, "set_mouse_pos", 2, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} }, 1 },
   
   { 0, NULL, 0, {} }
 };
@@ -796,6 +799,7 @@
   cmd = calloc(1, sizeof(mp_cmd_t));
   cmd->id = cmd_def->id;
   cmd->name = strdup(cmd_def->name);
+  cmd->stay_pause_loop = cmd_def->stay_pause_loop;
   cmd->pausing = pausing;
 
   ptr = str;
Index: input/input.h
===================================================================
--- input/input.h	(revision 27416)
+++ input/input.h	(working copy)
@@ -192,6 +193,7 @@
   char* name;
   int nargs;
   mp_cmd_arg_t args[MP_CMD_MAX_ARGS];
+  int stay_pause_loop;
   int pausing;
 } mp_cmd_t;
 
Index: mplayer.c
===================================================================
--- mplayer.c   (revision 27416)
+++ mplayer.c   (working copy)
@@ -2353,9 +2360,10 @@
        mpctx->audio_out->pause();      // pause audio, keep data if possible
 
     while ( (cmd = mp_input_get_cmd(20, 1, 1)) == NULL
-            || cmd->id == MP_CMD_SET_MOUSE_POS) {
+            || cmd->stay_pause_loop) {
        if (cmd) {
          cmd = mp_input_get_cmd(0,1,0);
+         run_command(mpctx, cmd);
          mp_cmd_free(cmd);
          continue;
        }


More information about the MPlayer-dev-eng mailing list