diff options
author | Naushir Patuck <naush@raspberrypi.com> | 2021-12-03 11:32:05 +0000 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2021-12-07 10:55:56 +0000 |
commit | f31be76ae67f0eae8c417faa53d8e0281368e0bb (patch) | |
tree | 70ae92ceaa7951326b40ca60353232554b945dd7 | |
parent | acf8d028edda0a59b10e15962c2606137a4940af (diff) |
pipeline: raspberrypi: Return the sensor formats from generateConfiguration()
Return the available sensor PixelFormats and sizes from generateConfiguration()
if the StreamRole is set to StreamRole::Raw. The existing code returns the
PixelFormats and sizes for all other StreamRole types.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r-- | src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 321b72ad..62db8f26 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -589,12 +589,23 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera, return nullptr; } - /* Translate the V4L2PixelFormat to PixelFormat. */ std::map<PixelFormat, std::vector<SizeRange>> deviceFormats; - for (const auto &format : fmts) { - PixelFormat pf = format.first.toPixelFormat(); - if (pf.isValid()) - deviceFormats[pf] = format.second; + if (role == StreamRole::Raw) { + /* Translate the MBUS codes to a PixelFormat. */ + for (const auto &format : data->sensorFormats_) { + PixelFormat pf = mbusCodeToPixelFormat(format.first, + BayerFormat::Packing::CSI2); + if (pf.isValid()) + deviceFormats.emplace(std::piecewise_construct, std::forward_as_tuple(pf), + std::forward_as_tuple(format.second.begin(), format.second.end())); + } + } else { + /* Translate the V4L2PixelFormat to PixelFormat. */ + for (const auto &format : fmts) { + PixelFormat pf = format.first.toPixelFormat(); + if (pf.isValid()) + deviceFormats[pf] = format.second; + } } /* Add the stream format based on the device node used for the use case. */ |