From patchwork Mon Apr 26 10:57:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12113 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 3041FBDC9D for ; Mon, 26 Apr 2021 10:58:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7A9E1688AF; Mon, 26 Apr 2021 12:58:02 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="RBXVP4wi"; dkim-atps=neutral Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 746E7605BE for ; Mon, 26 Apr 2021 12:58:01 +0200 (CEST) Received: by mail-pl1-x634.google.com with SMTP id o16so15119901plg.5 for ; Mon, 26 Apr 2021 03:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=veNgScwQta2wX7hwbCdzl/M6SS4IJSslKbeysj0Cd0E=; b=RBXVP4wiP5YZJ7xYGCAxYNzK3s5KlcjySs2XC3ikwmhtA95L+J0NGJKJwDZMnkWsL3 kyDsA5vnMEs5KeoPjD92U9igSsAapwKMlqaHCbOjJb+UzHHNKa+lQSK8rNx8EZPu4jUi 3sCaLD4UDAxaDk4UTIf+WI4KTc7ILIY4i06mw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=veNgScwQta2wX7hwbCdzl/M6SS4IJSslKbeysj0Cd0E=; b=LTQlzl/na4BeEaTcHCHFhZkO8ViT+nMoG94F70Q1y9he3ny16MDolwdn382UPBMRmb ioePhUhyWDz6nORPtCk7SFokY1+eKHeMOJYpC4r0K5GSSfLIwHUKQ8OdzE5+gOo6VbJv FMY23VgOpctGwn8DK306GZZxKLfKD8EYuzm3C/scrc6d8ZNWMAyAp81cZZKFO85Ply2L xbfpMnP8exBy2/t4HyAZNvay8T0bjmXl4DLDQvKDvViNRcGBXdVFxhXy47FLJ2AVeBfc 7qgafpG+uFhVcfFwy2IrrkLYadApdsJFJFAbLCQfsDdIyuueF8L+HwxET4KEAj2+6CIF 6u6Q== X-Gm-Message-State: AOAM531C1CqUVCrvYK6teyI9NTE+dCU+rqI6udbmxLs7LtZMJuxiZV1S caO7QX7ihbYrelPqeprtIkyk+tTOLklIvw== X-Google-Smtp-Source: ABdhPJzEdBDmGTA9iR/cIa50JZYyVIpo733jk7Nx4w/liDT3oHrvovcx0NKZdMdud4oiwue5lgozxA== X-Received: by 2002:a17:90b:4a46:: with SMTP id lb6mr22177015pjb.45.1619434679457; Mon, 26 Apr 2021 03:57:59 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:a407:b8c2:d8b:a449]) by smtp.gmail.com with ESMTPSA id ms8sm11763564pjb.57.2021.04.26.03.57.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 03:57:58 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Mon, 26 Apr 2021 19:57:53 +0900 Message-Id: <20210426105753.3498691-1-hiroh@chromium.org> X-Mailer: git-send-email 2.31.1.498.g6c1eba8ee3d-goog MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] android: CameraDevice: factorize reporting a capture result 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" This factorizes a code of reporting a capture result including notifying either shutter or error. It will be useful to report capture results in other places than CameraDevice::reqeustComplete(). Signed-off-by: Hirokazu Honda --- src/android/camera_device.cpp | 22 +++++++++++++++------- src/android/camera_device.h | 4 ++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index fb89195e..70174a2b 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -2132,7 +2132,20 @@ void CameraDevice::requestComplete(Request *request) cameraStream->putBuffer(src); } - /* Prepare to call back the Android camera stack. */ + reportDescriptor(descriptor, status, timestamp, + resultMetadata ? resultMetadata->get() : nullptr); +} + +std::string CameraDevice::logPrefix() const +{ + return "'" + camera_->id() + "'"; +} + +void CameraDevice::reportDescriptor(Camera3RequestDescriptor &descriptor, + camera3_buffer_status status, + uint64_t timestamp, + camera_metadata_t *metadata) +{ camera3_capture_result_t captureResult = {}; captureResult.frame_number = descriptor.frameNumber_; captureResult.num_output_buffers = descriptor.buffers_.size(); @@ -2147,7 +2160,7 @@ void CameraDevice::requestComplete(Request *request) notifyShutter(descriptor.frameNumber_, timestamp); captureResult.partial_result = 1; - captureResult.result = resultMetadata->get(); + captureResult.result = metadata; } if (status == CAMERA3_BUFFER_STATUS_ERROR || !captureResult.result) { @@ -2164,11 +2177,6 @@ void CameraDevice::requestComplete(Request *request) callbacks_->process_capture_result(callbacks_, &captureResult); } -std::string CameraDevice::logPrefix() const -{ - return "'" + camera_->id() + "'"; -} - void CameraDevice::notifyShutter(uint32_t frameNumber, uint64_t timestamp) { camera3_notify_msg_t notify = {}; diff --git a/src/android/camera_device.h b/src/android/camera_device.h index fa652c3c..a42b8dc0 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -101,6 +101,10 @@ private: std::tuple calculateStaticMetadataSize(); libcamera::FrameBuffer *createFrameBuffer(const buffer_handle_t camera3buffer); + void reportDescriptor(Camera3RequestDescriptor &descriptor, + camera3_buffer_status status, + uint64_t timestamp = 0, + camera_metadata_t *metadata = nullptr); void notifyShutter(uint32_t frameNumber, uint64_t timestamp); void notifyError(uint32_t frameNumber, camera3_stream_t *stream); std::unique_ptr requestTemplatePreview();