view TOOLS/blocking.c @ 9344:bd7b5078475e

1) codecs.conf changed recently and demux_gif no longer needs to spit out BGR8 upside-down. the workaround for this is removed. 2) fixes a bug so that streaming gifs now works, and removes a workaround no longer needed. now libgif uses mplayer's stream_read function and thus http streaming, etc, works with demux_gif. 3) cosmetic clean-up because i no longer plan to support certain GIF extensions that would be more difficult to implement. patch by Joey Parrish <joey@nicewarrior.org>
author arpi
date Sat, 08 Feb 2003 15:49:03 +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;
}