[libcamera-devel] [PATCH v1 2/5] gstreamer: Update the obtained colorimetry in caps.

Rishikesh Donadkar rishikeshdonadkar at gmail.com
Sun Jul 3 09:33:55 CEST 2022


Get the colorimetry as a result conversion in the previous patch and
update the colorimetry in the gstreamer caps.

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 20c39919..690a9f43 100644
--- a/src/gstreamer/gstlibcamera-utils.cpp
+++ b/src/gstreamer/gstlibcamera-utils.cpp
@@ -205,10 +205,17 @@ gst_libcamera_stream_configuration_to_caps(const StreamConfiguration &stream_cfg
 {
 	GstCaps *caps = gst_caps_new_empty();
 	GstStructure *s = bare_structure_from_format(stream_cfg.pixelFormat);
+	const gchar *colorimetry;
+	std::optional<ColorSpace> colorspace = stream_cfg.colorSpace;
+	if (colorspace)
+		colorimetry = colorimerty_from_colorspace(colorspace);
+	else
+		colorimetry = g_strdup("Unset");
 
 	gst_structure_set(s,
 			  "width", G_TYPE_INT, stream_cfg.size.width,
 			  "height", G_TYPE_INT, stream_cfg.size.height,
+			  "colorimetry", G_TYPE_STRING, colorimetry,
 			  nullptr);
 	gst_caps_append_structure(caps, s);
 
-- 
2.25.1



More information about the libcamera-devel mailing list