summaryrefslogtreecommitdiff
path: root/include/libcamera/stream.h
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-05-26 00:24:39 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-06-19 12:14:37 +0200
commit63c578ed9993056dab3bd0774b572cd015747a45 (patch)
tree2ac926eb199a47a3b11d7dfe9f36d186354f6947 /include/libcamera/stream.h
parent87e46f7f594ec9e1e4873df43807e66fc407c6a9 (diff)
libcamera: stream: Add StreamFormats
Add a StreamFormats class which describes all the formats supported by a stream. The object does not collect any information itself but can simplify user interactions with formats as it's able to translate a stream format range into a discrete list and a discrete list to a range. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'include/libcamera/stream.h')
-rw-r--r--include/libcamera/stream.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
index e38c0e7e..48daf5ac 100644
--- a/include/libcamera/stream.h
+++ b/include/libcamera/stream.h
@@ -7,6 +7,7 @@
#ifndef __LIBCAMERA_STREAM_H__
#define __LIBCAMERA_STREAM_H__
+#include <map>
#include <string>
#include <vector>
@@ -18,6 +19,21 @@ namespace libcamera {
class Camera;
class Stream;
+class StreamFormats
+{
+public:
+ StreamFormats();
+ StreamFormats(const std::map<unsigned int, std::vector<SizeRange>> &formats);
+
+ std::vector<unsigned int> pixelformats() const;
+ std::vector<Size> sizes(unsigned int pixelformat) const;
+
+ SizeRange range(unsigned int pixelformat) const;
+
+private:
+ std::map<unsigned int, std::vector<SizeRange>> formats_;
+};
+
struct StreamConfiguration {
StreamConfiguration()
: stream_(nullptr)