mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-24 09:05:06 +03:00
libcamera: pipeline: simple: converter: Group query functions together
The SimpleConverter class has different sets of functions, related to static queries, device configuration and runtime operation. Group the query functions together. While at it, swap the arguments to the strideAndFrameSize() function to match the order in which pixel format and size are usually specified. No functional change is included. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Phi-Bang Nguyen <pnguyen@baylibre.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
29bd5583c4
commit
cc8da6b8c2
3 changed files with 19 additions and 19 deletions
|
@ -133,6 +133,21 @@ SizeRange SimpleConverter::sizes(const Size &input)
|
|||
return sizes;
|
||||
}
|
||||
|
||||
std::tuple<unsigned int, unsigned int>
|
||||
SimpleConverter::strideAndFrameSize(const PixelFormat &pixelFormat,
|
||||
const Size &size)
|
||||
{
|
||||
V4L2DeviceFormat format;
|
||||
format.fourcc = m2m_->capture()->toV4L2PixelFormat(pixelFormat);
|
||||
format.size = size;
|
||||
|
||||
int ret = m2m_->capture()->tryFormat(&format);
|
||||
if (ret < 0)
|
||||
return std::make_tuple(0, 0);
|
||||
|
||||
return std::make_tuple(format.planes[0].bpl, format.planes[0].size);
|
||||
}
|
||||
|
||||
int SimpleConverter::configure(PixelFormat inputFormat, const Size &inputSize,
|
||||
const StreamConfiguration &outputCfg)
|
||||
{
|
||||
|
@ -254,19 +269,4 @@ 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 std::make_tuple(0, 0);
|
||||
|
||||
return std::make_tuple(format.planes[0].bpl, format.planes[0].size);
|
||||
}
|
||||
|
||||
} /* namespace libcamera */
|
||||
|
|
|
@ -36,6 +36,9 @@ public:
|
|||
std::vector<PixelFormat> formats(PixelFormat input);
|
||||
SizeRange sizes(const Size &input);
|
||||
|
||||
std::tuple<unsigned int, unsigned int>
|
||||
strideAndFrameSize(const PixelFormat &pixelFormat, const Size &size);
|
||||
|
||||
int configure(PixelFormat inputFormat, const Size &inputSize,
|
||||
const StreamConfiguration &outputCfg);
|
||||
int exportBuffers(unsigned int count,
|
||||
|
@ -46,9 +49,6 @@ public:
|
|||
|
||||
int queueBuffers(FrameBuffer *input, FrameBuffer *output);
|
||||
|
||||
std::tuple<unsigned int, unsigned int>
|
||||
strideAndFrameSize(const Size &size, const PixelFormat &pixelFormat);
|
||||
|
||||
Signal<FrameBuffer *, FrameBuffer *> bufferReady;
|
||||
|
||||
private:
|
||||
|
|
|
@ -494,7 +494,7 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()
|
|||
SimpleConverter *converter = pipe->converter();
|
||||
|
||||
std::tie(cfg.stride, cfg.frameSize) =
|
||||
converter->strideAndFrameSize(cfg.size, cfg.pixelFormat);
|
||||
converter->strideAndFrameSize(cfg.pixelFormat, cfg.size);
|
||||
if (cfg.stride == 0)
|
||||
return Invalid;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue