v4l2object: Add V4L2_CID_MIN_BUFFERS_FOR_CAPTURE support

https://bugzilla.gnome.org/show_bug.cgi?id=720568
This commit is contained in:
Nicolas Dufresne 2013-12-05 18:49:19 -05:00
parent 3cf85c9083
commit d79eea15fa

View file

@ -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: