# GstAllocator

Memory is usually created by allocators with a gst_allocator_alloc method call. When NULL is used as the allocator, the default allocator will be used.

New allocators can be registered with gst_allocator_register. Allocators are identified by name and can be retrieved with gst_allocator_find. gst_allocator_set_default can be used to change the default allocator.

New memory can be created with gst_memory_new_wrapped that wraps the memory allocated elsewhere.

## GstAllocator

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstAllocator

The GstAllocator is used to create new memory.

### Members

`object` (GstObject) –
No description available
`mem_type` (const gchar*) –
No description available
`mem_map` (GstMemoryMapFunction) –

the implementation of the GstMemoryMapFunction

`mem_unmap` (GstMemoryUnmapFunction) –

the implementation of the GstMemoryUnmapFunction

`mem_copy` (GstMemoryCopyFunction) –

the implementation of the GstMemoryCopyFunction

`mem_share` (GstMemoryShareFunction) –

the implementation of the GstMemoryShareFunction

`mem_is_span` (GstMemoryIsSpanFunction) –

the implementation of the GstMemoryIsSpanFunction

`mem_map_full` (GstMemoryMapFullFunction) –

the implementation of the GstMemoryMapFullFunction. Will be used instead of mem_map if present. (Since: 1.6)

`mem_unmap_full` (GstMemoryUnmapFullFunction) –

the implementation of the GstMemoryUnmapFullFunction. Will be used instead of mem_unmap if present. (Since: 1.6)

### Class structure

#### GstAllocatorClass

The GstAllocator is used to create new memory.

##### Fields

`object_class` (GstObjectClass) –

Object parent class

### Gst.AllocatorClass

The Gst.Allocator is used to create new memory.

##### Attributes

`object_class` (Gst.ObjectClass) –

Object parent class

### Gst.AllocatorClass

The Gst.Allocator is used to create new memory.

##### Attributes

`object_class` (Gst.ObjectClass) –

Object parent class

## Gst.Allocator

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Allocator

The Gst.Allocator is used to create new memory.

### Members

`object` (Gst.Object) –
No description available
`mem_type` (String) –
No description available
`mem_map` (Gst.MemoryMapFunction) –

the implementation of the GstMemoryMapFunction

`mem_unmap` (Gst.MemoryUnmapFunction) –

the implementation of the GstMemoryUnmapFunction

`mem_copy` (Gst.MemoryCopyFunction) –

the implementation of the GstMemoryCopyFunction

`mem_share` (Gst.MemoryShareFunction) –

the implementation of the GstMemoryShareFunction

`mem_is_span` (Gst.MemoryIsSpanFunction) –

the implementation of the GstMemoryIsSpanFunction

`mem_map_full` (Gst.MemoryMapFullFunction) –

the implementation of the GstMemoryMapFullFunction. Will be used instead of mem_map if present. (Since: 1.6)

`mem_unmap_full` (Gst.MemoryUnmapFullFunction) –

the implementation of the GstMemoryUnmapFullFunction. Will be used instead of mem_unmap if present. (Since: 1.6)

## Gst.Allocator

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Allocator

The Gst.Allocator is used to create new memory.

### Members

`object` (Gst.Object) –
No description available
`mem_type` (str) –
No description available
`mem_map` (Gst.MemoryMapFunction) –

the implementation of the GstMemoryMapFunction

`mem_unmap` (Gst.MemoryUnmapFunction) –

the implementation of the GstMemoryUnmapFunction

`mem_copy` (Gst.MemoryCopyFunction) –

the implementation of the GstMemoryCopyFunction

`mem_share` (Gst.MemoryShareFunction) –

the implementation of the GstMemoryShareFunction

`mem_is_span` (Gst.MemoryIsSpanFunction) –

the implementation of the GstMemoryIsSpanFunction

`mem_map_full` (Gst.MemoryMapFullFunction) –

the implementation of the GstMemoryMapFullFunction. Will be used instead of mem_map if present. (Since: 1.6)

`mem_unmap_full` (Gst.MemoryUnmapFullFunction) –

