Message ID | 20200727151820.24466-3-kgupta@es.iitr.ac.in |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
diff --git a/include/libcamera/pixel_format.h b/include/libcamera/pixel_format.h index 6727315..c4ae088 100644 --- a/include/libcamera/pixel_format.h +++ b/include/libcamera/pixel_format.h @@ -38,6 +38,8 @@ public: std::string toString() const; + static PixelFormat fromString(const std::string &name); + private: uint32_t fourcc_; uint64_t modifier_; diff --git a/src/libcamera/pixel_format.cpp b/src/libcamera/pixel_format.cpp index 14addb5..fbb2158 100644 --- a/src/libcamera/pixel_format.cpp +++ b/src/libcamera/pixel_format.cpp @@ -130,4 +130,13 @@ std::string PixelFormat::toString() const return info.name; } +/** + * \brief Retrive pixel format correspoding to the string + * \return Pixel format + */ +PixelFormat PixelFormat::fromString(const std::string &name) +{ + return PixelFormatInfo::info(name); +} + } /* namespace libcamera */
Add a function which retrieves pixel format corrsponding to its name from PixelFormatInfo. Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in> --- include/libcamera/pixel_format.h | 2 ++ src/libcamera/pixel_format.cpp | 9 +++++++++ 2 files changed, 11 insertions(+)