]> code.delx.au - pulseaudio/blob - polyp/memchunk.h
4eefc8c100e918caf6810239a80a9830f005df7e
[pulseaudio] / polyp / memchunk.h
1 #ifndef foomemchunkhfoo
2 #define foomemchunkhfoo
3
4 /* $Id$ */
5
6 /***
7 This file is part of polypaudio.
8
9 polypaudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as
11 published by the Free Software Foundation; either version 2.1 of the
12 License, or (at your option) any later version.
13
14 polypaudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with polypaudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 USA.
23 ***/
24
25 #include "memblock.h"
26
27 /* A memchunk describes a part of a memblock. In contrast to the memblock, a
28 * memchunk is not allocated dynamically or reference counted, instead
29 * it is usually stored on the stack and copied around */
30
31 typedef struct pa_memchunk {
32 pa_memblock *memblock;
33 size_t index, length;
34 } pa_memchunk;
35
36 /* Make a memchunk writable, i.e. make sure that the caller may have
37 * exclusive access to the memblock and it is not read_only. If needed
38 * the memblock in the structure is replaced by a copy. */
39 void pa_memchunk_make_writable(pa_memchunk *c, pa_memblock_stat *s, size_t min);
40
41 /* Invalidate a memchunk. This does not free the cotaining memblock,
42 * but sets all members to zero. */
43 void pa_memchunk_reset(pa_memchunk *c);
44
45 #endif