From patchwork Thu Dec 9 10:12:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 15092 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 02DC8BF415 for ; Thu, 9 Dec 2021 10:13:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A925E6088C; Thu, 9 Dec 2021 11:13:33 +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="UZyIbIxa"; dkim-atps=neutral Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 330AD6086A for ; Thu, 9 Dec 2021 11:13:32 +0100 (CET) Received: by mail-wr1-x430.google.com with SMTP id j3so8810099wrp.1 for ; Thu, 09 Dec 2021 02:13:32 -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=UZyIbIxa/+2Dl/LyzGV2y3tn66s32bOqhU8HsrVEm+6OZTVVfiOYHgefAV8AYCGsOE zX8CqMlb/QKO/DH4L66suuBw0WMOsNF7jK1QeA6SbIlHgO9mQFa8BXPofE+4XDnQrcIW 4SWoB9a9TB62CVDzsXAZ5hM7s4dwVg3BCSWF1OyxprP08DHA9c0d7wwvLLd1so4lnI2M zitlN/Gx/o7VM2bR9xekUUZlqAXlwndjPuju6uARx463GDJSTXMD3or6ZtBjZYhDtWq9 zYP4EUQcNCe7sKdTe96BRuX4mpmePIzxYWIlwCmeTvNycUD7KfE9TDwQCHSutc4Rp29m rIkA== 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=MCxVPdIcrig0JDV16SVCyNcCEG3Q6ZdUCX52O0IkNZ7FnQGqM1aWrRAJ5TsZAGa9xA 8MPZwBFV+YPMODPJL6XsaF9svhv7jVprPQHIkKrZiF9qsOUHCsBPfqswhRutQg3x57KC takoIlpCfzoZUoXqJAtWrhv1MILJRs9Q+FphWRMLM0ceKO60rXyQnT2qFbzfFtcYAN0O bJ1NvPgBB82cWY23vP5EzX6/Ia7VIzRCkDoIWnM7ExlIGIZvYSLtEj8AXhbz6oCt6tQY aIdk2lA/q+710d+RIkgAb65YallBArYkVW68/rTJJiPPxCJ0ty6JZrDUCi6rLg1Cq9h+ vZ9Q== X-Gm-Message-State: AOAM531ZMwhBjYpL0uA0DeeYUqjB7CCqgTpKShSLxV/IAMYeHEVCUDEC tXex/ckCg9PLqkStv0HaPTAkdB+zZ0gSP+RK X-Google-Smtp-Source: ABdhPJwNyTbKFhOBDXWv2xdfEwi+PVoNDhQKd3N+QoaG+uuk+rK7mbVUirYxzznWrg1LqNHBwPWb3Q== X-Received: by 2002:adf:a389:: with SMTP id l9mr5316342wrb.121.1639044811691; Thu, 09 Dec 2021 02:13:31 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id j8sm5079449wrh.16.2021.12.09.02.13.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Dec 2021 02:13:31 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org, Laurent Pinchart , Kieran Bingham , Hans Verkuil , Tomasz Figa , Jacopo Mondi , Naushir Patuck Date: Thu, 9 Dec 2021 10:12:39 +0000 Message-Id: <20211209101245.6187-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211209101245.6187-1-david.plowman@raspberrypi.com> References: <20211209101245.6187-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v10 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