From patchwork Wed Dec 1 15:44: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: 14975 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 78FE8C3250 for ; Wed, 1 Dec 2021 15:45:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2E1B9607E3; Wed, 1 Dec 2021 16:45:07 +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="qroTas8c"; 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 AE4F3607BD for ; Wed, 1 Dec 2021 16:45:04 +0100 (CET) Received: by mail-wr1-x430.google.com with SMTP id l16so53220883wrp.11 for ; Wed, 01 Dec 2021 07:45: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=eq/N2vQlsBncc36dYA90+vuvH+H4tIw8Sag0Uta/y1A=; b=qroTas8c94LB82l4oPAZAbO1qisqadcYrQf9CDQy9I0GUt/n8EKAhpj0lc2C3alqKZ JsHMOCr3vq9ndsi4PqFJ1lzNDm6HQGxEVEpd7sU/+Z1UhvTTKRBZ0qWVjWNsO4ocZu5Q 2II5Qgpv2gW9ovuC4wAQ6qf5ocusky5+OHJ8xzDeC8ePg1ofSZalXD5iZfY12FwyCGD7 g/Z0O2RLWItIY7b/h3QB5hDPJi6zLYrsC63PkJPljP5Kz/aTNy7sg14gHGx3kKX2hpWp YiOvBhAegjKtQy8qZED+XpLzWQxqGg8vLnargfbwKc9OQLkOUT972l0EiU2QWBU6MSLe zMqw== 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=eq/N2vQlsBncc36dYA90+vuvH+H4tIw8Sag0Uta/y1A=; b=hnhpv3yMox3My+ZeKCuaA/V9caP2wqJo2Bm5mLF7EsFugnq27T35eG6DPDX4PvDsIp Zd6V1pdhZVRSMD8pAry7Ujsi7LyZ1W0gPnSIARWIf+nSsXNeJYwp3FW+AO9JPJ4LnT59 n7w2m1QOGV1oEm0wSc2896rTsfiGz47PZa6CH0J6UwpIdNMG0u75DMXnZTaeQdlmnYBY gIbXMVmVu1EVFAomwCzIxKSPoRqYvEcxhZmkcCaly5W1bdRDd/7XB1sLKykfdnZ2alnE 105qygs0S3z/pqMb0Y2+89+6mWd8IappG8JcARQRXfQ3J0i/HOEd1nYtm29fG0yWk6iK ZlJw== X-Gm-Message-State: AOAM533UGpo4G2oOtlYmf+bJoTekV/WIq6NCbwlX6uwkP+SdOyvmpHPD ynLZs9mjEH9s3KMhyDHxwXeKl/u5pLAS1wji X-Google-Smtp-Source: ABdhPJwlg5w/bwXue5WouxLniJtL5LkPs+Ar4Csk0cPIBfXGtzPIIreFcKQin5YNlpBtLwtuBvMMbA== X-Received: by 2002:a05:6000:118a:: with SMTP id g10mr7917833wrx.533.1638373504065; Wed, 01 Dec 2021 07:45:04 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id y7sm148209wrw.55.2021.12.01.07.45.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Dec 2021 07:45:03 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org, Laurent Pinchart , Kieran Bingham , Jacopo Mondi , Hans Verkuil , Tomasz Figa , Naushir Patuck Date: Wed, 1 Dec 2021 15:44:28 +0000 Message-Id: <20211201154434.23127-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211201154434.23127-1-david.plowman@raspberrypi.com> References: <20211201154434.23127-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v8 2/8] 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 Reviewed-by: Jacopo Mondi --- 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