GMutex lock;
} GstDmaBufMemory;
-#define ALLOCATOR_NAME "dmabuf"
-
GST_DEBUG_CATEGORY_STATIC (dmabuf_debug);
#define GST_CAT_DEFAULT dmabuf_debug
{
GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator);
- alloc->mem_type = ALLOCATOR_NAME;
+ alloc->mem_type = GST_ALLOCATOR_DMABUF;
alloc->mem_map = gst_dmabuf_mem_map;
alloc->mem_unmap = gst_dmabuf_mem_unmap;
alloc->mem_share = gst_dmabuf_mem_share;
{
GstAllocator *allocator =
g_object_new (dmabuf_mem_allocator_get_type (), NULL);
- gst_allocator_register (ALLOCATOR_NAME, allocator);
+ gst_allocator_register (GST_ALLOCATOR_DMABUF, allocator);
GST_DEBUG_CATEGORY_INIT (dmabuf_debug, "dmabuf", 0, "dmabuf memory");
}
g_once (&dmabuf_allocator_once, (GThreadFunc) gst_dmabuf_mem_init, NULL);
- allocator = gst_allocator_find (ALLOCATOR_NAME);
+ allocator = gst_allocator_find (GST_ALLOCATOR_DMABUF);
if (!allocator)
- GST_WARNING ("No allocator named %s found", ALLOCATOR_NAME);
+ GST_WARNING ("No allocator named %s found", GST_ALLOCATOR_DMABUF);
return allocator;
}
gboolean
gst_is_dmabuf_memory (GstMemory * mem)
{
- g_return_val_if_fail (mem != NULL, FALSE);
-
- return g_strcmp0 (mem->allocator->mem_type, ALLOCATOR_NAME) == 0;
+ return gst_memory_is_type (mem, GST_ALLOCATOR_DMABUF);
}
#else /* !HAVE_MMAP */
#include <gst/gst.h>
+G_BEGIN_DECLS
+
+#define GST_ALLOCATOR_DMABUF "dmabuf"
+
GstAllocator * gst_dmabuf_allocator_obtain (void);
GstMemory * gst_dmabuf_allocator_alloc (GstAllocator * allocator, gint fd, gsize size);
gboolean gst_is_dmabuf_memory (GstMemory * mem);
+G_END_DECLS
#endif /* __GST_DMABUF_H__ */