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

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Aug 23 20:38:56 CEST 2022


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 */
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list