mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-17 01:15:06 +03:00
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>
This commit is contained in:
parent
7283eff090
commit
68e65da0cc
1 changed files with 14 additions and 0 deletions
|
@ -388,10 +388,24 @@ int SimpleCameraData::setupFormats(V4L2SubdeviceFormat *format,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sink->entity()->function() != MEDIA_ENT_F_IO_V4L) {
|
if (sink->entity()->function() != MEDIA_ENT_F_IO_V4L) {
|
||||||
|
V4L2SubdeviceFormat sourceFormat = *format;
|
||||||
|
|
||||||
V4L2Subdevice *subdev = pipe->subdev(sink->entity());
|
V4L2Subdevice *subdev = pipe->subdev(sink->entity());
|
||||||
ret = subdev->setFormat(sink->index(), format, whence);
|
ret = subdev->setFormat(sink->index(), format, whence);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
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)
|
LOG(SimplePipeline, Debug)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue