From patchwork Mon Dec 6 10:50:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 15043 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 21A34BDB13 for ; Mon, 6 Dec 2021 10:51:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2F54C60889; Mon, 6 Dec 2021 11:51:26 +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="pz/nsoPZ"; dkim-atps=neutral Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3984360872 for ; Mon, 6 Dec 2021 11:51:22 +0100 (CET) Received: by mail-wm1-x330.google.com with SMTP id 137so7787515wma.1 for ; Mon, 06 Dec 2021 02:51:22 -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=S8VVl7/+9S4D8aM7tuAng1H4cosPqk1LN3e9Ply+FyA=; b=pz/nsoPZTNrA+iB4gG2vFGL8u54tylLEhKC6wEM9cTdD7W6d6BKpR3cbqcprZaOOP1 RinK3pRsL5SvlCxjHR9s2Dk+Qy1rG+/Mp2HTfqSSG/8JtUPeQMYVggfOldg5h+rxpAme JE623mEZoOgn83XWU+mW1JZpun2f517DlPStIOJBSBTTKKMdzbo4A2V1foxwiNfbAfpl TY2sX+sCQCFnKp1C+hYziNvxVNccmKMMUtWm+wHUR9K20vOcYGeQLEpwsO4Gp6+TMdaJ Gm5aVAHq+LsYVK96GFHj/A+FLw5+JfrfXTKqTfT0ziOagSbMEmHvXr8HAHs8AI+n3n+1 GiCA== 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=S8VVl7/+9S4D8aM7tuAng1H4cosPqk1LN3e9Ply+FyA=; b=h1mCtCaM+9ETho5CKyL3LDUZTUhCJF7xQ/OpHIeUCKakl/YgSH6hCg93A8nUxYcybR dUvGn8ihJpVkjV+iiyLEp8MsgJFEHNlQ7PiOf997yqy/qcdRgwUKM1CELUEt63oic4hU rJGStblYhDnu/O2xqlQ38sMVjBu/4wuDcQ3jSEKJLqY0J7f8+gxMu3/Ghgo5lEPYtZCI uBYcfR3B+oe5lYav97g/GMq8g+n65ukOywa3tnefP9Jj6Iuu101AeQck4YQT0r2A39ip UZV1Qk0Xmn9F53x8BP7HPdJz4XnFT7bmAn8zqvnH2glYJWPST/aZW0BkVIkvSxp4foTB oaFA== X-Gm-Message-State: AOAM530K0yauo8V+83RZxrrJ66oDjs/2itmaUAvHX8cBs8uHmDxJDihv hatSlsA4rdk4YL311htLisjobQhVlohrkHif X-Google-Smtp-Source: ABdhPJzDqd18HhseDaf+4MiQwDJT8dEy7O3BZ5ud3wKGODEKd4zIckwJrgvlo3Guzd5ab6yj1I2+ag== X-Received: by 2002:a05:600c:3788:: with SMTP id o8mr36845761wmr.82.1638787881790; Mon, 06 Dec 2021 02:51:21 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:1ce1:9965:4328:89c4]) by smtp.gmail.com with ESMTPSA id r7sm10878186wrq.29.2021.12.06.02.51.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Dec 2021 02:51:21 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org, naush@raspberrypi.com, jacopo@jmondi.org, tfiga@google.com, hverkuil-cisco@xs4all.nl, kieran.bingham@ideasonboard.com, laurent.pinchart@ideasonboard.com Date: Mon, 6 Dec 2021 10:50:25 +0000 Message-Id: <20211206105032.13876-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211206105032.13876-1-david.plowman@raspberrypi.com> References: <20211206105032.13876-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v9 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 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