From patchwork Fri Nov 26 10:40:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 14798 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 3A4D4BF415 for ; Fri, 26 Nov 2021 10:41:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1CCF460569; Fri, 26 Nov 2021 11:41:05 +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="SIx+3CBN"; dkim-atps=neutral Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AB3CC604FB for ; Fri, 26 Nov 2021 11:41:00 +0100 (CET) Received: by mail-wr1-x42d.google.com with SMTP id d24so17747400wra.0 for ; Fri, 26 Nov 2021 02:41:00 -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=shW5Lu1A+Lc6XtBauNJCn5DQ5L+QxnNGx+78Zmg+UGQ=; b=SIx+3CBN1jUyaMs1J3d70jdQDaSXSlkgQMf97/itJp0xXZNGUqiJSe8IfMjb6ka1U0 wFDknXrC2poh8heRJJ9wKpQ34iS3ALImrgsNQOsXZNPL1Ln10whd2mKFKuPWkUzZ+AHc UgKrU4rKpzTwOvc6nvfuJhxNKOk4In0OVWriqpuMdejjiAZR+URscbonoFMzIivYCwjl 982kihDLNU0en7EhABdYFnNV8uLXbidV9eIpDL93/ITQGdz3XhxsFSftq5KevSmzaUZ9 B7XUWlPIk7hwtkCalWLcyLrAqvqGPZmAxlKEeaX8o4cKFIoCjlNxwf4U8hBFtLLGlsc9 9cyA== 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=shW5Lu1A+Lc6XtBauNJCn5DQ5L+QxnNGx+78Zmg+UGQ=; b=oGFkpDV2N4mICqg7P9a1ir+W4nhJqsgqqz1XeAnq2OkvawzeWcRJBfX7MvFZcb1Ev2 yk3AqP2m7xzJmmwyZ6cggnrfSNyFs4qucnahu2M8g7NMe3qtVYQGzxZ4D26KtwOu1jzy ULybAc/8l3YKUMMoSr7KO9euwFge/tdkNkhiYDGugi/xVJkGoVPXRMHoW9t4Y7ESE5S5 9/SzQerUaSm4t7BSclxKjcDi3/waJgMb0TuJuFNFX0M0ap4vO2kRo0ZxvCU5Gh6reDIv i/6OysnC7N5UH40+xGpB9y1ofY03lGIIXGVAgAynm40VeHrNspcIO4DIoOFIdAI9jRWd a6rQ== X-Gm-Message-State: AOAM532O3DoxburM7NzOwROwtOcaxuKR2R7QyFyCo4/7eV1VVo5Ysb4u mLaJKy5fs+LunP79UpjP9ADPQg== X-Google-Smtp-Source: ABdhPJxtVsEtgrZ3r1oO/tSinSZ2lT0KtyWkRTNNYmzdqcYCaA66TPT5371Ygm706LEEzqUjmPLGAw== X-Received: by 2002:a05:6000:118a:: with SMTP id g10mr13414724wrx.533.1637923260472; Fri, 26 Nov 2021 02:41:00 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id y7sm5106795wrw.55.2021.11.26.02.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Nov 2021 02:41:00 -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, 26 Nov 2021 10:40:40 +0000 Message-Id: <20211126104045.4756-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211126104045.4756-1-david.plowman@raspberrypi.com> References: <20211126104045.4756-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 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 Reviewed-by: Jacopo Mondi --- include/libcamera/stream.h | 3 +++ src/libcamera/stream.cpp | 19 +++++++++++++++++++ 2 files changed, 22 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..b281c309 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -329,6 +329,25 @@ 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. + * On some platforms, generateConfiguration() may provide default values + * here which the application can of course override. + * + * 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