: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` :Constructors: :: Allocator(**properties) 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:: find(name: str | None = None) -> ~gi.repository.Gst.Allocator | None Find a previously registered allocator with ``name``. When ``name`` is :const:`None`, the default allocator will be returned. :param name: the name of the allocator .. 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 .. method:: register(name: str, allocator: ~gi.repository.Gst.Allocator) -> None Registers the memory ``allocator`` with ``name``. :param name: the name of the allocator :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