[libcamera-devel] [PATCH v1 2/5] gstreamer: Update the obtained colorimetry in caps.
Nicolas Dufresne
nicolas.dufresne at collabora.com
Mon Jul 4 20:10:28 CEST 2022
Le dimanche 03 juillet 2022 à 13:03 +0530, Rishikesh Donadkar a écrit :
> 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");
As currently implemented, colorimerty_from_colorspace() never turns null. Also,
"Unset" is an invalid colorimetry value that will break the streaming. If you
add a way for colorspace to fail, first don't leave that silent, its likely due
to a missing mapping, and second, simply don't set the field or set it to a
valid fallback.
>
> 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);
>
More information about the libcamera-devel
mailing list