]>
code.delx.au - pulseaudio/blob - polyp/memblockq.h
1 #ifndef foomemblockqhfoo
2 #define foomemblockqhfoo
7 This file is part of polypaudio.
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 published
11 by the Free Software Foundation; either version 2 of the License,
12 or (at your option) any later version.
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 General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with polypaudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 #include <sys/types.h>
33 - maxlength: maximum length of queue. If more data is pushed into the queue, data from the front is dropped
34 - length: the target length of the queue.
35 - base: a base value for all metrics. Only multiples of this value are popped from the queue
36 - prebuf: before passing the first byte out, make sure that enough bytes are in the queue
37 - minreq: pa_memblockq_missing() will only return values greater than this value
39 struct pa_memblockq
* pa_memblockq_new(size_t maxlength
,
44 struct pa_memblock_stat
*s
);
45 void pa_memblockq_free(struct pa_memblockq
*bq
);
47 /* Push a new memory chunk into the queue. Optionally specify a value for future cancellation. */
48 void pa_memblockq_push(struct pa_memblockq
* bq
, const struct pa_memchunk
*chunk
, size_t delta
);
50 /* Same as pa_memblockq_push(), however chunks are filtered through a mcalign object, and thus aligned to multiples of base */
51 void pa_memblockq_push_align(struct pa_memblockq
* bq
, const struct pa_memchunk
*chunk
, size_t delta
);
53 /* Return a copy of the next memory chunk in the queue. It is not removed from the queue */
54 int pa_memblockq_peek(struct pa_memblockq
* bq
, struct pa_memchunk
*chunk
);
56 /* Drop the specified bytes from the queue, only valid aufter pa_memblockq_peek() */
57 void pa_memblockq_drop(struct pa_memblockq
*bq
, const struct pa_memchunk
*chunk
, size_t length
);
59 /* Drop the specified bytes from the queue */
60 void pa_memblockq_skip(struct pa_memblockq
*bq
, size_t length
);
62 /* Shorten the pa_memblockq to the specified length by dropping data at the end of the queue */
63 void pa_memblockq_shorten(struct pa_memblockq
*bq
, size_t length
);
65 /* Empty the pa_memblockq */
66 void pa_memblockq_empty(struct pa_memblockq
*bq
);
68 /* Test if the pa_memblockq is currently readable, that is, more data than base */
69 int pa_memblockq_is_readable(struct pa_memblockq
*bq
);
71 /* Test if the pa_memblockq is currently writable for the specified amount of bytes */
72 int pa_memblockq_is_writable(struct pa_memblockq
*bq
, size_t length
);
74 /* Return the length of the queue in bytes */
75 uint32_t pa_memblockq_get_length(struct pa_memblockq
*bq
);
77 /* Return how many bytes are missing in queue to the specified fill amount */
78 uint32_t pa_memblockq_missing(struct pa_memblockq
*bq
);
80 /* Returns the minimal request value */
81 uint32_t pa_memblockq_get_minreq(struct pa_memblockq
*bq
);
83 /* Force disabling of pre-buf even when the pre-buffer is not yet filled */
84 void pa_memblockq_prebuf_disable(struct pa_memblockq
*bq
);
86 /* Reenable pre-buf to the initial level */
87 void pa_memblockq_prebuf_reenable(struct pa_memblockq
*bq
);
89 /* Manipulate the write pointer */
90 void pa_memblockq_seek(struct pa_memblockq
*bq
, size_t delta
);
93 void pa_memblockq_flush(struct pa_memblockq
*bq
);
95 /* Get Target length */
96 uint32_t pa_memblockq_get_tlength(struct pa_memblockq
*bq
);