android: mm: Provide helper macro for PIMPL

Each memory backend has to declare a CameraBuffer class implementation
that bridges the API calls to each CameraBuffer::Private implementation.

As the code is likely the same for most (if not all) backends, provide
a convenience macro that expands to the CameraBuffer class declaration.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi 2021-02-26 11:48:47 +01:00
parent 00fec7d5ed
commit 1427d124e8
2 changed files with 34 additions and 38 deletions

View file

@ -85,41 +85,4 @@ size_t CameraBuffer::Private::jpegBufferSize(size_t maxJpegBufferSize) const
maxJpegBufferSize);
}
CameraBuffer::CameraBuffer(buffer_handle_t camera3Buffer, int flags)
: Extensible(new Private(this, camera3Buffer, flags))
{
}
CameraBuffer::~CameraBuffer()
{
}
bool CameraBuffer::isValid() const
{
const Private *const d = LIBCAMERA_D_PTR();
return d->isValid();
}
unsigned int CameraBuffer::numPlanes() const
{
const Private *const d = LIBCAMERA_D_PTR();
return d->numPlanes();
}
Span<const uint8_t> CameraBuffer::plane(unsigned int plane) const
{
const Private *const d = LIBCAMERA_D_PTR();
return const_cast<Private *>(d)->plane(plane);
}
Span<uint8_t> CameraBuffer::plane(unsigned int plane)
{
Private *const d = LIBCAMERA_D_PTR();
return d->plane(plane);
}
size_t CameraBuffer::jpegBufferSize(size_t maxJpegBufferSize) const
{
const Private *const d = LIBCAMERA_D_PTR();
return d->jpegBufferSize(maxJpegBufferSize);
}
PUBLIC_CAMERA_BUFFER_IMPLEMENTATION