Patch Detail
Show a patch.
GET /api/patches/13197/?format=api
{ "id": 13197, "url": "https://patchwork.libcamera.org/api/patches/13197/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13197/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210804124314.8044-3-laurent.pinchart@ideasonboard.com>", "date": "2021-08-04T12:43:08", "name": "[libcamera-devel,v3,2/8] cam: Add FrameSink base class", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "9a647ff105c9dc0054c952dac06a9f4c0260c5fa", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13197/mbox/", "series": [ { "id": 2303, "url": "https://patchwork.libcamera.org/api/series/2303/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2303", "date": "2021-08-04T12:43:06", "name": "libcamera: Add DRM/KMS viewfinder display to cam", "version": 3, "mbox": "https://patchwork.libcamera.org/series/2303/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13197/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13197/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 1C4DBC3235\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 4 Aug 2021 12:43:35 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F1DEA68888;\n\tWed, 4 Aug 2021 14:43:32 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8BAA26880F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 4 Aug 2021 14:43:30 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 313F624F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 4 Aug 2021 14:43:30 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"g4NJYyjB\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1628081010;\n\tbh=uPsXmPc8g+RKsdzOcf2gsG0e7nPONRsJXXap6RcIvS0=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=g4NJYyjBUpm+z5fS/69YMtlyM/k2+rdiBeFaKEvFNo8shhGLhYqCMGRiT2m1wKkJJ\n\tjkbOBI/1PkzY3iyq2qm0gLgNjFRXOdxG4IRG37IeaSMnCz/JwvBMwX2xPznT7v0v7D\n\twiUodmAAWKjns5WW/kddOYCX8QKB31a4HBmGG/nk=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 4 Aug 2021 15:43:08 +0300", "Message-Id": "<20210804124314.8044-3-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20210804124314.8044-1-laurent.pinchart@ideasonboard.com>", "References": "<20210804124314.8044-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 2/8] cam: Add FrameSink base class", "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": "The FrameSink class serves as a base to implement components that\nconsume frames. This allows handling frame sinks in a generic way,\nindependent of their nature. The BufferWrite class will be ported to\nFrameSink in a second step.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n---\nChanges since v2:\n\n- Document the FrameSink class\n- Update copyright year\n- Rename consumeRequest() to processRequest() and requestReleased to\n requestProcessed\n---\n src/cam/frame_sink.cpp | 67 ++++++++++++++++++++++++++++++++++++++++++\n src/cam/frame_sink.h | 34 +++++++++++++++++++++\n src/cam/meson.build | 1 +\n 3 files changed, 102 insertions(+)\n create mode 100644 src/cam/frame_sink.cpp\n create mode 100644 src/cam/frame_sink.h", "diff": "diff --git a/src/cam/frame_sink.cpp b/src/cam/frame_sink.cpp\nnew file mode 100644\nindex 000000000000..af21d575172e\n--- /dev/null\n+++ b/src/cam/frame_sink.cpp\n@@ -0,0 +1,67 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2021, Ideas on Board Oy\n+ *\n+ * frame_sink.cpp - Base Frame Sink Class\n+ */\n+\n+#include \"frame_sink.h\"\n+\n+/**\n+ * \\class FrameSink\n+ * \\brief Abstract class to model a consumer of frames\n+ *\n+ * The FrameSink class models the consumer that processes frames after a request\n+ * completes. It receives requests through processRequest(), and processes them\n+ * synchronously or asynchronously. This allows frame sinks to hold onto frames\n+ * for an extended period of time, for instance to display them until a new\n+ * frame arrives.\n+ *\n+ * A frame sink processes whole requests, and is solely responsible for deciding\n+ * how to handle different frame buffers in case multiple streams are captured.\n+ */\n+\n+FrameSink::~FrameSink()\n+{\n+}\n+\n+int FrameSink::configure([[maybe_unused]] const libcamera::CameraConfiguration &config)\n+{\n+\treturn 0;\n+}\n+\n+void FrameSink::mapBuffer([[maybe_unused]] libcamera::FrameBuffer *buffer)\n+{\n+}\n+\n+int FrameSink::start()\n+{\n+\treturn 0;\n+}\n+\n+int FrameSink::stop()\n+{\n+\treturn 0;\n+}\n+\n+/**\n+ * \\fn FrameSink::processRequest()\n+ * \\param[in] request The request\n+ *\n+ * This function is called to instruct the sink to process a request. The sink\n+ * may process the request synchronously or queue it for asynchronous\n+ * processing.\n+ *\n+ * When the request is processed synchronously, this function shall return true.\n+ * The \\a request shall not be accessed by the FrameSink after the function\n+ * returns.\n+ *\n+ * When the request is processed asynchronously, the FrameSink temporarily takes\n+ * ownership of the \\a request. The function shall return false, and the\n+ * FrameSink shall emit the requestProcessed signal when the request processing\n+ * completes. If the stop() function is called before the request processing\n+ * completes, it shall release the request synchronously.\n+ *\n+ * \\return True if the request has been processed synchronously, false if\n+ * processing has been queued\n+ */\ndiff --git a/src/cam/frame_sink.h b/src/cam/frame_sink.h\nnew file mode 100644\nindex 000000000000..76e1fc30a905\n--- /dev/null\n+++ b/src/cam/frame_sink.h\n@@ -0,0 +1,34 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2021, Ideas on Board Oy\n+ *\n+ * frame_sink.h - Base Frame Sink Class\n+ */\n+#ifndef __CAM_FRAME_SINK_H__\n+#define __CAM_FRAME_SINK_H__\n+\n+#include <libcamera/base/signal.h>\n+\n+namespace libcamera {\n+class CameraConfiguration;\n+class FrameBuffer;\n+class Request;\n+} /* namespace libcamera */\n+\n+class FrameSink\n+{\n+public:\n+\tvirtual ~FrameSink();\n+\n+\tvirtual int configure(const libcamera::CameraConfiguration &config);\n+\n+\tvirtual void mapBuffer(libcamera::FrameBuffer *buffer);\n+\n+\tvirtual int start();\n+\tvirtual int stop();\n+\n+\tvirtual bool processRequest(libcamera::Request *request) = 0;\n+\tlibcamera::Signal<libcamera::Request *> requestProcessed;\n+};\n+\n+#endif /* __CAM_FRAME_SINK_H__ */\ndiff --git a/src/cam/meson.build b/src/cam/meson.build\nindex 1e90ee521f74..649cc990d867 100644\n--- a/src/cam/meson.build\n+++ b/src/cam/meson.build\n@@ -13,6 +13,7 @@ cam_sources = files([\n 'buffer_writer.cpp',\n 'camera_session.cpp',\n 'event_loop.cpp',\n+ 'frame_sink.cpp',\n 'main.cpp',\n 'options.cpp',\n 'stream_options.cpp',\n", "prefixes": [ "libcamera-devel", "v3", "2/8" ] }