-static void
-_gst_allocator_free (GstAllocator * allocator)
-{
- if (allocator->notify)
- allocator->notify (allocator->user_data);
-
- g_slice_free1 (sizeof (GstAllocator), allocator);
-}
-
-static GstAllocator *
-_gst_allocator_copy (GstAllocator * allocator)
-{
- return gst_allocator_ref (allocator);
-}
-
-/**
- * gst_allocator_new:
- * @info: a #GstMemoryInfo
- * @user_data: user data
- * @notify: a #GDestroyNotify for @user_data
- *
- * Create a new memory allocator with @info and @user_data.
- *
- * All functions in @info are mandatory exept the copy and is_span
- * functions, which will have a default implementation when left NULL.
- *
- * The @user_data will be passed to all calls of the alloc function. @notify
- * will be called with @user_data when the allocator is freed.
- *
- * Returns: a new #GstAllocator.
- */
-GstAllocator *
-gst_allocator_new (const GstMemoryInfo * info, gpointer user_data,
- GDestroyNotify notify)
-{
- GstAllocator *allocator;
-
- g_return_val_if_fail (info != NULL, NULL);
- g_return_val_if_fail (info->alloc != NULL, NULL);
- g_return_val_if_fail (info->mem_map != NULL, NULL);
- g_return_val_if_fail (info->mem_unmap != NULL, NULL);
- g_return_val_if_fail (info->mem_free != NULL, NULL);
- g_return_val_if_fail (info->mem_share != NULL, NULL);
-
- allocator = g_slice_new0 (GstAllocator);
-
- gst_mini_object_init (GST_MINI_OBJECT_CAST (allocator), GST_TYPE_ALLOCATOR,
- (GstMiniObjectCopyFunction) _gst_allocator_copy, NULL,
- (GstMiniObjectFreeFunction) _gst_allocator_free);
-
- allocator->info = *info;
- allocator->user_data = user_data;
- allocator->notify = notify;
-
-#define INSTALL_FALLBACK(_t) \
- if (allocator->info._t == NULL) allocator->info._t = _fallback_ ##_t;
- INSTALL_FALLBACK (mem_copy);
- INSTALL_FALLBACK (mem_is_span);
-#undef INSTALL_FALLBACK
-
- GST_CAT_DEBUG (GST_CAT_MEMORY, "new allocator %p", allocator);
-
- return allocator;
-}
-
-/**
- * gst_allocator_get_memory_type:
- * @allocator: a #GstAllocator
- *
- * Get the memory type allocated by this allocator
- *
- * Returns: the memory type provided by @allocator
- */
-const gchar *
-gst_allocator_get_memory_type (GstAllocator * allocator)
-{
- g_return_val_if_fail (allocator != NULL, NULL);
-
- return allocator->info.mem_type;
-}
-
-/**
- * gst_allocator_register:
- * @name: the name of the allocator
- * @allocator: (transfer full): #GstAllocator
- *
- * Registers the memory @allocator with @name. This function takes ownership of
- * @allocator.
- */
-void
-gst_allocator_register (const gchar * name, GstAllocator * allocator)
-{
- g_return_if_fail (name != NULL);
- g_return_if_fail (allocator != NULL);
-
- GST_CAT_DEBUG (GST_CAT_MEMORY, "registering allocator %p with name \"%s\"",
- allocator, name);
-
- g_rw_lock_writer_lock (&lock);
- g_hash_table_insert (allocators, (gpointer) name, (gpointer) allocator);
- g_rw_lock_writer_unlock (&lock);
-}
-
-/**
- * gst_allocator_find:
- * @name: the name of the allocator
- *
- * Find a previously registered allocator with @name. When @name is NULL, the
- * default allocator will be returned.
- *
- * Returns: (transfer full): a #GstAllocator or NULL when the allocator with @name was not
- * registered. Use gst_allocator_unref() to release the allocator after usage.
- */
-GstAllocator *
-gst_allocator_find (const gchar * name)
-{
- GstAllocator *allocator;
-
- g_rw_lock_reader_lock (&lock);
- if (name) {
- allocator = g_hash_table_lookup (allocators, (gconstpointer) name);
- } else {
- allocator = _default_allocator;
- }
- if (allocator)
- gst_allocator_ref (allocator);
- g_rw_lock_reader_unlock (&lock);
-
- return allocator;
-}
-
-/**
- * gst_allocator_set_default:
- * @allocator: (transfer full): a #GstAllocator
- *
- * Set the default allocator. This function takes ownership of @allocator.
- */
-void
-gst_allocator_set_default (GstAllocator * allocator)
-{
- GstAllocator *old;
- g_return_if_fail (allocator != NULL);
-
- g_rw_lock_writer_lock (&lock);
- old = _default_allocator;
- _default_allocator = allocator;
- g_rw_lock_writer_unlock (&lock);
-
- if (old)
- gst_allocator_unref (old);
-}
-
-/**
- * gst_allocation_params_init:
- * @params: a #GstAllocationParams
- *
- * Initialize @params to its default values
- */
-void
-gst_allocation_params_init (GstAllocationParams * params)
-{
- g_return_if_fail (params != NULL);
-
- memset (params, 0, sizeof (GstAllocationParams));
-}
-
-/**
- * gst_allocation_params_copy:
- * @params: (transfer none): a #GstAllocationParams
- *
- * Create a copy of @params.
- *
- * Free-function: gst_allocation_params_free
- *
- * Returns: (transfer full): a new ##GstAllocationParams, free with
- * gst_allocation_params_free().
- */
-GstAllocationParams *
-gst_allocation_params_copy (const GstAllocationParams * params)
-{
- GstAllocationParams *result = NULL;
-
- if (params) {
- result =
- (GstAllocationParams *) g_slice_copy (sizeof (GstAllocationParams),
- params);
- }
- return result;
-}
-
-/**
- * gst_allocation_params_free:
- * @params: (in) (transfer full): a #GstAllocationParams
- *
- * Free @params
- */