From patchwork Wed Aug 3 11:26:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 16953 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 93D39C3272 for ; Wed, 3 Aug 2022 11:27:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 648646331B; Wed, 3 Aug 2022 13:27:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1659526031; 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:Cc: From; b=LJ0YQz9oj3X0Yf8QXUDDFt+fKpZhDo7Q8s7TZmVngX9Zc3jFHv1GegT6WVfXw55GO kY2d7gxBqqCbqMc5BP8fPxaR3VXIN1yA+kNxB9Ln2rNR4vwCVorE8EzJ2wknz5FfL3 qv04aTrRC8d4MNvFF4DKOSbX4JWuf6xnAeScWruy4gGzJvfXLEpsstT/422nrsROw3 JG1ccwjPAVNCCeCAnZF5y8w3OloiMfpPygW6pA7hxjXAGfVLUJF7JLgdlXt6nOdMa7 X/D+Evew8Zyw2ZJJdSKN9nfdtQk0ibNOA1lMP+ZFw31/TUvRbMdUrD2L4LPLwFpfvn tHrCH4ECI+1dQ== Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 646FB6330F for ; Wed, 3 Aug 2022 13:27:10 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 93BD31BF20C; Wed, 3 Aug 2022 11:27:08 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Wed, 3 Aug 2022 13:26:40 +0200 Message-Id: <20220803112640.30402-9-jacopo@jmondi.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220803112640.30402-1-jacopo@jmondi.org> References: <20220803112640.30402-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 8/8] 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 Cc: jozef@mlich.cz, Pavel Machek 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 */