@@ -24,6 +24,7 @@ enum class Orientation {
};
Orientation orientationFromRotation(int angle, bool *success = nullptr);
+std::string orientationToString(const Orientation &orientation);
std::ostream &operator<<(std::ostream &out, const Orientation &orientation);
@@ -8,6 +8,7 @@
#include <libcamera/orientation.h>
#include <array>
+#include <sstream>
/**
* \file orientation.h
@@ -91,6 +92,19 @@ Orientation orientationFromRotation(int angle, bool *success)
return Orientation::Rotate0;
}
+/**
+ * \brief Generate a string representation of \a orientation item
+ * \param[in] orientation The Orientation item
+ * \return A std::string representation for \a orientation
+ */
+std::string orientationToString(const Orientation &orientation)
+{
+ std::stringstream ss;
+ ss << orientation;
+
+ return ss.str();
+}
+
/**
* \brief Prints human-friendly names for Orientation items
* \param[in] out The output stream
Provide a orientationToString() helper to convert Orientation enum to a std::string. Signed-off-by: Umang Jain <uajain@igalia.com> --- include/libcamera/orientation.h | 1 + src/libcamera/orientation.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+)