[libcamera-devel] [PATCH v2 4/8] libcamera: pipeline: uvcvideo: Translate from V4L2 to DRM pixel formats
Niklas Söderlund
niklas.soderlund at ragnatech.se
Tue Mar 17 04:52:35 CET 2020
When generating a camera configuration pixel formats directly from the
video device are used that contains V4L2 pixel formats. Translate the
pixel formats to DRM before using them i the camera configuration.
Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
---
src/libcamera/pipeline/uvcvideo.cpp | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
index 320da2685795c041..14f7ddb18a765834 100644
--- a/src/libcamera/pipeline/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo.cpp
@@ -154,7 +154,14 @@ CameraConfiguration *PipelineHandlerUVC::generateConfiguration(Camera *camera,
return config;
ImageFormats v4l2formats = data->video_->formats();
- StreamFormats formats(v4l2formats.data());
+ std::map<PixelFormat, std::vector<SizeRange>> deviceformats;
+ for (const auto &it : v4l2formats.data()) {
+ PixelFormat pixelformat = V4L2VideoDevice::toPixelFormat(it.first);
+ const std::vector<SizeRange> &ranges = it.second;
+ deviceformats[pixelformat] = ranges;
+ }
+
+ StreamFormats formats(deviceformats);
StreamConfiguration cfg(formats);
cfg.pixelFormat = formats.pixelformats().front();
--
2.25.1
More information about the libcamera-devel
mailing list