{"id":20848,"url":"https://patchwork.libcamera.org/api/patches/20848/?format=json","web_url":"https://patchwork.libcamera.org/patch/20848/","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":"<20240808173921.2519957-2-kieran.bingham@ideasonboard.com>","date":"2024-08-08T17:39:20","name":"[1/2] pipeline: simple: Remove media member variable","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"92b46049362e3e3af86556fd6557c924b06a88c5","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20848/mbox/","series":[{"id":4505,"url":"https://patchwork.libcamera.org/api/series/4505/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4505","date":"2024-08-08T17:39:19","name":"pipeline: simple: Fix matching with an empty media graph","version":1,"mbox":"https://patchwork.libcamera.org/series/4505/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20848/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20848/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 7779EC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  8 Aug 2024 17:39:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 29AB963382;\n\tThu,  8 Aug 2024 19:39:29 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CE6E16337F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Aug 2024 19:39:24 +0200 (CEST)","from Monstersaurus.tail69b4.ts.net\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E9048C8E;\n\tThu,  8 Aug 2024 19:38:30 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"mSqi5QiW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723138711;\n\tbh=l4hjMp0+x9x77pS0m7uX5MOyVl1PnogMgw8D/SO5su8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=mSqi5QiWBbLEhIA5Dl8G/lHArcayEWiZV+wZgQeLfr9C8WTn4FqM3RCC44tTBhYFG\n\tlbk6u0SXSx3vnmf8CCelodll6aKnIrx1GcvRnxWjelQ49017rs+4+euARC/x+k5+VU\n\ta1RpKDUWP17SbgZTyWFk0J5fMnzYdGUvYn9DtDbo=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Cc":"Paul Elder <paul.elder@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"[PATCH 1/2] pipeline: simple: Remove media member variable","Date":"Thu,  8 Aug 2024 18:39:20 +0100","Message-Id":"<20240808173921.2519957-2-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20240808173921.2519957-1-kieran.bingham@ideasonboard.com>","References":"<20240808173921.2519957-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Paul Elder <paul.elder@ideasonboard.com>\n\nThere is no need for the simple pipeline handler to save the media\ndevice. Remove it.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/pipeline/simple/simple.cpp | 21 +++++++++++----------\n 1 file changed, 11 insertions(+), 10 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 9910900e0e5e..222052ce02f8 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -363,13 +363,12 @@ private:\n \t\treturn static_cast<SimpleCameraData *>(camera->_d());\n \t}\n \n-\tstd::vector<MediaEntity *> locateSensors();\n+\tstd::vector<MediaEntity *> locateSensors(MediaDevice *media);\n \tstatic int resetRoutingTable(V4L2Subdevice *subdev);\n \n \tconst MediaPad *acquirePipeline(SimpleCameraData *data);\n \tvoid releasePipeline(SimpleCameraData *data);\n \n-\tMediaDevice *media_;\n \tstd::map<const MediaEntity *, EntityData> entities_;\n \n \tMediaDevice *converter_;\n@@ -1424,7 +1423,8 @@ int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request)\n  * Match and Setup\n  */\n \n-std::vector<MediaEntity *> SimplePipelineHandler::locateSensors()\n+std::vector<MediaEntity *>\n+SimplePipelineHandler::locateSensors(MediaDevice *media)\n {\n \tstd::vector<MediaEntity *> entities;\n \n@@ -1432,7 +1432,7 @@ std::vector<MediaEntity *> SimplePipelineHandler::locateSensors()\n \t * Gather all the camera sensor entities based on the function they\n \t * expose.\n \t */\n-\tfor (MediaEntity *entity : media_->entities()) {\n+\tfor (MediaEntity *entity : media->entities()) {\n \t\tif (entity->function() == MEDIA_ENT_F_CAM_SENSOR)\n \t\t\tentities.push_back(entity);\n \t}\n@@ -1520,17 +1520,18 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n {\n \tconst SimplePipelineInfo *info = nullptr;\n \tunsigned int numStreams = 1;\n+\tMediaDevice *media;\n \n \tfor (const SimplePipelineInfo &inf : supportedDevices) {\n \t\tDeviceMatch dm(inf.driver);\n-\t\tmedia_ = acquireMediaDevice(enumerator, dm);\n-\t\tif (media_) {\n+\t\tmedia = acquireMediaDevice(enumerator, dm);\n+\t\tif (media) {\n \t\t\tinfo = &inf;\n \t\t\tbreak;\n \t\t}\n \t}\n \n-\tif (!media_)\n+\tif (!media)\n \t\treturn false;\n \n \tfor (const auto &[name, streams] : info->converters) {\n@@ -1545,13 +1546,13 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator)\n \tswIspEnabled_ = info->swIspEnabled;\n \n \t/* Locate the sensors. */\n-\tstd::vector<MediaEntity *> sensors = locateSensors();\n+\tstd::vector<MediaEntity *> sensors = locateSensors(media);\n \tif (sensors.empty()) {\n-\t\tLOG(SimplePipeline, Info) << \"No sensor found for \" << media_->deviceNode();\n+\t\tLOG(SimplePipeline, Info) << \"No sensor found for \" << media->deviceNode();\n \t\treturn false;\n \t}\n \n-\tLOG(SimplePipeline, Debug) << \"Sensor found for \" << media_->deviceNode();\n+\tLOG(SimplePipeline, Debug) << \"Sensor found for \" << media->deviceNode();\n \n \t/*\n \t * Create one camera data instance for each sensor and gather all\n","prefixes":["1/2"]}