mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 07:19:45 +03:00
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>
This commit is contained in:
parent
cadae67e45
commit
f0d928b56e
6 changed files with 48 additions and 65 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue