libcamera: simple: Fill stride and frameSize at config validation
Fill the stride and frameSize fields of the StreamConfiguration at configuration validation time instead of at camera configuration time. This allows applications to get the stride when trying a configuration without modifying the active configuration of the camera. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
@@ -261,4 +261,19 @@ void SimpleConverter::outputBufferReady(FrameBuffer *buffer)
|
||||
}
|
||||
}
|
||||
|
||||
std::tuple<unsigned int, unsigned int>
|
||||
SimpleConverter::strideAndFrameSize(const Size &size,
|
||||
const PixelFormat &pixelFormat)
|
||||
{
|
||||
V4L2DeviceFormat format = {};
|
||||
format.fourcc = m2m_->capture()->toV4L2PixelFormat(pixelFormat);
|
||||
format.size = size;
|
||||
|
||||
int ret = m2m_->capture()->tryFormat(&format);
|
||||
if (ret < 0)
|
||||
return { 0, 0 };
|
||||
|
||||
return { format.planes[0].bpl, format.planes[0].size };
|
||||
}
|
||||
|
||||
} /* namespace libcamera */
|
||||
|
||||
Reference in New Issue
Block a user