{"id":3865,"url":"https://patchwork.libcamera.org/api/1.1/patches/3865/?format=json","web_url":"https://patchwork.libcamera.org/patch/3865/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200526142237.407557-7-jacopo@jmondi.org>","date":"2020-05-26T14:22:35","name":"[libcamera-devel,6/8] android: camera_manager: Replace hardcoded stream configuration","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"d7c9b96ad20177348da502718e133b9892b30f15","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":{"id":15,"url":"https://patchwork.libcamera.org/api/1.1/users/15/?format=json","username":"jmondi","first_name":"Jacopo","last_name":"Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/patch/3865/mbox/","series":[{"id":930,"url":"https://patchwork.libcamera.org/api/1.1/series/930/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=930","date":"2020-05-26T14:22:29","name":"android: Implament format translation","version":1,"mbox":"https://patchwork.libcamera.org/series/930/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3865/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3865/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[217.70.183.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3168D60E08\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 May 2020 16:19:28 +0200 (CEST)","from localhost.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay2-d.mail.gandi.net (Postfix) with ESMTPSA id B7C684000B;\n\tTue, 26 May 2020 14:19:27 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 26 May 2020 16:22:35 +0200","Message-Id":"<20200526142237.407557-7-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.26.2","In-Reply-To":"<20200526142237.407557-1-jacopo@jmondi.org>","References":"<20200526142237.407557-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 6/8] android: camera_manager: Replace\n\thardcoded stream configuration","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":"Tue, 26 May 2020 14:19:28 -0000"},"content":"Replace the hardcoded stream configuration map with the information\ncollected at CameraDevice initialization time.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_device.cpp | 38 ++++++++++++++++++-----------------\n 1 file changed, 20 insertions(+), 18 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 6cc377820210..f8a52342abe5 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -623,23 +623,22 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \tstaticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM,\n \t\t\t\t  &maxDigitalZoom, 1);\n \n-\tstd::vector<uint32_t> availableStreamFormats = {\n-\t\tANDROID_SCALER_AVAILABLE_FORMATS_BLOB,\n-\t\tANDROID_SCALER_AVAILABLE_FORMATS_YCbCr_420_888,\n-\t\tANDROID_SCALER_AVAILABLE_FORMATS_IMPLEMENTATION_DEFINED,\n-\t};\n+\tstd::vector<uint32_t> availableStreamFormats;\n+\tfor (const auto &entry : streamConfigurations_)\n+\t\tavailableStreamFormats.push_back(entry.androidScalerCode);\n \tstaticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_FORMATS,\n \t\t\t\t  availableStreamFormats.data(),\n \t\t\t\t  availableStreamFormats.size());\n \n-\tstd::vector<uint32_t> availableStreamConfigurations = {\n-\t\tANDROID_SCALER_AVAILABLE_FORMATS_BLOB, 2560, 1920,\n-\t\tANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT,\n-\t\tANDROID_SCALER_AVAILABLE_FORMATS_YCbCr_420_888, 2560, 1920,\n-\t\tANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT,\n-\t\tANDROID_SCALER_AVAILABLE_FORMATS_IMPLEMENTATION_DEFINED, 2560, 1920,\n-\t\tANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT,\n-\t};\n+\tstd::vector<uint32_t> availableStreamConfigurations;\n+\tfor (const auto &entry : streamConfigurations_) {\n+\t\tavailableStreamConfigurations.push_back(entry.androidScalerCode);\n+\t\tavailableStreamConfigurations.push_back(entry.resolution.width);\n+\t\tavailableStreamConfigurations.push_back(entry.resolution.height);\n+\t\tavailableStreamConfigurations.push_back(entry.input ?\n+\t\t\tANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT :\n+\t\t\tANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT);\n+\t}\n \tstaticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS,\n \t\t\t\t  availableStreamConfigurations.data(),\n \t\t\t\t  availableStreamConfigurations.size());\n@@ -651,11 +650,14 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n \t\t\t\t  availableStallDurations.data(),\n \t\t\t\t  availableStallDurations.size());\n \n-\tstd::vector<int64_t> minFrameDurations = {\n-\t\tANDROID_SCALER_AVAILABLE_FORMATS_BLOB, 2560, 1920, 33333333,\n-\t\tANDROID_SCALER_AVAILABLE_FORMATS_IMPLEMENTATION_DEFINED, 2560, 1920, 33333333,\n-\t\tANDROID_SCALER_AVAILABLE_FORMATS_YCbCr_420_888, 2560, 1920, 33333333,\n-\t};\n+\t/* \\todo Collect the minimum frame duration from the camera. */\n+\tstd::vector<int64_t> minFrameDurations;\n+\tfor (const auto &entry : streamConfigurations_) {\n+\t\tminFrameDurations.push_back(entry.androidScalerCode);\n+\t\tminFrameDurations.push_back(entry.resolution.width);\n+\t\tminFrameDurations.push_back(entry.resolution.height);\n+\t\tminFrameDurations.push_back(33333333);\n+\t}\n \tstaticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS,\n \t\t\t\t  minFrameDurations.data(),\n \t\t\t\t  minFrameDurations.size());\n","prefixes":["libcamera-devel","6/8"]}