# GstDmaBufAllocator

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstAllocator
                    ╰──GstFdAllocator
                        ╰──GstDmaBufAllocator

Base class for allocators with dmabuf-backed memory

### Members

`parent` (GstFdAllocator) –
No description available

### Class structure

#### GstDmaBufAllocatorClass

##### Fields

`parent_class` (GstFdAllocatorClass) –
No description available

### GstAllocators.DmaBufAllocatorClass

##### Attributes

`parent_class` (GstAllocators.FdAllocatorClass) –
No description available

### GstAllocators.DmaBufAllocatorClass

##### Attributes

`parent_class` (GstAllocators.FdAllocatorClass) –
No description available

## GstAllocators.DmaBufAllocator

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Allocator
                    ╰──GstAllocators.FdAllocator
                        ╰──GstAllocators.DmaBufAllocator

Base class for allocators with dmabuf-backed memory

### Members

`parent` (GstAllocators.FdAllocator) –
No description available

## GstAllocators.DmaBufAllocator

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.Allocator
                    ╰──GstAllocators.FdAllocator
                        ╰──GstAllocators.DmaBufAllocator

Base class for allocators with dmabuf-backed memory

### Members

`parent` (GstAllocators.FdAllocator) –
No description available

### Constructors

#### gst_dmabuf_allocator_new

    GstAllocator *
    gst_dmabuf_allocator_new ()

Return a new dmabuf allocator.

Returns ( [transfer: full]) –

a new dmabuf allocator, or NULL if the allocator isn't available. Use gst_object_unref to release the allocator after usage

Since : 1.2

#### GstAllocators.DmaBufAllocator.prototype.new

    function GstAllocators.DmaBufAllocator.prototype.new(): {
        // javascript wrapper for 'gst_dmabuf_allocator_new'
    }

Return a new dmabuf allocator.

Returns (Gst.Allocator) –

a new dmabuf allocator, or NULL if the allocator isn't available. Use Gst.Object.prototype.unref to release the allocator after usage

Since : 1.2

#### GstAllocators.DmaBufAllocator.new

    def GstAllocators.DmaBufAllocator.new ():
        #python wrapper for 'gst_dmabuf_allocator_new'

Return a new dmabuf allocator.

Returns (Gst.Allocator) –

a new dmabuf allocator, or NULL if the allocator isn't available. Use Gst.Object.unref to release the allocator after usage

Since : 1.2

### Functions

#### gst_dmabuf_allocator_alloc

    GstMemory *
    gst_dmabuf_allocator_alloc (GstAllocator * allocator,
                                gint fd,
                                gsize size)

Return a GstMemory that wraps a dmabuf file descriptor.

Parameters:

`allocator` –

allocator to be used for this memory

`fd` –

dmabuf file descriptor

`size` –

memory size

Returns ( [transfer: full]) –

a GstMemory based on allocator. When the buffer will be released dmabuf allocator will close the fd. The memory is only mmapped on gst_buffer_map request.

Since : 1.2

#### GstAllocators.DmaBufAllocator.prototype.alloc

    function GstAllocators.DmaBufAllocator.prototype.alloc(allocator: Gst.Allocator, fd: Number, size: Number): {
        // javascript wrapper for 'gst_dmabuf_allocator_alloc'
    }

Return a Gst.Memory that wraps a dmabuf file descriptor.

Parameters:

`allocator` (Gst.Allocator) –

allocator to be used for this memory

`fd` (Number) –

dmabuf file descriptor

`size` (Number) –

memory size

Returns (Gst.Memory) –

a GstMemory based on allocator. When the buffer will be released dmabuf allocator will close the fd. The memory is only mmapped on Gst.Buffer.prototype.map request.

Since : 1.2

#### GstAllocators.DmaBufAllocator.alloc

    def GstAllocators.DmaBufAllocator.alloc (allocator, fd, size):
        #python wrapper for 'gst_dmabuf_allocator_alloc'

Return a Gst.Memory that wraps a dmabuf file descriptor.

Parameters:

`allocator` (Gst.Allocator) –

allocator to be used for this memory

`fd` (int) –

dmabuf file descriptor

`size` (int) –

memory size

Returns (Gst.Memory) –

a GstMemory based on allocator. When the buffer will be released dmabuf allocator will close the fd. The memory is only mmapped on Gst.Buffer.map request.

Since : 1.2

#### gst_dmabuf_allocator_alloc_with_flags

    GstMemory *
    gst_dmabuf_allocator_alloc_with_flags (GstAllocator * allocator,
                                           gint fd,
                                           gsize size,
                                           GstFdMemoryFlags flags)

Return a GstMemory that wraps a dmabuf file descriptor.

Parameters:

`allocator` –

allocator to be used for this memory

`fd` –

dmabuf file descriptor

`size` –

memory size

`flags` –

extra GstFdMemoryFlags

Returns ( [transfer: full]) –

a GstMemory based on allocator.

When the buffer will be released the allocator will close the fd unless the GST_FD_MEMORY_FLAG_DONT_CLOSE flag is specified. The memory is only mmapped on gst_buffer_mmap request.

Since : 1.16

#### GstAllocators.DmaBufAllocator.prototype.alloc_with_flags

    function GstAllocators.DmaBufAllocator.prototype.alloc_with_flags(allocator: Gst.Allocator, fd: Number, size: Number, flags: GstAllocators.FdMemoryFlags): {
        // javascript wrapper for 'gst_dmabuf_allocator_alloc_with_flags'
    }

Return a Gst.Memory that wraps a dmabuf file descriptor.

Parameters:

`allocator` (Gst.Allocator) –

allocator to be used for this memory

`fd` (Number) –

dmabuf file descriptor

`size` (Number) –

memory size

`flags` (GstAllocators.FdMemoryFlags) –

extra GstAllocators.FdMemoryFlags

Returns (Gst.Memory) –

a GstMemory based on allocator.

When the buffer will be released the allocator will close the fd unless the GstAllocators.FdMemoryFlags.DONT_CLOSE flag is specified. The memory is only mmapped on gst_buffer_mmap request.

Since : 1.16

#### GstAllocators.DmaBufAllocator.alloc_with_flags

    def GstAllocators.DmaBufAllocator.alloc_with_flags (allocator, fd, size, flags):
        #python wrapper for 'gst_dmabuf_allocator_alloc_with_flags'

Return a Gst.Memory that wraps a dmabuf file descriptor.

Parameters:

`allocator` (Gst.Allocator) –

allocator to be used for this memory

`fd` (int) –

dmabuf file descriptor

`size` (int) –

memory size

`flags` (GstAllocators.FdMemoryFlags) –

extra GstAllocators.FdMemoryFlags

Returns (Gst.Memory) –

a GstMemory based on allocator.

When the buffer will be released the allocator will close the fd unless the GstAllocators.FdMemoryFlags.DONT_CLOSE flag is specified. The memory is only mmapped on gst_buffer_mmap request.

Since : 1.16

## Functions

### gst_dmabuf_memory_get_fd

    gint
    gst_dmabuf_memory_get_fd (GstMemory * mem)

Return the file descriptor associated with mem.

Parameters:

`mem` –

the memory to get the file descriptor

Returns –

the file descriptor associated with the memory, or -1. The file descriptor is still owned by the GstMemory. Use dup to take a copy if you intend to use it beyond the lifetime of this GstMemory.

Since : 1.2

### GstAllocators.prototype.dmabuf_memory_get_fd

    function GstAllocators.prototype.dmabuf_memory_get_fd(mem: Gst.Memory): {
        // javascript wrapper for 'gst_dmabuf_memory_get_fd'
    }

Return the file descriptor associated with mem.

Parameters:

`mem` (Gst.Memory) –

the memory to get the file descriptor

Returns (Number) –

the file descriptor associated with the memory, or -1. The file descriptor is still owned by the GstMemory. Use dup to take a copy if you intend to use it beyond the lifetime of this GstMemory.

Since : 1.2

### GstAllocators.dmabuf_memory_get_fd

    def GstAllocators.dmabuf_memory_get_fd (mem):
        #python wrapper for 'gst_dmabuf_memory_get_fd'

Return the file descriptor associated with mem.

Parameters:

`mem` (Gst.Memory) –

the memory to get the file descriptor

Returns (int) –

the file descriptor associated with the memory, or -1. The file descriptor is still owned by the GstMemory. Use dup to take a copy if you intend to use it beyond the lifetime of this GstMemory.

Since : 1.2

### gst_is_dmabuf_memory

    gboolean
    gst_is_dmabuf_memory (GstMemory * mem)

Check if mem is dmabuf memory.

Parameters:

`mem` –

the memory to be check

Returns –

TRUE if mem is dmabuf memory, otherwise FALSE

Since : 1.2

### GstAllocators.prototype.is_dmabuf_memory

    function GstAllocators.prototype.is_dmabuf_memory(mem: Gst.Memory): {
        // javascript wrapper for 'gst_is_dmabuf_memory'
    }

Check if mem is dmabuf memory.

Parameters:

`mem` (Gst.Memory) –

the memory to be check

Returns (Number) –

true if mem is dmabuf memory, otherwise false

Since : 1.2

### GstAllocators.is_dmabuf_memory

    def GstAllocators.is_dmabuf_memory (mem):
        #python wrapper for 'gst_is_dmabuf_memory'

Check if mem is dmabuf memory.

Parameters:

`mem` (Gst.Memory) –

the memory to be check

Returns (bool) –

True if mem is dmabuf memory, otherwise False

Since : 1.2

## Function Macros

### GST_DMABUF_ALLOCATOR_CAST

    #define GST_DMABUF_ALLOCATOR_CAST(obj)         ((GstDmaBufAllocator *)(obj))

## Constants

### GST_ALLOCATOR_DMABUF

    #define GST_ALLOCATOR_DMABUF "dmabuf"

### GstAllocators.ALLOCATOR_DMABUF

### GST_CAPS_FEATURE_MEMORY_DMABUF

    #define GST_CAPS_FEATURE_MEMORY_DMABUF "memory:DMABuf"

Constant that defines the caps feature name for DMA buffer sharing.

It has to be used for non-mappable dma-buf only, i.e. when the underlying memory is not mappable to user space. Or when the mapped memory contains non meaningful data. It can be the case for protected content or when the user wants explicitly avoid any software post processing.

In these cases all elements between the exported and the importer has to work in passthrough mode. This is done by adding this caps feature.

When the memory is mappable for read and write requests then it is assumes to be a fast path and so this caps feature should not be used. Though according to the dma-buf protocol, while it is mapped it prevents the exporter to migrate the buffer.

This caps feature should not serve at all the purpose of selecting the GST_ALLOCATOR_DMABUF allocator during caps negotiation. When the exporter is the upstream element from the importer point of view, the exporter should try to map the dma buffer at runtime (preferably during decide_allocation phase). When it succeeds for GST_MAP_READWRITE this caps feature should not be used. This allows scalers, color converts and any image processing filters to work directly on the dma buffer. In this case the importer element should check all incoming memory using gst_is_dmabuf_memory.

### GstAllocators.CAPS_FEATURE_MEMORY_DMABUF

Constant that defines the caps feature name for DMA buffer sharing.

It has to be used for non-mappable dma-buf only, i.e. when the underlying memory is not mappable to user space. Or when the mapped memory contains non meaningful data. It can be the case for protected content or when the user wants explicitly avoid any software post processing.

In these cases all elements between the exported and the importer has to work in passthrough mode. This is done by adding this caps feature.

When the memory is mappable for read and write requests then it is assumes to be a fast path and so this caps feature should not be used. Though according to the dma-buf protocol, while it is mapped it prevents the exporter to migrate the buffer.

This caps feature should not serve at all the purpose of selecting the GST_ALLOCATOR_DMABUF allocator during caps negotiation. When the exporter is the upstream element from the importer point of view, the exporter should try to map the dma buffer at runtime (preferably during decide_allocation phase). When it succeeds for Gst.MAP_READWRITE this caps feature should not be used. This allows scalers, color converts and any image processing filters to work directly on the dma buffer. In this case the importer element should check all incoming memory using GstAllocators.prototype.is_dmabuf_memory.

### GstAllocators.CAPS_FEATURE_MEMORY_DMABUF

Constant that defines the caps feature name for DMA buffer sharing.

It has to be used for non-mappable dma-buf only, i.e. when the underlying memory is not mappable to user space. Or when the mapped memory contains non meaningful data. It can be the case for protected content or when the user wants explicitly avoid any software post processing.

In these cases all elements between the exported and the importer has to work in passthrough mode. This is done by adding this caps feature.

When the memory is mappable for read and write requests then it is assumes to be a fast path and so this caps feature should not be used. Though according to the dma-buf protocol, while it is mapped it prevents the exporter to migrate the buffer.

This caps feature should not serve at all the purpose of selecting the GST_ALLOCATOR_DMABUF allocator during caps negotiation. When the exporter is the upstream element from the importer point of view, the exporter should try to map the dma buffer at runtime (preferably during decide_allocation phase). When it succeeds for Gst.MAP_READWRITE this caps feature should not be used. This allows scalers, color converts and any image processing filters to work directly on the dma buffer. In this case the importer element should check all incoming memory using GstAllocators.is_dmabuf_memory.

The results of the search are