libcamera: pixel_format: Add a function to return format based on string
Add a function which retrieves pixel format corresponding to its name from PixelFormatInfo. Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
committed by
Kieran Bingham
parent
c4b75cb66c
commit
6b32eebf86
@@ -130,4 +130,15 @@ std::string PixelFormat::toString() const
|
||||
return info.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Create a PixelFormat from a string
|
||||
* \return Pixel format
|
||||
* \return The PixelFormat represented by the \a name if known, or an
|
||||
* invalid pixel format otherwise.
|
||||
*/
|
||||
PixelFormat PixelFormat::fromString(const std::string &name)
|
||||
{
|
||||
return PixelFormatInfo::info(name).format;
|
||||
}
|
||||
|
||||
} /* namespace libcamera */
|
||||
|
||||
Reference in New Issue
Block a user