[{"id":3858,"web_url":"https://patchwork.libcamera.org/comment/3858/","msgid":"<20200229130543.GE18738@pendragon.ideasonboard.com>","date":"2020-02-29T13:05:43","subject":"Re: [libcamera-devel] [PATCH v2 01/27] Add GStreamer plugin and\n\telement skeleton","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Nicolas,\n\nThank you for the patch.\n\nOn Thu, Feb 27, 2020 at 03:03:41PM -0500, Nicolas Dufresne wrote:\n> This implements the GStreamer plugin interface and adds libcamerasrc\n> element feature to it. This is just enough to allow plugin\n> introspection.\n> \n> gst-inspect-1.0 build/src/gstreamer/libgstlibcamera.so\n> Plugin 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> \n> GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer gst-inspect-1.0 libcamerasrc\n> Factory 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> \n> Plugin 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> \n> GObject\n>  +----GInitiallyUnowned\n>        +----GstObject\n>              +----GstElement\n>                    +----GstLibcameraSrc\n> \n> Pad Templates:\n>   none\n> \n> Element has no clocking capabilities.\n> Element has no URI handling capabilities.\n> \n> Pads:\n>   none\n> \n> Element Properties:\n>   name                : The name of the object\n>                         flags: accès en lecture, accès en écriture, 0x2000\n\nLocalised content, sweet :-)\n\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> \n> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\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\n> \n> diff --git a/meson_options.txt b/meson_options.txt\n> index 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')\n> diff --git a/src/gstreamer/gstlibcamera.c b/src/gstreamer/gstlibcamera.c\n> new file mode 100644\n> index 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\");\n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\n> new file mode 100644\n> index 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> +}\n> diff --git a/src/gstreamer/gstlibcamerasrc.h b/src/gstreamer/gstlibcamerasrc.h\n> new file mode 100644\n> index 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__ */\n> diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build\n> new file mode 100644\n> index 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\n> diff --git a/src/meson.build b/src/meson.build\n> index 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')","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 45B4762689\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 29 Feb 2020 14:06:07 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B43412AF;\n\tSat, 29 Feb 2020 14:06:06 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1582981566;\n\tbh=xlJMLEdNB8SKqDfu8fq0sCfVRAcYpgJ1C+NLHF3OUDs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=FRt5d+t9cGnaFIsGDxvWjrLN0urQP0VquULVVuopotzB5ffTurBuvZm/525K+7mij\n\tdmw7ZUsmy06qr0JYEUPtMDw9KGwxtIQm0Y0WnYW5WfxjwBf41JqrIdo/8gTB83Q8ks\n\tYP1A3aaMEcagWF6Kz4rGdTrNkSSVvvtOgDqwsEbQ=","Date":"Sat, 29 Feb 2020 15:05:43 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200229130543.GE18738@pendragon.ideasonboard.com>","References":"<20200227200407.490616-1-nicolas.dufresne@collabora.com>\n\t<20200227200407.490616-2-nicolas.dufresne@collabora.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200227200407.490616-2-nicolas.dufresne@collabora.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 01/27] Add GStreamer plugin and\n\telement skeleton","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":"Sat, 29 Feb 2020 13:06:07 -0000"}}]