XMMS2
src/includepriv/xmmspriv/xmms_ringbuf.h
Go to the documentation of this file.
00001 /*  XMMS2 - X Music Multiplexer System
00002  *  Copyright (C) 2003-2011 XMMS2 Team
00003  *
00004  *  PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2.1 of the License, or (at your option) any later version.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Lesser General Public License for more details.
00015  */
00016 
00017 
00018 
00019 
00020 #ifndef __XMMS_RINGBUF_H__
00021 #define __XMMS_RINGBUF_H__
00022 
00023 #include <glib.h>
00024 
00025 typedef struct xmms_ringbuf_St xmms_ringbuf_t;
00026 
00027 xmms_ringbuf_t *xmms_ringbuf_new (guint size);
00028 void xmms_ringbuf_destroy (xmms_ringbuf_t *ringbuf);
00029 void xmms_ringbuf_clear (xmms_ringbuf_t *ringbuf);
00030 guint xmms_ringbuf_bytes_free (const xmms_ringbuf_t *ringbuf);
00031 guint xmms_ringbuf_bytes_used (const xmms_ringbuf_t *ringbuf);
00032 guint xmms_ringbuf_size (xmms_ringbuf_t *ringbuf);
00033 
00034 guint xmms_ringbuf_read (xmms_ringbuf_t *ringbuf, gpointer data, guint length);
00035 guint xmms_ringbuf_read_wait (xmms_ringbuf_t *ringbuf, gpointer data, guint length, GMutex *mtx);
00036 guint xmms_ringbuf_peek (xmms_ringbuf_t *ringbuf, gpointer data, guint length);
00037 guint xmms_ringbuf_peek_wait (xmms_ringbuf_t *ringbuf, gpointer data, guint length, GMutex *mtx);
00038 void xmms_ringbuf_hotspot_set (xmms_ringbuf_t *ringbuf, gboolean (*cb) (void *), void (*destroy) (void *), void *arg);
00039 guint xmms_ringbuf_write (xmms_ringbuf_t *ringbuf, gconstpointer data, guint length);
00040 guint xmms_ringbuf_write_wait (xmms_ringbuf_t *ringbuf, gconstpointer data, guint length, GMutex *mtx);
00041 
00042 void xmms_ringbuf_wait_free (const xmms_ringbuf_t *ringbuf, guint len, GMutex *mtx);
00043 void xmms_ringbuf_wait_used (const xmms_ringbuf_t *ringbuf, guint len, GMutex *mtx);
00044 
00045 gboolean xmms_ringbuf_iseos (const xmms_ringbuf_t *ringbuf);
00046 void xmms_ringbuf_set_eos (xmms_ringbuf_t *ringbuf, gboolean eos);
00047 void xmms_ringbuf_wait_eos (const xmms_ringbuf_t *ringbuf, GMutex *mtx);
00048 
00049 #endif /* __XMMS_RINGBUF_H__ */