Gst.Allocator

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.Allocator Gst.Allocator Gst.Object->Gst.Allocator

Subclasses:None

Methods

Inherited:Gst.Object (27), GObject.Object (37)
Structs:GObject.ObjectClass (5)
class find (name)
class register (name, allocator)
  alloc (size, params)
  free (memory)
  set_default ()

Virtual Methods

Inherited:Gst.Object (1), GObject.Object (7)
  do_alloc (size, params)
  do_free (memory)

Properties

Inherited:Gst.Object (2)

Fields

Inherited:Gst.Object (1), GObject.Object (1)
Name Type Access Description
mem_copy Gst.MemoryCopyFunction r the implementation of the Gst.MemoryCopyFunction
mem_is_span Gst.MemoryIsSpanFunction r the implementation of the Gst.MemoryIsSpanFunction
mem_map Gst.MemoryMapFunction r the implementation of the Gst.MemoryMapFunction
mem_map_full Gst.MemoryMapFullFunction r the implementation of the Gst.MemoryMapFullFunction. Will be used instead of mem_map if present.
mem_share Gst.MemoryShareFunction r the implementation of the Gst.MemoryShareFunction
mem_type str r  
mem_unmap Gst.MemoryUnmapFunction r the implementation of the Gst.MemoryUnmapFunction
mem_unmap_full Gst.MemoryUnmapFullFunction r the implementation of the Gst.MemoryUnmapFullFunction. Will be used instead of mem_unmap if present.
object Gst.Object r  

Class Details

class Gst.Allocator(**kwargs)
Bases:Gst.Object
Abstract:Yes
Structure:Gst.AllocatorClass

Memory is usually created by allocators with a Gst.Allocator.alloc() method call. When None 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.

classmethod find(name)[source]
Parameters:name (str or None) – the name of the allocator
Returns:a Gst.Allocator or None when the allocator with name was not registered. Use Gst.Object.unref() to release the allocator after usage.
Return type:Gst.Allocator or None

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

classmethod register(name, allocator)[source]
Parameters:

Registers the memory allocator with name. This function takes ownership of allocator.

alloc(size, params)[source]
Parameters:
Returns:

a new Gst.Memory.

Return type:

Gst.Memory or None

Use self 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 None 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 self is None, 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.

free(memory)[source]
Parameters:memory (Gst.Memory) – the memory to free

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

set_default()[source]

Set the default allocator. This function takes ownership of self.

do_alloc(size, params) virtual
Parameters:
Returns:

a new Gst.Memory.

Return type:

Gst.Memory or None

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 None 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 None, 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.

do_free(memory) virtual
Parameters:memory (Gst.Memory) – the memory to free

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