From patchwork Fri Sep 3 20:23:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13616 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id DB064BD87D for ; Fri, 3 Sep 2021 20:23:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4717469168; Fri, 3 Sep 2021 22:23:26 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="TFWSR+jv"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AD3E169167 for ; Fri, 3 Sep 2021 22:23:24 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 37EF3BBE for ; Fri, 3 Sep 2021 22:23:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1630700604; bh=gENi+zVsTL+hISiXHUIaBRQG0bDI568t6GOWAiUt/+M=; h=From:To:Subject:Date:From; b=TFWSR+jv0AxCr30xlj9fa2uKohR9dC8a8LEKR3XrfGAUgeDskF1RKLPmOZKyJnKqL xh4YpWVlI9gehgdX7VbfQgwHWvDG1Ys6nXVO3pnJ5iLXGlF7G+KUx5tpmQz78/136z RuDyZvQzZ8PAygj78VgjMFu9Rkzp4fHvUGXr+bIo= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Sep 2021 23:23:05 +0300 Message-Id: <20210903202305.17689-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] v4l2: Use V4L2PixelFormat::toPixelFormat() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Replace the open-coded PixelFormat lookup with the V4L2PixelFormat::toPixelFormat() helper function. This simplifies the implementation. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Kieran Bingham --- src/v4l2/v4l2_camera_proxy.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 7682c4bddf90..07b1a90aa32f 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;