From patchwork Fri Dec 6 16:07:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 22234 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 E9EDBBE173 for ; Fri, 6 Dec 2024 16:08:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F1CED67E30; Fri, 6 Dec 2024 17:08:08 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JP+oIAMH"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 18E9F67E29 for ; Fri, 6 Dec 2024 17:07:58 +0100 (CET) Received: from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 633D1B2B; Fri, 6 Dec 2024 17:07:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733501248; bh=IpztqRtWVNDKpC+2Hj1pd4wRUpF3AsCDrijqdSYA3X0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JP+oIAMHh3GLvU4UkZunLxuyMg2Dl/nmj+0sCPjOgNXDUlJn1NhB5PzarJgJHNHgp 74cZDBN/S2K0ZJG465P5ikjqid+jeBupON8Go6G6B6aBdJfpH1SlvNsr4rFRd9brTG 32xGdt3HVva/K6A27/UEcp3YlY32KRNd3NoKCYIU= From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi , Harvey Yang , Han-Lin Chen Subject: [PATCH 8/8] [DNI] apps: cam: Use Camera::metadataAvailable signal Date: Fri, 6 Dec 2024 17:07:46 +0100 Message-ID: <20241206160747.97176-9-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241206160747.97176-1-jacopo.mondi@ideasonboard.com> References: <20241206160747.97176-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 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" Handle the Camera::metadataAvailable signal and print the metadata list. Use the --metadata option of cam to validate that the metadata list in Request::metadata() matches the accumulated results. Signed-off-by: Jacopo Mondi --- src/apps/cam/camera_session.cpp | 17 +++++++++++++++++ src/apps/cam/camera_session.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp index 6e9890ccfda1..422874ae74ea 100644 --- a/src/apps/cam/camera_session.cpp +++ b/src/apps/cam/camera_session.cpp @@ -246,6 +246,7 @@ int CameraSession::start() + "-stream" + std::to_string(index); } + camera_->metadataAvailable.connect(this, &CameraSession::metadataAvailable); camera_->requestCompleted.connect(this, &CameraSession::requestComplete); #ifdef HAVE_KMS @@ -407,6 +408,22 @@ int CameraSession::queueRequest(Request *request) return camera_->queueRequest(request); } +void CameraSession::metadataAvailable(Request *request, + std::unordered_set ids) +{ + const ControlList &metadata = request->metadata(); + + std::cerr << "EARLY METADATA COMPLETION FOR REQUEST: " + << request->sequence() << std::endl; + + for (const auto id : ids) { + const ControlValue &value = metadata.get(id->id()); + + std::cout << "\t" << id->name() << " = " + << value.toString() << std::endl; + } +} + void CameraSession::requestComplete(Request *request) { if (request->status() == Request::RequestCancelled) diff --git a/src/apps/cam/camera_session.h b/src/apps/cam/camera_session.h index 4442fd9b1a6a..0539f759a65a 100644 --- a/src/apps/cam/camera_session.h +++ b/src/apps/cam/camera_session.h @@ -53,6 +53,8 @@ private: int startCapture(); int queueRequest(libcamera::Request *request); + void metadataAvailable(libcamera::Request *request, + std::unordered_set ids); void requestComplete(libcamera::Request *request); void processRequest(libcamera::Request *request); void sinkRelease(libcamera::Request *request);