summaryrefslogtreecommitdiff
path: root/test/v4l2_videodevice/buffer_sharing.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-12-18 18:47:45 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-01-12 16:10:37 +0100
commitf0d928b56eb3cf34bd61a94ccdaeedafd8108c49 (patch)
treecace3dc35ca1614f15c5f1c3aaee839a4ceb4a13 /test/v4l2_videodevice/buffer_sharing.cpp
parentcadae67e45785dc5dc005adb63c2dec841f44b1d (diff)
test: v4l2_videodevice: Switch to FrameBuffer interface
The V4L2VideoDevice class can now operate using a FrameBuffer interface, switch all test cases to use it. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test/v4l2_videodevice/buffer_sharing.cpp')
-rw-r--r--test/v4l2_videodevice/buffer_sharing.cpp30
1 files changed, 15 insertions, 15 deletions
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<std::unique_ptr<Buffer>> buffers;
- buffers = capture_->queueAllBuffers();
- if (buffers.empty())
- return TestFail;
+ for (const std::unique_ptr<FrameBuffer> &buffer : buffers_) {
+ if (capture_->queueBuffer(buffer.get())) {
+ std::cout << "Failed to queue buffer" << std::endl;
+ return TestFail;
+ }
+ }
ret = capture_->streamOn();
if (ret) {