[Mplayer-cvslog] CVS: main mplayer.c,1.334,1.335 cfg-mplayer.h,1.110,1.111

Arpi of Ize arpi at mplayer.dev.hu
Tue Dec 4 22:04:19 CET 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv15608

Modified Files:
	mplayer.c cfg-mplayer.h 
Log Message:
-slave patch by Kilian A. Foth <foth at informatik.uni-hamburg.de>

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.334
retrieving revision 1.335
diff -u -r1.334 -r1.335
--- mplayer.c	4 Dec 2001 00:26:45 -0000	1.334
+++ mplayer.c	4 Dec 2001 21:04:17 -0000	1.335
@@ -73,6 +73,7 @@
 #include "Gui/mplayer/play.h"
 #endif
 
+int slave_mode=0;
 int verbose=0;
 int quiet=0;
 
@@ -1245,7 +1246,7 @@
 
 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_StartPlaying);fflush(stdout);
 
-if(!use_stdin){
+if(!use_stdin && !slave_mode){
   getch2_enable();  // prepare stdin for hotkeys...
   inited_flags|=INITED_GETCH2;
 }
@@ -1682,7 +1683,23 @@
 #endif
       if (audio_out && sh_audio)
          audio_out->pause();	// pause audio, keep data if possible
-         while(
+
+      if(slave_mode) {
+        fd_set set;
+        struct timeval timeout;
+        while (1) {
+          usec_sleep(1000);
+          FD_ZERO (&set);
+          FD_SET (STDIN_FILENO, &set);
+          timeout.tv_sec = 0;
+          timeout.tv_usec = 1000;
+          if(1==select(FD_SETSIZE, &set, NULL, NULL, &timeout)) {
+            break;
+          }
+        }
+      } else {
+
+        while(
 #ifdef HAVE_LIRC
              lirc_mp_getinput()<=0 &&
 #endif
@@ -1699,6 +1716,7 @@
 #endif
              if(use_stdin) usec_sleep(1000); // do not eat the CPU
          }
+      }
          osd_function=OSD_PLAY;
       if (audio_out && sh_audio)
         audio_out->resume();	// resume audio
@@ -1721,6 +1739,39 @@
 
 //================= Keyboard events, SEEKing ====================
 
+/* slave mode */ 
+ if(slave_mode) {
+   char buffer[1024];
+   fd_set set;
+   struct timeval timeout;
+   int arg;
+   
+   FD_ZERO (&set);
+   FD_SET (STDIN_FILENO, &set);
+   timeout.tv_sec = 0;
+   timeout.tv_usec = 1000;
+  
+   if(1 == select (FD_SETSIZE, &set, NULL, NULL, &timeout)) {
+     fgets(buffer, 1024, stdin);
+     if(!strcmp("play\n", buffer)) {
+       osd_function=OSD_PLAY;
+     } else if(!strcmp("stop\n", buffer)) {
+       osd_function=OSD_PAUSE;
+     } else if(!strncmp("seek ", buffer, 5)) {
+       sscanf(buffer+5, "%d", &arg);
+       rel_seek_secs = arg-d_video->pts;
+     } else if(!strncmp("skip ", buffer, 5)) {
+       sscanf(buffer+5, "%d", &arg);
+       rel_seek_secs = arg;
+     } else if(!strcmp("quit\n", buffer)) {
+       exit_player(MSGTR_Exit_quit);
+     } 
+   } else {
+     osd_function=OSD_PLAY;
+   }
+ } else
+ 
+/* interactive mode */
 { int c;
   while(
 #ifdef HAVE_LIRC

Index: cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- cfg-mplayer.h	3 Dec 2001 14:05:02 -0000	1.110
+++ cfg-mplayer.h	4 Dec 2001 21:04:17 -0000	1.111
@@ -244,6 +244,8 @@
 	{"nodapsync", &dapsync, CONF_TYPE_FLAG, 0, 1, 0},
 	{"softsleep", &softsleep, CONF_TYPE_FLAG, 0, 0, 1},
 
+	{"slave", &slave_mode, CONF_TYPE_FLAG, 0, 0, 1},
+
 
 #define MAIN_CONF
 #include "cfg-common.h"




More information about the MPlayer-cvslog mailing list