view TOOLS/blocking.c @ 10252:d275152390ee

I've found some time to implement the encoding support for the new DivX API. Now it's possible to play and encode movies with the latest DivX release. One thing that doesn't work is the new Video Buffer Verifier (VBV) multipass encoding. The encoder segfaults. Maybe it just isn't supported with the standard profile of the released binary encoder. Andreas Hess <jaska@gmx.net>
author arpi
date Fri, 06 Jun 2003 19:57:37 +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;
}