Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1085 pj 1
 
2
#ifndef XREAD_H_
3
#define XREAD_H_
4
 
5
#include <stdio.h>
6
 
7
#define BUFFERMAXSIZE (128*1024l)
8
 
9
struct xbuffer {  
10
  int  handle;
11
  char buffer[BUFFERMAXSIZE+8];
12
  int  readptr;
13
  int  writeptr;
14
};
15
extern struct xbuffer *table[OPEN_MAX];
16
 
17
void x_init(void);
18
 
19
/* rate in bit/sec */
20
/* band in percentuale */
21
int x_initbuffer(int group, FILE *f, int rate, int band);
22
 
23
#define XUNUSEDPID 5821
24
 
25
/*
26
 *
27
 */
28
 
29
static __inline__ int filledspace(struct xbuffer *ptr)
30
{
31
  int size;
32
 
33
  if (ptr->writeptr==ptr->readptr) return 0;
34
 
35
  size=ptr->writeptr-ptr->readptr;
36
  if (size<0) size+=BUFFERMAXSIZE;
37
 
38
  return size;
39
}
40
 
41
static __inline__ int freespace(struct xbuffer *ptr)
42
{
43
  return BUFFERMAXSIZE-filledspace(ptr);
44
}
45
 
46
#endif