summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authordiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-07-30 20:19:23 +0000
committerdiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-07-30 20:19:23 +0000
commitf4a8670d96e90fc24749ff2a88173cd16f1f945b (patch)
treed2627cc2123cf9d1847bc04339bff2e6e271a2b7 /TOOLS
parent4deb67c3faeab4dbc063e5442c6d41df78c5de81 (diff)
downloadmpv-f4a8670d96e90fc24749ff2a88173cd16f1f945b.tar.bz2
mpv-f4a8670d96e90fc24749ff2a88173cd16f1f945b.tar.xz
Removed long obsolete files.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12921 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'TOOLS')
-rw-r--r--TOOLS/.cvsignore3
-rw-r--r--TOOLS/audio-select.c73
-rw-r--r--TOOLS/blocking.c47
-rw-r--r--TOOLS/buffer.c73
-rwxr-xr-xTOOLS/c2
-rw-r--r--TOOLS/cache.c121
-rw-r--r--TOOLS/cache2.c168
-rw-r--r--TOOLS/usleep-test.c26
8 files changed, 0 insertions, 513 deletions
diff --git a/TOOLS/.cvsignore b/TOOLS/.cvsignore
index f5dcbcda47..91a31d6e07 100644
--- a/TOOLS/.cvsignore
+++ b/TOOLS/.cvsignore
@@ -2,8 +2,6 @@ bios2dump
mem2dump
movinfo
cpuinfo
-audio-select
-audio-block
png2raw
fastmem-mmx
fastmem-k6
@@ -13,4 +11,3 @@ fastmem2-mmx
fastmem2-k6
fastmem2-k7
fastmem2-sse
-
diff --git a/TOOLS/audio-select.c b/TOOLS/audio-select.c
deleted file mode 100644
index 872245b5ef..0000000000
--- a/TOOLS/audio-select.c
+++ /dev/null
@@ -1,73 +0,0 @@
-// This small util discovers your audio driver's behaviour
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/soundcard.h>
-
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#define OUTBURST 128
-
-// Returns current time in microseconds
-unsigned int GetTimer(){
- struct timeval tv;
- struct timezone tz;
-// float s;
- gettimeofday(&tv,&tz);
-// s=tv.tv_usec;s*=0.000001;s+=tv.tv_sec;
- return (tv.tv_sec*1000000+tv.tv_usec);
-}
-
-static unsigned char a_buffer[OUTBURST];
-
-int main(){
- int audio_buffer_size;
- int r;
- int xxx=1024;
- int audio_fd;
- char *dsp="/dev/dsp";
- unsigned int t1,t2,t3;
-
- audio_fd=open(dsp, O_WRONLY);
- if(audio_fd<0){
- printf("Can't open audio device %s\n",dsp);
- return 1;
- }
-
- r=AFMT_S16_LE;ioctl (audio_fd, SNDCTL_DSP_SETFMT, &r);
- r=1; ioctl (audio_fd, SNDCTL_DSP_STEREO, &r);
- r=44100; if(ioctl (audio_fd, SNDCTL_DSP_SPEED, &r)==-1)
- printf("audio_setup: your card doesn't support %d Hz samplerate\n",r);
-
- t3=t1=GetTimer();
-
-while(xxx>0){
- audio_buffer_size=0;
- while(audio_buffer_size<0x100000){
- fd_set rfds;
- struct timeval tv;
- FD_ZERO(&rfds); FD_SET(audio_fd,&rfds);
- tv.tv_sec=0; tv.tv_usec = 0;
- if(!select(audio_fd+1, NULL, &rfds, NULL, &tv)) break;
- r=write(audio_fd,a_buffer,OUTBURST);
- if(r<0) printf("Error writting to device\n"); else
- if(r==0) printf("EOF writting to device???\n"); else
- audio_buffer_size+=r;
- }
- t2=GetTimer();
- if(audio_buffer_size>0){
- printf("%6d bytes written in %5d us (wait %5d us)\n",audio_buffer_size,t2-t1,t1-t3);
- --xxx;
- t3=t2;
- }
- t1=t2;
-}
-
-close(audio_fd);
-
-return 0;
-}
-
diff --git a/TOOLS/blocking.c b/TOOLS/blocking.c
deleted file mode 100644
index d7fb6aaf83..0000000000
--- a/TOOLS/blocking.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#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;
-}
-
diff --git a/TOOLS/buffer.c b/TOOLS/buffer.c
deleted file mode 100644
index bc568902a7..0000000000
--- a/TOOLS/buffer.c
+++ /dev/null
@@ -1,73 +0,0 @@
-
-// General purpose Ring-buffering routines
-
-#define BUFFSIZE (1024)
-#define NUM_BUFS (64)
-
-static unsigned char *buffer[NUM_BUFS];
-
-static unsigned int buf_read=0;
-static unsigned int buf_write=0;
-static unsigned int buf_read_pos=0;
-static unsigned int buf_write_pos=0;
-
-static int full_buffers=0;
-static int buffered_bytes=0;
-
-static int write_buffer(unsigned char* data,int len){
- int len2=0;
- int x;
- while(len>0){
- if(full_buffers==NUM_BUFS) break;
- x=BUFFSIZE-buf_write_pos;
- if(x>len) x=len;
- memcpy(buffer[buf_write]+buf_write_pos,data+len2,x);
- len2+=x; len-=x;
- buffered_bytes+=x; buf_write_pos+=x;
- if(buf_write_pos>=BUFFSIZE){
- // block is full, find next!
- buf_write=(buf_write+1)%NUM_BUFS;
- ++full_buffers;
- buf_write_pos=0;
- }
- }
- return len2;
-}
-
-static int read_buffer(unsigned char* data,int len){
- int len2=0;
- int x;
- while(len>0){
- if(full_buffers==0) break; // no more data buffered!
- x=BUFFSIZE-buf_read_pos;
- if(x>len) x=len;
- memcpy(data+len2,buffer[buf_read]+buf_read_pos,x);
- len2+=x; len-=x;
- buffered_bytes-=x; buf_read_pos+=x;
- if(buf_read_pos>=BUFFSIZE){
- // block is empty, find next!
- buf_read=(buf_read+1)%NUM_BUFS;
- --full_buffers;
- buf_read_pos=0;
- }
- }
- return len2;
-}
-
-static int get_space(){
- return (NUM_BUFS-full_buffers)*BUFFSIZE - buf_write_pos;
-}
-
-static int get_delay(){
- return buffered_bytes;
-}
-
-int main(int argc,char* argv[]){
-
- int i;
-
- for(i=0;i<NUM_BUFS;i++) buffer[i]=malloc(BUFFSIZE);
-
-return 0;
-}
-
diff --git a/TOOLS/c b/TOOLS/c
index 37a1230fbc..67f948142a 100755
--- a/TOOLS/c
+++ b/TOOLS/c
@@ -2,8 +2,6 @@ gcc bios2dump.c -o bios2dump
gcc mem2dump.c -o mem2dump
gcc movinfo.c -o movinfo
-gcc audio-select.c -o audio-select
-
gcc png2raw.c -o png2raw -lpng
gcc -g -DNAME=\"mmx\" -DHAVE_MMX fastmemcpybench.c -o fastmem-mmx
diff --git a/TOOLS/cache.c b/TOOLS/cache.c
deleted file mode 100644
index 8c587ea9f4..0000000000
--- a/TOOLS/cache.c
+++ /dev/null
@@ -1,121 +0,0 @@
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-//int open(const char *pathname, int flags);
-
-
-#define BUFFSIZE (4*65536)
-#define NUM_BUFS (16)
-
-unsigned char *buffer[NUM_BUFS];
-
-unsigned int buf_read=0;
-unsigned int buf_write=0;
-unsigned int buf_read_pos=0;
-unsigned int buf_write_pos=0;
-int full_buffers=0;
-
-int main(int argc,char* argv[]){
-
- fd_set rfds;
- fd_set wfds;
- struct timeval tv;
- int retval;
- int i;
-// int empty=1;
- int can_read=1;
- int eof=0;
- int in_fd=0; // stdin
-
- if(argc>1) in_fd=open(argv[1],O_RDONLY|O_NDELAY);
-
- for(i=0;i<NUM_BUFS;i++) buffer[i]=malloc(BUFFSIZE);
-
-while(1){
- /* Watch stdin (fd 0) to see when it has input. */
- FD_ZERO(&rfds); if(can_read){ FD_SET(in_fd, &rfds);}
- FD_ZERO(&wfds); FD_SET(1, &wfds);
- /* Wait up to five seconds. */
- tv.tv_sec = 1;
- tv.tv_usec = 0;
- retval = select((in_fd<1?1:in_fd)+1, &rfds, &wfds, NULL, &tv);
- /* Don't rely on the value of tv now! */
-
- if (retval){
- if(FD_ISSET(in_fd, &rfds) || !full_buffers){
- fprintf(stderr,"\n%d r",full_buffers);fflush(stderr);
- if(full_buffers==NUM_BUFS){
- // buffer is full!
- can_read=0;
- fprintf(stderr,"\n%d full!\n",full_buffers);fflush(stderr);
- } else {
- // we can read input.
- int len=BUFFSIZE-buf_read_pos;
- fprintf(stderr,"R");fflush(stderr);
- len=read(in_fd,buffer[buf_read]+buf_read_pos,len);
- fprintf(stderr,"(%d)\n",len);fflush(stderr);
- if(len>0){
- buf_read_pos+=len;
- if(buf_read_pos>=BUFFSIZE){
- // block is full, find next!
- buf_read=(buf_read+1)%NUM_BUFS;
- ++full_buffers;
- buf_read_pos=0;
- fprintf(stderr,"+");fflush(stderr);
- }
- } else {
- eof=1;
- }
- }
- }
- if(FD_ISSET(1, &wfds)){
- fprintf(stderr,"\n%d w",full_buffers);fflush(stderr);
- if(full_buffers==0){
- if(eof){
- // flush buffer!
- int pos=0;
- int len;
- fprintf(stderr,"\nf");fflush(stderr);
- while((len=buf_read_pos-pos)>0){
- len=write(1,buffer[buf_write]+pos,len);
- fprintf(stderr,"(%d)",len);fflush(stderr);
- if(len<=0) break;
- pos+=len;
- }
- exit(1);
- }
- fprintf(stderr," empty");fflush(stderr);
- //empty=1; // we must fill buffers!
- } else {
- // yeah, we can read from the buffer!
- int len=BUFFSIZE-buf_write_pos;
- fprintf(stderr,"W");fflush(stderr);
- len=write(1,buffer[buf_write]+buf_write_pos,len);
- fprintf(stderr,"(%d)",len);fflush(stderr);
- if(len>0){
- buf_write_pos+=len;
- if(buf_write_pos>=BUFFSIZE){
- // block is empty, find next!
- buf_write=(buf_write+1)%NUM_BUFS;
- --full_buffers;
- buf_write_pos=0;
- fprintf(stderr,"-");fflush(stderr);
- can_read=1;
- }
- }
- }
- }
- } else {
- fprintf(stderr,".");fflush(stderr);
- }
-}
-
-return 0;
-}
-
diff --git a/TOOLS/cache2.c b/TOOLS/cache2.c
deleted file mode 100644
index 0be7b44aa4..0000000000
--- a/TOOLS/cache2.c
+++ /dev/null
@@ -1,168 +0,0 @@
-
-// gcc cache2.c ../osdep/shmem.o -o cache2
-
-// Initial draft of my new cache system...
-// includes some simulation code, using usleep() to emulate limited bandwith
-// TODO: seeking, data consistency checking
-
-#define READ_SPEED 20
-#define FILL_SPEED 10
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "../osdep/shmem.h"
-
-typedef struct {
- // constats:
- void *buffer; // base pointer of the alllocated buffer memory
- int buffer_size; // size of the alllocated buffer memory
- int sector_size; // size of a single sector (2048/2324)
- // Note: buffer_size should be N*sector_size, where N is integer...
- int back_size; // we should keep back_size amount of old bytes for backward seek
- int fill_limit; // we should fill buffer if space>fill_limit
- // reader's pointers:
- int read_filepos;
- // filler's pointers:
- int min_filepos; // buffer contain only a part of the file, from min-max pos
- int max_filepos;
- int offset; // filepos <-> bufferpos offset value (filepos of the buffer's first byte)
- // commands/locking:
- int cmd_lock; // 1 if we will seek/reset buffer, 2 if we are ready for cmd
- int fifo_flag; // 1 if we should use FIFO to notice cache about buffer reads.
-} cache_vars_t;
-
-int min_fill=0;
-int sleep_flag=0;
-
-void cache_stats(cache_vars_t* s){
- int newb=s->max_filepos-s->read_filepos; // new bytes in the buffer
- printf("0x%06X [0x%06X] 0x%06X ",s->min_filepos,s->read_filepos,s->max_filepos);
- printf("%3d %% (%3d%%)\n",100*newb/s->buffer_size,100*min_fill/s->buffer_size);
-}
-
-int cache_read(cache_vars_t* s,int size){
- int total=0;
- while(size>0){
- int pos,newb,len;
-
- pos=s->read_filepos - s->offset;
- if(pos<0) pos+=s->buffer_size; else
- if(pos>=s->buffer_size) pos-=s->buffer_size;
-
- newb=s->max_filepos-s->read_filepos; // new bytes in the buffer
-
- if(newb<min_fill) min_fill=newb; // statistics...
-
- if(newb<=0){
- // waiting for buffer fill...
- usleep(10000); // 10ms
- continue;
- }
-
-// printf("*** newb: %d bytes ***\n",newb);
-
- if(newb>s->buffer_size-pos) newb=s->buffer_size-pos; // handle wrap...
- if(newb>size) newb=size;
-
- // len=write(mem,newb)
- printf("Buffer read: %d bytes\n",newb);
- len=newb;usleep(len*READ_SPEED*sleep_flag);
- // ...
-
- s->read_filepos+=len;
- size-=len;
- total+=len;
-
- }
- return total;
-}
-
-int cache_fill(cache_vars_t* s){
- int read,back,newb,space,len,pos,endpos;
-
- read=s->read_filepos;
-
- // calc number of back-bytes:
- back=read - s->min_filepos;
- if(back<0) back=0; // strange...
- if(back>s->back_size) back=s->back_size;
-
- // calc number of new bytes:
- newb=s->max_filepos - read;
- if(newb<0) newb=0; // strange...
-
- // calc free buffer space:
- space=s->buffer_size - (newb+back);
-
- // calc bufferpos:
- pos=s->max_filepos - s->offset;
- if(pos>=s->buffer_size) pos-=s->buffer_size; // wrap-around
-
- if(space<s->fill_limit){
-// printf("Buffer is full (%d bytes free, limit: %d)\n",space,s->fill_limit);
- return 0; // no fill...
- }
-
-// printf("### read=0x%X back=%d newb=%d space=%d pos=%d\n",read,back,newb,space,pos);
-
- // reduce space if needed:
- if(space>s->buffer_size-pos) space=s->buffer_size-pos;
-
- if(space>32768) space=32768; // limit one-time block size
-
- s->min_filepos=read-back; // avoid seeking-back to temp area...
-
- // ....
- printf("Buffer fill: %d bytes of %d\n",space,s->buffer_size);
- len=space; usleep(len*FILL_SPEED*sleep_flag);
- // ....
-
- s->max_filepos+=len;
- if(pos+len>=s->buffer_size){
- // wrap...
- s->offset+=s->buffer_size;
- }
-
- return len;
-
-}
-
-cache_vars_t* cache_init(int size,int sector){
- int num;
- cache_vars_t* s=shmem_alloc(sizeof(cache_vars_t));
- memset(s,0,sizeof(cache_vars_t));
- num=size/sector;
- s->buffer_size=num*sector;
- s->sector_size=sector;
- s->buffer=shmem_alloc(s->buffer_size);
- s->fill_limit=8*sector;
- s->back_size=size/2;
- return s;
-}
-
-int main(){
-
- cache_vars_t* s=cache_init(1024*1024,2048);
-
-// while(cache_fill(s)){ } // fill buffer:
-
- min_fill=s->buffer_size;
- sleep_flag=1; // start simulation
-
- if(fork()){
- while(1){
- if(!cache_fill(s)) usleep(10000); // wait 10ms for buffer space
- //cache_stats(s);
- }
- } else {
- srand(12345);
- while(1){
- int len=10+rand()&8191;
- cache_stats(s);
- cache_read(s,len);
- }
- }
-
-}
-
diff --git a/TOOLS/usleep-test.c b/TOOLS/usleep-test.c
deleted file mode 100644
index 936693b8bb..0000000000
--- a/TOOLS/usleep-test.c
+++ /dev/null
@@ -1,26 +0,0 @@
-
-main(){
-int u;
-
-for(u=0;u<30000;u+=500){
- unsigned int x[9];
- int i;
- x[0]=GetTimer();
- for(i=1;i<=8;i++){
- usleep(u);
- x[i]=GetTimer();
- }
- printf("%d -> %d %d %d %d %d %d %d %d\n",u,
- x[1]-x[0],
- x[2]-x[1],
- x[3]-x[2],
- x[4]-x[3],
- x[5]-x[4],
- x[6]-x[5],
- x[7]-x[6],
- x[8]-x[7]
- );
-}
-
-
-}