[libcamera-devel] [PATCH] gstreamer: Add support for additional RGB formats

Xavier Roumegue (OSS) xavier.roumegue at oss.nxp.com
Wed Aug 24 13:08:53 CEST 2022


On 8/23/22 20:38, Laurent Pinchart wrote:
> libcamerasrc only supports three RGB formats. Adding the other RGB
> formats supported by libcamera is trivial, do so.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> I haven't tested this yet as I don't have a board hooked up that can
> capture these formats. If someone can test it with an OV5640 sensor on
> an i.MX8MP, that would be great, otherwise I'll get to it in the not too
> distant future.
> ---
>   src/gstreamer/gstlibcamera-utils.cpp | 14 +++++++++++++-
>   1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> index c97c0d438de2..5a21a391c698 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -19,9 +19,21 @@ static struct {
>   	/* Compressed */
>   	{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },
>   
> -	/* RGB */
> +	/* RGB16 */
> +	{ GST_VIDEO_FORMAT_RGB16, formats::RGB565 },
> +
> +	/* RGB24 */
>   	{ GST_VIDEO_FORMAT_RGB, formats::BGR888 },
>   	{ GST_VIDEO_FORMAT_BGR, formats::RGB888 },
> +
> +	/* RGB32 */
> +	{ GST_VIDEO_FORMAT_BGRx, formats::XRGB8888 },
> +	{ GST_VIDEO_FORMAT_RGBx, formats::XBGR8888 },
> +	{ GST_VIDEO_FORMAT_xBGR, formats::RGBX8888 },
> +	{ GST_VIDEO_FORMAT_xRGB, formats::BGRX8888 },
> +	{ GST_VIDEO_FORMAT_BGRA, formats::ARGB8888 },
> +	{ GST_VIDEO_FORMAT_RGBA, formats::ABGR8888 },
> +	{ GST_VIDEO_FORMAT_ABGR, formats::RGBA8888 },
>   	{ GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 },
>   
>   	/* YUV Semiplanar */
GST formats RGB16, RGB, BGR, BGRx, BGRA tested successfully on i.MX8MP 
platform with ov5640 sensors so:

Tested-by: Xavier Roumegue <xavier.roumegue at oss.nxp.com>


More information about the libcamera-devel mailing list