[libcamera-devel] [PATCH v2 4/4] gstreamer: Configure the colorSpace in the Stream configuration.

Rishikesh Donadkar rishikeshdonadkar at gmail.com
Thu Jul 7 11:44:02 CEST 2022


Get the colorimetry if requested in the gstreamer pipeline and pass
that to the function colorspace_form_colorimetry() which will set
the colorspace corresponding to the requested colorimetry in the
stream configuration.

Signed-off-by: Rishikesh Donadkar <rishikeshdonadkar at gmail.com>
---
 src/gstreamer/gstlibcamera-utils.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
index feefead9..229a29cd 100644
--- a/src/gstreamer/gstlibcamera-utils.cpp
+++ b/src/gstreamer/gstlibcamera-utils.cpp
@@ -279,6 +279,13 @@ gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg,
 		g_critical("Unsupported media type: %s", gst_structure_get_name(s));
 	}
 
+	/* Configure colorSpace */
+	if (gst_structure_has_field(s, "colorimetry")) {
+		const gchar *colorimetry = gst_structure_get_string(s, "colorimetry");
+		std::optional<ColorSpace> &colorSpace = stream_cfg.colorSpace;
+		colorspace_form_colorimetry(colorSpace, colorimetry);
+	}
+
 	gint width, height;
 	gst_structure_get_int(s, "width", &width);
 	gst_structure_get_int(s, "height", &height);
-- 
2.25.1



More information about the libcamera-devel mailing list