libcamera: formats: Add ImageFormats

Add a new class to hold format information for V4L2 devices and
subdevices. The object describes the relationship between either pixel
formats (V4L2 devices) or media bus codes (V4L2 subdevice) and a list of
image sizes which can be produced with that format.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund
2019-05-24 23:44:47 +02:00
parent 22e0005fdd
commit 1cf709b1d2
2 changed files with 102 additions and 0 deletions

View File

@@ -17,6 +17,20 @@ namespace libcamera {
typedef std::map<unsigned int, std::vector<SizeRange>> FormatEnum;
class ImageFormats
{
public:
int addFormat(unsigned int format, const std::vector<SizeRange> &sizes);
bool isEmpty() const;
std::vector<unsigned int> formats() const;
const std::vector<SizeRange> &sizes(unsigned int format) const;
const std::map<unsigned int, std::vector<SizeRange>> &data() const;
private:
std::map<unsigned int, std::vector<SizeRange>> data_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_FORMATS_H__ */