From patchwork Fri Oct 29 13:23:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 14426 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 20A13BF415 for ; Fri, 29 Oct 2021 13:23:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6F734600F9; Fri, 29 Oct 2021 15:23:50 +0200 (CEST) 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="GOXtuunw"; dkim-atps=neutral Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5E69E600BC for ; Fri, 29 Oct 2021 15:23:48 +0200 (CEST) Received: by mail-wr1-x42b.google.com with SMTP id k7so16079791wrd.13 for ; Fri, 29 Oct 2021 06:23:48 -0700 (PDT) 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=nUVlWu72PlyE29kbK+yxhDq/7AfELhGkPOIcJt8NS14=; b=GOXtuunwd51yuak3XYBoux3uv4WFoYVaMjsLT5MNsg5Nt7zvC5Xe07UTC3uCT5ZJBq qPLZNuft3Z1ZdJgQA8Hjr9xjsNRwWQhtoeVm8Vc589PI0SxU2QmhgCxTM7PnrpF9UWVd qIme8Su49UwRP4g124UbUsAdkQciIYM+vaOYdCh3y1r/ECqtuHY3rWmx8Rm1Z4EkEmo4 ypRK48emcawU8OWnQFKvhnZW7zEnBvUx6lHVLgXVxJ1uDMzIjOduiLDtDoQbpmjpLaJy YtasKUj+lLwpedFoTXDno8TlGoIZ7Kr9s7Bw54Yyx7J2PEvh/t3Mlx5xY/0pd6yhZk1T LNwg== 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=nUVlWu72PlyE29kbK+yxhDq/7AfELhGkPOIcJt8NS14=; b=JVXP22eEwJXPxx/AEb2+aUuotsL7YB4Xh31oZT4S3G62H34C7YHqT4illw0DfmtTpY eTgXazdi6PcGdWWvCfY7BZGMcrCaNytM4kJ5osR04BCdTry6FAA6Sc9IeXTSlI4mqp/F IqWkWVPEy6fxX/wW93Hb7jlgH2jlksbENkcnVhgTslLfU1DBkyV7I73DhL9f0ceCjM+0 yNaBy3lsuXRnyLcZ3EvTFa+zpcyi4+g/6Eb9EUfAtaxvfvbWI5mqDRyJbtPsQ73qqEJk /GNFWQhYP+Jh/Nvh3sOJJxH919l6fmIfVcxVDNGy0csdjcjZJ/pBrkNtdCjj4kxokoCJ fFFw== X-Gm-Message-State: AOAM5318ou4tdW2uGu3zcYM3fJrR/YxLApc7vmhS7Y1cCvz7j1kFvu4f ORHP4Ht9xkrZ5ZJcdMst6QaHYIwY50cgeQ== X-Google-Smtp-Source: ABdhPJx0QtYpHdeWNvEhDLkIvZKqzW/GpzboaxBdWi4nIxFOG8ZI3PvkCPyI54Y1wn4w0f7bt4P2vw== X-Received: by 2002:adf:a411:: with SMTP id d17mr13807531wra.232.1635513827895; Fri, 29 Oct 2021 06:23:47 -0700 (PDT) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:1ce1:9965:4328:89c4]) by smtp.gmail.com with ESMTPSA id l7sm111934wrf.31.2021.10.29.06.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Oct 2021 06:23:47 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Fri, 29 Oct 2021 14:23:38 +0100 Message-Id: <20211029132343.1629-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211029132343.1629-1-david.plowman@raspberrypi.com> References: <20211029132343.1629-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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. There are two fields: the "requestedColorSpace" which is the one an application wants, and the "actualColorSpace" which is what the underlying hardware can deliver, and which is filled in by the validate() method. Signed-off-by: David Plowman --- include/libcamera/stream.h | 4 ++++ src/libcamera/stream.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index 0c55e716..fe491ff5 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -47,6 +48,9 @@ struct StreamConfiguration { unsigned int bufferCount; + ColorSpace requestedColorSpace; + ColorSpace actualColorSpace; + 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..1ddbbb8c 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -329,6 +329,31 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats) * \brief Requested number of buffers to allocate for the stream */ +/** + * \var StreamConfiguration::requestedColorSpace + * \brief The ColorSpace this stream should have + * + * The generateConfiguration method will generate reasonable default + * values (ColorSpace::Jpeg for stills, ColorSpace::Rec709 for video and + * ColorSpace::Raw for raw streams) but applications are free to overwrite + * this value. + */ + +/** + * \var StreamConfiguration::actualColorSpace + * \brief The ColorSpace the will be used for this stream + * + * This field is filled in by CameraConfiguration::validate(). + * Normally this should match the requestedColorSpace, but it may differ + * if the hardware does not support it. + * + * In general cameras may have different constraints here, for example, + * they may require all output streams to share the same color space. + * Sometimes the fields within this color space may report "Undefined" + * values if the hardware drivers are going to use a color space that + * is not recognised by the ColorSpace class. + */ + /** * \fn StreamConfiguration::stream() * \brief Retrieve the stream associated with the configuration