Patch Detail
Show a patch.
GET /api/1.1/patches/8513/?format=api
{ "id": 8513, "url": "https://patchwork.libcamera.org/api/1.1/patches/8513/?format=api", "web_url": "https://patchwork.libcamera.org/patch/8513/", "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": "<20200629163916.1815321-4-kieran.bingham@ideasonboard.com>", "date": "2020-06-29T16:39:15", "name": "[libcamera-devel,3/4] android: camera_device: Provide a toPixelFormat helper", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "fb33ec48accaa51f330b6b21b94b355fd69d550b", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/8513/mbox/", "series": [ { "id": 1060, "url": "https://patchwork.libcamera.org/api/1.1/series/1060/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1060", "date": "2020-06-29T16:39:12", "name": "Android HAL multi-stream support", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1060/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/8513/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/8513/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 4E671C2E69\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Jun 2020 16:39:26 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1771A60AFB;\n\tMon, 29 Jun 2020 18:39:26 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7DFA7609DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2020 18:39:21 +0200 (CEST)", "from Q.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net\n\t[86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1597C299;\n\tMon, 29 Jun 2020 18:39:21 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"b0QJky2h\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593448761;\n\tbh=LCQ+bda7b5ut7nTHw6bSZBz2T05n5oUAGbVR1vch/yA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=b0QJky2hrsbdKgBcQEnPj2DPMpOrTvAkHmGbmbgCD+lnoEf1C2WRuudl2R4YR+oi4\n\t0cvS6SQbkSY/GqJ0RcsqHgvLyiAcGoNLee7ojRoPKqealH60kLOnrRdENajd7vw3Mi\n\tYMMbqeY7EPFQDzERXrRTg1AnVOkJj9E+j5f/vmz8=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Date": "Mon, 29 Jun 2020 17:39:15 +0100", "Message-Id": "<20200629163916.1815321-4-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20200629163916.1815321-1-kieran.bingham@ideasonboard.com>", "References": "<20200629163916.1815321-1-kieran.bingham@ideasonboard.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH 3/4] android: camera_device: Provide a\n\ttoPixelFormat helper", "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": "Rather than converting pixelformats through the map, and then\ndereferencing the iterator later, create a helper to explicitly return a\nPixelFormat type.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/android/camera_device.cpp | 29 +++++++++++++++++++++--------\n src/android/camera_device.h | 1 +\n 2 files changed, 22 insertions(+), 8 deletions(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex f788c11e7254..a6410f42fee8 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -923,6 +923,20 @@ const camera_metadata_t *CameraDevice::constructDefaultRequestSettings(int type)\n \treturn requestTemplate->get();\n }\n \n+PixelFormat CameraDevice::toPixelFormat(int format)\n+{\n+\t/* Translate Android format code to libcamera pixel format. */\n+\tauto it = formatsMap_.find(format);\n+\tif (it == formatsMap_.end()) {\n+\t\tLOG(HAL, Error) << \"Requested format \"\n+\t\t\t\t<< utils::hex(format)\n+\t\t\t\t<< \" not supported\";\n+\t\treturn PixelFormat();\n+\t}\n+\n+\treturn it->second;\n+}\n+\n /*\n * Inspect the stream_list to produce a list of StreamConfiguration to\n * be use to configure the Camera.\n@@ -932,11 +946,14 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \tfor (unsigned int i = 0; i < stream_list->num_streams; ++i) {\n \t\tcamera3_stream_t *stream = stream_list->streams[i];\n \n+\t\tPixelFormat format = toPixelFormat(stream->format);\n+\n \t\tLOG(HAL, Info) << \"Stream #\" << i\n \t\t\t << \", direction: \" << stream->stream_type\n \t\t\t << \", width: \" << stream->width\n \t\t\t << \", height: \" << stream->height\n-\t\t\t << \", format: \" << utils::hex(stream->format);\n+\t\t\t << \", format: \" << utils::hex(stream->format)\n+\t\t\t << \" (\" << format.toString() << \")\";\n \t}\n \n \t/* Only one stream is supported. */\n@@ -947,13 +964,9 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \tcamera3_stream_t *camera3Stream = stream_list->streams[0];\n \n \t/* Translate Android format code to libcamera pixel format. */\n-\tauto it = formatsMap_.find(camera3Stream->format);\n-\tif (it == formatsMap_.end()) {\n-\t\tLOG(HAL, Error) << \"Requested format \"\n-\t\t\t\t<< utils::hex(camera3Stream->format)\n-\t\t\t\t<< \" not supported\";\n+\tPixelFormat format = toPixelFormat(camera3Stream->format);\n+\tif (!format.isValid())\n \t\treturn -EINVAL;\n-\t}\n \n \t/*\n \t * Hardcode viewfinder role, replacing the generated configuration\n@@ -969,7 +982,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \tStreamConfiguration *streamConfiguration = &config_->at(0);\n \tstreamConfiguration->size.width = camera3Stream->width;\n \tstreamConfiguration->size.height = camera3Stream->height;\n-\tstreamConfiguration->pixelFormat = it->second;\n+\tstreamConfiguration->pixelFormat = format;\n \n \tswitch (config_->validate()) {\n \tcase CameraConfiguration::Valid:\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex ed11410a5577..5bd6cf416156 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -72,6 +72,7 @@ private:\n \tstd::tuple<uint32_t, uint32_t> calculateStaticMetadataSize();\n \tvoid notifyShutter(uint32_t frameNumber, uint64_t timestamp);\n \tvoid notifyError(uint32_t frameNumber, camera3_stream_t *stream);\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 \n", "prefixes": [ "libcamera-devel", "3/4" ] }