{"id":2883,"url":"https://patchwork.libcamera.org/api/patches/2883/?format=json","web_url":"https://patchwork.libcamera.org/patch/2883/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200227200407.490616-2-nicolas.dufresne@collabora.com>","date":"2020-02-27T20:03:41","name":"[libcamera-devel,v2,01/27] Add GStreamer plugin and element skeleton","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"fabd2e4b22afe98e5051e8af28241086e6b32610","submitter":{"id":31,"url":"https://patchwork.libcamera.org/api/people/31/?format=json","name":"Nicolas Dufresne","email":"nicolas.dufresne@collabora.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2883/mbox/","series":[{"id":693,"url":"https://patchwork.libcamera.org/api/series/693/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=693","date":"2020-02-27T20:03:40","name":"GStreamer Element for libcamera","version":2,"mbox":"https://patchwork.libcamera.org/series/693/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2883/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2883/checks/","tags":{},"headers":{"Return-Path":"<nicolas.dufresne@collabora.com>","Received":["from bhuna.collabora.co.uk (bhuna.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 60EE2626BE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 Feb 2020 21:04:18 +0100 (CET)","from [127.0.0.1] (localhost [127.0.0.1])\n\t(Authenticated sender: nicolas) with ESMTPSA id DFA3029654A"],"From":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 27 Feb 2020 15:03:41 -0500","Message-Id":"<20200227200407.490616-2-nicolas.dufresne@collabora.com>","X-Mailer":"git-send-email 2.24.1","In-Reply-To":"<20200227200407.490616-1-nicolas.dufresne@collabora.com>","References":"<20200227200407.490616-1-nicolas.dufresne@collabora.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 01/27] Add GStreamer plugin and element\n\tskeleton","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Thu, 27 Feb 2020 20:04:18 -0000"},"content":"This implements the GStreamer plugin interface and adds libcamerasrc\nelement feature to it. This is just enough to allow plugin\nintrospection.\n\ngst-inspect-1.0 build/src/gstreamer/libgstlibcamera.so\nPlugin Details:\n  Name                     libcamera\n  Description              libcamera capture plugin\n  Filename                 build/src/gstreamer/libgstlibcamera.so\n  Version                  0.0.0+1042-6c9f16d3-dirty\n  License                  LGPL\n  Source module            libcamera\n  Binary package           libcamera\n  Origin URL               https://libcamera.org\n\n  libcamerasrc: libcamera Source\n\n  1 features:\n\nGST_PLUGIN_PATH=$(pwd)/build/src/gstreamer gst-inspect-1.0 libcamerasrc\nFactory Details:\n  Rank                     primary (256)\n  Long-name                libcamera Source\n  Klass                    Source/Video\n  Description              Linux Camera source using libcamera\n  Author                   Nicolas Dufresne <nicolas.dufresne@collabora.com\n\nPlugin Details:\n  Name                     libcamera\n  Description              libcamera capture plugin\n  Filename                 /home/nicolas/Sources/libcamera/build/src/gstreamer/libgstlibcamera.so\n  Version                  0.0.0+1042-6c9f16d3-dirty\n  License                  LGPL\n  Source module            libcamera\n  Binary package           libcamera\n  Origin URL               https://libcamera.org\n\nGObject\n +----GInitiallyUnowned\n       +----GstObject\n             +----GstElement\n                   +----GstLibcameraSrc\n\nPad Templates:\n  none\n\nElement has no clocking capabilities.\nElement has no URI handling capabilities.\n\nPads:\n  none\n\nElement Properties:\n  name                : The name of the object\n                        flags: accès en lecture, accès en écriture, 0x2000\n                        String. Default: \"libcamerasrc0\"\n  parent              : The parent of the object\n                        flags: accès en lecture, accès en écriture, 0x2000\n                        Object of type \"GstObject\"\n\nSigned-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n---\n meson_options.txt                 |  5 +++++\n src/gstreamer/gstlibcamera.c      | 21 +++++++++++++++++++++\n src/gstreamer/gstlibcamerasrc.cpp | 31 +++++++++++++++++++++++++++++++\n src/gstreamer/gstlibcamerasrc.h   | 22 ++++++++++++++++++++++\n src/gstreamer/meson.build         | 22 ++++++++++++++++++++++\n src/meson.build                   |  2 ++\n 6 files changed, 103 insertions(+)\n create mode 100644 src/gstreamer/gstlibcamera.c\n create mode 100644 src/gstreamer/gstlibcamerasrc.cpp\n create mode 100644 src/gstreamer/gstlibcamerasrc.h\n create mode 100644 src/gstreamer/meson.build","diff":"diff --git a/meson_options.txt b/meson_options.txt\nindex 79ee4de..b17b6de 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -7,6 +7,11 @@ option('documentation',\n         type : 'boolean',\n         description : 'Generate the project documentation')\n \n+option('gstreamer',\n+        type : 'feature',\n+        value : 'auto',\n+        description : 'Compile libcamera GStreamer plugin')\n+\n option('test',\n         type : 'boolean',\n         description: 'Compile and include the tests')\ndiff --git a/src/gstreamer/gstlibcamera.c b/src/gstreamer/gstlibcamera.c\nnew file mode 100644\nindex 0000000..7dd94ca\n--- /dev/null\n+++ b/src/gstreamer/gstlibcamera.c\n@@ -0,0 +1,21 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2019, Collabora Ltd.\n+ *     Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n+ *\n+ * gstlibcamera.c - GStreamer plugin\n+ */\n+\n+#include \"gstlibcamerasrc.h\"\n+\n+static gboolean\n+plugin_init(GstPlugin *plugin)\n+{\n+\treturn gst_element_register(plugin, \"libcamerasrc\", GST_RANK_PRIMARY,\n+\t\t\t\t    GST_TYPE_LIBCAMERA_SRC);\n+\treturn TRUE;\n+}\n+\n+GST_PLUGIN_DEFINE(GST_VERSION_MAJOR, GST_VERSION_MINOR,\n+\t\t  libcamera, \"libcamera capture plugin\",\n+\t\t  plugin_init, VERSION, \"LGPL\", PACKAGE, \"https://libcamera.org\");\ndiff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nnew file mode 100644\nindex 0000000..3807503\n--- /dev/null\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -0,0 +1,31 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2019, Collabora Ltd.\n+ *     Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n+ *\n+ * gstlibcamerasrc.cpp - GStreamer Capture Element\n+ */\n+\n+#include \"gstlibcamerasrc.h\"\n+\n+struct _GstLibcameraSrc {\n+\tGstElement parent;\n+};\n+\n+G_DEFINE_TYPE(GstLibcameraSrc, gst_libcamera_src, GST_TYPE_ELEMENT);\n+\n+static void\n+gst_libcamera_src_init(GstLibcameraSrc *self)\n+{\n+}\n+\n+static void\n+gst_libcamera_src_class_init(GstLibcameraSrcClass *klass)\n+{\n+\tGstElementClass *element_class = (GstElementClass *)klass;\n+\n+\tgst_element_class_set_metadata(element_class,\n+\t\t\t\t       \"libcamera Source\", \"Source/Video\",\n+\t\t\t\t       \"Linux Camera source using libcamera\",\n+\t\t\t\t       \"Nicolas Dufresne <nicolas.dufresne@collabora.com\");\n+}\ndiff --git a/src/gstreamer/gstlibcamerasrc.h b/src/gstreamer/gstlibcamerasrc.h\nnew file mode 100644\nindex 0000000..0144cbc\n--- /dev/null\n+++ b/src/gstreamer/gstlibcamerasrc.h\n@@ -0,0 +1,22 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2019, Collabora Ltd.\n+ *     Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n+ *\n+ * gstlibcamerasrc.h - GStreamer Capture Element\n+ */\n+\n+#ifndef __GST_LIBCAMERA_SRC_H__\n+#define __GST_LIBCAMERA_SRC_H__\n+\n+#include <gst/gst.h>\n+\n+G_BEGIN_DECLS\n+\n+#define GST_TYPE_LIBCAMERA_SRC gst_libcamera_src_get_type()\n+G_DECLARE_FINAL_TYPE(GstLibcameraSrc, gst_libcamera_src,\n+\t\t     GST_LIBCAMERA, SRC, GstElement)\n+\n+G_END_DECLS\n+\n+#endif /* __GST_LIBCAMERA_SRC_H__ */\ndiff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build\nnew file mode 100644\nindex 0000000..832b8a5\n--- /dev/null\n+++ b/src/gstreamer/meson.build\n@@ -0,0 +1,22 @@\n+libcamera_gst_sources = [\n+    'gstlibcamera.c',\n+    'gstlibcamerasrc.cpp',\n+]\n+\n+libcamera_gst_c_args = [\n+    '-DVERSION=\"@0@\"'.format(libcamera_git_version),\n+    '-DPACKAGE=\"@0@\"'.format(meson.project_name()),\n+]\n+\n+gst_dep = dependency('gstreamer-video-1.0', version : '>=1.16.1',\n+                     required : get_option('gstreamer'))\n+\n+if gst_dep.found()\n+    libcamera_gst = shared_library('gstlibcamera',\n+        libcamera_gst_sources,\n+        c_args : libcamera_gst_c_args,\n+        dependencies : [libcamera_dep, gst_dep],\n+        install: true,\n+        install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),\n+    )\n+endif\ndiff --git a/src/meson.build b/src/meson.build\nindex 5adcd61..d818d8b 100644\n--- a/src/meson.build\n+++ b/src/meson.build\n@@ -10,3 +10,5 @@ subdir('qcam')\n if get_option('v4l2')\n     subdir('v4l2')\n endif\n+\n+subdir('gstreamer')\n","prefixes":["libcamera-devel","v2","01/27"]}