From patchwork Tue Nov 24 17:43:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10490 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 929CABE176 for ; Tue, 24 Nov 2020 17:43:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DEC206340C; Tue, 24 Nov 2020 18:43:55 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="h/nCrFBt"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 46C8963401 for ; Tue, 24 Nov 2020 18:43:54 +0100 (CET) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CC9EC183D for ; Tue, 24 Nov 2020 18:43:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1606239834; bh=VE3C23kaENsrNnAovS4lzJG90QyerAxPRn6mGuKsPro=; h=From:To:Subject:Date:In-Reply-To:References:From; b=h/nCrFBtsQUKU7I+xPHC9w7hfA27ROgVRxFYjO3enIX3YlPOe/UbIFa6n5fViD18U omBfpvy3kmc4GWQpy5BQ3De7R5yZrsP6LdVBzKq63Q1MTqdmPqDCDzh61FV2d2qyUv xtrbsOoP1nMl6RR7z87wRxCZAa04bv8jSfyj1hUY= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 24 Nov 2020 19:43:40 +0200 Message-Id: <20201124174342.19587-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201124174342.19587-1-laurent.pinchart@ideasonboard.com> References: <20201124174342.19587-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] Documentation: Fix doxygen warning X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Recent doxygen versions don't appreciate unquoted PROJECT_NUMBER values that contain spaces. Fix this by quoting the string. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- Documentation/Doxyfile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in index 87959e23ce28..4bbacc464a5e 100644 --- a/Documentation/Doxyfile.in +++ b/Documentation/Doxyfile.in @@ -39,7 +39,7 @@ PROJECT_NAME = "libcamera" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = @VERSION@ +PROJECT_NUMBER = "@VERSION@" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From patchwork Tue Nov 24 17:43:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10491 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 18183BE176 for ; Tue, 24 Nov 2020 17:43:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B8BE36340E; Tue, 24 Nov 2020 18:43:56 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="on8TJwEc"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9FBEE63401 for ; Tue, 24 Nov 2020 18:43:54 +0100 (CET) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2ECB5A19 for ; Tue, 24 Nov 2020 18:43:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1606239834; bh=v46SoKQPo0NIBMP8CW9YEJjMv3eQzmtT8kBdtdgrh/8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=on8TJwEctZQgu9Y+u6un+tK+lrR9CaHVyQ/8fZVhn4Zpa/j6PlroRly2C6bBTnFW/ YR8qFMSIhji1D6mZvFJET2SnSx+3hIg9xe7Iwr3jB1QVVGPYh6gnaWC4DdLAPjRKSG Vu9n+3Wlvbq57QPEOJsBBnJ9/s0gY8M6Cc4nNEfU= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 24 Nov 2020 19:43:41 +0200 Message-Id: <20201124174342.19587-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201124174342.19587-1-laurent.pinchart@ideasonboard.com> References: <20201124174342.19587-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/3] qcam: main: Fix comment incorrectly referring to the cam application X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The top file description comment was incorrectly copied from the cam application. Fix it. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/qcam/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp index f60d3cef0ecb..5505a5d88ef6 100644 --- a/src/qcam/main.cpp +++ b/src/qcam/main.cpp @@ -2,7 +2,7 @@ /* * Copyright (C) 2019, Google Inc. * - * main.cpp - cam - The libcamera swiss army knife + * main.cpp - qcam - The libcamera GUI test application */ #include From patchwork Tue Nov 24 17:43:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10492 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id B5C4CBE176 for ; Tue, 24 Nov 2020 17:43:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8391663406; Tue, 24 Nov 2020 18:43:58 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="mRfZnKi3"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EA02763401 for ; Tue, 24 Nov 2020 18:43:54 +0100 (CET) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8A446183D for ; Tue, 24 Nov 2020 18:43:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1606239834; bh=ITJjNxAMP1497s7O7f8PabXr5v0n8HehKBvdz27narY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mRfZnKi3zVah7rV6D2X/awlWFOdhw8h0SuuvuJU/ObPK48t0DkKZqbXZUDzxAs6+W 4zqXm7aPKb3ExHEmhgJGGkAHJz3vI2KW7c0tk9bEx0r9fZ99pNUt4Zi5BjcG52MAMq TE7noLLD/95fyPlz9LROTVztw6xjeOQi9u/9POZs= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 24 Nov 2020 19:43:42 +0200 Message-Id: <20201124174342.19587-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201124174342.19587-1-laurent.pinchart@ideasonboard.com> References: <20201124174342.19587-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/3] qcam: Make log less verbose by default X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The qcam log prints one message per frame, which is pretty verbose. This feature is useful for debugging, but not necessarily as a default option. Silence it by default, and add a -v/--verbose command line parameter to make the log verbose. While this could have been handled manually by checking a verbose flag when printing the message, the feature is instead integrated with the Qt log infrastructure to make it more flexible. Messages printed by qDebug() are now silenced by default and controlled by the -v/--verbose argument. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/qcam/main.cpp | 5 +++++ src/qcam/main_window.cpp | 2 +- src/qcam/main_window.h | 2 ++ src/qcam/meson.build | 1 + src/qcam/message_handler.cpp | 27 +++++++++++++++++++++++++++ src/qcam/message_handler.h | 26 ++++++++++++++++++++++++++ 6 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/qcam/message_handler.cpp create mode 100644 src/qcam/message_handler.h diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp index 5505a5d88ef6..5eff90a3fa66 100644 --- a/src/qcam/main.cpp +++ b/src/qcam/main.cpp @@ -16,6 +16,7 @@ #include "../cam/options.h" #include "../cam/stream_options.h" #include "main_window.h" +#include "message_handler.h" void signalHandler([[maybe_unused]] int signal) { @@ -38,6 +39,8 @@ OptionsParser::Options parseOptions(int argc, char *argv[]) "renderer", ArgumentRequired, "renderer"); parser.addOption(OptStream, &streamKeyValue, "Set configuration of a camera stream", "stream", true); + parser.addOption(OptVerbose, OptionNone, + "Print verbose log messages", "verbose"); OptionsParser::Options options = parser.parse(argc, argv); if (options.isSet(OptHelp)) @@ -57,6 +60,8 @@ int main(int argc, char **argv) if (options.isSet(OptHelp)) return 0; + MessageHandler msgHandler(options.isSet(OptVerbose)); + struct sigaction sa = {}; sa.sa_handler = &signalHandler; sigaction(SIGINT, &sa, nullptr); diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 2502ecd40abe..39d034de6bb2 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -746,7 +746,7 @@ void MainWindow::processViewfinder(FrameBuffer *buffer) fps = lastBufferTime_ && fps ? 1000000000.0 / fps : 0.0; lastBufferTime_ = metadata.timestamp; - qInfo().noquote() + qDebug().noquote() << QString("seq: %1").arg(metadata.sequence, 6, 10, QLatin1Char('0')) << "bytesused:" << metadata.planes[0].bytesused << "timestamp:" << metadata.timestamp diff --git a/src/qcam/main_window.h b/src/qcam/main_window.h index 64bcfebc7dbd..a9aa8ffcd8fd 100644 --- a/src/qcam/main_window.h +++ b/src/qcam/main_window.h @@ -41,6 +41,7 @@ enum { OptHelp = 'h', OptRenderer = 'r', OptStream = 's', + OptVerbose = 'v', }; class MainWindow : public QMainWindow @@ -98,6 +99,7 @@ private: /* Options */ const OptionsParser::Options &options_; + bool verbose_; /* Camera manager, camera, configuration and buffers */ CameraManager *cm_; diff --git a/src/qcam/meson.build b/src/qcam/meson.build index 9bb48c0d06c5..ebcd5ca010cf 100644 --- a/src/qcam/meson.build +++ b/src/qcam/meson.build @@ -6,6 +6,7 @@ qcam_sources = files([ 'format_converter.cpp', 'main.cpp', 'main_window.cpp', + 'message_handler.cpp', 'viewfinder_qt.cpp', ]) diff --git a/src/qcam/message_handler.cpp b/src/qcam/message_handler.cpp new file mode 100644 index 000000000000..261623e19ca9 --- /dev/null +++ b/src/qcam/message_handler.cpp @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2020, Laurent Pinchart + * + * message_handler.cpp - qcam - Log message handling + */ + +#include "message_handler.h" + +QtMessageHandler MessageHandler::handler_ = nullptr; +bool MessageHandler::verbose_ = false; + +MessageHandler::MessageHandler(bool verbose) +{ + verbose_ = verbose; + handler_ = qInstallMessageHandler(&MessageHandler::handleMessage); +} + +void MessageHandler::handleMessage(QtMsgType type, + const QMessageLogContext &context, + const QString &msg) +{ + if (type == QtDebugMsg && !verbose_) + return; + + handler_(type, context, msg); +} diff --git a/src/qcam/message_handler.h b/src/qcam/message_handler.h new file mode 100644 index 000000000000..4534db9d93f7 --- /dev/null +++ b/src/qcam/message_handler.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2020, Laurent Pinchart + * + * message_handler.cpp - qcam - Log message handling + */ +#ifndef __QCAM_MESSAGE_HANDLER_H__ +#define __QCAM_MESSAGE_HANDLER_H__ + +#include + +class MessageHandler +{ +public: + MessageHandler(bool verbose); + +private: + static void handleMessage(QtMsgType type, + const QMessageLogContext &context, + const QString &msg); + + static QtMessageHandler handler_; + static bool verbose_; +}; + +#endif /* __QCAM_MESSAGE_HANDLER_H__ */