Main Page   Modules   Compound List   File List   Compound Members   File Members  

xlv_pbuffer.h

00001 /*
00002  * xlv_pbuffer.h
00003  *
00004  * Copyright (C) 2001 Guilhem Lavaux
00005  *
00006  * This file is part of XLV, a free middleware audio-video stream coder/decoder.
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Library General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2 of the License, or (at your option) any later version.
00012  *
00013  * XLV is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  */
00022 #ifndef _XLV_BUFFER_H
00023 #define _XLV_BUFFER_H
00024 
00025 #include <glib.h>
00026 
00027 #ifdef XLV_INTERNAL
00028 typedef struct _XLV_Buffer_Atom {
00029     gpointer m_buffer;
00030     guint32 m_bufsize;
00031     guint32 m_position;
00032 } XLV_Buffer_Atom;
00033 
00034 struct _XLV_Buffer {
00035     GList *m_in_buffers;
00036     gboolean m_stop;
00037     guint32 m_max_buffer_size;
00038     guint32 m_size_in_list;
00039     GAllocator *m_allocator;
00040 };
00041 #endif
00042 
00043 typedef struct _XLV_Buffer XLV_Buffer;
00044 
00045 #define xlv_buffer_full(b) (xlv_buffer_get_size(b) >= xlv_buffer_get_max_size(b))
00046 
00047 #define XLV_BUFFER_OK    0
00048 #define XLV_BUFFER_FULL  -1
00049 #define XLV_BUFFER_EMPTY -2
00050 #define XLV_BUFFER_INVAL -3
00051 
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055 
00056     XLV_Buffer *xlv_buffer_new (guint32 max_size, gboolean stop_when_full);
00057     void xlv_buffer_release (XLV_Buffer * buf);
00058 
00059     gint xlv_buffer_push (XLV_Buffer * buffer, gpointer bufin,
00060                           guint32 bufsize);
00061     gint xlv_buffer_alloc (XLV_Buffer * buffer, gpointer * bufout,
00062                            guint32 bufsize);
00063     gint xlv_buffer_get (XLV_Buffer * buffer, gpointer buf,
00064                          guint32 * bufsize);
00065     gint xlv_buffer_peek (XLV_Buffer * buffer, gpointer buf,
00066                           guint32 * bufsize);
00067     gint xlv_buffer_skip (XLV_Buffer * buffer, guint32 skipsize);
00068     void xlv_buffer_clean_all (XLV_Buffer * buf);
00069     guint32 xlv_buffer_get_size (XLV_Buffer * buf);
00070     guint32 xlv_buffer_get_max_size (XLV_Buffer * buf);
00071     guint32 xlv_buffer_get_first_frag_size (XLV_Buffer * buf);
00072     gint xlv_buffer_get_byte (XLV_Buffer * buffer);
00073 
00074     gint xlv_buffer_detach_buffer (XLV_Buffer * buffer, gpointer * buf,
00075                                    guint32 * bufsize, guint32 * pos);
00076     gint xlv_buffer_attach_buffer (XLV_Buffer * buffer, gpointer bufin,
00077                                    guint32 bufsize);
00078 
00079 #ifdef __cplusplus
00080 }
00081 #endif
00082 #endif

Generated on Mon Jul 1 19:39:06 2002 for XLV by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002