From 9bb36ec274da530e509fe2f4010b262c43e812f3 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 9 Jul 2019 13:56:55 +0300 Subject: libcamera: v4l2_videodevice: Add helper to queue all buffers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When starting the stream on a capture video device it is often needed to queue all the allocated buffers. Add a helper method to do so, and refactor the existing queueBuffer() method to make it clearer. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- test/v4l2_videodevice/capture_async.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'test/v4l2_videodevice/capture_async.cpp') diff --git a/test/v4l2_videodevice/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp index cea4fffb..4909f71a 100644 --- a/test/v4l2_videodevice/capture_async.cpp +++ b/test/v4l2_videodevice/capture_async.cpp @@ -46,11 +46,10 @@ protected: capture_->bufferReady.connect(this, &CaptureAsyncTest::receiveBuffer); - /* Queue all the buffers to the device. */ - for (Buffer &b : pool_.buffers()) { - if (capture_->queueBuffer(&b)) - return TestFail; - } + std::vector> buffers; + buffers = capture_->queueAllBuffers(); + if (buffers.empty()) + return TestFail; ret = capture_->streamOn(); if (ret) -- cgit v1.2.1