libcamera: framebuffer: Make FrameBuffer class Extensible

Implement the D-Pointer design pattern in the FrameBuffer class to allow
changing internal data without affecting the public ABI.

Move the request_ field and the setRequest() function to the
FrameBuffer::Private class. This allows hiding the setRequest() function
from the public API, removing one todo item. More fields may be moved
later.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Laurent Pinchart
2021-06-28 01:02:44 +03:00
parent 689811d87a
commit d6d4710d04
6 changed files with 46 additions and 24 deletions
+4 -3
View File
@@ -18,6 +18,7 @@
#include <libcamera/stream.h>
#include "libcamera/internal/camera_controls.h"
#include "libcamera/internal/framebuffer.h"
#include "libcamera/internal/tracepoints.h"
/**
@@ -121,7 +122,7 @@ void Request::reuse(ReuseFlag flags)
if (flags & ReuseBuffers) {
for (auto pair : bufferMap_) {
FrameBuffer *buffer = pair.second;
buffer->setRequest(this);
buffer->_d()->setRequest(this);
pending_.insert(buffer);
}
} else {
@@ -191,7 +192,7 @@ int Request::addBuffer(const Stream *stream, FrameBuffer *buffer)
return -EEXIST;
}
buffer->setRequest(this);
buffer->_d()->setRequest(this);
pending_.insert(buffer);
bufferMap_[stream] = buffer;
@@ -336,7 +337,7 @@ bool Request::completeBuffer(FrameBuffer *buffer)
int ret = pending_.erase(buffer);
ASSERT(ret == 1);
buffer->setRequest(nullptr);
buffer->_d()->setRequest(nullptr);
if (buffer->metadata().status == FrameMetadata::FrameCancelled)
cancelled_ = true;