view TOOLS/blocking.c @ 7787:05e518badc1b

doc fixes part 1 (more will come when i find the time to read the rest) if anything is not ok, please let me know documentation.html: * OGG -> OGG/OGM (both file formats are supported) * somewhat better wording (no real change of meaning) * update of the current xf86 version from 4.2.0 to 4.2.1 * mga_vid is not old * partial sync of the options with the manpage (someone with deeper knwoledge should check them and finish the sync) * added 2 links about quoting and correct writing of mails to the mailinglists formats.html: * fixing typo interleaved -> non-interleaved (at least i think it's a typo please someone check it) * non-interleaved AVIs should be played with -ni * OGG -> OGG/OGM
author attila
date Fri, 18 Oct 2002 17:57:05 +0000
parents b9ad3b70fc61
children
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>

#define BUFFSIZE (32*65536)

unsigned char *buffer[1];

int main(int argc,char* argv[]){

           fd_set rfds;
           struct timeval tv;
           int retval;
	   int in_fd=0; // stdin

	   buffer[0]=malloc(BUFFSIZE);
	   
	   if(argc>1) in_fd=open(argv[1],O_RDONLY|O_NONBLOCK);

while(1){
           FD_ZERO(&rfds); FD_SET(in_fd, &rfds);
           tv.tv_sec = 1;
           tv.tv_usec = 0;
           retval = select(in_fd+1, &rfds, NULL, NULL, &tv);

           if (retval){
	       if(FD_ISSET(in_fd, &rfds)){
		       // we can read input.
	               int len;
	               fprintf(stderr,"r");fflush(stderr);
		       len=read(in_fd,buffer[0],BUFFSIZE);
	               fprintf(stderr,"(%d)",len);fflush(stderr);
		}
	   } else {
	           fprintf(stderr,".");fflush(stderr);
	   }

           fprintf(stderr,"\n");fflush(stderr);
}

return 0;
}