source: golgotha/src/i4/loaders/mp3/xfermem.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.2 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9/*
10 *   xfermem.h
11 *
12 *   Oliver Fromme  <oliver.fromme@heim3.tu-clausthal.de>
13 *   Sat Mar 29 04:41:34 MET 1997
14 *
15 *   This is a stand-alone module which implements a unidirectional,
16 *   fast pipe using mmap().  Its primary use is to transfer large
17 *   amounts of data from a parent process to its child process,
18 *   with a buffer in between which decouples blocking conditions
19 *   on both sides.  Control information is transferred between the
20 *   processes through a socketpair.  See xftest.c for an example on
21 *   how to use this module.
22 */
23
24#ifndef TRUE
25#define FALSE 0
26#define TRUE  1
27#endif
28
29typedef unsigned char byte;
30
31typedef struct {
32        int freeindex;  /* [W] next free index */
33        int readindex;  /* [R] next index to read */
34        int fd[2];
35        int wakeme[2];
36        byte *data;
37        byte *metadata;
38        int size;
39        int metasize;
40} txfermem;
41/*
42 *   [W] -- May be written to by the writing process only!
43 *   [R] -- May be written to by the reading process only!
44 *   All other entries are initialized once.
45 */
46
47void xfermem_init (txfermem **xf, int bufsize, int msize);
48void xfermem_init_writer (txfermem *xf);
49void xfermem_init_reader (txfermem *xf);
50
51int  xfermem_write (txfermem *xf, byte *data, int count);
52int  xfermem_read  (txfermem *xf, byte *data, int count);
53
54int xfermem_get_freespace (txfermem *xf);
55int xfermem_get_usedspace (txfermem *xf);
56#define XF_CMD_WAKEUP    0x02
57#define XF_CMD_TERMINATE 0x03
58#define XF_WRITER 0
59#define XF_READER 1
60int xfermem_getcmd (int fd, int block);
61int xfermem_putcmd (int fd, byte cmd);
62int xfermem_block (int fd, txfermem *xf);
63
64void xfermem_done (txfermem *xf);
65#define xfermem_done_writer xfermem_init_reader
66#define xfermem_done_reader xfermem_init_writer
67
68/* EOF */
Note: See TracBrowser for help on using the repository browser.