From patchwork Mon Sep 16 04:51:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harvey Yang X-Patchwork-Id: 21279 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 0D3CEC3257 for ; Mon, 16 Sep 2024 04:58:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A1F6B63500; Mon, 16 Sep 2024 06:58:18 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="oH8yRcjW"; dkim-atps=neutral Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C5260618E3 for ; Mon, 16 Sep 2024 06:58:14 +0200 (CEST) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-718e1ce7e84so2863280b3a.1 for ; Sun, 15 Sep 2024 21:58:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1726462693; x=1727067493; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eoqGVILsE6mFBQBGrz8bxAwZezeYWnk5vho4nXkdgcc=; b=oH8yRcjWaQuZzNPGs6BKY/aBHdkQ9NacR1cNOPc1b2wBaTmanYTIuLdYK3TT3xBNpF vd8gMezW4MLz3XV2MREdIadKvDHpypuk/0J9P9fkLXXpdj5neyqRtuXVBU9O5eO5WGbj zOBISFtbrhIFJV35MwaVVTagH0zUM2a7/77gc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726462693; x=1727067493; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eoqGVILsE6mFBQBGrz8bxAwZezeYWnk5vho4nXkdgcc=; b=hTvdZTzYvriPkQDtjSTtMrmFQ/axI1DNvKJ7bZL2ZORC1VCy/9IXGPcMPRsUXREjdA BEQ2IHwLuuWLBxLfBwRxBAhs65S24FXfC0e8848Sq1e+3z+QQgYcwmngBQUDKcMI2krX npnAajdaeCxGK8S9At66NIqAZ2RX26HqzYERP4TUpTIdizKNqHpmQ6WdHJvpwxbXLikL n59ezkwma+KvrC8W2rkcxTX6p3AuTK5bDVfqpR8sGN56j215UxGuZG13sTVSsqSDK6RO RFuhDmDkJ+URDobBbPV+G7N0cq0NJfc8GSUVZHz0RyhdDgpYFZQVW1IUIazceV0mTit4 8J7w== X-Gm-Message-State: AOJu0YwJ15dD2yFqELHAaGzNQCceJlYrfn+axJUCvTxSMLWoE92B8HY0 5mek/4A721lzF6rFFewyIAiUiWh7mHK/YddePeQ/4KmzdWGxP9LKW1rwaYkw7sqR+Ez8hO++KqY = X-Google-Smtp-Source: AGHT+IH+ckfWo6/XelCYbq+1hgGKMPs8/LrXCA6K0AI9n1hV6Bkm25UJo6Rbod5rLAKGyaIODVSEHw== X-Received: by 2002:a05:6a00:10c5:b0:706:3329:5533 with SMTP id d2e1a72fcca58-719261ee946mr22173193b3a.24.1726462692911; Sun, 15 Sep 2024 21:58:12 -0700 (PDT) Received: from chenghaoyang-low.c.googlers.com.com (208.158.221.35.bc.googleusercontent.com. [35.221.158.208]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71944ab5590sm2996267b3a.65.2024.09.15.21.58.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Sep 2024 21:58:12 -0700 (PDT) From: Harvey Yang X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Han-Lin Chen , Harvey Yang Subject: [PATCH 1/1] libcamera: Add StreamRole into StreamConfiguration Date: Mon, 16 Sep 2024 04:51:55 +0000 Message-ID: <20240916045802.3799103-2-chenghaoyang@google.com> X-Mailer: git-send-email 2.46.0.662.g92d0881bb0-goog In-Reply-To: <20240916045802.3799103-1-chenghaoyang@google.com> References: <20240916045802.3799103-1-chenghaoyang@google.com> MIME-Version: 1.0 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" From: Han-Lin Chen Add StreamRole into StreamConfigurations, so the user can configure a specific stream as a specific role. Some platforms will configure differently for different roles internally. Signed-off-by: Han-Lin Chen Co-developed-by: Harvey Yang --- include/libcamera/stream.h | 2 ++ src/libcamera/stream.cpp | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index 071b7169..1dccba5e 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -21,6 +21,7 @@ namespace libcamera { class Camera; class Stream; +enum class StreamRole; class StreamFormats { @@ -50,6 +51,7 @@ struct StreamConfiguration { std::optional colorSpace; + StreamRole role; 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 1f75dbbc..3e378d0d 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -281,7 +281,7 @@ SizeRange StreamFormats::range(const PixelFormat &pixelformat) const */ StreamConfiguration::StreamConfiguration() : pixelFormat(0), stride(0), frameSize(0), bufferCount(0), - stream_(nullptr) + role(StreamRole::Viewfinder), stream_(nullptr) { } @@ -290,7 +290,7 @@ StreamConfiguration::StreamConfiguration() */ StreamConfiguration::StreamConfiguration(const StreamFormats &formats) : pixelFormat(0), stride(0), frameSize(0), bufferCount(0), - stream_(nullptr), formats_(formats) + role(StreamRole::Viewfinder), stream_(nullptr), formats_(formats) { } @@ -350,6 +350,14 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats) * color spaces can be supported and in what combinations. */ +/** + * \var StreamConfiguration::role + * \brief The StreamRole that this StreamConfiguration should be set to + * + * Some applications may want to assign a StreamConfiguration to a certain + * role of Stream. + */ + /** * \fn StreamConfiguration::stream() * \brief Retrieve the stream associated with the configuration