From patchwork Thu Nov 18 15:19:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 14627 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 5D2DABF415 for ; Thu, 18 Nov 2021 15:20:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0864360371; Thu, 18 Nov 2021 16:20:30 +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="D9pAURQ0"; dkim-atps=neutral Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D6F9E6038A for ; Thu, 18 Nov 2021 16:20:26 +0100 (CET) Received: by mail-wr1-x429.google.com with SMTP id u1so12208868wru.13 for ; Thu, 18 Nov 2021 07:20:26 -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=kLk2z8qXqfOpGggekOhFU+kISUZcUm+8gTdLG71oWtQ=; b=D9pAURQ0CNj+Xm919iQ+lQNeDQCH3P3++ZpwvVkcTlyGu+YzBJoseGKdFHQD4zYgzp Bb+5lOYEaTmlBfWy8aKCxAqTutzTPbwHIM75kyEC6YiU2REMOMVqQUXjLrB0QPh8ao79 Fxsn1D5Y+xg3SdQmIT0c9UjvGFZtDBxAgIPM6pn5fR9V+dKw0oDXarLcDhkNq/y4pejj 22EDoJtpCVxSM9Qsr//BxCN/5ki785vDapefxotMQMxkEWA/c4Wq+QTwARKilI4ZWqrR w+trMzfM+oiQkIIc7jukkHwSHFkCqLSUqgoVTrAO6UaWBJyeymzacJo2Z1iDfafbXcz6 IpVg== 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=kLk2z8qXqfOpGggekOhFU+kISUZcUm+8gTdLG71oWtQ=; b=M2fNUiiTb+s5gXb8MgJDkb8V6KAYdqYuGp0hFYEKKZnzPkwmPvhxsBua+UIcDBtC0e 2csOHz6SAIUsxPr3mo0cKN/DlYskQWFg1GPpBrUTsiNG+Oc2iOr9hj95frS8b89eMVoG nddBawUbwR8uf7GfwKtatxmjIm0FFDWWNRkUC+T0AFCTEFssF8WepzeUiD3hvhzpboTS T7kfaG3cuuh3PCelukvuySEIaXnZIyICeoHdSTszTg8JhfPHxZYHmbIKZ1hIMOXAE43o P4+prpVUMYsxj5to85aRTzagNedEk8Yjgpmr6TvMG2/q7Qu+zdfj5XfsfYEKbwK/btA1 kywg== X-Gm-Message-State: AOAM5328/ixlKclhP4qiOLnLeUTqUoh8M3NjfKx1ohuj81Ex1+YVKwXA 2aMzSWpERpzM6a6BR+ZCjvxSEg== X-Google-Smtp-Source: ABdhPJx/MP1iXD71qEns5O9vMKAyvBo91FlSomT9nJWbyGAmGnPqc9RGqvewbaAWWeJiNZxsTU8MMw== X-Received: by 2002:adf:9bdb:: with SMTP id e27mr32804867wrc.417.1637248826625; Thu, 18 Nov 2021 07:20:26 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:1ce1:9965:4328:89c4]) by smtp.gmail.com with ESMTPSA id p12sm147367wro.33.2021.11.18.07.20.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 07:20:26 -0800 (PST) From: David Plowman To: laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com, hverkuil-cisco@xs4all.nl, tfiga@google.com, jacopo@jmondi.org, naush@raspberrypi.com, libcamera-devel@lists.libcamera.org Date: Thu, 18 Nov 2021 15:19:28 +0000 Message-Id: <20211118151933.15627-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211118151933.15627-1-david.plowman@raspberrypi.com> References: <20211118151933.15627-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 2/7] libcamera: 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 driver's default color space. Signed-off-by: David Plowman Reviewed-by: Umang Jain --- include/libcamera/stream.h | 3 +++ src/libcamera/stream.cpp | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index 0c55e716..bea88eb4 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..300b3af7 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -329,6 +329,20 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats) * \brief Requested number of buffers to allocate for the stream */ +/** + * \var StreamConfiguration::colorSpace + * \brief The ColorSpace for this stream + * + * A suitable color space may be set here or chosen by an application. + * Alternatively the color space may be left unset, in which case it will + * be up to the driver to choose a color space. + * + * If the system cannot deliver the requested color space, the validate() + * method will overwrite the value here with what it can deliver. Note that + * platforms may enforce extra contraints here, such as requiring all output + * streams to share the same color space. + */ + /** * \fn StreamConfiguration::stream() * \brief Retrieve the stream associated with the configuration