Subversion Repositories shark

Rev

Rev 1085 | Blame | Compare with Previous | Last modification | View Log | RSS feed


#ifndef XREAD_H_
#define XREAD_H_

#include <stdio.h>

#define BUFFERMAXSIZE (128*1024l)

struct xbuffer {  
  int  handle;
  char buffer[BUFFERMAXSIZE+8];
  int  readptr;
  int  writeptr;
};
extern struct xbuffer *table[OPEN_MAX];

void x_init(void);

/* rate in bit/sec */
/* band in percentuale */
int x_initbuffer(int group, FILE *f, int rate, int band);

#define XUNUSEDPID 5821

/*
 *
 */


static __inline__ int filledspace(struct xbuffer *ptr)
{
  int size;
 
  if (ptr->writeptr==ptr->readptr) return 0;
 
  size=ptr->writeptr-ptr->readptr;
  if (size<0) size+=BUFFERMAXSIZE;
 
  return size;
}

static __inline__ int freespace(struct xbuffer *ptr)
{
  return BUFFERMAXSIZE-filledspace(ptr);
}

#endif