allocator: remove user_data from alloc vmethod

Remove the user_data from the alloc vmethod. Subclasses that implement a new
alloc function can also implement their own vmethod to pass extra arguments. We
can then also require that custom allocators implement an alloc function so that
gst_allocator_alloc() always works.
This commit is contained in:
Wim Taymans 2012-07-27 12:12:37 +02:00
parent 60382cd994
commit a2027b5e9b
4 changed files with 5 additions and 7 deletions

View file

@ -303,7 +303,7 @@ gst_allocator_alloc (GstAllocator * allocator, gsize size,
aclass = GST_ALLOCATOR_GET_CLASS (allocator);
if (aclass->alloc)
mem = aclass->alloc (allocator, size, params, NULL);
mem = aclass->alloc (allocator, size, params);
else
mem = NULL;
@ -505,7 +505,7 @@ _default_mem_is_span (GstMemoryDefault * mem1, GstMemoryDefault * mem2,
static GstMemory *
default_alloc (GstAllocator * allocator, gsize size,
GstAllocationParams * params, gpointer user_data)
GstAllocationParams * params)
{
gsize maxsize = size + params->prefix + params->padding;

View file

@ -125,7 +125,7 @@ struct _GstAllocatorClass {
GstObjectClass object_class;
GstMemory * (*alloc) (GstAllocator *allocator, gsize size,
GstAllocationParams *params, gpointer user_data);
GstAllocationParams *params);
void (*free) (GstAllocator *allocator, GstMemory *memory);
/*< private >*/

View file

@ -29,8 +29,7 @@ typedef struct
static GstMemory *
_my_alloc (GstAllocator * allocator, gsize size,
GstAllocationParams * params, gpointer user_data)
_my_alloc (GstAllocator * allocator, gsize size, GstAllocationParams * params)
{
MyMemory *mem;
gsize maxsize = size + params->prefix + params->padding;

View file

@ -34,8 +34,7 @@ typedef struct
static GstMemory *
_my_alloc (GstAllocator * allocator, gsize size,
GstAllocationParams * params, gpointer user_data)
_my_alloc (GstAllocator * allocator, gsize size, GstAllocationParams * params)
{
g_warning ("Use my_vidmem_alloc() to allocate from this allocator");