From ad12f09a6237818cea9f2ff765ccaf8eb993d147 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 26 Dec 2020 23:45:04 +0200 Subject: libcamera: pipeline: simple: converter: Use StreamConfiguration for input configuration Group the configuration parameters for the converter input in a StreamConfiguration instance. This makes the configure() function signature cleaner, and will allow passing additional parameters (such as stride and buffer count). Signed-off-by: Laurent Pinchart Tested-by: Phi-Bang Nguyen Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/simple/converter.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/libcamera/pipeline/simple/converter.cpp') diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp index 8f54caac..6f4e41db 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -148,15 +148,17 @@ SimpleConverter::strideAndFrameSize(const PixelFormat &pixelFormat, return std::make_tuple(format.planes[0].bpl, format.planes[0].size); } -int SimpleConverter::configure(PixelFormat inputFormat, const Size &inputSize, +int SimpleConverter::configure(const StreamConfiguration &inputCfg, const StreamConfiguration &outputCfg) { - V4L2DeviceFormat format; int ret; - V4L2PixelFormat videoFormat = m2m_->output()->toV4L2PixelFormat(inputFormat); + V4L2PixelFormat videoFormat = + m2m_->output()->toV4L2PixelFormat(inputCfg.pixelFormat); + + V4L2DeviceFormat format; format.fourcc = videoFormat; - format.size = inputSize; + format.size = inputCfg.size; ret = m2m_->output()->setFormat(&format); if (ret < 0) { @@ -165,7 +167,7 @@ int SimpleConverter::configure(PixelFormat inputFormat, const Size &inputSize, return ret; } - if (format.fourcc != videoFormat || format.size != inputSize) { + if (format.fourcc != videoFormat || format.size != inputCfg.size) { LOG(SimplePipeline, Error) << "Input format not supported"; return -EINVAL; -- cgit v1.2.1