From 7aed4a98061478aa2a75b8ab5630ac693ef3ce80 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Mon, 5 May 2014 12:06:44 -0400 Subject: [PATCH] v4l2allocator: Add a method to read number of allocated group --- sys/v4l2/gstv4l2allocator.c | 14 ++++++++++++++ sys/v4l2/gstv4l2allocator.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/sys/v4l2/gstv4l2allocator.c b/sys/v4l2/gstv4l2allocator.c index 2057b17dd..6f1487166 100644 --- a/sys/v4l2/gstv4l2allocator.c +++ b/sys/v4l2/gstv4l2allocator.c @@ -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; +} diff --git a/sys/v4l2/gstv4l2allocator.h b/sys/v4l2/gstv4l2allocator.h index 53ac7af2a..54cf1cbc8 100644 --- a/sys/v4l2/gstv4l2allocator.h +++ b/sys/v4l2/gstv4l2allocator.h @@ -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__ */ -- GitLab