From f0d928b56eb3cf34bd61a94ccdaeedafd8108c49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Wed, 18 Dec 2019 18:47:45 +0100 Subject: test: v4l2_videodevice: Switch to FrameBuffer interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The V4L2VideoDevice class can now operate using a FrameBuffer interface, switch all test cases to use it. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- test/v4l2_videodevice/buffer_sharing.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'test/v4l2_videodevice/buffer_sharing.cpp') diff --git a/test/v4l2_videodevice/buffer_sharing.cpp b/test/v4l2_videodevice/buffer_sharing.cpp index fe48b2e9..6acb06a2 100644 --- a/test/v4l2_videodevice/buffer_sharing.cpp +++ b/test/v4l2_videodevice/buffer_sharing.cpp @@ -73,16 +73,14 @@ protected: return TestFail; } - pool_.createBuffers(bufferCount); - - ret = capture_->exportBuffers(&pool_); - if (ret) { - std::cout << "Failed to export buffers" << std::endl; + ret = capture_->exportBuffers(bufferCount, &buffers_); + if (ret < 0) { + std::cout << "Failed to allocate buffers" << std::endl; return TestFail; } - ret = output_->importBuffers(&pool_); - if (ret) { + ret = output_->importBuffers(bufferCount); + if (ret < 0) { std::cout << "Failed to import buffers" << std::endl; return TestFail; } @@ -90,7 +88,7 @@ protected: return 0; } - void captureBufferReady(Buffer *buffer) + void captureBufferReady(FrameBuffer *buffer) { const FrameMetadata &metadata = buffer->metadata(); @@ -103,7 +101,7 @@ protected: framesCaptured_++; } - void outputBufferReady(Buffer *buffer) + void outputBufferReady(FrameBuffer *buffer) { const FrameMetadata &metadata = buffer->metadata(); @@ -122,13 +120,15 @@ protected: Timer timeout; int ret; - capture_->bufferReady.connect(this, &BufferSharingTest::captureBufferReady); - output_->bufferReady.connect(this, &BufferSharingTest::outputBufferReady); + capture_->frameBufferReady.connect(this, &BufferSharingTest::captureBufferReady); + output_->frameBufferReady.connect(this, &BufferSharingTest::outputBufferReady); - std::vector> buffers; - buffers = capture_->queueAllBuffers(); - if (buffers.empty()) - return TestFail; + for (const std::unique_ptr &buffer : buffers_) { + if (capture_->queueBuffer(buffer.get())) { + std::cout << "Failed to queue buffer" << std::endl; + return TestFail; + } + } ret = capture_->streamOn(); if (ret) { -- cgit v1.2.1