XMMS2
xmms_ringbuf.h
Go to the documentation of this file.
1 /* XMMS2 - X Music Multiplexer System
2  * Copyright (C) 2003-2011 XMMS2 Team
3  *
4  * PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Lesser General Public License for more details.
15  */
16 
17 
18 
19 
20 #ifndef __XMMS_RINGBUF_H__
21 #define __XMMS_RINGBUF_H__
22 
23 #include <glib.h>
24 
25 typedef struct xmms_ringbuf_St xmms_ringbuf_t;
26 
27 xmms_ringbuf_t *xmms_ringbuf_new (guint size);
28 void xmms_ringbuf_destroy (xmms_ringbuf_t *ringbuf);
29 void xmms_ringbuf_clear (xmms_ringbuf_t *ringbuf);
30 guint xmms_ringbuf_bytes_free (const xmms_ringbuf_t *ringbuf);
31 guint xmms_ringbuf_bytes_used (const xmms_ringbuf_t *ringbuf);
32 guint xmms_ringbuf_size (xmms_ringbuf_t *ringbuf);
33 
34 guint xmms_ringbuf_read (xmms_ringbuf_t *ringbuf, gpointer data, guint length);
35 guint xmms_ringbuf_read_wait (xmms_ringbuf_t *ringbuf, gpointer data, guint length, GMutex *mtx);
36 guint xmms_ringbuf_peek (xmms_ringbuf_t *ringbuf, gpointer data, guint length);
37 guint xmms_ringbuf_peek_wait (xmms_ringbuf_t *ringbuf, gpointer data, guint length, GMutex *mtx);
38 void xmms_ringbuf_hotspot_set (xmms_ringbuf_t *ringbuf, gboolean (*cb) (void *), void (*destroy) (void *), void *arg);
39 guint xmms_ringbuf_write (xmms_ringbuf_t *ringbuf, gconstpointer data, guint length);
40 guint xmms_ringbuf_write_wait (xmms_ringbuf_t *ringbuf, gconstpointer data, guint length, GMutex *mtx);
41 
42 void xmms_ringbuf_wait_free (const xmms_ringbuf_t *ringbuf, guint len, GMutex *mtx);
43 void xmms_ringbuf_wait_used (const xmms_ringbuf_t *ringbuf, guint len, GMutex *mtx);
44 
45 gboolean xmms_ringbuf_iseos (const xmms_ringbuf_t *ringbuf);
46 void xmms_ringbuf_set_eos (xmms_ringbuf_t *ringbuf, gboolean eos);
47 void xmms_ringbuf_wait_eos (const xmms_ringbuf_t *ringbuf, GMutex *mtx);
48 
49 #endif /* __XMMS_RINGBUF_H__ */