v4l2allocator: Add a method to read number of allocated group
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Mon, 5 May 2014 16:06:44 +0000 (12:06 -0400)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 8 May 2014 19:56:37 +0000 (15:56 -0400)
sys/v4l2/gstv4l2allocator.c
sys/v4l2/gstv4l2allocator.h

index 2057b17..6f14871 100644 (file)
@@ -1361,3 +1361,17 @@ gst_v4l2_allocator_reset_group (GstV4l2Allocator * allocator,
       break;
   }
 }
+
+gsize
+gst_v4l2_allocator_num_allocated (GstV4l2Allocator * allocator)
+{
+  gsize num_allocated;
+
+  GST_OBJECT_LOCK (allocator);
+
+  num_allocated = allocator->count;
+
+  GST_OBJECT_UNLOCK (allocator);
+
+  return num_allocated;
+}
index 53ac7af..54cf1cb 100644 (file)
@@ -149,6 +149,8 @@ GstV4l2MemoryGroup*  gst_v4l2_allocator_dqbuf          (GstV4l2Allocator * alloc
 void                 gst_v4l2_allocator_reset_group    (GstV4l2Allocator * allocator,
                                                         GstV4l2MemoryGroup * group);
 
+gsize                gst_v4l2_allocator_num_allocated  (GstV4l2Allocator * allocator);
+
 G_END_DECLS
 
 #endif /* __GST_V4L2_ALLOCATOR_H__ */