summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKaaira Gupta <kgupta@es.iitr.ac.in>2020-07-27 21:51:41 +0530
committerKieran Bingham <kieran.bingham@ideasonboard.com>2020-08-03 11:48:46 +0100
commitc4b75cb66c5671e6494ce9ec0aa661ce1b90572d (patch)
tree41bdd83fc3b56ccf92319d17ac79185bd40f1438 /src
parent2dd19efffc5a68f857e3d1748767eeb6f8fe1161 (diff)
libcamera: formats: PixelFormatInfo: Add name lookup function
Add a function which returns PixelFormatInfo, given format name as a string. Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/formats.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
index cd63c15c..a51e9681 100644
--- a/src/libcamera/formats.cpp
+++ b/src/libcamera/formats.cpp
@@ -704,6 +704,22 @@ const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)
}
/**
+ * \brief Retrieve information about a pixel format
+ * \param[in] name The name of pixel format
+ * \return The PixelFormatInfo describing the PixelFormat matching the
+ * \a name if known, or an invalid PixelFormatInfo otherwise
+ */
+const PixelFormatInfo &PixelFormatInfo::info(const std::string &name)
+{
+ for (const auto &info : pixelFormatInfo) {
+ if (info.second.name == name)
+ return info.second;
+ }
+
+ return pixelFormatInfoInvalid;
+}
+
+/**
* \brief Compute the stride
* \param[in] width The width of the line, in pixels
* \param[in] plane The index of the plane whose stride is to be computed