Message ID | 20250520123158.44237-8-mzamazal@redhat.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi 2025. 05. 20. 14:31 keltezéssel, Milan Zamazal írta: > 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 | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp > index d0f44c7d..78a76f34 100644 > --- a/src/libcamera/pipeline/simple/simple.cpp > +++ b/src/libcamera/pipeline/simple/simple.cpp > @@ -378,6 +378,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 > @@ -1299,12 +1302,26 @@ 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); > > if (roles.empty()) > return config; In this case the new booleans are left uninitialized. There is also another potential issue: applications are allowed to call `generateConfiguration()` with an empty list of roles, and in that case I believe they are supposed to use `CameraConfiguration::addConfiguration()` to add the streams manually. I think you'll have to update these two in `validate()`, the same way `needsConversion_` is updated there. Regards, Barnabás Pőcze > > + config->processedRequested_ = false; > + config->rawRequested_ = false; > + for (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; >
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index d0f44c7d..78a76f34 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -378,6 +378,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 @@ -1299,12 +1302,26 @@ 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); if (roles.empty()) return config; + config->processedRequested_ = false; + config->rawRequested_ = false; + for (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;
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 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)