fdmemory

fdmemory — Memory wrapper for fd backed memory

Synopsis

#include <gst/allocators/gstfdmemory.h>

enum                GstFdMemoryFlags;
GstMemory *         gst_fd_allocator_alloc              (GstAllocator *allocator,
                                                         gint fd,
                                                         gsize size,
                                                         GstFdMemoryFlags flags);
GType               gst_fd_allocator_get_type           (void);
GstAllocator *      gst_fd_allocator_new                (void);
gint                gst_fd_memory_get_fd                (GstMemory *mem);
gboolean            gst_is_fd_memory                    (GstMemory *mem);

Description

Details

enum GstFdMemoryFlags

typedef enum {
  GST_FD_MEMORY_FLAG_NONE = 0,
  GST_FD_MEMORY_FLAG_KEEP_MAPPED = (1 << 0),
  GST_FD_MEMORY_FLAG_MAP_PRIVATE = (1 << 1),
} GstFdMemoryFlags;

Various flags to control the operation of the fd backed memory.

GST_FD_MEMORY_FLAG_NONE

no flag

GST_FD_MEMORY_FLAG_KEEP_MAPPED

once the memory is mapped, keep it mapped until the memory is destroyed.

GST_FD_MEMORY_FLAG_MAP_PRIVATE

do a private mapping instead of the default shared mapping.

Since 1.6


gst_fd_allocator_alloc ()

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

Return a GstMemory that wraps a generic file descriptor.

allocator :

allocator to be used for this memory

fd :

file descriptor

size :

memory size

flags :

extra GstFdMemoryFlags

Returns :

a GstMemory based on allocator. When the buffer will be released the allocator will close the fd. The memory is only mmapped on gst_buffer_mmap() request. [transfer full]

Since 1.6


gst_fd_allocator_get_type ()

GType               gst_fd_allocator_get_type           (void);

gst_fd_allocator_new ()

GstAllocator *      gst_fd_allocator_new                (void);

Return a new fd allocator.

Returns :

a new fd allocator, or NULL if the allocator isn't available. Use gst_object_unref() to release the allocator after usage. [transfer full]

Since 1.6


gst_fd_memory_get_fd ()

gint                gst_fd_memory_get_fd                (GstMemory *mem);

Get the fd from mem. Call gst_is_fd_memory() to check if mem has an fd.

mem :

GstMemory

Returns :

the fd of mem or -1 when there is no fd on mem

Since 1.6


gst_is_fd_memory ()

gboolean            gst_is_fd_memory                    (GstMemory *mem);

Check if mem is memory backed by an fd

mem :

GstMemory

Returns :

TRUE when mem has an fd that can be retrieved with gst_fd_memory_get_fd().

Since 1.6

See Also

GstMemory