diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2020-07-01 00:21:17 +0900 |
---|---|---|
committer | Paul Elder <paul.elder@ideasonboard.com> | 2020-07-10 16:11:21 +0900 |
commit | bded08db18109eddc62caa970829ee7da9bf2573 (patch) | |
tree | 98556a88769af6a1b6a359e4a77485580f18ade8 /src/libcamera | |
parent | bc5cd599b2c0b807ce503912d4af8750fe3b2dab (diff) |
libcamera: pipeline: uvcvideo: Filter out unsupported formats
Unsupported formats should not be added to the configuration when
generating the configuration. Filter them out.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera')
-rw-r--r-- | src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index 80a0e77b..9db69dd3 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -161,14 +161,11 @@ CameraConfiguration *PipelineHandlerUVC::generateConfiguration(Camera *camera, std::map<V4L2PixelFormat, std::vector<SizeRange>> v4l2Formats = data->video_->formats(); std::map<PixelFormat, std::vector<SizeRange>> deviceFormats; - std::transform(v4l2Formats.begin(), v4l2Formats.end(), - std::inserter(deviceFormats, deviceFormats.begin()), - [&](const decltype(v4l2Formats)::value_type &format) { - return decltype(deviceFormats)::value_type{ - format.first.toPixelFormat(), - format.second - }; - }); + for (const auto &format : v4l2Formats) { + PixelFormat pixelFormat = format.first.toPixelFormat(); + if (pixelFormat.isValid()) + deviceFormats[pixelFormat] = format.second; + } StreamFormats formats(deviceFormats); StreamConfiguration cfg(formats); |