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

View file

@ -35,8 +35,10 @@ struct FrameMetadata {
std::vector<Plane> planes;
};
class FrameBuffer final
class FrameBuffer final : public Extensible
{
LIBCAMERA_DECLARE_PRIVATE()
public:
struct Plane {
FileDescriptor fd;
@ -47,8 +49,7 @@ public:
const std::vector<Plane> &planes() const { return planes_; }
Request *request() const { return request_; }
void setRequest(Request *request) { request_ = request; }
Request *request() const;
const FrameMetadata &metadata() const { return metadata_; }
unsigned int cookie() const { return cookie_; }
@ -63,7 +64,6 @@ private:
std::vector<Plane> planes_;
Request *request_;
FrameMetadata metadata_;
unsigned int cookie_;