summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Konovalov <andrey.konovalov@linaro.org>2020-04-21 23:39:53 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-27 22:04:50 +0300
commit68e65da0ccc8308ba3d87b1522d77b36c54efae7 (patch)
tree07f4bc65e3b59613a8103f5ef811dfb760afce9c
parent7283eff090f801ba97a198e4929e64d0d158e063 (diff)
libcamera: pipeline: simple: Make sure the formats at the link's pads match
Change SimpleCameraData::setupFormats() to return -EINVAL if the sink pad of the link doesn't support the format set on the source pad of this link. Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index b1814b08..c2498d4e 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -388,10 +388,24 @@ int SimpleCameraData::setupFormats(V4L2SubdeviceFormat *format,
}
if (sink->entity()->function() != MEDIA_ENT_F_IO_V4L) {
+ V4L2SubdeviceFormat sourceFormat = *format;
+
V4L2Subdevice *subdev = pipe->subdev(sink->entity());
ret = subdev->setFormat(sink->index(), format, whence);
if (ret < 0)
return ret;
+
+ if (format->mbus_code != sourceFormat.mbus_code ||
+ format->size != sourceFormat.size) {
+ LOG(SimplePipeline, Debug)
+ << "Source '" << source->entity()->name()
+ << "':" << source->index()
+ << " produces " << sourceFormat.toString()
+ << ", sink '" << sink->entity()->name()
+ << "':" << sink->index()
+ << " requires " << format->toString();
+ return -EINVAL;
+ }
}
LOG(SimplePipeline, Debug)