the implementation of the GstMemoryUnmapFullFunction. Will be used instead of mem_unmap if present. (Since: 1.6)

### Methods

#### gst_allocator_alloc

    GstMemory *
    gst_allocator_alloc (GstAllocator * allocator,
                         gsize size,
                         GstAllocationParams * params)

Use allocator to allocate a new memory block with memory that is at least size big.

The optional params can specify the prefix and padding for the memory. If NULL is passed, no flags, no extra prefix/padding and a default alignment is used.

The prefix/padding will be filled with 0 if flags contains GST_MEMORY_FLAG_ZERO_PREFIXED and GST_MEMORY_FLAG_ZERO_PADDED respectively.

When allocator is NULL, the default allocator will be used.

The alignment in params is given as a bitmask so that align + 1 equals the amount of bytes to align to. For example, to align to 8 bytes, use an alignment of 7.

Parameters:

`allocator` ( [transfer: none][nullable]) –

a GstAllocator to use

`size` –

size of the visible memory area

`params` ( [transfer: none][nullable]) –

optional parameters

Returns ( [transfer: full][nullable]) –

a new GstMemory.

#### Gst.Allocator.prototype.alloc

    function Gst.Allocator.prototype.alloc(size: Number, params: Gst.AllocationParams): {
        // javascript wrapper for 'gst_allocator_alloc'
    }

Use allocator to allocate a new memory block with memory that is at least size big.

The optional params can specify the prefix and padding for the memory. If NULL is passed, no flags, no extra prefix/padding and a default alignment is used.

The prefix/padding will be filled with 0 if flags contains Gst.MemoryFlags.ZERO_PREFIXED and Gst.MemoryFlags.ZERO_PADDED respectively.

When allocator is NULL, the default allocator will be used.

The alignment in params is given as a bitmask so that align + 1 equals the amount of bytes to align to. For example, to align to 8 bytes, use an alignment of 7.

Parameters:

`allocator` (Gst.Allocator) –

a Gst.Allocator to use

`size` (Number) –

size of the visible memory area

`params` (Gst.AllocationParams) –

optional parameters

Returns (Gst.Memory) –

a new Gst.Memory.

#### Gst.Allocator.alloc

    def Gst.Allocator.alloc (self, size, params):
        #python wrapper for 'gst_allocator_alloc'

Use allocator to allocate a new memory block with memory that is at least size big.

The optional params can specify the prefix and padding for the memory. If NULL is passed, no flags, no extra prefix/padding and a default alignment is used.

The prefix/padding will be filled with 0 if flags contains Gst.MemoryFlags.ZERO_PREFIXED and Gst.MemoryFlags.ZERO_PADDED respectively.

When allocator is NULL, the default allocator will be used.

The alignment in params is given as a bitmask so that align + 1 equals the amount of bytes to align to. For example, to align to 8 bytes, use an alignment of 7.

Parameters:

`allocator` (Gst.Allocator) –

a Gst.Allocator to use

`size` (int) –

size of the visible memory area

`params` (Gst.AllocationParams) –

optional parameters

Returns (Gst.Memory) –

a new Gst.Memory.

#### gst_allocator_free

    gst_allocator_free (GstAllocator * allocator,
                        GstMemory * memory)

Free memory that was previously allocated with gst_allocator_alloc.

Parameters:

`allocator` ( [transfer: none]) –

a GstAllocator to use

`memory` ( [transfer: full]) –

the memory to free

#### Gst.Allocator.prototype.free

    function Gst.Allocator.prototype.free(memory: Gst.Memory): {
        // javascript wrapper for 'gst_allocator_free'
    }

Free memory that was previously allocated with Gst.Allocator.prototype.alloc.

Parameters:

`allocator` (Gst.Allocator) –

a Gst.Allocator to use

`memory` (Gst.Memory) –

the memory to free

#### Gst.Allocator.free

    def Gst.Allocator.free (self, memory):
        #python wrapper for 'gst_allocator_free'

Free memory that was previously allocated with Gst.Allocator.alloc.

Parameters:

