From d79eea15fa958783bddabe584b6a2b113098d816 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 5 Dec 2013 18:49:19 -0500 Subject: [PATCH] v4l2object: Add V4L2_CID_MIN_BUFFERS_FOR_CAPTURE support https://bugzilla.gnome.org/show_bug.cgi?id=720568 --- sys/v4l2/gstv4l2object.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index ed363a6e58..a93b4ad42c 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -3146,6 +3146,7 @@ gst_v4l2_object_decide_allocation (GstV4l2Object * obj, GstQuery * query) GstBufferPool *pool; guint size, min, max; gboolean update; + struct v4l2_control ctl = { 0, }; GST_DEBUG_OBJECT (obj->element, "decide allocation"); @@ -3173,6 +3174,14 @@ gst_v4l2_object_decide_allocation (GstV4l2Object * obj, GstQuery * query) min = 2; } + /* Certain driver may expose a minimum through controls */ + ctl.id = V4L2_CID_MIN_BUFFERS_FOR_CAPTURE; + if (v4l2_ioctl (obj->video_fd, VIDIOC_G_CTRL, &ctl) >= 0) { + GST_DEBUG_OBJECT (obj->element, "driver require a minimum of %d buffers", + ctl.value); + min += ctl.value; + } + /* select a pool */ switch (obj->mode) { case GST_V4L2_IO_RW: