From patchwork Wed Aug 3 10:38:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 16933 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 EC6ABBE173 for ; Wed, 3 Aug 2022 10:39:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BC7CE63325; Wed, 3 Aug 2022 12:39:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1659523149; bh=iedALra/qDBzxP9ptFkvgqY3VnntJu0nfTu75a8zYgE=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=TNcxZBUnojE4oGE+d/ic/HjSKqT1qcEQN7K7vjzGve4Fs3eeWTO9UFSV8DG5AdZc3 ShCwayNWfbSxULHBYZrrV2qXy+v/5HXG088gby98HXeR/4k/tKJ9kGWv91OLC5QcZ/ r15028YzXPOJDbrhmqUF19kDT3vDz45vFWYKkjXjkjG53XYjJW46WQ+q1cfgMeow2z nKCyJLoc0i8EYnPAqj9Yj+EdUsyOnI7+H8n1hUMCGXbtiywgaxCNFkj6r1CubtVaRc jgJU7tGThcnZ6iCfst04UKzieiHrrtDsvf5MZF/So5wpdo8PFPPPper0ZLpn2E9QmV y1NDOW0uoZejA== Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 40FE463310 for ; Wed, 3 Aug 2022 12:39:08 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 155C11C0003; Wed, 3 Aug 2022 10:39:06 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Wed, 3 Aug 2022 12:38:49 +0200 Message-Id: <20220803103849.26144-8-jacopo@jmondi.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220803103849.26144-1-jacopo@jmondi.org> References: <20220803103849.26144-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 7/7] libcamera: formats: Map V4L2_PIX_FMT_JPEG to formats::MJPEG 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: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The V4L2_PIX_FMT_JPEG and V4L2_PIX_FMT_MJPEG formats are under-specified and are used interchangeably by kernel drivers. Map both of them to formats::MJPEG and use the newly re-introduced V4L2VideoDevice::toV4L2PixelFormat() to map to the one actually used by the video device. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/formats.cpp | 5 ++++- src/libcamera/v4l2_pixelformat.cpp | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index b760ec0eff82..4746d38c30d2 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -785,7 +785,10 @@ const std::map pixelFormatInfo{ { formats::MJPEG, { .name = "MJPEG", .format = formats::MJPEG, - .v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), }, + .v4l2Formats = { + V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), + V4L2PixelFormat(V4L2_PIX_FMT_JPEG), + }, .bitsPerPixel = 0, .colourEncoding = PixelFormatInfo::ColourEncodingYUV, .packed = false, diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 90c8fa8d9aae..ca05de6c0b4a 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -183,6 +183,8 @@ const std::map vpf2pf{ /* Compressed formats. */ { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), { formats::MJPEG, "Motion-JPEG" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_JPEG), + { formats::MJPEG, "JPEG JFIF" } }, }; } /* namespace */