Patch Detail
Show a patch.
GET /api/1.1/patches/9005/?format=api
{ "id": 9005, "url": "https://patchwork.libcamera.org/api/1.1/patches/9005/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9005/", "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": "<20200725144058.129388-6-jacopo@jmondi.org>", "date": "2020-07-25T14:40:57", "name": "[libcamera-devel,v2,5/6] android: camera_device: Break-out request template", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "62c3f7fabbc96277e95469c9839555cbd0b3f4be", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/9005/mbox/", "series": [ { "id": 1146, "url": "https://patchwork.libcamera.org/api/1.1/series/1146/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1146", "date": "2020-07-25T14:40:52", "name": "android: camera_device: Generate correct preview template", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1146/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9005/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9005/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 9910EBD87A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 25 Jul 2020 14:37:32 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 117016138C;\n\tSat, 25 Jul 2020 16:37:32 +0200 (CEST)", "from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 64D4A611A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 25 Jul 2020 16:37:30 +0200 (CEST)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay10.mail.gandi.net (Postfix) with ESMTPSA id BB3C9240004;\n\tSat, 25 Jul 2020 14:37:29 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 25 Jul 2020 16:40:57 +0200", "Message-Id": "<20200725144058.129388-6-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20200725144058.129388-1-jacopo@jmondi.org>", "References": "<20200725144058.129388-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2 5/6] android: camera_device: Break-out\n\trequest template", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Currently the request template returned from\nCameraDevice::constructDefaultRequestSettings() is the same for all\nthe supported template types.\n\nTo prepare to adjust the template depending on the use case, break out\nthe template generation to a dedicated function that supports the\nPREVIEW use case. All the other template types use the\nrequestTemplatePreview() function and just update the capture intent\nproperty.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 82 ++++++++++++++++++++---------------\n src/android/camera_device.h | 1 +\n 2 files changed, 47 insertions(+), 36 deletions(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 48f8090a93db..b294b88367d4 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -821,48 +821,14 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \treturn staticMetadata_->get();\n }\n \n-/*\n- * Produce a metadata pack to be used as template for a capture request.\n- */\n-const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n+CameraMetadata *CameraDevice::requestTemplatePreview()\n {\n-\tauto it = requestTemplates_.find(type);\n-\tif (it != requestTemplates_.end())\n-\t\treturn it->second->get();\n-\n-\t/* Use the capture intent matching the requested template type. */\n-\tuint8_t captureIntent;\n-\tswitch (type) {\n-\tcase CAMERA3_TEMPLATE_PREVIEW:\n-\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW;\n-\t\tbreak;\n-\tcase CAMERA3_TEMPLATE_STILL_CAPTURE:\n-\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE;\n-\t\tbreak;\n-\tcase CAMERA3_TEMPLATE_VIDEO_RECORD:\n-\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD;\n-\t\tbreak;\n-\tcase CAMERA3_TEMPLATE_VIDEO_SNAPSHOT:\n-\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT;\n-\t\tbreak;\n-\tcase CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG:\n-\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG;\n-\t\tbreak;\n-\tcase CAMERA3_TEMPLATE_MANUAL:\n-\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_MANUAL;\n-\t\tbreak;\n-\tdefault:\n-\t\tLOG(HAL, Error) << \"Invalid template request type: \" << type;\n-\t\treturn nullptr;\n-\t}\n-\n \t/*\n \t * \\todo Keep this in sync with the actual number of entries.\n \t * Currently: 12 entries, 15 bytes\n \t */\n \tCameraMetadata *requestTemplate = new CameraMetadata(15, 20);\n \tif (!requestTemplate->isValid()) {\n-\t\tLOG(HAL, Error) << \"Failed to allocate template metadata\";\n \t\tdelete requestTemplate;\n \t\treturn nullptr;\n \t}\n@@ -911,15 +877,59 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n \trequestTemplate->addEntry(ANDROID_COLOR_CORRECTION_ABERRATION_MODE,\n \t\t\t\t &aberrationMode, 1);\n \n+\tuint8_t captureIntent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW;\n \trequestTemplate->addEntry(ANDROID_CONTROL_CAPTURE_INTENT,\n \t\t\t\t &captureIntent, 1);\n \n-\tif (!requestTemplate->isValid()) {\n+\treturn requestTemplate;\n+}\n+\n+/*\n+ * Produce a metadata pack to be used as template for a capture request.\n+ */\n+const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n+{\n+\tauto it = requestTemplates_.find(type);\n+\tif (it != requestTemplates_.end())\n+\t\treturn it->second->get();\n+\n+\t/* Use the capture intent matching the requested template type. */\n+\tCameraMetadata *requestTemplate;\n+\tuint8_t captureIntent;\n+\tswitch (type) {\n+\tcase CAMERA3_TEMPLATE_PREVIEW:\n+\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW;\n+\t\tbreak;\n+\tcase CAMERA3_TEMPLATE_STILL_CAPTURE:\n+\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE;\n+\t\tbreak;\n+\tcase CAMERA3_TEMPLATE_VIDEO_RECORD:\n+\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD;\n+\t\tbreak;\n+\tcase CAMERA3_TEMPLATE_VIDEO_SNAPSHOT:\n+\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT;\n+\t\tbreak;\n+\tcase CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG:\n+\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG;\n+\t\tbreak;\n+\tcase CAMERA3_TEMPLATE_MANUAL:\n+\t\tcaptureIntent = ANDROID_CONTROL_CAPTURE_INTENT_MANUAL;\n+\t\tbreak;\n+\tdefault:\n+\t\tLOG(HAL, Error) << \"Invalid template request type: \" << type;\n+\t\treturn nullptr;\n+\t}\n+\n+\trequestTemplate = requestTemplatePreview();\n+\tif (!requestTemplate || !requestTemplate->isValid()) {\n \t\tLOG(HAL, Error) << \"Failed to construct request template\";\n \t\tdelete requestTemplate;\n \t\treturn nullptr;\n \t}\n \n+\trequestTemplate->updateEntry(ANDROID_CONTROL_CAPTURE_INTENT,\n+\t\t\t\t &captureIntent, 1);\n+\n \trequestTemplates_[type] = requestTemplate;\n \treturn requestTemplate->get();\n }\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex af1b58ab6b4e..5a52ad8f741c 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -83,6 +83,7 @@ private:\n \tlibcamera::FrameBuffer *createFrameBuffer(const buffer_handle_t camera3buffer);\n \tvoid notifyShutter(uint32_t frameNumber, uint64_t timestamp);\n \tvoid notifyError(uint32_t frameNumber, camera3_stream_t *stream);\n+\tCameraMetadata *requestTemplatePreview();\n \tlibcamera::PixelFormat toPixelFormat(int format);\n \tstd::unique_ptr<CameraMetadata> getResultMetadata(int frame_number,\n \t\t\t\t\t\t\t int64_t timestamp);\n", "prefixes": [ "libcamera-devel", "v2", "5/6" ] }