[Mplayer-cvslog] CVS: main/input input.c,1.70,1.71

Sascha Sommer CVS faust3 at mplayerhq.hu
Fri Apr 4 22:56:52 CEST 2003


Update of /cvsroot/mplayer/main/input
In directory mail:/var/tmp.root/cvs-serv21163/input

Modified Files:
	input.c 
Log Message:
allow select()less compilation

Index: input.c
===================================================================
RCS file: /cvsroot/mplayer/main/input/input.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- input.c	4 Apr 2003 15:04:25 -0000	1.70
+++ input.c	4 Apr 2003 20:56:29 -0000	1.71
@@ -784,15 +784,19 @@
 
 int
 mp_input_read_key_code(int time) {
+#ifndef HAVE_NO_POSIX_SELECT
   fd_set fds;
   struct timeval tv,*time_val;
+#endif
   int i,n=0,max_fd = 0;
   static int last_loop = 0;
 
   if(num_key_fd == 0)
     return MP_INPUT_NOTHING;
 
+#ifndef HAVE_NO_POSIX_SELECT
   FD_ZERO(&fds);
+#endif
   // Remove fd marked as dead and build the fd_set
   // n == number of fd's to be select() checked
   for(i = 0; (unsigned int)i < num_key_fd; i++) {
@@ -804,13 +808,16 @@
       continue;
     if(key_fds[i].fd > max_fd)
       max_fd = key_fds[i].fd;
+#ifndef HAVE_NO_POSIX_SELECT
     FD_SET(key_fds[i].fd,&fds);
+#endif
     n++;
   }
 
   if(num_key_fd == 0)
     return MP_INPUT_NOTHING;
 
+#ifndef HAVE_NO_POSIX_SELECT
 // if we have fd's without MP_FD_NO_SELECT flag, call select():
 if(n>0){
 
@@ -831,6 +838,7 @@
   }
 
 }
+#endif
 
   for(i = last_loop + 1 ; i != last_loop ; i++) {
     int code = -1;
@@ -841,9 +849,11 @@
       last_loop %= (num_key_fd+1);
       continue;
     }
+#ifndef HAVE_NO_POSIX_SELECT
     // No input from this fd
     if(! (key_fds[i].flags & MP_FD_NO_SELECT) && ! FD_ISSET(key_fds[i].fd,&fds))
       continue;
+#endif
     if(key_fds[i].fd == 0) { // stdin is handled by getch2
       code = getch2(time);
       if(code < 0)
@@ -959,8 +969,10 @@
 
 static mp_cmd_t*
 mp_input_read_cmds(int time) {
+#ifndef HAVE_NO_POSIX_SELECT
   fd_set fds;
   struct timeval tv,*time_val;
+#endif
   int i,n = 0,max_fd = 0,got_cmd = 0;
   mp_cmd_t* ret;
   static int last_loop = 0;
@@ -968,7 +980,9 @@
   if(num_cmd_fd == 0)
     return NULL;
 
+#ifndef HAVE_NO_POSIX_SELECT
   FD_ZERO(&fds);
+#endif
   for(i = 0; (unsigned int)i < num_cmd_fd ; i++) {
     if( (cmd_fds[i].flags & MP_FD_DEAD) || (cmd_fds[i].flags & MP_FD_EOF) ) {
       mp_input_rm_cmd_fd(cmd_fds[i].fd);
@@ -980,13 +994,16 @@
       got_cmd = 1;
     if(cmd_fds[i].fd > max_fd)
       max_fd = cmd_fds[i].fd;
+#ifndef HAVE_NO_POSIX_SELECT
     FD_SET(cmd_fds[i].fd,&fds);
+#endif
     n++;
   }
 
   if(num_cmd_fd == 0)
     return NULL;
 
+#ifndef HAVE_NO_POSIX_SELECT
   if(time >= 0) {
     tv.tv_sec=time/1000; 
     tv.tv_usec = (time%1000)*1000;
@@ -1006,6 +1023,7 @@
     }
     break;
   }
+#endif
 
   for(i = last_loop + 1; i !=  last_loop ; i++) {
     int r = 0;
@@ -1016,8 +1034,10 @@
       last_loop %= (num_cmd_fd+1);
       continue;
     }
+#ifndef HAVE_NO_POSIX_SELECT
     if( ! (cmd_fds[i].flags & MP_FD_NO_SELECT) && ! FD_ISSET(cmd_fds[i].fd,&fds) && ! (cmd_fds[i].flags & MP_FD_GOT_CMD) )
       continue;
+#endif
 
     r = mp_input_read_cmd(&cmd_fds[i],&cmd);
     if(r < 0) {



More information about the MPlayer-cvslog mailing list