libcamera: v4l2_videodevice: Add helper to queue all buffers

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 <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart 2019-07-09 13:56:55 +03:00
parent 33d3c4e204
commit 9bb36ec274
5 changed files with 70 additions and 24 deletions

View file

@ -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<std::unique_ptr<Buffer>> buffers;
buffers = capture_->queueAllBuffers();
if (buffers.empty())
return TestFail;
ret = capture_->streamOn();
if (ret)