-struct _GstAllocator
-{
- GQuark name;
-
- GstMemoryInfo info;
-};
-
-/* default memory implementation */
-typedef struct
-{
- GstMemory mem;
- gsize slice_size;
- guint8 *data;
- GFreeFunc free_func;
- gsize maxsize;
- gsize offset;
- gsize size;
-} GstMemoryDefault;
-
-/* the default allocator */
-static const GstAllocator *_default_allocator;
-
-/* our predefined allocators */
-static const GstAllocator *_default_mem_impl;
-
-/* initialize the fields */
-static void
-_default_mem_init (GstMemoryDefault * mem, GstMemoryFlags flags,
- GstMemory * parent, gsize slice_size, gpointer data,
- GFreeFunc free_func, gsize maxsize, gsize offset, gsize size)
-{
- mem->mem.allocator = _default_mem_impl;
- mem->mem.flags = flags;
- mem->mem.refcount = 1;
- mem->mem.parent = parent ? gst_memory_ref (parent) : NULL;
- mem->slice_size = slice_size;
- mem->data = data;
- mem->free_func = free_func;
- mem->maxsize = maxsize;
- mem->offset = offset;
- mem->size = size;
-}
-
-/* create a new memory block that manages the given memory */
-static GstMemoryDefault *
-_default_mem_new (GstMemoryFlags flags, GstMemory * parent, gpointer data,
- GFreeFunc free_func, gsize maxsize, gsize offset, gsize size)
-{
- GstMemoryDefault *mem;
- gsize slice_size;
-
- slice_size = sizeof (GstMemoryDefault);
-
- mem = g_slice_alloc (slice_size);
- _default_mem_init (mem, flags, parent, slice_size,
- data, free_func, maxsize, offset, size);
-
- return mem;
-}
-
-/* allocate the memory and structure in one block */
-static GstMemoryDefault *
-_default_mem_new_block (gsize maxsize, gsize align, gsize offset, gsize size)
-{
- GstMemoryDefault *mem;
- gsize aoffset, slice_size;
- guint8 *data;
-
- /* ensure configured alignment */
- align |= gst_memory_alignment;
- /* allocate more to compensate for alignment */
- maxsize += align;
- /* alloc header and data in one block */
- slice_size = sizeof (GstMemoryDefault) + maxsize;
-
- mem = g_slice_alloc (slice_size);
- if (mem == NULL)
- return NULL;
-
- data = (guint8 *) mem + sizeof (GstMemoryDefault);
-
- if ((aoffset = ((guintptr) data & align)))
- aoffset = (align + 1) - aoffset;
-
- _default_mem_init (mem, 0, NULL, slice_size, data, NULL, maxsize,
- aoffset + offset, size);