`allocator` (Gst.Allocator) –

a Gst.Allocator to use

`memory` (Gst.Memory) –

the memory to free

#### gst_allocator_set_default

    gst_allocator_set_default (GstAllocator * allocator)

Set the default allocator.

Parameters:

`allocator` ( [transfer: full]) –

a GstAllocator

#### Gst.Allocator.prototype.set_default

    function Gst.Allocator.prototype.set_default(): {
        // javascript wrapper for 'gst_allocator_set_default'
    }

Set the default allocator.

Parameters:

`allocator` (Gst.Allocator) –

a Gst.Allocator

#### Gst.Allocator.set_default

    def Gst.Allocator.set_default (self):
        #python wrapper for 'gst_allocator_set_default'

Set the default allocator.

Parameters:

`allocator` (Gst.Allocator) –

a Gst.Allocator

### Functions

#### gst_allocator_find

    GstAllocator *
    gst_allocator_find (const gchar* name)

Find a previously registered allocator with name. When name is NULL, the default allocator will be returned.

Parameters:

`name` ( [nullable]) –

the name of the allocator

Returns ( [transfer: full][nullable]) –

a GstAllocator or NULL when the allocator with name was not registered.

#### Gst.Allocator.prototype.find

    function Gst.Allocator.prototype.find(name: String): {
        // javascript wrapper for 'gst_allocator_find'
    }

Find a previously registered allocator with name. When name is NULL, the default allocator will be returned.

Parameters:

`name` (String) –

the name of the allocator

Returns (Gst.Allocator) –

a Gst.Allocator or NULL when the allocator with name was not registered.

#### Gst.Allocator.find

    def Gst.Allocator.find (name):
        #python wrapper for 'gst_allocator_find'

Find a previously registered allocator with name. When name is NULL, the default allocator will be returned.

Parameters:

`name` (str) –

the name of the allocator

Returns (Gst.Allocator) –

a Gst.Allocator or NULL when the allocator with name was not registered.

#### gst_allocator_register

    gst_allocator_register (const gchar* name,
                            GstAllocator * allocator)

Registers the memory allocator with name.

Parameters:

`name` –

the name of the allocator

`allocator` ( [transfer: full]) –

GstAllocator

#### Gst.Allocator.prototype.register

    function Gst.Allocator.prototype.register(name: String, allocator: Gst.Allocator): {
        // javascript wrapper for 'gst_allocator_register'
    }

Registers the memory allocator with name.

Parameters:

`name` (String) –

the name of the allocator

`allocator` (Gst.Allocator) –

Gst.Allocator

#### Gst.Allocator.register

    def Gst.Allocator.register (name, allocator):
        #python wrapper for 'gst_allocator_register'

Registers the memory allocator with name.

Parameters:

`name` (str) –

the name of the allocator

`allocator` (Gst.Allocator) –

Gst.Allocator

### Virtual Methods

#### alloc

    GstMemory *
    alloc (GstAllocator * allocator,
           gsize size,
           GstAllocationParams * params)

implementation that acquires memory

Parameters:

`allocator` –
No description available
`size` –
No description available
`params` –
No description available
Returns –
No description available

#### vfunc_alloc

    function vfunc_alloc(allocator: Gst.Allocator, size: Number, params: Gst.AllocationParams): {
        // javascript implementation of the 'alloc' virtual method
    }

implementation that acquires memory

Parameters:

`allocator` (Gst.Allocator) –
No description available
`size` (Number) –
No description available
`params` (Gst.AllocationParams) –
No description available
Returns (Gst.Memory) –
No description available

#### do_alloc

    def do_alloc (allocator, size, params):
        #python implementation of the 'alloc' virtual method

implementation that acquires memory

Parameters:

`allocator` (Gst.Allocator) –
No description available
`size` (int) –
No description available
`params` (Gst.AllocationParams) –
No description available
Returns (Gst.Memory) –
No description available

#### free

    free (GstAllocator * allocator,
          GstMemory * memory)

implementation that releases memory

Parameters:

`allocator` –
No description available
`memory` –
No description available

