libcamera: framebuffer: Move remaining private data to Private class
Private members of the FrameBuffer class are split between FrameBuffer and FrameBuffer::Private. There was no real justification for this split, and keeping some members private in the FrameBuffer class causes multiple issues: - Future modifications of the FrameBuffer class without breaking the ABI may be more difficult. - Mutable access to members that should not be modified by applications require a friend statement, or going through the Private class. Move all remaining private members to the Private class to address the first issue, and add a Private::metadata() function to address the second problem. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Naushir Patuck <naush@raspberrypi.com>
This commit is contained in:
@@ -28,8 +28,9 @@ class CrosFrameBufferData : public FrameBuffer::Private
|
||||
LIBCAMERA_DECLARE_PUBLIC(FrameBuffer)
|
||||
|
||||
public:
|
||||
CrosFrameBufferData(cros::ScopedBufferHandle scopedHandle)
|
||||
: FrameBuffer::Private(), scopedHandle_(std::move(scopedHandle))
|
||||
CrosFrameBufferData(cros::ScopedBufferHandle scopedHandle,
|
||||
const std::vector<FrameBuffer::Plane> &planes)
|
||||
: FrameBuffer::Private(planes), scopedHandle_(std::move(scopedHandle))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -81,8 +82,7 @@ PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,
|
||||
}
|
||||
|
||||
return std::make_unique<FrameBuffer>(
|
||||
std::make_unique<CrosFrameBufferData>(std::move(scopedHandle)),
|
||||
planes);
|
||||
std::make_unique<CrosFrameBufferData>(std::move(scopedHandle), planes));
|
||||
}
|
||||
|
||||
PUBLIC_FRAME_BUFFER_ALLOCATOR_IMPLEMENTATION
|
||||
|
||||
@@ -32,8 +32,10 @@ class GenericFrameBufferData : public FrameBuffer::Private
|
||||
|
||||
public:
|
||||
GenericFrameBufferData(struct alloc_device_t *allocDevice,
|
||||
buffer_handle_t handle)
|
||||
: allocDevice_(allocDevice), handle_(handle)
|
||||
buffer_handle_t handle,
|
||||
const std::vector<FrameBuffer::Plane> &planes)
|
||||
: FrameBuffer::Private(planes), allocDevice_(allocDevice),
|
||||
handle_(handle)
|
||||
{
|
||||
ASSERT(allocDevice_);
|
||||
ASSERT(handle_);
|
||||
@@ -136,8 +138,7 @@ PlatformFrameBufferAllocator::Private::allocate(int halPixelFormat,
|
||||
}
|
||||
|
||||
return std::make_unique<FrameBuffer>(
|
||||
std::make_unique<GenericFrameBufferData>(allocDevice_, handle),
|
||||
planes);
|
||||
std::make_unique<GenericFrameBufferData>(allocDevice_, handle, planes));
|
||||
}
|
||||
|
||||
PUBLIC_FRAME_BUFFER_ALLOCATOR_IMPLEMENTATION
|
||||
|
||||
Reference in New Issue
Block a user