summaryrefslogtreecommitdiff
path: root/src/v4l2/v4l2_camera_proxy.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-03 22:03:01 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-05 23:31:12 +0300
commite6886f63529bce803433158bb81dfb6550b5b10c (patch)
treef774704ef527ebeafcf2593b3b5ead9fe56a5c63 /src/v4l2/v4l2_camera_proxy.cpp
parent3335d5a504374166f749a267ba1e1d803a0ed1f6 (diff)
v4l2: Use V4L2PixelFormat::toPixelFormat()
Replace the open-coded PixelFormat lookup with the V4L2PixelFormat::toPixelFormat() helper function. This simplifies the implementation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasoboard.com>
Diffstat (limited to 'src/v4l2/v4l2_camera_proxy.cpp')
-rw-r--r--src/v4l2/v4l2_camera_proxy.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index 7682c4bd..07b1a90a 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -243,7 +243,7 @@ int V4L2CameraProxy::vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_fr
LOG(V4L2Compat, Debug) << "Servicing vidioc_enum_framesizes fd = " << file->efd();
V4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->pixel_format);
- PixelFormat format = PixelFormatInfo::info(v4l2Format).format;
+ PixelFormat format = v4l2Format.toPixelFormat();
/*
* \todo This might need to be expanded as few pipeline handlers
* report StreamFormats.
@@ -299,7 +299,7 @@ int V4L2CameraProxy::vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg)
int V4L2CameraProxy::tryFormat(struct v4l2_format *arg)
{
V4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->fmt.pix.pixelformat);
- PixelFormat format = PixelFormatInfo::info(v4l2Format).format;
+ PixelFormat format = v4l2Format.toPixelFormat();
Size size(arg->fmt.pix.width, arg->fmt.pix.height);
StreamConfiguration config;
@@ -348,8 +348,7 @@ int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg)
Size size(arg->fmt.pix.width, arg->fmt.pix.height);
V4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->fmt.pix.pixelformat);
- ret = vcam_->configure(&streamConfig_, size,
- PixelFormatInfo::info(v4l2Format).format,
+ ret = vcam_->configure(&streamConfig_, size, v4l2Format.toPixelFormat(),
bufferCount_);
if (ret < 0)
return -EINVAL;
@@ -491,8 +490,7 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf
Size size(v4l2PixFormat_.width, v4l2PixFormat_.height);
V4L2PixelFormat v4l2Format = V4L2PixelFormat(v4l2PixFormat_.pixelformat);
int ret = vcam_->configure(&streamConfig_, size,
- PixelFormatInfo::info(v4l2Format).format,
- arg->count);
+ v4l2Format.toPixelFormat(), arg->count);
if (ret < 0)
return -EINVAL;