{"id":18088,"url":"https://patchwork.libcamera.org/api/patches/18088/?format=json","web_url":"https://patchwork.libcamera.org/patch/18088/","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":"<20230105043726.679968-3-chenghaoyang@google.com>","date":"2023-01-05T04:37:19","name":"[libcamera-devel,v3,2/9] libcamera: Add MediaDeviceBase","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"738e937af6798d037ae6db977ec5dfbd08bae746","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/people/117/?format=json","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18088/mbox/","series":[{"id":3700,"url":"https://patchwork.libcamera.org/api/series/3700/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3700","date":"2023-01-05T04:37:17","name":"Virtual pipeline handler","version":3,"mbox":"https://patchwork.libcamera.org/series/3700/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18088/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18088/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 00C55C322E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 Jan 2023 04:38:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 78CCF625E8;\n\tThu,  5 Jan 2023 05:38:00 +0100 (CET)","from mail-pl1-x629.google.com (mail-pl1-x629.google.com\n\t[IPv6:2607:f8b0:4864:20::629])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 258BB625E0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 Jan 2023 05:37:57 +0100 (CET)","by mail-pl1-x629.google.com with SMTP id 17so38291850pll.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 04 Jan 2023 20:37:57 -0800 (PST)","from chenghaoyang-low.c.googlers.com.com\n\t(46.165.189.35.bc.googleusercontent.com. [35.189.165.46])\n\tby smtp.gmail.com with ESMTPSA id\n\tx23-20020a170902b41700b00188c5f0f9e9sm25015200plr.199.2023.01.04.20.37.54\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 04 Jan 2023 20:37:54 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1672893480;\n\tbh=TUpyjQ7lDZNCc/ppOivZyjU7TlW2mgSX8d4w4ji1yQ8=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=J/+/qmx8I5i4GgB+DEHLmN0KR1HoSnf28FMGPZPlhVvux066Zi9Band5+3GB2i7dt\n\tnTX8x62GQ/TsphY4xpN98TrFDIwkCraD6IcMFyeC6IpMk6RtlxOzBYM3YudooJF/n/\n\t1xG66CDzeDtp1RmGfBDwwx3nUulFrd+OCO54BCCRs2AInLUzJTDJPqfgxLoi4REbfA\n\tFgv+8WmVp0UqEm0EJOmIfjhoCveSlyb8+qFixhc6Tsfl8lDIQO87eHrpMrI4t19xdp\n\tIGKprH7IlN8bd1pjbyqKooo6gA4+LioJZ/vQX1SBGkpUekelr9pwSt8FoKNKpaz9Mu\n\tKcJ3Wq6yQD0xg==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=Lu1+s6tyYLkcwjuQSi7kdVu6yK/pRdKhbH99IcqAYhc=;\n\tb=WN2MRzyjz72gTMOwtJoNJ1XyntJtbCr8omFY9VhslXu01wH+y9rNU9zPOg2k2pwW5Q\n\tRR5ZqRT5Yl2HuXVf9NwAR5aKDfDHI2R2v/hlbzi/FQnBgcuV6OgXVrBONWWvkJ2tkocv\n\t8rNTWRFSjYbE9HYhT8cIB8NjxHUjS9ALcQyAc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"WN2MRzyj\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=Lu1+s6tyYLkcwjuQSi7kdVu6yK/pRdKhbH99IcqAYhc=;\n\tb=VdiMcq8gVVNOy+ogfkRybnyGpBgvbrTSChcKNu37zkFYOFfoejdPenc2C2Sq4Nddp6\n\t/Wra3jkQ4ooybYl0usiI5YBxyg1CvXxS6hsseGIftR7AmgyHOmZnO/tNaGsqZ7umQEKC\n\tQy51s0yL7oMAc42n+1VUukPvzqGXG23ra40CDBlXwqkSHcKFYLCg06LYIsRglhU3Bc9i\n\tI8zcj7JDrNk+rD3/BR5mZXrem4RgWPQtDA8j0YgIhTWAkjWNsNCbdw2Bd6Fg1SX7+5kh\n\tRuWfBnMjLAQ/vl9HBjpDoSRbZ7S86NwUoRx8cU8flNx/nt7QdoIVU4ORw9lQEdamkTK+\n\tD9cQ==","X-Gm-Message-State":"AFqh2kqz903Sfsa0am1OGa6eQPvxRI9Cp/U7kcYZLTvhfbnNxM7H2M4T\n\tTZREVBKHNnHu5XqxS4neNmY5+JdsVTJv7E2U","X-Google-Smtp-Source":"AMrXdXvPrnaNx5PR5CJD23n9nbfLfwhtAgcAH6b+DDvA8mVASc4tfn8R4MpspgcWxWYzr8o1AfZcRA==","X-Received":"by 2002:a17:902:a513:b0:192:fe0a:11d4 with SMTP id\n\ts19-20020a170902a51300b00192fe0a11d4mr593965plq.64.1672893475150; \n\tWed, 04 Jan 2023 20:37:55 -0800 (PST)","X-Google-Original-From":"Harvey Yang <chenghaoyang@google.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  5 Jan 2023 04:37:19 +0000","Message-Id":"<20230105043726.679968-3-chenghaoyang@google.com>","X-Mailer":"git-send-email 2.39.0.314.g84b9a713c41-goog","In-Reply-To":"<20230105043726.679968-1-chenghaoyang@google.com>","References":"<20230105043726.679968-1-chenghaoyang@google.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 2/9] libcamera: Add MediaDeviceBase","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>","From":"Harvey Yang via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Harvey Yang <chenghaoyang@chromium.org>","Cc":"Harvey Yang <chenghaoyang@google.com>,\n\tHarvey Yang <chenghaoyang@chromium.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"To introduce a virtual MediaDevice class in the following patches, adds\na base class of MediaDevice, to be used in other base classes.\n\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n include/libcamera/internal/media_device.h     |  35 +----\n .../libcamera/internal/media_device_base.h    |  68 +++++++++\n include/libcamera/internal/meson.build        |   1 +\n src/libcamera/media_device.cpp                |  97 +-----------\n src/libcamera/media_device_base.cpp           | 140 ++++++++++++++++++\n src/libcamera/meson.build                     |   1 +\n 6 files changed, 221 insertions(+), 121 deletions(-)\n create mode 100644 include/libcamera/internal/media_device_base.h\n create mode 100644 src/libcamera/media_device_base.cpp","diff":"diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h\nindex eb8cfde4..0edf6b98 100644\n--- a/include/libcamera/internal/media_device.h\n+++ b/include/libcamera/internal/media_device.h\n@@ -18,35 +18,26 @@\n #include <libcamera/base/signal.h>\n #include <libcamera/base/unique_fd.h>\n \n+#include \"libcamera/internal/media_device_base.h\"\n #include \"libcamera/internal/media_object.h\"\n \n namespace libcamera {\n \n-class MediaDevice : protected Loggable\n+class MediaDevice : public MediaDeviceBase\n {\n public:\n \tMediaDevice(const std::string &deviceNode);\n \t~MediaDevice();\n \n-\tbool acquire();\n-\tvoid release();\n-\tbool busy() const { return acquired_; }\n+\tbool lock() override;\n+\tvoid unlock() override;\n \n-\tbool lock();\n-\tvoid unlock();\n+\tint populate() override;\n \n-\tint populate();\n-\tbool isValid() const { return valid_; }\n-\n-\tconst std::string &driver() const { return driver_; }\n-\tconst std::string &deviceNode() const { return deviceNode_; }\n \tconst std::string &model() const { return model_; }\n \tunsigned int version() const { return version_; }\n \tunsigned int hwRevision() const { return hwRevision_; }\n \n-\tconst std::vector<MediaEntity *> &entities() const { return entities_; }\n-\tMediaEntity *getEntityByName(const std::string &name) const;\n-\n \tMediaLink *link(const std::string &sourceName, unsigned int sourceIdx,\n \t\t\tconst std::string &sinkName, unsigned int sinkIdx);\n \tMediaLink *link(const MediaEntity *source, unsigned int sourceIdx,\n@@ -54,18 +45,13 @@ public:\n \tMediaLink *link(const MediaPad *source, const MediaPad *sink);\n \tint disableLinks();\n \n-\tSignal<> disconnected;\n-\n-protected:\n-\tstd::string logPrefix() const override;\n-\n private:\n-\tint open();\n-\tvoid close();\n+\tint open() override;\n+\tvoid close() override;\n \n \tMediaObject *object(unsigned int id);\n \tbool addObject(MediaObject *object);\n-\tvoid clear();\n+\tvoid clear() override;\n \n \tstruct media_v2_interface *findInterface(const struct media_v2_topology &topology,\n \t\t\t\t\t\t unsigned int entityId);\n@@ -77,18 +63,13 @@ private:\n \tfriend int MediaLink::setEnabled(bool enable);\n \tint setupLink(const MediaLink *link, unsigned int flags);\n \n-\tstd::string driver_;\n-\tstd::string deviceNode_;\n \tstd::string model_;\n \tunsigned int version_;\n \tunsigned int hwRevision_;\n \n \tUniqueFD fd_;\n-\tbool valid_;\n-\tbool acquired_;\n \n \tstd::map<unsigned int, MediaObject *> objects_;\n-\tstd::vector<MediaEntity *> entities_;\n };\n \n } /* namespace libcamera */\ndiff --git a/include/libcamera/internal/media_device_base.h b/include/libcamera/internal/media_device_base.h\nnew file mode 100644\nindex 00000000..4f2d1fb7\n--- /dev/null\n+++ b/include/libcamera/internal/media_device_base.h\n@@ -0,0 +1,68 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Google Inc.\n+ *\n+ * media_device.h - The base class of media device handler\n+ */\n+\n+#pragma once\n+\n+#include <map>\n+#include <sstream>\n+#include <string>\n+#include <vector>\n+\n+#include <linux/media.h>\n+\n+#include <libcamera/base/log.h>\n+#include <libcamera/base/signal.h>\n+#include <libcamera/base/unique_fd.h>\n+\n+#include \"libcamera/internal/media_object.h\"\n+\n+namespace libcamera {\n+\n+class MediaDeviceBase : protected Loggable\n+{\n+public:\n+\tMediaDeviceBase(const std::string &deviceNode);\n+\t~MediaDeviceBase();\n+\n+\tbool acquire();\n+\tvoid release();\n+\tbool busy() const { return acquired_; }\n+\n+\tvirtual bool lock();\n+\tvirtual void unlock();\n+\n+\tvirtual int populate();\n+\tbool isValid() const { return valid_; }\n+\n+\tconst std::string &driver() const { return driver_; }\n+\tconst std::string &deviceNode() const { return deviceNode_; }\n+\n+\tconst std::vector<MediaEntity *> &entities() const { return entities_; }\n+\tMediaEntity *getEntityByName(const std::string &name) const;\n+\n+\tSignal<> disconnected;\n+\n+protected:\n+\tstd::string logPrefix() const override;\n+\n+\tvirtual int open() { return 0; }\n+\tvirtual void close() {}\n+\tvirtual void clear();\n+\n+\tstd::string driver_;\n+\tstd::string deviceNode_;\n+\n+\tbool valid_;\n+\tbool acquired_;\n+\n+\tstd::vector<MediaEntity *> entities_;\n+\n+private:\n+\tbool lock_;\n+};\n+\n+} /* namespace libcamera */\ndiff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build\nindex f8be86e0..826a241c 100644\n--- a/include/libcamera/internal/meson.build\n+++ b/include/libcamera/internal/meson.build\n@@ -31,6 +31,7 @@ libcamera_internal_headers = files([\n     'ipc_unixsocket.h',\n     'mapped_framebuffer.h',\n     'media_device.h',\n+    'media_device_base.h',\n     'media_object.h',\n     'pipeline_handler.h',\n     'process.h',\ndiff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\nindex 52c8e66e..ea0525d5 100644\n--- a/src/libcamera/media_device.cpp\n+++ b/src/libcamera/media_device.cpp\n@@ -63,63 +63,13 @@ LOG_DEFINE_CATEGORY(MediaDevice)\n  * populate() before the media graph can be queried.\n  */\n MediaDevice::MediaDevice(const std::string &deviceNode)\n-\t: deviceNode_(deviceNode), valid_(false), acquired_(false)\n+\t: MediaDeviceBase(deviceNode)\n {\n }\n \n MediaDevice::~MediaDevice()\n {\n \tfd_.reset();\n-\tclear();\n-}\n-\n-std::string MediaDevice::logPrefix() const\n-{\n-\treturn deviceNode() + \"[\" + driver() + \"]\";\n-}\n-\n-/**\n- * \\brief Claim a device for exclusive use\n- *\n- * The device claiming mechanism offers simple media device access arbitration\n- * between multiple users. When the media device is created, it is available to\n- * all users. Users can query the media graph to determine whether they can\n- * support the device and, if they do, claim the device for exclusive use. Other\n- * users are then expected to skip over media devices in use as reported by the\n- * busy() function.\n- *\n- * Once claimed the device shall be released by its user when not needed anymore\n- * by calling the release() function. Acquiring the media device opens a file\n- * descriptor to the device which is kept open until release() is called.\n- *\n- * Exclusive access is only guaranteed if all users of the media device abide by\n- * the device claiming mechanism, as it isn't enforced by the media device\n- * itself.\n- *\n- * \\return true if the device was successfully claimed, or false if it was\n- * already in use\n- * \\sa release(), busy()\n- */\n-bool MediaDevice::acquire()\n-{\n-\tif (acquired_)\n-\t\treturn false;\n-\n-\tif (open())\n-\t\treturn false;\n-\n-\tacquired_ = true;\n-\treturn true;\n-}\n-\n-/**\n- * \\brief Release a device previously claimed for exclusive use\n- * \\sa acquire(), busy()\n- */\n-void MediaDevice::release()\n-{\n-\tclose();\n-\tacquired_ = false;\n }\n \n /**\n@@ -290,12 +240,6 @@ done:\n  * \\return The name of the kernel driver that handles the MediaDevice\n  */\n \n-/**\n- * \\fn MediaDevice::deviceNode()\n- * \\brief Retrieve the media device node path\n- * \\return The MediaDevice deviceNode path\n- */\n-\n /**\n  * \\fn MediaDevice::model()\n  * \\brief Retrieve the media device model name\n@@ -320,26 +264,6 @@ done:\n  * \\return The MediaDevice hardware revision\n  */\n \n-/**\n- * \\fn MediaDevice::entities()\n- * \\brief Retrieve the list of entities in the media graph\n- * \\return The list of MediaEntities registered in the MediaDevice\n- */\n-\n-/**\n- * \\brief Return the MediaEntity with name \\a name\n- * \\param[in] name The entity name\n- * \\return The entity with \\a name, or nullptr if no such entity is found\n- */\n-MediaEntity *MediaDevice::getEntityByName(const std::string &name) const\n-{\n-\tfor (MediaEntity *e : entities_)\n-\t\tif (e->name() == name)\n-\t\t\treturn e;\n-\n-\treturn nullptr;\n-}\n-\n /**\n  * \\brief Retrieve the MediaLink connecting two pads, identified by entity\n  * names and pad indexes\n@@ -453,16 +377,6 @@ int MediaDevice::disableLinks()\n \treturn 0;\n }\n \n-/**\n- * \\var MediaDevice::disconnected\n- * \\brief Signal emitted when the media device is disconnected from the system\n- *\n- * This signal is emitted when the device enumerator detects that the media\n- * device has been removed from the system. For hot-pluggable devices this is\n- * usually caused by physical device disconnection, but can also result from\n- * driver unloading for most devices. The media device is passed as a parameter.\n- */\n-\n /**\n  * \\brief Open the media device\n  *\n@@ -565,14 +479,9 @@ void MediaDevice::clear()\n \t\tdelete o.second;\n \n \tobjects_.clear();\n-\tentities_.clear();\n-\tvalid_ = false;\n-}\n \n-/**\n- * \\var MediaDevice::entities_\n- * \\brief Global list of media entities in the media graph\n- */\n+\tMediaDeviceBase::clear();\n+}\n \n /**\n  * \\brief Find the interface associated with an entity\ndiff --git a/src/libcamera/media_device_base.cpp b/src/libcamera/media_device_base.cpp\nnew file mode 100644\nindex 00000000..12161d1a\n--- /dev/null\n+++ b/src/libcamera/media_device_base.cpp\n@@ -0,0 +1,140 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2022, Google Inc.\n+ *\n+ * media_device_base.cpp - The base class of media device handler\n+ */\n+\n+#include \"libcamera/internal/media_device_base.h\"\n+\n+namespace libcamera {\n+\n+LOG_DEFINE_CATEGORY(MediaDeviceBase)\n+\n+MediaDeviceBase::MediaDeviceBase(const std::string &deviceNode)\n+\t: deviceNode_(deviceNode), valid_(false), acquired_(false), lock_(false)\n+{\n+}\n+\n+MediaDeviceBase::~MediaDeviceBase()\n+{\n+\tclear();\n+}\n+\n+/**\n+ * \\brief Claim a device for exclusive use\n+ *\n+ * The device claiming mechanism offers simple media device access arbitration\n+ * between multiple users. When the media device is created, it is available to\n+ * all users. Users can query the media graph to determine whether they can\n+ * support the device and, if they do, claim the device for exclusive use. Other\n+ * users are then expected to skip over media devices in use as reported by the\n+ * busy() function.\n+ *\n+ * Once claimed the device shall be released by its user when not needed anymore\n+ * by calling the release() function. Acquiring the media device opens a file\n+ * descriptor to the device which is kept open until release() is called.\n+ *\n+ * Exclusive access is only guaranteed if all users of the media device abide by\n+ * the device claiming mechanism, as it isn't enforced by the media device\n+ * itself.\n+ *\n+ * \\return true if the device was successfully claimed, or false if it was\n+ * already in use\n+ * \\sa release(), busy()\n+ */\n+bool MediaDeviceBase::acquire()\n+{\n+\tif (acquired_)\n+\t\treturn false;\n+\n+\tif (open())\n+\t\treturn false;\n+\n+\tacquired_ = true;\n+\treturn true;\n+}\n+\n+/**\n+ * \\brief Release a device previously claimed for exclusive use\n+ * \\sa acquire(), busy()\n+ */\n+void MediaDeviceBase::release()\n+{\n+\tclose();\n+\tacquired_ = false;\n+}\n+\n+bool MediaDeviceBase::lock()\n+{\n+\tif (lock_)\n+\t\treturn false;\n+\n+\tlock_ = true;\n+\treturn true;\n+}\n+\n+void MediaDeviceBase::unlock()\n+{\n+\tlock_ = false;\n+}\n+\n+int MediaDeviceBase::populate()\n+{\n+\tvalid_ = true;\n+\treturn 0;\n+}\n+\n+/**\n+ * \\fn MediaDeviceBase::deviceNode()\n+ * \\brief Retrieve the media device node path\n+ * \\return The MediaDeviceBase deviceNode path\n+ */\n+\n+/**\n+ * \\fn MediaDeviceBase::entities()\n+ * \\brief Retrieve the list of entities in the media graph\n+ * \\return The list of MediaEntities registered in the MediaDeviceBase\n+ */\n+\n+/**\n+ * \\brief Return the MediaEntity with name \\a name\n+ * \\param[in] name The entity name\n+ * \\return The entity with \\a name, or nullptr if no such entity is found\n+ */\n+MediaEntity *MediaDeviceBase::getEntityByName(const std::string &name) const\n+{\n+\tfor (MediaEntity *e : entities_)\n+\t\tif (e->name() == name)\n+\t\t\treturn e;\n+\n+\treturn nullptr;\n+}\n+\n+/**\n+ * \\var MediaDeviceBase::disconnected\n+ * \\brief Signal emitted when the media device is disconnected from the system\n+ *\n+ * This signal is emitted when the device enumerator detects that the media\n+ * device has been removed from the system. For hot-pluggable devices this is\n+ * usually caused by physical device disconnection, but can also result from\n+ * driver unloading for most devices. The media device is passed as a parameter.\n+ */\n+\n+std::string MediaDeviceBase::logPrefix() const\n+{\n+\treturn deviceNode() + \"[\" + driver() + \"]\";\n+}\n+\n+void MediaDeviceBase::clear()\n+{\n+\tentities_.clear();\n+\tvalid_ = false;\n+}\n+\n+/**\n+ * \\var MediaDeviceBase::entities_\n+ * \\brief Global list of media entities in the media graph\n+ */\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex 0494e808..ce4c1a29 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -32,6 +32,7 @@ libcamera_sources = files([\n     'ipc_unixsocket.cpp',\n     'mapped_framebuffer.cpp',\n     'media_device.cpp',\n+    'media_device_base.cpp',\n     'media_object.cpp',\n     'pipeline_handler.cpp',\n     'pixel_format.cpp',\n","prefixes":["libcamera-devel","v3","2/9"]}