[v8,05/10] libcamera: simple: Identify requested stream roles
diff mbox series

Message ID 20250702121024.38728-6-mzamazal@redhat.com
State New
Headers show
Series
  • Enable raw streams with software ISP
Related show

Commit Message

Milan Zamazal July 2, 2025, 12:10 p.m. UTC
Currently, raw streams don't work in the simple pipeline and the
requested stream roles are ignored.  In order to support raw streams, we
now track in SimpleCameraConfiguration whether raw and/or processed
streams are requested.  We also check that at most one raw stream is
requested, there is no reason to have more.

That information will be used in the followup patches.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
---
 src/libcamera/pipeline/simple/simple.cpp | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 1a7474228..6330afeb5 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -384,6 +384,9 @@  public:
 	bool needConversion() const { return needConversion_; }
 	const Transform &combinedTransform() const { return combinedTransform_; }
 
+	bool processedRequested_;
+	bool rawRequested_;
+
 private:
 	/*
 	 * The SimpleCameraData instance is guaranteed to be valid as long as
@@ -1311,12 +1314,27 @@  std::unique_ptr<CameraConfiguration>
 SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRole> roles)
 {
 	SimpleCameraData *data = cameraData(camera);
-	std::unique_ptr<CameraConfiguration> config =
+	std::unique_ptr<SimpleCameraConfiguration> config =
 		std::make_unique<SimpleCameraConfiguration>(camera, data);
 
+	config->processedRequested_ = false;
+	config->rawRequested_ = false;
+
 	if (roles.empty())
 		return config;
 
+	for (const auto &role : roles)
+		if (role == StreamRole::Raw) {
+			if (config->rawRequested_) {
+				LOG(SimplePipeline, Error)
+					<< "Can't capture multiple raw streams";
+				return nullptr;
+			}
+			config->rawRequested_ = true;
+		} else {
+			config->processedRequested_ = true;
+		}
+
 	/* Create the formats map. */
 	std::map<PixelFormat, std::vector<SizeRange>> formats;