xine-lib 1.2.11
ring_buffer.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2000-2018 the xine project
3 *
4 * This file is part of xine, a free video player.
5 *
6 * xine 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 * xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 *
20 * Fifo + Ring Buffer
21 */
22
23#ifndef XINE_RING_BUFFER_H
24#define XINE_RING_BUFFER_H
25
26#include <stddef.h> /* size_t */
27#include <xine/attributes.h>
28
30
31/* Creates a new ring buffer */
33
34/* Deletes a ring buffer */
36
37/* Returns a new chunk of the specified size */
38/* Might block if the ring buffer is full */
39void *xine_ring_buffer_alloc(xine_ring_buffer_t *ring_buffer, size_t size) XINE_PROTECTED;
40
41/* Put a chunk into the ring */
42void xine_ring_buffer_put(xine_ring_buffer_t *ring_buffer, void *chunk) XINE_PROTECTED;
43
44/* Get a chunk of a specified size from the ring buffer
45 * Might block if the ring buffer is empty
46 * param size: the desired size
47 * param rsize: the size of the chunk returned
48 * rsize is not equal to size at the end of stream, the caller MUST check
49 * rsize value.
50 */
51void *xine_ring_buffer_get(xine_ring_buffer_t *ring_buffer, size_t size, size_t *rsize) XINE_PROTECTED;
52
53/* Releases the chunk, makes memory available for the alloc function */
54void xine_ring_buffer_release(xine_ring_buffer_t *ring_buffer, void *chunk) XINE_PROTECTED;
55
56/* Closes the ring buffer
57 * The writer uses this function to signal the end of stream to the reader.
58 * The reader MUST check the rsize value returned by the get function.
59 */
61
62
63#endif /* XINE_RING_BUFFER_H */
#define XINE_MALLOC
Definition: attributes.h:141
#define XINE_PROTECTED
Definition: attributes.h:75
void xine_ring_buffer_delete(xine_ring_buffer_t *ring_buffer)
Definition: ring_buffer.c:139
void xine_ring_buffer_put(xine_ring_buffer_t *ring_buffer, void *chunk)
Definition: ring_buffer.c:223
void * xine_ring_buffer_get(xine_ring_buffer_t *ring_buffer, size_t size, size_t *rsize)
Definition: ring_buffer.c:264
void xine_ring_buffer_close(xine_ring_buffer_t *ring_buffer)
Definition: ring_buffer.c:368
void * xine_ring_buffer_alloc(xine_ring_buffer_t *ring_buffer, size_t size)
Definition: ring_buffer.c:179
xine_ring_buffer_t * xine_ring_buffer_new(size_t size)
Definition: ring_buffer.c:91
void xine_ring_buffer_release(xine_ring_buffer_t *ring_buffer, void *chunk)
Definition: ring_buffer.c:318
Definition: ring_buffer.c:59