~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to mpg123_artsplugin/mpg123/xfermem.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   xfermem.h
 
3
 *
 
4
 *   Oliver Fromme  <oliver.fromme@heim3.tu-clausthal.de>
 
5
 *   Sat Mar 29 04:41:34 MET 1997
 
6
 *
 
7
 *   This is a stand-alone module which implements a unidirectional,
 
8
 *   fast pipe using mmap().  Its primary use is to transfer large
 
9
 *   amounts of data from a parent process to its child process,
 
10
 *   with a buffer in between which decouples blocking conditions
 
11
 *   on both sides.  Control information is transferred between the
 
12
 *   processes through a socketpair.  See xftest.c for an example on
 
13
 *   how to use this module.
 
14
 */
 
15
 
 
16
#ifndef TRUE
 
17
#define FALSE 0
 
18
#define TRUE  1
 
19
#endif
 
20
 
 
21
typedef struct {
 
22
        int freeindex;  /* [W] next free index */
 
23
        int readindex;  /* [R] next index to read */
 
24
        int fd[2];
 
25
        int wakeme[2];
 
26
        byte *data;
 
27
        byte *metadata;
 
28
        int size;
 
29
        int metasize;
 
30
        int buf[3];
 
31
} txfermem;
 
32
/*
 
33
 *   [W] -- May be written to by the writing process only!
 
34
 *   [R] -- May be written to by the reading process only!
 
35
 *   All other entries are initialized once.
 
36
 */
 
37
 
 
38
void xfermem_init (txfermem **xf, int bufsize, int msize,int skipbuf);
 
39
void xfermem_init_writer (txfermem *xf);
 
40
void xfermem_init_reader (txfermem *xf);
 
41
 
 
42
int  xfermem_write (txfermem *xf, byte *data, int count);
 
43
int  xfermem_read  (txfermem *xf, byte *data, int count);
 
44
 
 
45
int xfermem_get_freespace (txfermem *xf);
 
46
int xfermem_get_usedspace (txfermem *xf);
 
47
#define XF_CMD_WAKEUP_INFO  0x04
 
48
#define XF_CMD_WAKEUP    0x02
 
49
#define XF_CMD_TERMINATE 0x03
 
50
#define XF_WRITER 0
 
51
#define XF_READER 1
 
52
int xfermem_getcmd (int fd, int block);
 
53
int xfermem_putcmd (int fd, byte cmd);
 
54
int xfermem_block (int fd, txfermem *xf);
 
55
 
 
56
void xfermem_done (txfermem *xf);
 
57
#define xfermem_done_writer xfermem_init_reader
 
58
#define xfermem_done_reader xfermem_init_writer
 
59
 
 
60
/* EOF */