Statistics
| Branch: | Tag: | Revision:

dvbd / ringbuffy.h @ bfdb7446

History | View | Annotate | Download (1.54 KB)

1
/* 
2
    Ringbuffer Implementation for gtvscreen
3

4
    Copyright (C) 2000 Marcus Metzler (mocm@metzlerbros.de)
5

6
    This program is free software; you can redistribute it and/or modify
7
    it under the terms of the GNU General Public License as published by
8
    the Free Software Foundation; either version 2 of the License, or
9
    (at your option) any later version.
10

11
    This program is distributed in the hope that it will be useful,
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
    GNU General Public License for more details.
15

16
    You should have received a copy of the GNU General Public License
17
    along with this program; if not, write to the Free Software
18
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
*/
20

    
21
#ifndef RINGBUFFY_H
22
#define RINGBUFFY_H
23

    
24
#include <stdio.h>
25
#include <stdlib.h>
26
#include <unistd.h>
27

    
28
#ifdef __cplusplus
29
extern "C" {
30
#endif                                /* __cplusplus */
31

    
32
#define FULL_BUFFER  -1000
33
typedef struct ringbuffy{
34
        int read_pos;
35
        int write_pos;
36
        int size;
37
        char *buffy;
38
} ringbuffy;
39

    
40
int  ring_init (ringbuffy *rbuf, int size);
41
void ring_destroy(ringbuffy *rbuf);
42
int ring_write(ringbuffy *rbuf, char *data, int count);
43
int ring_read(ringbuffy *rbuf, char *data, int count);
44
int ring_write_file(ringbuffy *rbuf, int fd, int count);
45
int ring_read_file(ringbuffy *rbuf, int fd, int count);
46
int ring_rest(ringbuffy *rbuf);
47
int ring_peek(ringbuffy *rbuf, char *data, int count, long off);
48

    
49
#ifdef __cplusplus
50
}
51
#endif                                /* __cplusplus */
52
#endif /* RINGBUFFY_H */