@@ -43,6 +43,7 @@ public:
void addConfiguration(const StreamConfiguration &cfg);
virtual Status validate() = 0;
+ virtual bool tryValidate(std::vector<std::pair<StreamConfiguration, Status>> &config) const;
StreamConfiguration &at(unsigned int index);
const StreamConfiguration &at(unsigned int index) const;
@@ -171,6 +171,28 @@ void CameraConfiguration::addConfiguration(const StreamConfiguration &cfg)
config_.push_back(cfg);
}
+/**
+ * \fn CameraConfiguration::tryValidate()
+ * \brief construct configurations from config, which can be produced
+ * simultaneously w/o adjust.
+ *
+ * This method modifies config to satisfy
+ * 1.) config[i].second is Invalid or
+ * 2.) config[i].second is either Valid or Adjust and the config[i].first can be
+ * accepted by a native camera. validate() returns Valid or Adjust with the
+ * configurations.
+ *
+ * \todo: Remove this tryValidate() in this base class.
+ */
+bool CameraConfiguration::tryValidate(
+ std::vector<std::pair<StreamConfiguration, Status>> &config) const
+{
+ for (auto &c : config) {
+ c.second = Invalid;
+ }
+ return false;
+}
+
/**
* \fn CameraConfiguration::validate()
* \brief Validate and possibly adjust the camera configuration
This adds tryValidate() to CameraConfiguration. The function doesn't change CameraConfiguration status. It dry-runs validate() with passed configurations, so that a caller can know acceptable configurations. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> --- include/libcamera/camera.h | 1 + src/libcamera/camera.cpp | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) -- 2.30.0.365.g02bc693789-goog