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>
This commit is contained in:
parent
2dd19efffc
commit
c4b75cb66c
2 changed files with 17 additions and 0 deletions
|
@ -703,6 +703,22 @@ const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)
|
|||
return info->second;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue