@@ -9,6 +9,7 @@
#include <memory>
#include <string>
+#include <unordered_map>
#include <vector>
#include <libcamera/base/class.h>
@@ -34,6 +35,8 @@ struct CameraSensorProperties;
class CameraSensor : protected Loggable
{
public:
+ using SensorDelays = std::unordered_map<const ControlId *, unsigned int>;
+
explicit CameraSensor(const MediaEntity *entity);
~CameraSensor();
@@ -45,6 +48,7 @@ public:
const std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }
std::vector<Size> sizes(unsigned int mbusCode) const;
Size resolution() const;
+ const SensorDelays &sensorDelays();
const std::vector<controls::draft::TestPatternModeEnum> &testPatternModes() const
{
return testPatternModes_;
@@ -47,6 +47,14 @@ LOG_DEFINE_CATEGORY(CameraSensor)
* devices as the needs arise.
*/
+/**
+ * \typedef CameraSensor::SensorDelays
+ * \brief Camera sensor controls delays
+ *
+ * Type to represent a map of camera sensor controls associated with their
+ * latencies, expressed in frame periods.
+ */
+
/**
* \brief Construct a CameraSensor
* \param[in] entity The media entity backing the camera sensor
@@ -561,6 +569,28 @@ Size CameraSensor::resolution() const
return std::min(sizes_.back(), activeArea_.size());
}
+/**
+ * \brief Retrieve the map of latencies associated with camera controls
+ *
+ * Retrieve the SensorDelays map that associates camera controls with
+ * their latencies.
+ *
+ * If a camera sensor does not provide such information an empty map is
+ * returned.
+ *
+ * \return A map of controls associated with their latencies or an empty map
+ * if no sensor delays are available.
+ */
+const CameraSensor::SensorDelays &CameraSensor::sensorDelays()
+{
+ static SensorDelays emptyDelays{};
+
+ if (!staticProps_)
+ return emptyDelays;
+
+ return staticProps_->sensorDelays;
+}
+
/**
* \fn CameraSensor::testPatternModes()
* \brief Retrieve all the supported test pattern modes of the camera sensor
Add a function to the CameraSensor to retrieve the SensorDelay map that associate controls to their latencies. If such information is not provided, return a reference to an empty map. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- include/libcamera/internal/camera_sensor.h | 4 +++ src/libcamera/camera_sensor.cpp | 30 ++++++++++++++++++++++ 2 files changed, 34 insertions(+)