From 29bd5583c4ebbd62583c12d76d5d0aceb300b649 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 26 Dec 2020 23:45:04 +0200 Subject: libcamera: pipeline: simple: Don't override stride at configure time The stride (and frame size) calculation has been moved from configure time to configuration validate time by commit 89fb1efac240 ("libcamera: simple: Fill stride and frameSize at config validation"). This change has however left one stray setting of the stride when configuring the converter. Fix it. While at it, turn the SimpleConverter::configure() output configuration argument to a const reference to emphasize it can't be null and isn't modified by the function, and rename it from cfg to outputCfg to make its purpose clearer. Fixes: 89fb1efac240 ("libcamera: simple: Fill stride and frameSize at config validation") Signed-off-by: Laurent Pinchart Tested-by: Phi-Bang Nguyen Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/simple/converter.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 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 a6a8e139..87d15c78 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -134,7 +134,7 @@ SizeRange SimpleConverter::sizes(const Size &input) } int SimpleConverter::configure(PixelFormat inputFormat, const Size &inputSize, - StreamConfiguration *cfg) + const StreamConfiguration &outputCfg) { V4L2DeviceFormat format; int ret; @@ -157,10 +157,10 @@ int SimpleConverter::configure(PixelFormat inputFormat, const Size &inputSize, } /* Set the pixel format and size on the output. */ - videoFormat = m2m_->capture()->toV4L2PixelFormat(cfg->pixelFormat); + videoFormat = m2m_->capture()->toV4L2PixelFormat(outputCfg.pixelFormat); format = {}; format.fourcc = videoFormat; - format.size = cfg->size; + format.size = outputCfg.size; ret = m2m_->capture()->setFormat(&format); if (ret < 0) { @@ -169,14 +169,12 @@ int SimpleConverter::configure(PixelFormat inputFormat, const Size &inputSize, return ret; } - if (format.fourcc != videoFormat || format.size != cfg->size) { + if (format.fourcc != videoFormat || format.size != outputCfg.size) { LOG(SimplePipeline, Error) << "Output format not supported"; return -EINVAL; } - cfg->stride = format.planes[0].bpl; - return 0; } -- cgit v1.2.1