[libcamera-devel] libcamerasrc on librem 5: bayer support missing

Pavel Machek pavel at ucw.cz
Sat Dec 17 22:48:52 CET 2022


Hi!

> > Is there any way to get libcamerasrc (gstreamer glue) to work on
> > Librem 5?
> >
> > As far as I can tell, libcamerasrc does not support bayer formats,
> > thus I can't really use gstreamer glue on Librem 5.
> >
> > Would it be simple to add such support?


> Note that "some" patterns are already supported. If it's the case, you just
> need to map these into libcamerasrc.

This gets me going. I don't know how to pass details of bayer format,
so help would be welcome there.

Best regards,
								Pavel


diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
index 36b9564c..ed5f4449 100644
--- a/src/gstreamer/gstlibcamera-utils.cpp
+++ b/src/gstreamer/gstlibcamera-utils.cpp
@@ -55,6 +55,10 @@ static struct {
 	{ GST_VIDEO_FORMAT_YUY2, formats::YUYV },
 	{ GST_VIDEO_FORMAT_YVYU, formats::YVYU },
 
+	/* Lie about bayer */
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SGRBG8 },
+
+
 	/* \todo NV42 is used in libcamera but is not mapped in GStreamer yet. */
 };
 
@@ -233,6 +237,8 @@ bare_structure_from_format(const PixelFormat &format)
 {
 	GstVideoFormat gst_format = pixel_format_to_gst_format(format);
 
+	printf("bare_structure_from_format: XXX\n");
+
 	if (gst_format == GST_VIDEO_FORMAT_UNKNOWN)
 		return nullptr;
 
@@ -243,6 +249,8 @@ bare_structure_from_format(const PixelFormat &format)
 	switch (format) {
 	case formats::MJPEG:
 		return gst_structure_new_empty("image/jpeg");
+	case formats::SGRBG8:
+		return gst_structure_new_empty("video/x-bayer");
 	default:
 		return nullptr;
 	}
diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
index 8d97d7c2..2ceeeb99 100644
--- a/src/gstreamer/gstlibcamerasrc.cpp
+++ b/src/gstreamer/gstlibcamerasrc.cpp
@@ -161,7 +161,7 @@ G_DEFINE_TYPE_WITH_CODE(GstLibcameraSrc, gst_libcamera_src, GST_TYPE_ELEMENT,
 			GST_DEBUG_CATEGORY_INIT(source_debug, "libcamerasrc", 0,
 						"libcamera Source"))
 
-#define TEMPLATE_CAPS GST_STATIC_CAPS("video/x-raw; image/jpeg")
+#define TEMPLATE_CAPS GST_STATIC_CAPS("video/x-raw; video/x-bayer; image/jpeg")
 
 /* For the simple case, we have a src pad that is always present. */
 GstStaticPadTemplate src_template = {


-- 
People of Russia, stop Putin before his war on Ukraine escalates.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20221217/a2ddc67d/attachment.sig>


More information about the libcamera-devel mailing list