:right-sidebar: True Allocator =================================================================== .. currentmodule:: gi.repository.Gst .. class:: Allocator(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gst.Object`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Memory is usually created by allocators with a :func:`~gi.repository.Gst.Allocator.alloc` method call. When :const:`None` is used as the allocator, the default allocator will be used. New allocators can be registered with :func:`~gi.repository.Gst.Allocator.register`. Allocators are identified by name and can be retrieved with :func:`~gi.repository.Gst.Allocator.find`. :func:`~gi.repository.Gst.Allocator.set_default` can be used to change the default allocator. New memory can be created with :func:`~gi.repository.Gst.Memory.new_wrapped` that wraps the memory allocated elsewhere. Methods ------- .. rst-class:: interim-class .. class:: Allocator :no-index: .. method:: alloc(size: int, params: ~gi.repository.Gst.AllocationParams | None = None) -> ~gi.repository.Gst.Memory | 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 :const:`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_MEMORY_FLAG_ZERO_PREFIXED`` and ``GST_MEMORY_FLAG_ZERO_PADDED`` respectively. When ``allocator`` is :const:`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. :param size: size of the visible memory area :param params: optional parameters .. method:: do_alloc(self, size: int, params: ~gi.repository.Gst.AllocationParams | None = None) -> ~gi.repository.Gst.Memory | None :param size: :param params: .. method:: do_free(self, memory: ~gi.repository.Gst.Memory) -> None :param memory: .. classmethod:: find() -> ~gi.repository.Gst.Allocator | None Find a previously registered allocator with ``name``\. When ``name`` is :const:`None`, the default allocator will be returned. .. method:: free(memory: ~gi.repository.Gst.Memory) -> None Free ``memory`` that was previously allocated with :func:`~gi.repository.Gst.Allocator.alloc`. :param memory: the memory to free .. classmethod:: register(allocator: ~gi.repository.Gst.Allocator) -> None Registers the memory ``allocator`` with ``name``\. :param allocator: :obj:`~gi.repository.Gst.Allocator` .. method:: set_default() -> None Set the default allocator. Virtual Methods --------------- .. rst-class:: interim-class .. class:: Allocator :no-index: .. method:: do_alloc(size: int, params: ~gi.repository.Gst.AllocationParams | None = None) -> ~gi.repository.Gst.Memory | 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 :const:`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_MEMORY_FLAG_ZERO_PREFIXED`` and ``GST_MEMORY_FLAG_ZERO_PADDED`` respectively. When ``allocator`` is :const:`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. :param size: size of the visible memory area :param params: optional parameters .. method:: do_free(memory: ~gi.repository.Gst.Memory) -> None Free ``memory`` that was previously allocated with :func:`~gi.repository.Gst.Allocator.alloc`. :param memory: the memory to free Fields ------ .. rst-class:: interim-class .. class:: Allocator :no-index: .. attribute:: mem_copy The implementation of the GstMemoryCopyFunction .. attribute:: mem_is_span The implementation of the GstMemoryIsSpanFunction .. attribute:: mem_map The implementation of the GstMemoryMapFunction .. attribute:: mem_map_full The implementation of the GstMemoryMapFullFunction. Will be used instead of ``mem_map`` if present. (Since: 1.6) .. attribute:: mem_share The implementation of the GstMemoryShareFunction .. attribute:: mem_type .. attribute:: mem_unmap The implementation of the GstMemoryUnmapFunction .. attribute:: mem_unmap_full The implementation of the GstMemoryUnmapFullFunction. Will be used instead of ``mem_unmap`` if present. (Since: 1.6) .. attribute:: object .. attribute:: priv