{"id":13616,"url":"https://patchwork.libcamera.org/api/patches/13616/?format=json","web_url":"https://patchwork.libcamera.org/patch/13616/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210903202305.17689-1-laurent.pinchart@ideasonboard.com>","date":"2021-09-03T20:23:05","name":"[libcamera-devel] v4l2: Use V4L2PixelFormat::toPixelFormat()","commit_ref":"e6886f63529bce803433158bb81dfb6550b5b10c","pull_url":null,"state":"accepted","archived":false,"hash":"616f970177426f3ab334ca3ef986859dac1038c4","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13616/mbox/","series":[{"id":2445,"url":"https://patchwork.libcamera.org/api/series/2445/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2445","date":"2021-09-03T20:23:05","name":"[libcamera-devel] v4l2: Use V4L2PixelFormat::toPixelFormat()","version":1,"mbox":"https://patchwork.libcamera.org/series/2445/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13616/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13616/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DB064BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Sep 2021 20:23:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4717469168;\n\tFri,  3 Sep 2021 22:23:26 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AD3E169167\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Sep 2021 22:23:24 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 37EF3BBE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Sep 2021 22:23:24 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"TFWSR+jv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630700604;\n\tbh=gENi+zVsTL+hISiXHUIaBRQG0bDI568t6GOWAiUt/+M=;\n\th=From:To:Subject:Date:From;\n\tb=TFWSR+jv0AxCr30xlj9fa2uKohR9dC8a8LEKR3XrfGAUgeDskF1RKLPmOZKyJnKqL\n\txh4YpWVlI9gehgdX7VbfQgwHWvDG1Ys6nXVO3pnJ5iLXGlF7G+KUx5tpmQz78/136z\n\tRuDyZvQzZ8PAygj78VgjMFu9Rkzp4fHvUGXr+bIo=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","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","Content-Transfer-Encoding":"8bit","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":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Replace the open-coded PixelFormat lookup with the\nV4L2PixelFormat::toPixelFormat() helper function. This simplifies the\nimplementation.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/v4l2/v4l2_camera_proxy.cpp | 10 ++++------\n 1 file changed, 4 insertions(+), 6 deletions(-)","diff":"diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex 7682c4bddf90..07b1a90aa32f 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -243,7 +243,7 @@ int V4L2CameraProxy::vidioc_enum_framesizes(V4L2CameraFile *file, struct v4l2_fr\n \tLOG(V4L2Compat, Debug) << \"Servicing vidioc_enum_framesizes fd = \" << file->efd();\n \n \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->pixel_format);\n-\tPixelFormat format = PixelFormatInfo::info(v4l2Format).format;\n+\tPixelFormat format = v4l2Format.toPixelFormat();\n \t/*\n \t * \\todo This might need to be expanded as few pipeline handlers\n \t * report StreamFormats.\n@@ -299,7 +299,7 @@ int V4L2CameraProxy::vidioc_g_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n int V4L2CameraProxy::tryFormat(struct v4l2_format *arg)\n {\n \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->fmt.pix.pixelformat);\n-\tPixelFormat format = PixelFormatInfo::info(v4l2Format).format;\n+\tPixelFormat format = v4l2Format.toPixelFormat();\n \tSize size(arg->fmt.pix.width, arg->fmt.pix.height);\n \n \tStreamConfiguration config;\n@@ -348,8 +348,7 @@ int V4L2CameraProxy::vidioc_s_fmt(V4L2CameraFile *file, struct v4l2_format *arg)\n \n \tSize size(arg->fmt.pix.width, arg->fmt.pix.height);\n \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(arg->fmt.pix.pixelformat);\n-\tret = vcam_->configure(&streamConfig_, size,\n-\t\t\t       PixelFormatInfo::info(v4l2Format).format,\n+\tret = vcam_->configure(&streamConfig_, size, v4l2Format.toPixelFormat(),\n \t\t\t       bufferCount_);\n \tif (ret < 0)\n \t\treturn -EINVAL;\n@@ -491,8 +490,7 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n \tSize size(v4l2PixFormat_.width, v4l2PixFormat_.height);\n \tV4L2PixelFormat v4l2Format = V4L2PixelFormat(v4l2PixFormat_.pixelformat);\n \tint ret = vcam_->configure(&streamConfig_, size,\n-\t\t\t\t   PixelFormatInfo::info(v4l2Format).format,\n-\t\t\t\t   arg->count);\n+\t\t\t\t   v4l2Format.toPixelFormat(), arg->count);\n \tif (ret < 0)\n \t\treturn -EINVAL;\n \n","prefixes":["libcamera-devel"]}