From patchwork Fri Jan 19 20:08:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dufresne X-Patchwork-Id: 19417 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 92C75C323E for ; Fri, 19 Jan 2024 20:09:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CA34662916; Fri, 19 Jan 2024 21:09:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1705694940; bh=8dK+fx1U/Rm4uQqLalwH8wJCS9ZVyWq2iWCqiOUoyew=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=gpBjPFhsrrGxSVfCzDf0VhJK97q1u2iqq6Qi1G1mjyjl/8K7iBp/PeZ+QZDq4quPE AJnSoMBUJIv1XO86THe8g+AXwgb9tapDZ9HHJoZw7XLSyZPRPo2SIRU5Q7i8cAj3Vb D14KY9rl8h4/y83G+v9P12uNmRGUrD5RDQDhudDlBN6gNkJeoqNDLLsA+CHQOIkipQ VrIY46ej92G+AsbfAAPoZsFgtXhlPt53aIALt31B9UhzrXFBgyIfgaTpGW16HwxMqr 9uPoumsPFhrSuamRl4FgBtTKzjPQcSsRlaabsUANP7v9xp16MbWI0P/5BTTUD1KLGO VC379zy7TEEfQ== Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [IPv6:2a00:1098:ed:100::25]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E096761D3C for ; Fri, 19 Jan 2024 21:08:59 +0100 (CET) Received: from nicolas-tpx395.lan (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nicolas) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 2D15B378042B; Fri, 19 Jan 2024 20:08:59 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Fri, 19 Jan 2024 15:08:47 -0500 Message-ID: <20240119200848.358298-1-nicolas@ndufresne.ca> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/2] gstreamer: Add meson devenv support X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Nicolas Dufresne via libcamera-devel From: Nicolas Dufresne Reply-To: Nicolas Dufresne Cc: Nicolas Dufresne Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Nicolas Dufresne This change to the build system will prepend the plugin build directory to GST_PLUGIN_PATH environment. This makes the built plugin visible to GStreamer inside meson devenv enabling uninstalled testing. In order to avoid pulluting the user registry, the GST_REGISTRY environement is also set. Signed-off-by: Nicolas Dufresne Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- Changes in V2: - Use gst_ prefix for the path and env - Don't call fs.parent twice - Set GST_REGISTRY - Update the documentation README.rst | 7 ++++--- src/gstreamer/meson.build | 11 +++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 315738ee..a7e0561f 100644 --- a/README.rst +++ b/README.rst @@ -120,12 +120,13 @@ setting the ``LIBCAMERA_LOG_LEVELS`` environment variable: Using GStreamer plugin ~~~~~~~~~~~~~~~~~~~~~~ -To use GStreamer plugin from source tree, set the following environment so that -GStreamer can find it. This isn't necessary when libcamera is installed. +To use GStreamer plugin from source tree, use meson ``devenv`` command. +This will create a new shell instance with ``GST_PLUGIN_PATH`` environment set +accordingly. .. code:: - export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer + meson devenv -C build The debugging tool ``gst-launch-1.0`` can be used to construct a pipeline and test it. The following pipeline will stream from the camera named "Camera 1" diff --git a/src/gstreamer/meson.build b/src/gstreamer/meson.build index 20784b71..1536fd23 100644 --- a/src/gstreamer/meson.build +++ b/src/gstreamer/meson.build @@ -46,3 +46,14 @@ libcamera_gst = shared_library('gstlibcamera', install : true, install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')), ) + +# Makes the plugin visible to GStreamer inside meson devenv +fs = import('fs') +gst_plugin_path = fs.parent(libcamera_gst.full_path()) + +gst_env = environment() +gst_env.prepend('GST_PLUGIN_PATH', gst_plugin_path) +# Avoid polluting the system registry +gst_env.set('GST_REGISTRY', gst_plugin_path / 'registry.data') + +meson.add_devenv(gst_env) From patchwork Fri Jan 19 20:08:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dufresne X-Patchwork-Id: 19418 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id B268CC323E for ; Fri, 19 Jan 2024 20:09:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 678E161D4C; Fri, 19 Jan 2024 21:09:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1705694954; bh=HvP1O5J7UkCfnfwhamMK0sBUkDJQnn6tDV1FlpaGbcc=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=uMutLT93qbAzTRCcxh1jGS/34sGz3aHnte1YvDOfKQLD0Q9GaX/6QHOlzPykZoHsy bye/sG2eDWRTcYB6XVof2MjcuKuPWwtFGxPBR0tLFSt6D0P0QchlLtZzaNDP2pvYQB cZx5HeZmPKe7dJbHJ2dSGdctBlX0h7Cz3aDLhSVT9wCR9tH4/WV0x2KeNIh2cwS2DZ dSWODnnG73VNUDabtfGaP7SUckjVlxacAgldVqU885UZBl4JTX/iVJ+aCdFs8lgODi ZT9PUsew2FXqbSW/c17e02MQxPFTycs7afNZj+wuur2ra9gaaU/bhcA0L5YI2NRJwu fBCFZnf9gm4Iw== Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [IPv6:2a00:1098:ed:100::25]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 41C8361D3C for ; Fri, 19 Jan 2024 21:09:12 +0100 (CET) Received: from nicolas-tpx395.lan (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nicolas) by madrid.collaboradmins.com (Postfix) with ESMTPSA id A31A6378042B; Fri, 19 Jan 2024 20:09:11 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Fri, 19 Jan 2024 15:08:48 -0500 Message-ID: <20240119200848.358298-2-nicolas@ndufresne.ca> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240119200848.358298-1-nicolas@ndufresne.ca> References: <20240119200848.358298-1-nicolas@ndufresne.ca> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/2] test: gstreamer: Use env instead of registry edit X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Nicolas Dufresne via libcamera-devel From: Nicolas Dufresne Reply-To: Nicolas Dufresne Cc: Nicolas Dufresne Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Nicolas Dufresne Instead of editing the registry, use gst_env variable provided by the plugin and already used as part of the devenv shell. This reduces the complexity of the C++ test code. Signed-off-by: Nicolas Dufresne Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- New in V2 test/gstreamer/gstreamer_test.cpp | 17 ----------------- test/gstreamer/meson.build | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/test/gstreamer/gstreamer_test.cpp b/test/gstreamer/gstreamer_test.cpp index 091f7bf7..e8119b85 100644 --- a/test/gstreamer/gstreamer_test.cpp +++ b/test/gstreamer/gstreamer_test.cpp @@ -51,23 +51,6 @@ GstreamerTest::GstreamerTest(unsigned int numStreams) return; } - /* - * Remove the system libcamera plugin, if any, and add the plugin from - * the build directory. - */ - GstRegistry *registry = gst_registry_get(); - g_autoptr(GstPlugin) plugin = gst_registry_lookup(registry, "libgstlibcamera.so"); - if (plugin) - gst_registry_remove_plugin(registry, plugin); - - std::string path = libcamera::utils::libcameraBuildPath() + "src/gstreamer"; - if (!gst_registry_scan_path(registry, path.c_str())) { - g_printerr("Failed to add plugin to registry\n"); - - status_ = TestFail; - return; - } - /* * Atleast one camera should be available with numStreams streams, * otherwise skip the test entirely. diff --git a/test/gstreamer/meson.build b/test/gstreamer/meson.build index a5c003b6..f3ba5a23 100644 --- a/test/gstreamer/meson.build +++ b/test/gstreamer/meson.build @@ -17,5 +17,5 @@ foreach test : gstreamer_tests link_with : test_libraries, include_directories : test_includes_internal) - test(test['name'], exe, suite : 'gstreamer', is_parallel : false) + test(test['name'], exe, suite : 'gstreamer', is_parallel : false, env : gst_env) endforeach