--- old/input.c Wed Apr 3 19:58:17 2002 +++ input.c Mon Apr 8 17:55:49 2002 @@ -521,6 +521,8 @@ mp_fd->flags |= MP_FD_DROP; } + if (!(mp_fd->flags & MP_FD_GOT_CMD)) { + while( !(mp_fd->flags & MP_FD_EOF) && (mp_fd->size - mp_fd->pos > 1) ) { int r = ((mp_cmd_func_t)mp_fd->read_func)(mp_fd->fd,mp_fd->buffer+mp_fd->pos,mp_fd->size - 1 - mp_fd->pos); if(r < 0) { @@ -538,6 +540,9 @@ break; } + } + + mp_fd->flags &= ~MP_FD_GOT_CMD; while(1) { int l = 0; @@ -560,7 +565,7 @@ mp_fd->flags &= ~MP_FD_DROP; } if( mp_fd->pos - (l+1) > 0) - memmove(mp_fd->buffer,end,mp_fd->pos-(l+1)); + memmove(mp_fd->buffer,end+1,mp_fd->pos-(l+1)); mp_fd->pos -= l+1; } @@ -786,13 +791,17 @@ mp_input_read_cmds(int time) { fd_set fds; struct timeval tv,*time_val; - int i,n = 0,max_fd = 0; + int i,n = 0,max_fd = 0,got_cmd = 0; mp_cmd_t* ret; static int last_loop = 0; if(num_cmd_fd == 0) return NULL; + for(i = 0; (unsigned int)i < num_cmd_fd ; i++) { + if (cmd_fds[i].flags & MP_FD_GOT_CMD) got_cmd = 1; + } + FD_ZERO(&fds); 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) ) { @@ -816,7 +825,7 @@ time_val = &tv; } else time_val = NULL; - + while(n > 0) { if((i = select(max_fd+1,&fds,NULL,NULL,time_val)) <= 0) { if(i < 0) { @@ -824,7 +833,7 @@ continue; mp_msg(MSGT_INPUT,MSGL_ERR,"Select error : %s\n",strerror(errno)); } - return NULL; + if (!got_cmd) return NULL; } break; }