summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-12-26 23:45:04 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-03 00:59:02 +0200
commit3e743ee8ebb13cadbc18175ced0462e99054d0d0 (patch)
tree6172ca90c536fb457a36803d29fd12aeafd467ad /src
parentad12f09a6237818cea9f2ff765ccaf8eb993d147 (diff)
libcamera: pipeline: simple: converter: Configure input stride
Use the stride of the video capture device to configure the converter input. This ensures that no stride mismatch occurs inadvertently along the pipeline. 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>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/simple/converter.cpp5
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp
index 6f4e41db..550b2bcf 100644
--- a/src/libcamera/pipeline/simple/converter.cpp
+++ b/src/libcamera/pipeline/simple/converter.cpp
@@ -159,6 +159,8 @@ int SimpleConverter::configure(const StreamConfiguration &inputCfg,
V4L2DeviceFormat format;
format.fourcc = videoFormat;
format.size = inputCfg.size;
+ format.planesCount = 1;
+ format.planes[0].bpl = inputCfg.stride;
ret = m2m_->output()->setFormat(&format);
if (ret < 0) {
@@ -167,7 +169,8 @@ int SimpleConverter::configure(const StreamConfiguration &inputCfg,
return ret;
}
- if (format.fourcc != videoFormat || format.size != inputCfg.size) {
+ if (format.fourcc != videoFormat || format.size != inputCfg.size ||
+ format.planes[0].bpl != inputCfg.stride) {
LOG(SimplePipeline, Error)
<< "Input format not supported";
return -EINVAL;
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index cb8309ca..2f6dff16 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -606,6 +606,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
StreamConfiguration inputCfg;
inputCfg.pixelFormat = pipeConfig.pixelFormat;
inputCfg.size = pipeConfig.captureSize;
+ inputCfg.stride = captureFormat.planes[0].bpl;
ret = converter_->configure(inputCfg, cfg);
if (ret < 0) {