Patch Detail
Show a patch.
GET /api/1.1/patches/9483/?format=api
{ "id": 9483, "url": "https://patchwork.libcamera.org/api/1.1/patches/9483/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9483/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20200904084316.7319-4-show.liu@linaro.org>", "date": "2020-09-04T08:43:14", "name": "[libcamera-devel,v5,2/4] qcam: new viewfinder hierarchy", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "52fc035fd08b16af8aa1692bbea6412e73d89ce3", "submitter": { "id": 24, "url": "https://patchwork.libcamera.org/api/1.1/people/24/?format=api", "name": "Show Liu", "email": "show.liu@linaro.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/9483/mbox/", "series": [ { "id": 1263, "url": "https://patchwork.libcamera.org/api/1.1/series/1263/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1263", "date": "2020-09-04T08:43:14", "name": null, "version": 5, "mbox": "https://patchwork.libcamera.org/series/1263/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9483/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9483/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 92A4BBE174\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 4 Sep 2020 08:43:46 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5076562B29;\n\tFri, 4 Sep 2020 10:43:46 +0200 (CEST)", "from mail-pf1-x443.google.com (mail-pf1-x443.google.com\n\t[IPv6:2607:f8b0:4864:20::443])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 75CB262901\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 4 Sep 2020 10:43:45 +0200 (CEST)", "by mail-pf1-x443.google.com with SMTP id k15so4210587pfc.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 04 Sep 2020 01:43:45 -0700 (PDT)", "from localhost.localdomain (211-20-20-223.HINET-IP.hinet.net.\n\t[211.20.20.223]) by smtp.gmail.com with ESMTPSA id\n\ta6sm5202148pgt.70.2020.09.04.01.43.42\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 04 Sep 2020 01:43:43 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"YfyR6bOo\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=XUh/XGCaEuZ2KgtjZ42uPYeWJaBuSzbZ7pxxaPvQamc=;\n\tb=YfyR6bOoCPjtAlLUUOpAdFr3lVYUjHBYdS1dODZkzZlWR8fDShC15vsdhXP90IrLIw\n\t9ng85cidcO4YkQ3SLytYRkJx8plkwx5wlP2YoqtORMl9zYD8yAIAKdm+GFfbrwAmSq5T\n\tjEoAH9o3n3754VwYcKoSTjxoauIrAMKoJOFv7unzL/YDv64gFVzTjsdUpgsVARpbHEE4\n\tAZgNXeC7BwdHlAnUpx2qNlJ5EoRVbr1WC2d60Dk861id11MgjJx3yqS2efoG2K/V8KAA\n\tYIKk1ca1KEboRRjFIlWG9skoC3/YtphVEDq8b1Asj7sEvrqNM1+d6fc8QoPRvqfNiT0E\n\tjVRA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=XUh/XGCaEuZ2KgtjZ42uPYeWJaBuSzbZ7pxxaPvQamc=;\n\tb=jhiUxVxtEi1AsfGHATluHb6uQdz0K0jBL6ReNWmVI3pFDofYqgyGEgs3/Ytx2ub8P/\n\tE2pVbeQ5qMGJRmmFO5kWnNhX3xM5sWsWmpxQ/CTytbVV8+jHvynjekni4NBMfSvN19Fi\n\tONnvBYyUNSxeGRnw29buGT5CsdRriAqp7vdWkFPk0Y/EllkgZ+dWaKWkV1nAzjrgteul\n\tUO1F4Gt7SU4Xc3i3PNmkARup77dcXZ7FBJvgOnfc+vLRUmsi7R8dTOGPcE68aRuxWfK8\n\tsUX0vHIcTvh/LQTLMpaeToJIL18+3xIrELkaRXLEOO5eOp3VGJdgdm8hIGktsIdm7+SV\n\tdzcw==", "X-Gm-Message-State": "AOAM533nQVLBE40j9jSK2nHXVfKscn68HGZz6Z7k+xE49VXabwMlj/PK\n\tBQEwv4tpduNnqYy5frsvocgcbldK4Ls6tA==", "X-Google-Smtp-Source": "ABdhPJw/TTehSobwgnIKAenUEpLlyEtxeZOfv0EaOM5niPwxa9XEDlZiVfBvyHAkptbojdqbF5c4dw==", "X-Received": "by 2002:aa7:9685:: with SMTP id f5mr7796643pfk.232.1599209023864;\n\tFri, 04 Sep 2020 01:43:43 -0700 (PDT)", "From": "Show Liu <show.liu@linaro.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 4 Sep 2020 16:43:14 +0800", "Message-Id": "<20200904084316.7319-4-show.liu@linaro.org>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20200904084316.7319-1-show.liu@linaro.org>", "References": "<20200904084316.7319-1-show.liu@linaro.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v5 2/4] qcam: new viewfinder hierarchy", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Create viewfinder base class and rename the original viewfinder\nas default Qt render widget\n\nSigned-off-by: Show Liu <show.liu@linaro.org>\n---\n src/qcam/meson.build | 4 +-\n src/qcam/viewfinder.h | 60 ++++-------------\n .../{viewfinder.cpp => viewfinder_qt.cpp} | 24 +++----\n src/qcam/viewfinder_qt.h | 67 +++++++++++++++++++\n 4 files changed, 94 insertions(+), 61 deletions(-)\n rename src/qcam/{viewfinder.cpp => viewfinder_qt.cpp} (86%)\n create mode 100644 src/qcam/viewfinder_qt.h", "diff": "diff --git a/src/qcam/meson.build b/src/qcam/meson.build\nindex e0c6f26..a4bad0a 100644\n--- a/src/qcam/meson.build\n+++ b/src/qcam/meson.build\n@@ -6,12 +6,12 @@ qcam_sources = files([\n 'format_converter.cpp',\n 'main.cpp',\n 'main_window.cpp',\n- 'viewfinder.cpp',\n+ 'viewfinder_qt.cpp',\n ])\n \n qcam_moc_headers = files([\n 'main_window.h',\n- 'viewfinder.h',\n+ 'viewfinder_qt.h',\n ])\n \n qcam_resources = files([\ndiff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h\nindex 26a1320..fa7785f 100644\n--- a/src/qcam/viewfinder.h\n+++ b/src/qcam/viewfinder.h\n@@ -2,70 +2,36 @@\n /*\n * Copyright (C) 2019, Google Inc.\n *\n- * viewfinder.h - qcam - Viewfinder\n+ * viewfinder.h - qcam - Viewfinder base class\n */\n #ifndef __QCAM_VIEWFINDER_H__\n #define __QCAM_VIEWFINDER_H__\n \n-#include <stddef.h>\n-\n-#include <QIcon>\n-#include <QList>\n #include <QImage>\n-#include <QMutex>\n+#include <QList>\n+#include <QMap>\n #include <QSize>\n-#include <QWidget>\n \n #include <libcamera/buffer.h>\n-#include <libcamera/pixel_format.h>\n-\n-#include \"format_converter.h\"\n-\n-class QImage;\n+#include <libcamera/formats.h>\n \n struct MappedBuffer {\n \tvoid *memory;\n \tsize_t size;\n };\n \n-class ViewFinder : public QWidget\n+class ViewFinder\n {\n-\tQ_OBJECT\n-\n public:\n-\tViewFinder(QWidget *parent);\n-\t~ViewFinder();\n-\n-\tconst QList<libcamera::PixelFormat> &nativeFormats() const;\n+\tViewFinder(){};\n+\tvirtual ~ViewFinder(){};\n \n-\tint setFormat(const libcamera::PixelFormat &format, const QSize &size);\n-\tvoid render(libcamera::FrameBuffer *buffer, MappedBuffer *map);\n-\tvoid stop();\n+\tvirtual const QList<libcamera::PixelFormat> &nativeFormats() const = 0;\n \n-\tQImage getCurrentImage();\n+\tvirtual int setFormat(const libcamera::PixelFormat &format, const QSize &size) = 0;\n+\tvirtual void render(libcamera::FrameBuffer *buffer, MappedBuffer *map) = 0;\n+\tvirtual void stop() = 0;\n \n-Q_SIGNALS:\n-\tvoid renderComplete(libcamera::FrameBuffer *buffer);\n-\n-protected:\n-\tvoid paintEvent(QPaintEvent *) override;\n-\tQSize sizeHint() const override;\n-\n-private:\n-\tFormatConverter converter_;\n-\n-\tlibcamera::PixelFormat format_;\n-\tQSize size_;\n-\n-\t/* Camera stopped icon */\n-\tQSize vfSize_;\n-\tQIcon icon_;\n-\tQPixmap pixmap_;\n-\n-\t/* Buffer and render image */\n-\tlibcamera::FrameBuffer *buffer_;\n-\tQImage image_;\n-\tQMutex mutex_; /* Prevent concurrent access to image_ */\n+\tvirtual QImage getCurrentImage() = 0;\n };\n-\n-#endif /* __QCAM_VIEWFINDER__ */\n+#endif /* __QCAM_VIEWFINDER_H__ */\ndiff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder_qt.cpp\nsimilarity index 86%\nrename from src/qcam/viewfinder.cpp\nrename to src/qcam/viewfinder_qt.cpp\nindex dcf8a15..072f024 100644\n--- a/src/qcam/viewfinder.cpp\n+++ b/src/qcam/viewfinder_qt.cpp\n@@ -2,10 +2,10 @@\n /*\n * Copyright (C) 2019, Google Inc.\n *\n- * viewfinder.cpp - qcam - Viewfinder\n+ * viewfinder_qt.cpp - qcam - default Viewfinder for rendering by Qt\n */\n \n-#include \"viewfinder.h\"\n+#include \"viewfinder_qt.h\"\n \n #include <stdint.h>\n #include <utility>\n@@ -33,24 +33,24 @@ static const QMap<libcamera::PixelFormat, QImage::Format> nativeFormats\n \t{ libcamera::formats::BGR888, QImage::Format_RGB888 },\n };\n \n-ViewFinder::ViewFinder(QWidget *parent)\n+ViewFinderQt::ViewFinderQt(QWidget *parent)\n \t: QWidget(parent), buffer_(nullptr)\n {\n \ticon_ = QIcon(\":camera-off.svg\");\n }\n \n-ViewFinder::~ViewFinder()\n+ViewFinderQt::~ViewFinderQt()\n {\n }\n \n-const QList<libcamera::PixelFormat> &ViewFinder::nativeFormats() const\n+const QList<libcamera::PixelFormat> &ViewFinderQt::nativeFormats() const\n {\n \tstatic const QList<libcamera::PixelFormat> formats = ::nativeFormats.keys();\n \treturn formats;\n }\n \n-int ViewFinder::setFormat(const libcamera::PixelFormat &format,\n-\t\t\t const QSize &size)\n+int ViewFinderQt::setFormat(const libcamera::PixelFormat &format,\n+\t\t\t const QSize &size)\n {\n \timage_ = QImage();\n \n@@ -78,7 +78,7 @@ int ViewFinder::setFormat(const libcamera::PixelFormat &format,\n \treturn 0;\n }\n \n-void ViewFinder::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)\n+void ViewFinderQt::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)\n {\n \tif (buffer->planes().size() != 1) {\n \t\tqWarning() << \"Multi-planar buffers are not supported\";\n@@ -121,7 +121,7 @@ void ViewFinder::render(libcamera::FrameBuffer *buffer, MappedBuffer *map)\n \t\trenderComplete(buffer);\n }\n \n-void ViewFinder::stop()\n+void ViewFinderQt::stop()\n {\n \timage_ = QImage();\n \n@@ -133,14 +133,14 @@ void ViewFinder::stop()\n \tupdate();\n }\n \n-QImage ViewFinder::getCurrentImage()\n+QImage ViewFinderQt::getCurrentImage()\n {\n \tQMutexLocker locker(&mutex_);\n \n \treturn image_.copy();\n }\n \n-void ViewFinder::paintEvent(QPaintEvent *)\n+void ViewFinderQt::paintEvent(QPaintEvent *)\n {\n \tQPainter painter(this);\n \n@@ -175,7 +175,7 @@ void ViewFinder::paintEvent(QPaintEvent *)\n \tpainter.drawPixmap(point, pixmap_);\n }\n \n-QSize ViewFinder::sizeHint() const\n+QSize ViewFinderQt::sizeHint() const\n {\n \treturn size_.isValid() ? size_ : QSize(640, 480);\n }\ndiff --git a/src/qcam/viewfinder_qt.h b/src/qcam/viewfinder_qt.h\nnew file mode 100644\nindex 0000000..ee2abab\n--- /dev/null\n+++ b/src/qcam/viewfinder_qt.h\n@@ -0,0 +1,67 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * viewfinder_qt.h - qcam - default Viewfinder for rendering by Qt\n+ */\n+#ifndef __QCAM_VIEWFINDER_QT_H__\n+#define __QCAM_VIEWFINDER_QT_H__\n+\n+#include <stddef.h>\n+\n+#include <QIcon>\n+#include <QImage>\n+#include <QList>\n+#include <QMutex>\n+#include <QSize>\n+#include <QWidget>\n+\n+#include <libcamera/buffer.h>\n+#include <libcamera/formats.h>\n+#include <libcamera/pixel_format.h>\n+\n+#include \"format_converter.h\"\n+#include \"viewfinder.h\"\n+\n+class QImage;\n+\n+class ViewFinderQt : public QWidget, public ViewFinder\n+{\n+\tQ_OBJECT\n+\n+public:\n+\tViewFinderQt(QWidget *parent);\n+\t~ViewFinderQt();\n+\n+\tconst QList<libcamera::PixelFormat> &nativeFormats() const override;\n+\n+\tint setFormat(const libcamera::PixelFormat &format, const QSize &size) override;\n+\tvoid render(libcamera::FrameBuffer *buffer, MappedBuffer *map) override;\n+\tvoid stop() override;\n+\n+\tQImage getCurrentImage() override;\n+\n+Q_SIGNALS:\n+\tvoid renderComplete(libcamera::FrameBuffer *buffer);\n+\n+protected:\n+\tvoid paintEvent(QPaintEvent *) override;\n+\tQSize sizeHint() const override;\n+\n+private:\n+\tFormatConverter converter_;\n+\n+\tlibcamera::PixelFormat format_;\n+\tQSize size_;\n+\n+\t/* Camera stopped icon */\n+\tQSize vfSize_;\n+\tQIcon icon_;\n+\tQPixmap pixmap_;\n+\n+\t/* Buffer and render image */\n+\tlibcamera::FrameBuffer *buffer_;\n+\tQImage image_;\n+\tQMutex mutex_; /* Prevent concurrent access to image_ */\n+};\n+#endif /* __QCAM_VIEWFINDER_QT_H__ */\n", "prefixes": [ "libcamera-devel", "v5", "2/4" ] }