@@ -12,6 +12,7 @@
#include <string>
#include <vector>
+#include <libcamera/color_space.h>
#include <libcamera/framebuffer.h>
#include <libcamera/geometry.h>
#include <libcamera/pixel_format.h>
@@ -47,6 +48,9 @@ struct StreamConfiguration {
unsigned int bufferCount;
+ ColorSpace requestedColorSpace;
+ ColorSpace actualColorSpace;
+
Stream *stream() const { return stream_; }
void setStream(Stream *stream) { stream_ = stream; }
const StreamFormats &formats() const { return formats_; }
@@ -329,6 +329,31 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats)
* \brief Requested number of buffers to allocate for the stream
*/
+/**
+ * \var StreamConfiguration::requestedColorSpace
+ * \brief The ColorSpace this stream should have
+ *
+ * The generateConfiguration method will generate reasonable default
+ * values (ColorSpace::Jpeg for stills, ColorSpace::Rec709 for video and
+ * ColorSpace::Raw for raw streams) but applications are free to overwrite
+ * this value.
+ */
+
+/**
+ * \var StreamConfiguration::actualColorSpace
+ * \brief The ColorSpace the will be used for this stream
+ *
+ * This field is filled in by CameraConfiguration::validate().
+ * Normally this should match the requestedColorSpace, but it may differ
+ * if the hardware does not support it.
+ *
+ * In general cameras may have different constraints here, for example,
+ * they may require all output streams to share the same color space.
+ * Sometimes the fields within this color space may report "Undefined"
+ * values if the hardware drivers are going to use a color space that
+ * is not recognised by the ColorSpace class.
+ */
+
/**
* \fn StreamConfiguration::stream()
* \brief Retrieve the stream associated with the configuration
This is so that applications can choose appropriate color spaces which will then be passed down to the V4L2 devices. There are two fields: the "requestedColorSpace" which is the one an application wants, and the "actualColorSpace" which is what the underlying hardware can deliver, and which is filled in by the validate() method. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> --- include/libcamera/stream.h | 4 ++++ src/libcamera/stream.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+)