{"id":2263,"url":"https://patchwork.libcamera.org/api/patches/2263/?format=json","web_url":"https://patchwork.libcamera.org/patch/2263/","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":"<20191028022525.796995-4-niklas.soderlund@ragnatech.se>","date":"2019-10-28T02:25:16","name":"[libcamera-devel,RFC,03/12] libcamera: pipeline: Add helper to find request from buffer","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"65337e8c056e6504471f1e14ca6eff321be67b51","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2263/mbox/","series":[{"id":561,"url":"https://patchwork.libcamera.org/api/series/561/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=561","date":"2019-10-28T02:25:13","name":"libcamera: Rework buffer API","version":1,"mbox":"https://patchwork.libcamera.org/series/561/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2263/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2263/checks/","tags":{},"headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3073D6017C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Oct 2019 03:25:51 +0100 (CET)","from localhost.localdomain (unknown [93.2.121.143])\n\tby bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid 400e3bcd-f92a-11e9-903a-005056917f90;\n\tMon, 28 Oct 2019 03:25:47 +0100 (CET)"],"X-Halon-ID":"400e3bcd-f92a-11e9-903a-005056917f90","Authorized-sender":"niklas@soderlund.pp.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 28 Oct 2019 03:25:16 +0100","Message-Id":"<20191028022525.796995-4-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.23.0","In-Reply-To":"<20191028022525.796995-1-niklas.soderlund@ragnatech.se>","References":"<20191028022525.796995-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC 03/12] libcamera: pipeline: Add helper to\n\tfind request from buffer","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":"Mon, 28 Oct 2019 02:25:51 -0000"},"content":"The pipeline knows which buffer coming from the application belongs to\nwhich request. Add a helper to allow pipeline implementations to access\nthis knowledge.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/include/pipeline_handler.h |  2 ++\n src/libcamera/pipeline_handler.cpp       | 10 ++++++++++\n 2 files changed, 12 insertions(+)","diff":"diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\nindex 320740746bc6e998..6024357e266c2e2b 100644\n--- a/src/libcamera/include/pipeline_handler.h\n+++ b/src/libcamera/include/pipeline_handler.h\n@@ -39,6 +39,8 @@ public:\n \t}\n \tvirtual ~CameraData() {}\n \n+\tRequest *requestFromBuffer(Buffer *buffer);\n+\n \tCamera *camera_;\n \tPipelineHandler *pipe_;\n \tstd::list<Request *> queuedRequests_;\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex f9ae767d529d44d9..d70e286661aded8e 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -58,6 +58,16 @@ LOG_DEFINE_CATEGORY(Pipeline)\n  * exists.\n  */\n \n+Request *CameraData::requestFromBuffer(Buffer *buffer)\n+{\n+\tfor (Request *request : queuedRequests_)\n+\t\tfor (const auto &it : request->buffers())\n+\t\t\tif (it.second == buffer)\n+\t\t\t\treturn request;\n+\n+\treturn nullptr;\n+}\n+\n /**\n  * \\var CameraData::camera_\n  * \\brief The camera related to this CameraData instance\n","prefixes":["libcamera-devel","RFC","03/12"]}