libcamera: formats: Add toString() methods
Add toString() helpers to pretty print out a V4L2Device or V4L2Subdevice format. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
97e8b3a2eb
commit
ee81275238
4 changed files with 40 additions and 0 deletions
|
@ -6,6 +6,8 @@
|
|||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
|
@ -223,6 +225,22 @@ LOG_DEFINE_CATEGORY(V4L2)
|
|||
* \brief The number of valid data planes
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Assemble and return a string describing the format
|
||||
*
|
||||
* \return A string describing the V4L2DeviceFormat
|
||||
*/
|
||||
const std::string V4L2DeviceFormat::toString() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
||||
ss.fill(0);
|
||||
ss << width << "x" << height << "-0x" << std::hex
|
||||
<< std::setw(8) << fourcc;
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
/**
|
||||
* \class V4L2Device
|
||||
* \brief V4L2Device object and API
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue