[PATCH 3/4] gstreamer: Enable bayer formats with 10/12/14/16 bits

Jaslo Ziska jaslo at ziska.de
Wed Apr 23 10:48:55 CEST 2025


Hi Nicolas,

thanks for your reviews.

Nicolas Dufresne <nicolas at ndufresne.ca> writes:
> Le mardi 22 avril 2025 à 16:11 +0200, Jaslo Ziska a écrit :
>> GStreamer supports 10/12/14/16-bit bayer formats since version 
>> 1.24.
>>
>> Signed-off-by: Jaslo Ziska <jaslo at ziska.de>
>> ---
>>  src/gstreamer/gstlibcamera-utils.cpp | 18 +++++++++++++++++-
>>  1 file changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gstreamer/gstlibcamera-utils.cpp
>> b/src/gstreamer/gstlibcamera-utils.cpp
>> index 41eea7d8..ddbeb578 100644
>> --- a/src/gstreamer/gstlibcamera-utils.cpp
>> +++ b/src/gstreamer/gstlibcamera-utils.cpp
>> @@ -20,7 +20,7 @@ static struct {
>>  	/* Compressed */
>>  	{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },
>>
>> -	/* Bayer formats, gstreamer only supports 8-bit */
>> +	/* Bayer formats */
>>  	{ GST_VIDEO_FORMAT_ENCODED, formats::SBGGR8 },
>>  	{ GST_VIDEO_FORMAT_ENCODED, formats::SGBRG8 },
>>  	{ GST_VIDEO_FORMAT_ENCODED, formats::SGRBG8 },
>> @@ -325,6 +325,22 @@ bare_structure_from_format(const 
>> PixelFormat
>> &format)
>>  	case formats::SGBRG8:
>>  	case formats::SGRBG8:
>>  	case formats::SRGGB8:
>> +	case formats::SBGGR10:
>> +	case formats::SGBRG10:
>> +	case formats::SGRBG10:
>> +	case formats::SRGGB10:
>> +	case formats::SBGGR12:
>> +	case formats::SGBRG12:
>> +	case formats::SGRBG12:
>> +	case formats::SRGGB12:
>> +	case formats::SBGGR14:
>> +	case formats::SGBRG14:
>> +	case formats::SGRBG14:
>> +	case formats::SRGGB14:
>> +	case formats::SBGGR16:
>> +	case formats::SGBRG16:
>> +	case formats::SGRBG16:
>> +	case formats::SRGGB16:
>>  		return gst_structure_new("video/x-bayer", "format",
>> G_TYPE_STRING,
>>
>> bayer_format_to_string(format), nullptr);
>
> May I suggest to make bayer the default case ? That simply mean 
> that we
> need to handle the case where bayer_format_to_string() returns 
> nullptr.
> And this way we don't have to update things in two places.

Good idea, I will add this and the other suggestions.

>
> Nicolas


More information about the libcamera-devel mailing list