<div dir="ltr"><div dir="ltr">Hi David,<div><br></div><div>Thank you for your patch.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 20 Oct 2021 at 12:08, David Plowman <<a href="mailto:david.plowman@raspberrypi.com">david.plowman@raspberrypi.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This is so that applications can choose appropriate color spaces which<br>
will then be passed down to the V4L2 devices.<br>
<br>
There are two fields: the "requestedColorSpace" which is the one an<br>
application wants, and the "actualColorSpace" which is what the<br>
underlying hardware can deliver, and which is filled in by the<br>
validate() method.<br>
<br>
Signed-off-by: David Plowman <<a href="mailto:david.plowman@raspberrypi.com" target="_blank">david.plowman@raspberrypi.com</a>><br>
---<br>
include/libcamera/stream.h | 4 ++++<br>
src/libcamera/stream.cpp | 25 +++++++++++++++++++++++++<br>
2 files changed, 29 insertions(+)<br>
<br>
diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h<br>
index 0c55e716..fe491ff5 100644<br>
--- a/include/libcamera/stream.h<br>
+++ b/include/libcamera/stream.h<br>
@@ -12,6 +12,7 @@<br>
#include <string><br>
#include <vector><br>
<br>
+#include <libcamera/color_space.h><br>
#include <libcamera/framebuffer.h><br>
#include <libcamera/geometry.h><br>
#include <libcamera/pixel_format.h><br>
@@ -47,6 +48,9 @@ struct StreamConfiguration {<br>
<br>
unsigned int bufferCount;<br>
<br>
+ ColorSpace requestedColorSpace;<br>
+ ColorSpace actualColorSpace;<br>
+<br></blockquote><div><br></div><div>I had a brief look-ahead in this series, but it was not immediately</div><div>obvious to me why we would need requested and actual? Could</div><div>we make do with just one and update the user requested value</div><div>with what the HW will actually give us?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Stream *stream() const { return stream_; }<br>
void setStream(Stream *stream) { stream_ = stream; }<br>
const StreamFormats &formats() const { return formats_; }<br>
diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp<br>
index b421e17e..1ddbbb8c 100644<br>
--- a/src/libcamera/stream.cpp<br>
+++ b/src/libcamera/stream.cpp<br>
@@ -329,6 +329,31 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats)<br>
* \brief Requested number of buffers to allocate for the stream<br>
*/<br>
<br>
+/**<br>
+ * \var StreamConfiguration::requestedColorSpace<br>
+ * \brief The ColorSpace this stream should have<br>
+ *<br>
+ * The generateConfiguration method will generate reasonable default<br>
+ * values (ColorSpace::Jpeg for stills, ColorSpace::Rec709 for video and<br>
+ * ColorSpace::Raw for raw streams) but applications are free to overwrite<br>
+ * this value.<br>
+ */<br>
+<br>
+/**<br>
+ * \var StreamConfiguration::actualColorSpace<br>
+ * \brief The ColorSpace the will be used for this stream<br>
+ *<br>
+ * This field is filled in by CameraConfiguration::validate().<br>
+ * Normally this should match the requestedColorSpace, but it may differ<br>
+ * if the hardware does not support it.<br>
+ *<br>
+ * In general cameras may have different constraints here, for example,<br>
+ * they may require all output streams to share the same color space.<br>
+ * Sometimes the fields within this color space may report "Undefined"<br>
+ * values if the hardware drivers are going to use a color space that<br>
+ * is not recognised by the ColorSpace class.<br>
+ */<br>
+<br>
/**<br>
* \fn StreamConfiguration::stream()<br>
* \brief Retrieve the stream associated with the configuration<br>
-- <br>
2.20.1<br>
<br>
</blockquote></div></div>