From patchwork Wed Apr 29 19:31:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3612 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 30D9C603F5 for ; Wed, 29 Apr 2020 21:32:01 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="qcGezRVu"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B1ADB521 for ; Wed, 29 Apr 2020 21:32:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1588188720; bh=TEc/83kH+Hb/6JH/dto2IX5+tNX2WjPYscN3Gl4T1k4=; h=From:To:Subject:Date:From; b=qcGezRVuTbBEJG6Fl7kJtwcTJnV5UnsvpTOKJYhqqyyH+YAb3b0maNW7Wt9eKUW0N lpZ9Po3Dbk2ZN9jXkfpklrIyffoLWWG30RQZ4fA8ahh+8Hrve4kYC3yR3z91e/SZ4N OcgkliTdV0UCwLzkRPPezz4FD2PGsiYbPvjdKJzg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 29 Apr 2020 22:31:56 +0300 Message-Id: <20200429193156.28041-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.25.3 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] qcam: Fix logging of sequence number 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: , X-List-Received-Date: Wed, 29 Apr 2020 19:32:01 -0000 The sequence number of captured frames is logged to the console with padding to 6 characters to increase readability. The output is however incorrect, as 123 is printed as 00012300000. This is caused by the auto-space feature of QDebug, which inserts a space after every field. This doesn't play well with stream format manipulation, as it ends up padding the automatically inserted space the same way as the previous argument. This is a bug in Qt, work around it by formatting the sequence number manually. Fixes: 494da4467ddf ("qcam: Use Qt qInfo() and qWarning() logging facilities") Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/qcam/main_window.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index ed0cad417d62..d021fa9552de 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -531,8 +531,8 @@ void MainWindow::processCapture() fps = lastBufferTime_ && fps ? 1000000000.0 / fps : 0.0; lastBufferTime_ = metadata.timestamp; - qInfo() << "seq:" << qSetFieldWidth(6) << qSetPadChar('0') - << metadata.sequence << reset + qInfo().noquote() + << QString("seq: %1").arg(metadata.sequence, 6, 10, QLatin1Char('0')) << "bytesused:" << metadata.planes[0].bytesused << "timestamp:" << metadata.timestamp << "fps:" << fixed << qSetRealNumberPrecision(2) << fps;