2000-12-28 22:12:02 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
|
|
|
* gstbufferpool.h: Header for buffer-pool management
|
2000-08-14 10:57:30 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_BUFFER_POOL_H__
|
|
|
|
#define __GST_BUFFER_POOL_H__
|
|
|
|
|
2000-12-15 01:57:34 +00:00
|
|
|
#include <gst/gstbuffer.h>
|
2000-08-14 10:57:30 +00:00
|
|
|
|
2000-12-28 22:12:02 +00:00
|
|
|
|
2000-08-14 10:57:30 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
|
2001-06-21 11:19:08 +00:00
|
|
|
#define GST_BUFFER_POOL(pool) \
|
|
|
|
((GstBufferPool *)(pool))
|
|
|
|
#define GST_BUFFER_POOL_LOCK(pool) (g_mutex_lock(GST_BUFFER_POOL(pool)->lock))
|
2001-08-06 19:52:27 +00:00
|
|
|
#define GST_BUFFER_POOL_UNLOCK(pool) (g_mutex_unlock(GST_BUFFER_POOL(pool)->lock))
|
2000-08-14 10:57:30 +00:00
|
|
|
|
|
|
|
typedef struct _GstBufferPool GstBufferPool;
|
|
|
|
|
2001-08-27 06:01:11 +00:00
|
|
|
typedef GstBuffer* (*GstBufferPoolBufferNewFunction) (GstBufferPool *pool, gint64 location, gint size, gpointer user_data);
|
|
|
|
typedef void (*GstBufferPoolDestroyHook) (GstBufferPool *pool, gpointer user_data);
|
2000-08-14 10:57:30 +00:00
|
|
|
|
|
|
|
struct _GstBufferPool {
|
2001-06-21 11:19:08 +00:00
|
|
|
/* locking */
|
|
|
|
GMutex *lock;
|
|
|
|
|
|
|
|
/* refcounting */
|
|
|
|
#ifdef HAVE_ATOMIC_H
|
|
|
|
atomic_t refcount;
|
|
|
|
#define GST_BUFFER_POOL_REFCOUNT(pool) (atomic_read(&(GST_BUFFER_POOL((pool))->refcount)))
|
|
|
|
#else
|
|
|
|
int refcount;
|
|
|
|
#define GST_BUFFER_POOL_REFCOUNT(pool) (GST_BUFFER_POOL(pool)->refcount)
|
|
|
|
#endif
|
|
|
|
|
2001-08-27 06:01:11 +00:00
|
|
|
GstBufferPoolBufferNewFunction buffer_new;
|
|
|
|
GstBufferFreeFunc buffer_free;
|
2001-08-27 06:24:49 +00:00
|
|
|
GstBufferCopyFunc buffer_copy;
|
2001-08-27 06:01:11 +00:00
|
|
|
GstBufferPoolDestroyHook destroy_hook;
|
2001-08-27 05:08:28 +00:00
|
|
|
|
|
|
|
gpointer user_data;
|
2000-08-14 10:57:30 +00:00
|
|
|
};
|
|
|
|
|
2001-06-17 14:35:09 +00:00
|
|
|
void _gst_buffer_pool_initialize (void);
|
|
|
|
|
2000-08-14 10:57:30 +00:00
|
|
|
/* creating a new buffer pool from scratch */
|
2000-11-04 18:54:07 +00:00
|
|
|
GstBufferPool* gst_buffer_pool_new (void);
|
2000-08-14 10:57:30 +00:00
|
|
|
|
2001-06-21 11:19:08 +00:00
|
|
|
/* refcounting */
|
|
|
|
void gst_buffer_pool_ref (GstBufferPool *pool);
|
|
|
|
void gst_buffer_pool_ref_by_count (GstBufferPool *pool, int count);
|
2001-08-27 04:19:58 +00:00
|
|
|
void gst_buffer_pool_unref (GstBufferPool *buffer);
|
2001-06-21 11:19:08 +00:00
|
|
|
|
2000-08-14 10:57:30 +00:00
|
|
|
/* setting create and destroy functions */
|
2001-08-27 06:01:11 +00:00
|
|
|
void gst_buffer_pool_set_buffer_new_function (GstBufferPool *pool,
|
|
|
|
GstBufferPoolBufferNewFunction create);
|
|
|
|
void gst_buffer_pool_set_buffer_free_function (GstBufferPool *pool,
|
|
|
|
GstBufferFreeFunc destroy);
|
2001-08-27 06:24:49 +00:00
|
|
|
void gst_buffer_pool_set_buffer_copy_function (GstBufferPool *pool,
|
|
|
|
GstBufferCopyFunc copy);
|
2001-08-27 06:01:11 +00:00
|
|
|
void gst_buffer_pool_set_destroy_hook (GstBufferPool *pool,
|
|
|
|
GstBufferPoolDestroyHook destroy);
|
2001-08-27 05:08:28 +00:00
|
|
|
void gst_buffer_pool_set_user_data (GstBufferPool *pool,
|
|
|
|
gpointer user_data);
|
|
|
|
gpointer gst_buffer_pool_get_user_data (GstBufferPool *pool,
|
2001-08-27 04:19:58 +00:00
|
|
|
gpointer user_data);
|
2000-08-14 10:57:30 +00:00
|
|
|
|
|
|
|
/* destroying the buffer pool */
|
2001-08-27 04:19:58 +00:00
|
|
|
void gst_buffer_pool_destroy (GstBufferPool *pool);
|
2000-08-14 10:57:30 +00:00
|
|
|
|
2001-06-17 13:55:55 +00:00
|
|
|
/* a default buffer pool implementation */
|
2001-08-27 06:01:11 +00:00
|
|
|
GstBufferPool* gst_buffer_pool_get_default (guint buffer_size, guint pool_size);
|
2001-06-17 13:55:55 +00:00
|
|
|
|
2000-08-14 10:57:30 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* __GST_BUFFER_POOL_H__ */
|