Patch Detail
Show a patch.
GET /api/patches/2624/?format=api
{ "id": 2624, "url": "https://patchwork.libcamera.org/api/patches/2624/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2624/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20200113164245.52535-10-jacopo@jmondi.org>", "date": "2020-01-13T16:42:31", "name": "[libcamera-devel,09/23] android: camera_device: Use Camera properties for static Metadata", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "ed965a8d19e5232bbf9de9a2fe9aa9a18c1f78b5", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2624/mbox/", "series": [ { "id": 618, "url": "https://patchwork.libcamera.org/api/series/618/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=618", "date": "2020-01-13T16:42:22", "name": "Properties and compound controls", "version": 1, "mbox": "https://patchwork.libcamera.org/series/618/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2624/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2624/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DEB97606BD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Jan 2020 17:40:31 +0100 (CET)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 06C6F100004;\n\tMon, 13 Jan 2020 16:40:30 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 13 Jan 2020 17:42:31 +0100", "Message-Id": "<20200113164245.52535-10-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.24.0", "In-Reply-To": "<20200113164245.52535-1-jacopo@jmondi.org>", "References": "<20200113164245.52535-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 09/23] android: camera_device: Use Camera\n\tproperties for static Metadata", "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": "Mon, 13 Jan 2020 16:40:32 -0000" }, "content": "Construct two example static metadata to be reported to the Android\nframework using the properties reported by the Camera.\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 29 +++++++++++++++++++++++++++--\n 1 file changed, 27 insertions(+), 2 deletions(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex a98fd744f534..ea35dd685d3d 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -7,6 +7,9 @@\n \n #include \"camera_device.h\"\n \n+#include <libcamera/controls.h>\n+#include <libcamera/property_ids.h>\n+\n #include \"log.h\"\n #include \"utils.h\"\n \n@@ -95,6 +98,8 @@ camera_metadata_t *CameraDevice::getStaticMetadata()\n \tif (staticMetadata_)\n \t\treturn staticMetadata_->get();\n \n+\tconst ControlList &properties = camera_->properties();\n+\n \t/*\n \t * The here reported metadata are enough to implement a basic capture\n \t * example application, but a real camera implementation will require\n@@ -259,9 +264,15 @@ camera_metadata_t *CameraDevice::getStaticMetadata()\n \tstaticMetadata_->addEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,\n \t\t\t\t &exposureTimeRange, 2);\n \n+\t/*\n+\t * The Android orientation metadata and libcamera rotation property are\n+\t * defined differently but have identical numerical values for Android\n+\t * devices such as phones and tablets.\n+\t */\n \tint32_t orientation = 0;\n-\tstaticMetadata_->addEntry(ANDROID_SENSOR_ORIENTATION,\n-\t\t\t\t &orientation, 1);\n+\tif (properties.contains(properties::Rotation))\n+\t\torientation = properties.get(properties::Rotation);\n+\tstaticMetadata_->addEntry(ANDROID_SENSOR_ORIENTATION, &orientation, 1);\n \n \tstd::vector<int32_t> testPatterModes = {\n \t\tANDROID_SENSOR_TEST_PATTERN_MODE_OFF,\n@@ -308,6 +319,20 @@ camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\t\t\t lensApertures.size());\n \n \tuint8_t lensFacing = ANDROID_LENS_FACING_FRONT;\n+\tif (properties.contains(properties::Location)) {\n+\t\tint32_t location = properties.get(properties::Location);\n+\t\tswitch (location) {\n+\t\tcase properties::CameraLocationFront:\n+\t\t\tlensFacing = ANDROID_LENS_FACING_FRONT;\n+\t\t\tbreak;\n+\t\tcase properties::CameraLocationBack:\n+\t\t\tlensFacing = ANDROID_LENS_FACING_BACK;\n+\t\t\tbreak;\n+\t\tcase properties::CameraLocationExternal:\n+\t\t\tlensFacing = ANDROID_LENS_FACING_EXTERNAL;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n \tstaticMetadata_->addEntry(ANDROID_LENS_FACING, &lensFacing, 1);\n \n \tstd::vector<float> lensFocalLenghts = {\n", "prefixes": [ "libcamera-devel", "09/23" ] }