libcamera: formats: Reimplement V4L2 PixelFormatInfo::info()
The PixelFormatInfo::info(const V4L2PixelFormat &format) function returns the PixelFormatInfo associated with a V4L2 pixel format. As the pixelFormatInfo map is indexed using PixelFormat and a V4L2 format can easily be converted to a PixelFormat, simply return the info() function overload instead of maintaining two similar implementations of the same function. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
parent
23b6965a93
commit
f25ad4a2b1
1 changed files with 2 additions and 10 deletions
|
@ -987,22 +987,14 @@ const PixelFormatInfo &PixelFormatInfo::info(const PixelFormat &format)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retrieve information about a pixel format
|
* \brief Retrieve information about a V4L2 pixel format
|
||||||
* \param[in] format The V4L2 pixel format
|
* \param[in] format The V4L2 pixel format
|
||||||
* \return The PixelFormatInfo describing the V4L2 \a format if known, or an
|
* \return The PixelFormatInfo describing the V4L2 \a format if known, or an
|
||||||
* invalid PixelFormatInfo otherwise
|
* invalid PixelFormatInfo otherwise
|
||||||
*/
|
*/
|
||||||
const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)
|
const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)
|
||||||
{
|
{
|
||||||
const auto &info = std::find_if(pixelFormatInfo.begin(), pixelFormatInfo.end(),
|
return info(format.toPixelFormat());
|
||||||
[format](auto pair) {
|
|
||||||
return pair.second.v4l2Formats.single == format ||
|
|
||||||
pair.second.v4l2Formats.multi == format;
|
|
||||||
});
|
|
||||||
if (info == pixelFormatInfo.end())
|
|
||||||
return pixelFormatInfoInvalid;
|
|
||||||
|
|
||||||
return info->second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue