return mem1->mem.offset + mem1->mem.size == mem2->mem.offset;
}
-static void
-_v4l2mem_parent_to_dmabuf (GstV4l2Memory * mem, GstMemory * dma_mem)
-{
- gst_memory_lock (&mem->mem, GST_LOCK_FLAG_EXCLUSIVE);
- dma_mem->parent = gst_memory_ref (&mem->mem);
-}
-
gboolean
gst_is_v4l2_memory (GstMemory * mem)
{
return gst_memory_is_type (mem, GST_V4L2_MEMORY_TYPE);
}
+GQuark
+gst_v4l2_memory_quark (void)
+{
+ static GQuark quark = 0;
+
+ if (quark == 0)
+ quark = g_quark_from_string ("GstV4l2Memory");
+
+ return quark;
+}
+
/*************************************/
/* GstV4l2MemoryGroup implementation */
dma_mem = gst_dmabuf_allocator_alloc (dmabuf_allocator, dmafd,
mem->mem.maxsize);
- _v4l2mem_parent_to_dmabuf (mem, dma_mem);
+
+ gst_mini_object_set_qdata (GST_MINI_OBJECT (dma_mem),
+ GST_V4L2_MEMORY_QUARK, mem, (GDestroyNotify) gst_memory_unref);
group->mem[i] = dma_mem;
group->mems_allocated++;
#define GST_V4L2_ALLOCATOR_CAN_ALLOCATE(obj,type) \
(GST_OBJECT_FLAG_IS_SET (obj, GST_V4L2_ALLOCATOR_FLAG_ ## type ## _CREATE_BUFS))
+#define GST_V4L2_MEMORY_QUARK gst_v4l2_memory_quark ()
+
typedef struct _GstV4l2Allocator GstV4l2Allocator;
typedef struct _GstV4l2AllocatorClass GstV4l2AllocatorClass;
typedef struct _GstV4l2MemoryGroup GstV4l2MemoryGroup;
gboolean gst_is_v4l2_memory (GstMemory * mem);
+GQuark gst_v4l2_memory_quark (void);
+
gboolean gst_v4l2_allocator_is_active (GstV4l2Allocator * allocator);
guint gst_v4l2_allocator_get_size (GstV4l2Allocator * allocator);
goto done;
if (gst_is_dmabuf_memory (mem))
- mem = mem->parent;
+ mem = gst_mini_object_get_qdata (GST_MINI_OBJECT (mem),
+ GST_V4L2_MEMORY_QUARK);
- if (gst_is_v4l2_memory (mem)) {
+ if (mem && gst_is_v4l2_memory (mem)) {
GstV4l2Memory *vmem = (GstV4l2Memory *) mem;
valid = TRUE;
if (group)