memory: pass user_data to the alloc function

Pass the user data that was passed to _register to the alloc function of an
allocator.
This commit is contained in:
Wim Taymans 2011-06-07 17:54:33 +02:00
parent 70e799c8fc
commit cfd3faef5a
2 changed files with 11 additions and 4 deletions

View file

@ -691,5 +691,6 @@ gst_memory_allocator_alloc (const GstMemoryAllocator * allocator,
if (allocator == NULL) if (allocator == NULL)
allocator = _default_allocator; allocator = _default_allocator;
return allocator->info.alloc (allocator, maxsize, align); return allocator->info.alloc (allocator, maxsize, align,
allocator->info.user_data);
} }

View file

@ -106,15 +106,21 @@ typedef enum {
/** /**
* GstMemoryAllocFunction: * GstMemoryAllocFunction:
* @allocator: a #GstMemoryAllocator
* @maxsize: the maxsize * @maxsize: the maxsize
* @align: the alignment * @align: the alignment
* @user_data: user data
* *
* Allocate a new #GstMemory that can hold at least @maxsize bytes and is aligned * Allocate a new #GstMemory from @allocator that can hold at least @maxsize bytes
* to (@align + 1) 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() * 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: * GstMemoryGetSizesFunction: