libcamera: color_space: Add fromString() function

Add a ColorSpace:fromString() function to parse a string into a color
space. The string can either contain the name of a well-known color
space, or four color space components separate by a '/' character.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
Laurent Pinchart
2022-08-23 17:16:34 +03:00
parent 994358dab6
commit fbfdaa2d20
2 changed files with 125 additions and 30 deletions

View File

@@ -59,6 +59,8 @@ public:
std::string toString() const;
static std::string toString(const std::optional<ColorSpace> &colorSpace);
static std::optional<ColorSpace> fromString(const std::string &str);
};
bool operator==(const ColorSpace &lhs, const ColorSpace &rhs);