allocator: remove user_data from alloc vmethod
authorWim Taymans <wim.taymans@collabora.co.uk>
Fri, 27 Jul 2012 10:12:37 +0000 (12:12 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Fri, 27 Jul 2012 10:17:29 +0000 (12:17 +0200)
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.

gst/gstallocator.c
gst/gstallocator.h
tests/examples/memory/my-memory.c
tests/examples/memory/my-vidmem.c

index 7262675..30b73d7 100644 (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;
 
index 8a2ad36..f9edd50 100644 (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 >*/
index 1e5ca6d..1bbd960 100644 (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;
index 1268639..b1a58be 100644 (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");