Patch Detail
Show a patch.
GET /api/1.1/patches/1612/?format=api
{ "id": 1612, "url": "https://patchwork.libcamera.org/api/1.1/patches/1612/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1612/", "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": "<20190704130347.9372-10-kieran.bingham@ideasonboard.com>", "date": "2019-07-04T13:03:47", "name": "[libcamera-devel,v2,5/5] qcam: Update window title with FPS", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "22bf2182e1d24ed4d312852535ecd7569cab731e", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1612/mbox/", "series": [ { "id": 399, "url": "https://patchwork.libcamera.org/api/1.1/series/399/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=399", "date": "2019-07-04T13:03:38", "name": "[libcamera-devel,1/4] Documentation: Make the project brief more expressive", "version": 1, "mbox": "https://patchwork.libcamera.org/series/399/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1612/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1612/checks/", "tags": {}, "headers": { "Return-Path": "<kieran.bingham@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D6F7C61570\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 4 Jul 2019 15:03:54 +0200 (CEST)", "from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 82F35E21;\n\tThu, 4 Jul 2019 15:03:54 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1562245434;\n\tbh=PHlxt8y8jHEgOvB4XDf8D8pN9uWwZ2srk+YLHPgO7C4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ZXU+rJI+byl19a4hwDJpLOo+U1BtONIzXsMjdO4M6qFDmWhtcUG1ZgKlJgJhNsHI+\n\t8wOz7NQ06fvBJTYI2yWQkSEct7F60aiVrJdQEtx8TxXrq0wZnA4hp8yryMkvV6Wvfn\n\t5qvVk/R8xWosxQhX+YujmOuX9HP1Gf+HD6rfUv24=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "LibCamera Devel <libcamera-devel@lists.libcamera.org>", "Date": "Thu, 4 Jul 2019 14:03:47 +0100", "Message-Id": "<20190704130347.9372-10-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190704130347.9372-1-kieran.bingham@ideasonboard.com>", "References": "<20190704130347.9372-1-kieran.bingham@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 5/5] qcam: Update window title with FPS", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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": "Thu, 04 Jul 2019 13:03:55 -0000" }, "content": "Provide an average FPS in the QCam title bar to show the current rate of\nframe processing.\n\nThe QCam compilation is updated to process the QT MoC headers to support\nsignals and slots accordingly.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/qcam/main_window.cpp | 22 ++++++++++++++++++++++\n src/qcam/main_window.h | 11 +++++++++++\n src/qcam/meson.build | 11 ++++++++++-\n 3 files changed, 43 insertions(+), 1 deletion(-)", "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex d61369109d66..9f05ec05549f 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -29,6 +29,10 @@ MainWindow::MainWindow(const OptionsParser::Options &options)\n \ttitle_ = \"QCam \" + QString::fromStdString(libcamera::version);\n \tsetWindowTitle(title_);\n \n+\tQTimer *timer = new QTimer(this);\n+\tconnect(timer, SIGNAL(timeout()), this, SLOT(updateTitle()));\n+\ttimer->start(2000);\n+\n \tviewfinder_ = new ViewFinder(this);\n \tsetCentralWidget(viewfinder_);\n \tviewfinder_->setFixedSize(500, 500);\n@@ -54,6 +58,19 @@ MainWindow::~MainWindow()\n \tCameraManager::instance()->stop();\n }\n \n+void MainWindow::updateTitle()\n+{\n+\tunsigned int duration = frameRateInterval_.elapsed();\n+\tunsigned int frames = framesCaptured_ - previousFrames_;\n+\tdouble fps = frames * 1000.0 / duration;\n+\n+\t/* Restart counters */\n+\tframeRateInterval_.start();\n+\tpreviousFrames_ = framesCaptured_;\n+\n+\tsetWindowTitle(title_ + \" : \" + QString::number(fps, 'f', 2) + \" fps\");\n+}\n+\n int MainWindow::openCamera()\n {\n \tCameraManager *cm = CameraManager::instance();\n@@ -148,6 +165,9 @@ int MainWindow::startCapture()\n \t\trequests.push_back(request);\n \t}\n \n+\tframeRateInterval_.start();\n+\tpreviousFrames_ = 0;\n+\tframesCaptured_ = 0;\n \tlastBufferTime_ = 0;\n \n \tret = camera_->start();\n@@ -196,6 +216,8 @@ void MainWindow::requestComplete(Request *request,\n \tif (request->status() == Request::RequestCancelled)\n \t\treturn;\n \n+\tframesCaptured_++;\n+\n \tBuffer *buffer = buffers.begin()->second;\n \n \tdouble fps = buffer->timestamp() - lastBufferTime_;\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 46a494a9d783..6b3dcab6d490 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -10,7 +10,9 @@\n #include <map>\n #include <memory>\n \n+#include <QElapsedTimer>\n #include <QMainWindow>\n+#include <QObject>\n \n #include <libcamera/camera.h>\n #include <libcamera/stream.h>\n@@ -28,10 +30,15 @@ enum {\n \n class MainWindow : public QMainWindow\n {\n+\tQ_OBJECT\n+\n public:\n \tMainWindow(const OptionsParser::Options &options);\n \t~MainWindow();\n \n+public Q_SLOTS:\n+\tvoid updateTitle();\n+\n private:\n \tint openCamera();\n \n@@ -51,6 +58,10 @@ private:\n \n \tuint64_t lastBufferTime_;\n \n+\tQElapsedTimer frameRateInterval_;\n+\tuint32_t previousFrames_;\n+\tuint32_t framesCaptured_;\n+\n \tViewFinder *viewfinder_;\n };\n \ndiff --git a/src/qcam/meson.build b/src/qcam/meson.build\nindex 9f1fa75f9813..c2c4d7cc9787 100644\n--- a/src/qcam/meson.build\n+++ b/src/qcam/meson.build\n@@ -7,13 +7,22 @@ qcam_sources = files([\n 'viewfinder.cpp',\n ])\n \n-import('qt5')\n+qcam_headers = files([\n+ 'main_window.h',\n+])\n+\n+qt5 = import('qt5')\n qt5_dep = dependency('qt5',\n method : 'pkg-config',\n modules : ['Core', 'Gui', 'Widgets'],\n required : false)\n \n if qt5_dep.found()\n+ moc_files = qt5.preprocess(moc_headers: qcam_headers,\n+ dependencies: qt5_dep)\n+\n+ qcam_sources += moc_files\n+\n qcam = executable('qcam', qcam_sources,\n install : true,\n dependencies : [libcamera_dep, qt5_dep],\n", "prefixes": [ "libcamera-devel", "v2", "5/5" ] }