[MPlayer-dev-eng] [PATCH] Quit notification for slave mode

Mike Swieton swietonm at student.gvsu.edu
Sun Sep 28 22:54:03 CEST 2003


Attached is a patch that will have mplayer display a parseable message when
mplayer in slave mode quits from a user's action (pressing Q, for example),
and a different message when mplayer runs out of file to play and exits on its
own. I updated the slave.txt documentation to reflect this change.

The intent here is to make it possible for a front end program driving mplayer
to behave differently in those two cases.

There may be a bug in this if there is a different way for the user to quit
that I have not covered. I looked at the x11 and xv drivers and they did not
appear to handle window closing, so I assumed I was safe. Please let me know
if this is incorrect.

Mike Swieton
--
Our earth is degenerate in these latter days. Bribery and corruption are
common. Children no longer obey their parents. Every man wants to write a
book... The end of the world is evidently approaching. 
	- On a stone slab carved in 2800 B.C. in Assyria
-------------- next part --------------
? fibmap_mplayer
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.729
diff -u -r1.729 mplayer.c
--- mplayer.c	27 Sep 2003 20:01:46 -0000	1.729
+++ mplayer.c	28 Sep 2003 21:27:42 -0000
@@ -2529,6 +2529,8 @@
       brk_cmd = 1;
     } break;
     case MP_CMD_QUIT : {
+	  if (slave_mode)
+		  mp_msg(MSGT_GLOBAL,MSGL_INFO,"ACT_QUIT_USER\n");
       exit_player_with_rc(MSGTR_Exit_quit, 0);
     }
     case MP_CMD_GRAB_FRAMES : {
@@ -3740,6 +3742,7 @@
 done_freetype();
 #endif
 
+if (slave_mode) mp_msg(MSGT_GLOBAL,MSGL_INFO,"ACT_QUIT_EOF\n");
 exit_player_with_rc(MSGTR_Exit_eof, 0);
 
 return 1;
Index: DOCS/tech/slave.txt
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/tech/slave.txt,v
retrieving revision 1.8
diff -u -r1.8 slave.txt
--- DOCS/tech/slave.txt	22 Sep 2003 09:19:41 -0000	1.8
+++ DOCS/tech/slave.txt	28 Sep 2003 21:27:43 -0000
@@ -1,8 +1,25 @@
 SLAVE MODE PROTOCOL
 -------------------
 
-If the -slave option is given, playback is controlled by a line-based protocol.
-Each line must contain one of the following commands:
+If the -slave option is given, playback is controlled by a line-based
+protocol, and some feedback from MPlayer is given in an easily parseable form.
+
+FEEDBACK
+--------
+
+The following feedback is given when in slave mode:
+
+ACT_QUIT_USER
+	Displayed when the user quits MPlayer, such as through pressing a key
+	bound to that command.
+ACT_QUIT_EOF
+	Displayed when MPlayer is about to exit after having finished playing the
+	last file.
+
+COMMANDS
+--------
+
+The following commands are valid:
 
 seek <value> [type=<0/\:1/\:2>]
 	Seek to some place in the movie.


More information about the MPlayer-dev-eng mailing list