Patch Detail
Show a patch.
GET /api/1.1/patches/2404/?format=api
{ "id": 2404, "url": "https://patchwork.libcamera.org/api/1.1/patches/2404/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2404/", "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": "<20191205204350.28196-10-jacopo@jmondi.org>", "date": "2019-12-05T20:43:49", "name": "[libcamera-devel,v2,09/10] android: camera_device: Use Camera properties for static Metadata", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "13398faa0e8b47854f2105f14f91f955c3675d42", "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/2404/mbox/", "series": [ { "id": 582, "url": "https://patchwork.libcamera.org/api/1.1/series/582/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=582", "date": "2019-12-05T20:43:40", "name": "Introduce camera properties", "version": 2, "mbox": "https://patchwork.libcamera.org/series/582/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2404/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2404/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8D8C460BCA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 5 Dec 2019 21:41:58 +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 relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 043EE1BF205;\n\tThu, 5 Dec 2019 20:41:57 +0000 (UTC)" ], "X-Originating-IP": "2.224.242.101", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 5 Dec 2019 21:43:49 +0100", "Message-Id": "<20191205204350.28196-10-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.23.0", "In-Reply-To": "<20191205204350.28196-1-jacopo@jmondi.org>", "References": "<20191205204350.28196-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 09/10] android: camera_device: Use\n\tCamera properties 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": "Thu, 05 Dec 2019 20:41:58 -0000" }, "content": "Construct two example static metadata to be reported to the Android\nframework using the properties reported by the Camera.\n\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 065e0292e186..e01c7fb2e541 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@@ -97,6 +100,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@@ -261,9 +266,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 * Android reports orientation as clockwise correction, while libcamera\n+\t * uses counter-clockwise.\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 = (360 - properties.get(properties::Rotation))\n+\t\t\t % 360;\n+\tstaticMetadata_->addEntry(ANDROID_SENSOR_ORIENTATION, &orientation, 1);\n \n \tstd::vector<int32_t> testPatterModes = {\n \t\tANDROID_SENSOR_TEST_PATTERN_MODE_OFF,\n@@ -310,6 +321,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 CAMERA_LOCATION_FRONT:\n+\t\t\tlensFacing = ANDROID_LENS_FACING_FRONT;\n+\t\t\tbreak;\n+\t\tcase CAMERA_LOCATION_BACK:\n+\t\t\tlensFacing = ANDROID_LENS_FACING_BACK;\n+\t\t\tbreak;\n+\t\tcase CAMERA_LOCATION_EXTERNAL:\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", "v2", "09/10" ] }