#### vfunc_free

    function vfunc_free(allocator: Gst.Allocator, memory: Gst.Memory): {
        // javascript implementation of the 'free' virtual method
    }

implementation that releases memory

Parameters:

`allocator` (Gst.Allocator) –
No description available
`memory` (Gst.Memory) –
No description available

#### do_free

    def do_free (allocator, memory):
        #python implementation of the 'free' virtual method

implementation that releases memory

Parameters:

`allocator` (Gst.Allocator) –
No description available
`memory` (Gst.Memory) –
No description available

## GstAllocationParams

Parameters to control the allocation of memory

### Members

`flags` (GstMemoryFlags) –

flags to control allocation

`align` (gsize) –

the desired alignment of the memory

`prefix` (gsize) –

the desired prefix

`padding` (gsize) –

the desired padding

## Gst.AllocationParams

Parameters to control the allocation of memory

### Members

`flags` (Gst.MemoryFlags) –

flags to control allocation

`align` (Number) –

the desired alignment of the memory

`prefix` (Number) –

the desired prefix

`padding` (Number) –

the desired padding

## Gst.AllocationParams

Parameters to control the allocation of memory

### Members

`flags` (Gst.MemoryFlags) –

flags to control allocation

`align` (int) –

the desired alignment of the memory

`prefix` (int) –

the desired prefix

`padding` (int) –

the desired padding

### Constructors

#### gst_allocation_params_new

    GstAllocationParams *
    gst_allocation_params_new ()

Create a new GstAllocationParams on the heap. This function is for use in GStreamer language bindings. In your own code, you can just declare a GstAllocationParams on the stack or in a struct, and call gst_allocation_params_init to initialize it.

You do not need to call gst_allocation_params_init on the instance returned by this function.

Returns ( [transfer: full][not nullable]) –

a new GstAllocationParams

Since : 1.20

#### Gst.AllocationParams.prototype.new

    function Gst.AllocationParams.prototype.new(): {
        // javascript wrapper for 'gst_allocation_params_new'
    }

Create a new Gst.AllocationParams on the heap. This function is for use in GStreamer language bindings. In your own code, you can just declare a Gst.AllocationParams on the stack or in a struct, and call Gst.AllocationParams.prototype.init to initialize it.

You do not need to call Gst.AllocationParams.prototype.init on the instance returned by this function.

Returns (Gst.AllocationParams) –

a new Gst.AllocationParams

Since : 1.20

#### Gst.AllocationParams.new

    def Gst.AllocationParams.new ():
        #python wrapper for 'gst_allocation_params_new'

Create a new Gst.AllocationParams on the heap. This function is for use in GStreamer language bindings. In your own code, you can just declare a Gst.AllocationParams on the stack or in a struct, and call Gst.AllocationParams.init to initialize it.

You do not need to call Gst.AllocationParams.init on the instance returned by this function.

Returns (Gst.AllocationParams) –

a new Gst.AllocationParams

Since : 1.20

### Methods

#### gst_allocation_params_copy

    GstAllocationParams *
    gst_allocation_params_copy (const GstAllocationParams * params)

Create a copy of params.

Parameters:

`params` ( [transfer: none][nullable]) –

a GstAllocationParams

Returns ( [transfer: full][nullable]) –

a new GstAllocationParams.

#### Gst.AllocationParams.prototype.copy

    function Gst.AllocationParams.prototype.copy(): {
        // javascript wrapper for 'gst_allocation_params_copy'
    }

Create a copy of params.

Parameters:

`params` (Gst.AllocationParams) –

a Gst.AllocationParams

Returns (Gst.AllocationParams) –

a new Gst.AllocationParams.

#### Gst.AllocationParams.copy

    def Gst.AllocationParams.copy (self):
        #python wrapper for 'gst_allocation_params_copy'

Create a copy of params.

Parameters:

`params` (Gst.AllocationParams) –

a Gst.AllocationParams

Returns (Gst.AllocationParams) –

a new Gst.AllocationParams.

#### gst_allocation_params_free

    gst_allocation_params_free (GstAllocationParams * params)

