libcamera: camera_sensor: getFormat(): Use span

The function takes a const std::vector reference, but it does
not actually need an `std::vector`. So use a `libcamera::Span`
instead to avoid forcing the caller to construct a vector.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze
2024-10-03 00:29:11 +02:00
parent 39d37fce12
commit 43dfbe2541
5 changed files with 16 additions and 11 deletions

View File

@@ -96,10 +96,13 @@ protected:
}
/* Use an invalid format and make sure it's not selected. */
V4L2SubdeviceFormat format = sensor_->getFormat({ 0xdeadbeef,
MEDIA_BUS_FMT_SBGGR10_1X10,
MEDIA_BUS_FMT_BGR888_1X24 },
Size(1024, 768));
static constexpr uint32_t mbusCodes[] = {
0xdeadbeef,
MEDIA_BUS_FMT_SBGGR10_1X10,
MEDIA_BUS_FMT_BGR888_1X24,
};
V4L2SubdeviceFormat format = sensor_->getFormat(mbusCodes, Size(1024, 768));
if (format.code != MEDIA_BUS_FMT_SBGGR10_1X10 ||
format.size != Size(4096, 2160)) {
cerr << "Failed to get a suitable format, expected 4096x2160-0x"