[libcamera-devel] [PATCH v3 0/5] Add colorimetry support to libcamera gstreamer element.

Rishikesh Donadkar rishikeshdonadkar at gmail.com
Mon Jul 11 17:37:06 CEST 2022


This series aims to add colorimetry support to the libcamera gstreamer
element.

If colorimetry is specified by the user in the gstreamer pipeline, try to
apply the libcamera colorspace corresponding to the GStreamer colorimetry
to the camera if the colorspace passes the validation then push the
colorimetry corresponding to the valid colorspace in the caps.
If the colorimetry pushed into the caps is same as requested negotiation
will succeed, else negotiation will fail.

If no colorimetry is specified by the user in the gstreamer pipeline,
push the GStreamer colorimetry corresponding to the current colorspace
applied to the camera into the caps and the negotiation will be take
care of by the gstreamer. If the colorimetry corresponding to the current
libcamera colorspace is not available in gstreamer then remove the 
colorimetry field if present in the caps.

[PATCH 1/5] - Made a verbose commit message. Introduced a new helper function
              for converting std::string representation of colorimetry into 
              G_STRING_TYPE. Removed unnecessary g_free(). Removed the std::optional
              wrapper around the colorSpace when converting into colorspace and 
              passed the value of the colorSpace instead to the function as it is
              checked to have value before passing to the function.
              Eliminated the code which was checking if the colorimetry is valid
              colorimetry will be valid always because we are working with predefined 
              colorimetries in gstreamer.

[PATCH 2/5] - Simplified the if-else block. Eliminated the code where colorimetry
              was set to nullptr when it was not known. Insted the field is left
              unset. If the field is present and is unset then remove the field.

[PATCH 3/5] - colorSpace was passed by reference as a function argument in the 
              function colorimetry_form_colorspace(), Changed the function to 
              return the colorspace instead and setting the colorspace in the 
              StreamConfiguration was done after the colorspace is returned from 
              the function. The local functions that were used in the same file 
              were declared static.

[PATCH 4/5] - Made the changes required due to the changes made in patch 3

[PATCH 5/5] - If the camera cannot deliver the colorspace requested in the 
              gstreamer pipeline then the colorspace is reset to the value 
              that was present before the attempt was made to set the 
              colorspace corresponding to the requested colorimetry.

Rishikesh Donadkar (5):
  gstreamer: convert from libcamera colorspace to GStreamer colorimetry.
  gstreamer: Update the obtained colorimetry in caps.
  gstreamer: Convert from GStreamer colorimetry to libcamera ColorSpace
  gstreamer: Configure the colorSpace in the Stream configuration.
  gstreamer: Reset the colorSpace if not the same after validation.

 src/gstreamer/gstlibcamera-utils.cpp | 69 ++++++++++++++++++++++++++++
 src/gstreamer/gstlibcamerasrc.cpp    | 12 +++++
 2 files changed, 81 insertions(+)

-- 
2.25.1



More information about the libcamera-devel mailing list