[PATCH 1/1] libcamera: Add StreamRole into StreamConfiguration
Harvey Yang
chenghaoyang at chromium.org
Mon Sep 16 06:51:55 CEST 2024
From: Han-Lin Chen <hanlinchen at chromium.org>
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 <hanlinchen at chromium.org>
Co-developed-by: Harvey Yang <chenghaoyang at chromium.org>
---
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> 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
--
2.46.0.662.g92d0881bb0-goog
More information about the libcamera-devel
mailing list