From cfd3faef5a2898e0537382b1953d731a7da05901 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 7 Jun 2011 17:54:33 +0200 Subject: [PATCH] memory: pass user_data to the alloc function Pass the user data that was passed to _register to the alloc function of an allocator. --- gst/gstmemory.c | 3 ++- gst/gstmemory.h | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gst/gstmemory.c b/gst/gstmemory.c index f6e7c781b9..7446ec3877 100644 --- a/gst/gstmemory.c +++ b/gst/gstmemory.c @@ -691,5 +691,6 @@ gst_memory_allocator_alloc (const GstMemoryAllocator * allocator, if (allocator == NULL) allocator = _default_allocator; - return allocator->info.alloc (allocator, maxsize, align); + return allocator->info.alloc (allocator, maxsize, align, + allocator->info.user_data); } diff --git a/gst/gstmemory.h b/gst/gstmemory.h index 3d9493c725..307373dcf7 100644 --- a/gst/gstmemory.h +++ b/gst/gstmemory.h @@ -106,15 +106,21 @@ typedef enum { /** * GstMemoryAllocFunction: + * @allocator: a #GstMemoryAllocator * @maxsize: the maxsize * @align: the alignment + * @user_data: user data * - * Allocate a new #GstMemory that can hold at least @maxsize bytes and is aligned - * to (@align + 1) bytes. + * Allocate a new #GstMemory from @allocator that can hold at least @maxsize bytes + * and is aligned to (@align + 1) bytes. + * + * @user_data is the data that was used when registering @allocator. * * Returns: a newly allocated #GstMemory. Free with gst_memory_unref() */ -typedef GstMemory * (*GstMemoryAllocFunction) (const GstMemoryAllocator *allocator, gsize maxsize, gsize align); +typedef GstMemory * (*GstMemoryAllocFunction) (const GstMemoryAllocator *allocator, + gsize maxsize, gsize align, + gpointer user_data); /** * GstMemoryGetSizesFunction: