## dmabuf dmabuf — Memory wrapper for Linux dmabuf memory |

## Synopsis

    #include <gst/allocators/gstdmabuf.h>

    GstMemory *         gst_dmabuf_allocator_alloc          (GstAllocator *allocator,
                                                             gint fd,
                                                             gsize size);
    GstAllocator *      gst_dmabuf_allocator_obtain         (void);
    gint                gst_dmabuf_memory_get_fd            (GstMemory *mem);
    gboolean            gst_is_dmabuf_memory                (GstMemory *mem);

## Description

## Details

### gst_dmabuf_allocator_alloc ()

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

Return a `GstMemory` that wraps a dmabuf file descriptor.

`allocator` : | allocator to be used for this memory. [allow-none]
`fd` : | dmabuf file descriptor
`size` : | memory size
Returns : | 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_mmap()` request. [transfer full]

Since 1.2

### gst_dmabuf_allocator_obtain ()

    GstAllocator *      gst_dmabuf_allocator_obtain         (void);

Return a dmabuf allocator.

Returns : | a dmabuf allocator, or NULL if the allocator isn't available. Use `gst_object_unref()` to release the allocator after usage. [transfer full]

Since 1.2

### gst_dmabuf_memory_get_fd ()

    gint                gst_dmabuf_memory_get_fd            (GstMemory *mem);

Return the file descriptor associated with `mem`.

`mem` : | the memory to get the file descriptor
Returns : | the file descriptor associated with the memory, or -1

Since 1.2

### gst_is_dmabuf_memory ()

    gboolean            gst_is_dmabuf_memory                (GstMemory *mem);

Check if `mem` is dmabuf memory.

`mem` : | the memory to be check
Returns : | `TRUE` if `mem` is dmabuf memory, otherwise `FALSE`

Since 1.2

## See Also

GstMemory