diff options
author | Jacopo Mondi <jacopo@jmondi.org> | 2022-07-15 14:53:43 +0200 |
---|---|---|
committer | Jacopo Mondi <jacopo@jmondi.org> | 2022-07-23 10:54:53 +0200 |
commit | 953879a15d83704d86a0b054a06d8e2d4730a2cb (patch) | |
tree | b3ba099ebc427268b2fad8c771e0554ae562c204 /src/v4l2/v4l2_camera_proxy.cpp | |
parent | cd374f31e06e9b334f88d6b32be80094f3781742 (diff) |
libcamera: v4l2_pixelformat: Return a format list in fromPixelFormat()
As we prepare to associate multiple V4L2 FourCC to a single libcamera
format, make the V4L2PixelFormat::fromPixelFormat() return a list of
formats and convert all its users to pick the first one.
This change prepares to re-introduce V4L2VideoDevice::toV4L2PixelFormat()
which will instead match the list of V4L2 FourCC against the formats
supported by the video device.
While at it, reword the V4L2PixelFormat::fromPixelFormat() documentation
to distinguish between planar/multiplanar and contiguous/non-contiguous.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/v4l2/v4l2_camera_proxy.cpp')
-rw-r--r-- | src/v4l2/v4l2_camera_proxy.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 26a227da..55ff62cd 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -182,7 +182,7 @@ void V4L2CameraProxy::setFmtFromConfig(const StreamConfiguration &streamConfig) v4l2PixFormat_.width = size.width; v4l2PixFormat_.height = size.height; - v4l2PixFormat_.pixelformat = V4L2PixelFormat::fromPixelFormat(streamConfig.pixelFormat); + v4l2PixFormat_.pixelformat = V4L2PixelFormat::fromPixelFormat(streamConfig.pixelFormat)[0]; v4l2PixFormat_.field = V4L2_FIELD_NONE; v4l2PixFormat_.bytesperline = streamConfig.stride; v4l2PixFormat_.sizeimage = streamConfig.frameSize; @@ -290,7 +290,7 @@ int V4L2CameraProxy::vidioc_enum_fmt(V4L2CameraFile *file, struct v4l2_fmtdesc * return -EINVAL; PixelFormat format = streamConfig_.formats().pixelformats()[arg->index]; - V4L2PixelFormat v4l2Format = V4L2PixelFormat::fromPixelFormat(format); + V4L2PixelFormat v4l2Format = V4L2PixelFormat::fromPixelFormat(format)[0]; arg->flags = format == formats::MJPEG ? V4L2_FMT_FLAG_COMPRESSED : 0; utils::strlcpy(reinterpret_cast<char *>(arg->description), @@ -333,7 +333,7 @@ int V4L2CameraProxy::tryFormat(struct v4l2_format *arg) arg->fmt.pix.width = config.size.width; arg->fmt.pix.height = config.size.height; - arg->fmt.pix.pixelformat = V4L2PixelFormat::fromPixelFormat(config.pixelFormat); + arg->fmt.pix.pixelformat = V4L2PixelFormat::fromPixelFormat(config.pixelFormat)[0]; arg->fmt.pix.field = V4L2_FIELD_NONE; arg->fmt.pix.bytesperline = config.stride; arg->fmt.pix.sizeimage = config.frameSize; |