Patch Detail
Show a patch.
GET /api/1.1/patches/3948/?format=api
{ "id": 3948, "url": "https://patchwork.libcamera.org/api/1.1/patches/3948/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3948/", "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": "<20200605141002.49119-5-jacopo@jmondi.org>", "date": "2020-06-05T14:09:58", "name": "[libcamera-devel,v3,4/8] android: camera_device: Translate Android format", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "ef7884e31f32ba18a4f937be98ac0254ee86fd52", "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/3948/mbox/", "series": [ { "id": 958, "url": "https://patchwork.libcamera.org/api/1.1/series/958/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=958", "date": "2020-06-05T14:09:54", "name": "android: Build stream configuration map", "version": 3, "mbox": "https://patchwork.libcamera.org/series/958/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3948/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3948/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7F7B4615F7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 5 Jun 2020 16:07:10 +0200 (CEST)", "from localhost.localdomain (93-34-118-233.ip49.fastwebnet.it\n\t[93.34.118.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id E09E420002;\n\tFri, 5 Jun 2020 14:07:09 +0000 (UTC)" ], "X-Originating-IP": "93.34.118.233", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 5 Jun 2020 16:09:58 +0200", "Message-Id": "<20200605141002.49119-5-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20200605141002.49119-1-jacopo@jmondi.org>", "References": "<20200605141002.49119-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 4/8] android: camera_device: Translate\n\tAndroid format", "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>", "X-List-Received-Date": "Fri, 05 Jun 2020 14:07:10 -0000" }, "content": "Translate the Android format code to the libcamera format code\nat stream configuration time, using the translation map built at\ncamera device initialization time.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 25 ++++++++++++++++---------\n 1 file changed, 16 insertions(+), 9 deletions(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 7e3df2503468..bbfc2464c908 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -939,12 +939,26 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\t\t << \", format: \" << utils::hex(stream->format);\n \t}\n \n-\t/* Hardcode viewfinder role, collecting sizes from the stream config. */\n+\t/* Only one stream is supported. */\n \tif (stream_list->num_streams != 1) {\n \t\tLOG(HAL, Error) << \"Only one stream supported\";\n \t\treturn -EINVAL;\n \t}\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+\t\treturn -EINVAL;\n+\t}\n \n+\t/*\n+\t * Hardcode viewfinder role, replacing the generated configuration\n+\t * parameters with the ones requested by the Android framework.\n+\t */\n \tStreamRoles roles = { StreamRole::Viewfinder };\n \tconfig_ = camera_->generateConfiguration(roles);\n \tif (!config_ || config_->empty()) {\n@@ -952,17 +966,10 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\treturn -EINVAL;\n \t}\n \n-\t/* Only one stream is supported. */\n-\tcamera3_stream_t *camera3Stream = stream_list->streams[0];\n \tStreamConfiguration *streamConfiguration = &config_->at(0);\n \tstreamConfiguration->size.width = camera3Stream->width;\n \tstreamConfiguration->size.height = camera3Stream->height;\n-\n-\t/*\n-\t * \\todo We'll need to translate from Android defined pixel format codes\n-\t * to the libcamera image format codes. For now, do not change the\n-\t * format returned from Camera::generateConfiguration().\n-\t */\n+\tstreamConfiguration->pixelFormat = it->second;\n \n \tswitch (config_->validate()) {\n \tcase CameraConfiguration::Valid:\n", "prefixes": [ "libcamera-devel", "v3", "4/8" ] }