Free params

Parameters:

`params` ( [in][transfer: full]) –

a GstAllocationParams

#### Gst.AllocationParams.prototype.free

    function Gst.AllocationParams.prototype.free(): {
        // javascript wrapper for 'gst_allocation_params_free'
    }

Free params

Parameters:

`params` (Gst.AllocationParams) –

a Gst.AllocationParams

#### Gst.AllocationParams.free

    def Gst.AllocationParams.free (self):
        #python wrapper for 'gst_allocation_params_free'

Free params

Parameters:

`params` (Gst.AllocationParams) –

a Gst.AllocationParams

#### gst_allocation_params_init

    gst_allocation_params_init (GstAllocationParams * params)

Initialize params to its default values

Parameters:

`params` –

a GstAllocationParams

#### Gst.AllocationParams.prototype.init

    function Gst.AllocationParams.prototype.init(): {
        // javascript wrapper for 'gst_allocation_params_init'
    }

Initialize params to its default values

Parameters:

`params` (Gst.AllocationParams) –

a Gst.AllocationParams

#### Gst.AllocationParams.init

    def Gst.AllocationParams.init (self):
        #python wrapper for 'gst_allocation_params_init'

Initialize params to its default values

Parameters:

`params` (Gst.AllocationParams) –

a Gst.AllocationParams

## Function Macros

### GST_ALLOCATOR_CAST

    #define GST_ALLOCATOR_CAST(obj)            ((GstAllocator *)(obj))

## Enumerations

### GstAllocatorFlags

Flags for allocators.

##### Members

`GST_ALLOCATOR_FLAG_CUSTOM_ALLOC` (16) –

The allocator has a custom alloc function. Only elements designed to work with this allocator should be using it, other elements should ignore it from allocation propositions. This implies GST_ALLOCATOR_FLAG_NO_COPY.

`GST_ALLOCATOR_FLAG_NO_COPY` (32) –

When copying a GstMemory allocated with this allocator, the copy will instead be allocated using the default allocator. Use this when allocating a new memory is an heavy opperation that should only be done with a GstBufferPool for example.

(Since: 1.24)
`GST_ALLOCATOR_FLAG_LAST` (1048576) –

first flag that can be used for custom purposes

### Gst.AllocatorFlags

Flags for allocators.

##### Members

`Gst.AllocatorFlags.CUSTOM_ALLOC` (16) –

The allocator has a custom alloc function. Only elements designed to work with this allocator should be using it, other elements should ignore it from allocation propositions. This implies Gst.AllocatorFlags.NO_COPY.

`Gst.AllocatorFlags.NO_COPY` (32) –

When copying a Gst.Memory allocated with this allocator, the copy will instead be allocated using the default allocator. Use this when allocating a new memory is an heavy opperation that should only be done with a Gst.BufferPool for example.

(Since: 1.24)
`Gst.AllocatorFlags.LAST` (1048576) –

first flag that can be used for custom purposes

### Gst.AllocatorFlags

Flags for allocators.

##### Members

`Gst.AllocatorFlags.CUSTOM_ALLOC` (16) –

The allocator has a custom alloc function. Only elements designed to work with this allocator should be using it, other elements should ignore it from allocation propositions. This implies Gst.AllocatorFlags.NO_COPY.

`Gst.AllocatorFlags.NO_COPY` (32) –

When copying a Gst.Memory allocated with this allocator, the copy will instead be allocated using the default allocator. Use this when allocating a new memory is an heavy opperation that should only be done with a Gst.BufferPool for example.

(Since: 1.24)
`Gst.AllocatorFlags.LAST` (1048576) –

first flag that can be used for custom purposes

## Constants

### GST_ALLOCATOR_SYSMEM

    #define GST_ALLOCATOR_SYSMEM   "SystemMemory"

The allocator name for the default system memory allocator

### Gst.ALLOCATOR_SYSMEM

The allocator name for the default system memory allocator

### Gst.ALLOCATOR_SYSMEM

The allocator name for the default system memory allocator

The results of the search are