From patchwork Fri Dec 10 14:44:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 15115 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 2D5B3BF415 for ; Fri, 10 Dec 2021 14:44:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8FE5D60897; Fri, 10 Dec 2021 15:44:41 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="PFh15tLc"; dkim-atps=neutral Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 540036089A for ; Fri, 10 Dec 2021 15:44:38 +0100 (CET) Received: by mail-wm1-x32e.google.com with SMTP id 77-20020a1c0450000000b0033123de3425so9229049wme.0 for ; Fri, 10 Dec 2021 06:44:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+sH0KfN2WD6NxZb8aJTKXBPu6mnk13ViaZCwPQX529M=; b=PFh15tLcvGqkun0JNjSyVOvabdRysp3B3lCm7P0RX3vUodzD0x+lUgWcHifSnzgUXt JCJDx3nUB/1MUH7F6Q6AhwNcuXVUD7UgyCHlgmNzdVKf1v7m5/EnNzBkzta1OgUYr2sK oR4ChGLs5SRRGJ+eHB3EizOXzdcamrUMswGeIZf3T/bVdcPi3516A6WmPdx5XumEDC5L oecCWZ9mD9bhoq7MLQ2j4dgCcbQ4Cy7kSeNWtz7EC6eK0lD12O8zLG14B2qnP34PWCBU rrdDbOumjRfAVceaaYwSreQ46uDi6+XYepGlTMoDTe9ju3I8r9vnXIsgrQ1vITxNM8ww BS3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+sH0KfN2WD6NxZb8aJTKXBPu6mnk13ViaZCwPQX529M=; b=LVHvyF8+BBQaLgwS6RZQIDP/cXToVmr8lGcfitjHmkKCcYJLRPmTHj9Qe4MpyOBS6a A5u7PgoFubyHIgP3WRNSBKgtKgZahJ53fKm+JEoOzLWOvABziPJVuPfMAB36mi0LNWud nFefMaIBngkfipZXetyz1+0Ve7SqE6eZUw3+qNiz8drxH5aaXZi7d5o+4aUV91X98/aE zCwewGtxqv/ItFqToJici0OiTQBc0r4f5ugumUb6aw8Gt5Gz16ZvhY9QzOfPZ9QTLeio 1l3EKImkqOoR1xNaaykhzfUisO6vcfHQNRwvNS3mhsGbf6h658yQYXsggUcHyEEqvWmu BlNw== X-Gm-Message-State: AOAM531eI6uhcD25/mzgo2G612XH/2NeaWl8xweT/nUsNvwqJnBf8p95 7jKpd2C6X9wacP7nQbZMDwwB5Q== X-Google-Smtp-Source: ABdhPJyqP9e5TP1Cz3iTlFuY+U68rI/Ub+0S78g17FoNnVJVufOOul0WInw9mB5NBYbYM6JrX1T0ZQ== X-Received: by 2002:a05:600c:4f92:: with SMTP id n18mr16535049wmq.123.1639147477881; Fri, 10 Dec 2021 06:44:37 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id w22sm3000515wmi.27.2021.12.10.06.44.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 06:44:37 -0800 (PST) From: David Plowman To: Laurent Pinchart , Kieran Bingham , Hans Verkuil , Tomasz Figa , Jacopo Mondi , Naushir Patuck , libcamera-devel@lists.libcamera.org Date: Fri, 10 Dec 2021 14:44:18 +0000 Message-Id: <20211210144424.14747-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211210144424.14747-1-david.plowman@raspberrypi.com> References: <20211210144424.14747-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v12 2/8] libcamera: stream: Add ColorSpace fields to StreamConfiguration 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" This is so that applications can choose appropriate color spaces which will then be passed down to the V4L2 devices. The ColorSpace field is actually optional. If it is not set you will get the camera's default color space. Signed-off-by: David Plowman Reviewed-by: Umang Jain Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- include/libcamera/stream.h | 3 +++ src/libcamera/stream.cpp | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index 41ec02b1..f0ae7e62 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -47,6 +48,8 @@ struct StreamConfiguration { unsigned int bufferCount; + std::optional colorSpace; + Stream *stream() const { return stream_; } void setStream(Stream *stream) { stream_ = stream; } const StreamFormats &formats() const { return formats_; } diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index b421e17e..686e693b 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -329,6 +329,26 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats) * \brief Requested number of buffers to allocate for the stream */ +/** + * \var StreamConfiguration::colorSpace + * \brief The ColorSpace for this stream + * + * This field allows a ColorSpace to be selected for this Stream. + * + * The field is optional and an application can choose to leave it unset. + * Platforms that support the use of color spaces may provide default + * values through the generateConfiguration() method. An application can + * override these when necessary. + * + * If a specific ColorSpace is requested but the Camera cannot deliver it, + * then the StreamConfiguration will be adjusted to a value that can be + * delivered. In this case the validate() method will indicate via its + * return value that the CameraConfiguration has been adjusted. + * + * Note that platforms will typically have different constraints on what + * color spaces can be supported and in what combinations. + */ + /** * \fn StreamConfiguration::stream() * \brief Retrieve the stream associated with the configuration