From patchwork Fri Dec 10 11:21:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 15106 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 58F33C324B for ; Fri, 10 Dec 2021 11:22:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 217DD60894; Fri, 10 Dec 2021 12:22:08 +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="GKeGqEeu"; dkim-atps=neutral Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A40816088E for ; Fri, 10 Dec 2021 12:22:04 +0100 (CET) Received: by mail-wr1-x434.google.com with SMTP id d9so14376782wrw.4 for ; Fri, 10 Dec 2021 03:22:04 -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=GKeGqEeu4r02zZYe5dsi5gaBXsyflqlPT6c3PFmdPpsvn0t7edGGvJ4k1E6q0SqtGo SEfKaVE13RjjQ4d2J9CidSx0XdzXEiQcbyu4XvOtZEHM4numObiVsRmwIKzWPE8F3EeU Gj32dIHu0a2tnCBwwIIOeRt5cepho2UC8rTVfMW4KyUcrGbDC3jOjQaZhyw06VVfFpW8 vB0LKnv0OyFWd5OcDfsnMrlJMAwUWyJd0TMwg/5UtA4q6vT5EZJ8dwExio+R8z2KBYtl TvwrX+Ywkc/gpX+aY0ZkbWafDz1jjvN2SMQqXyN5LgVEqJ9KYBHgI+JJsYHNIrUfuwm0 olxA== 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=uU3cwSpYxcbXiT1RQ34Ope0qaMLUbS0lKfbVv5XcaiGGGYGRedda9xNjm12krz4BOe tHTfNc71kLP0BohpHbUqfZeROJK/l3lepKSfRtucRJZB/hirKnaHliWALJTX+TlDIMWb mCxbMnF1u+UBuDW/b/+0HCWk+hXnU+0QErYQKIIR+xeLEYvZjE1BBLgo1FYGLJfhrsBH pHTEao2mPYKJvWPZOoI3Poc+RUmK0wA2qGYbhuAOBH3VOpeSQqoZ79ZaZB9Op/X5tggf R0Ooymg/8lgvexD9sQfYc9lLKzpb4IbbSOcypWH/r8cg4tX13DJ/BbHAKHPKMrY4ip3s SMKg== X-Gm-Message-State: AOAM530VKMuXOTlY6f6j3YbxNLREHETChiGU6vOQ4E3Q2+q/pQChG6rH KvTO6dNlfg9L+KOmJHqiKafAMg== X-Google-Smtp-Source: ABdhPJwvBEEYMiXgG9+OlHk3xvU1ggacccQlXfAA7WCNZrOvCALYHzNWwoHT3DrVN5WMS59kwm8fcQ== X-Received: by 2002:a05:6000:1862:: with SMTP id d2mr13608868wri.251.1639135324306; Fri, 10 Dec 2021 03:22:04 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id z18sm2198469wrq.11.2021.12.10.03.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 03:22:04 -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 11:21:36 +0000 Message-Id: <20211210112142.18441-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211210112142.18441-1-david.plowman@raspberrypi.com> References: <20211210112142.18441-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v11 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