{"id":8586,"url":"https://patchwork.libcamera.org/api/1.1/patches/8586/?format=json","web_url":"https://patchwork.libcamera.org/patch/8586/","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":"<20200703123919.2223048-7-kieran.bingham@ideasonboard.com>","date":"2020-07-03T12:39:17","name":"[libcamera-devel,v3,6/8] android: camera_device: Maintain a vector of CameraStream","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ef7591e37deddc6929b3b98197dc45ca7b3ef8c2","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/8586/mbox/","series":[{"id":1077,"url":"https://patchwork.libcamera.org/api/1.1/series/1077/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1077","date":"2020-07-03T12:39:11","name":"android: Multi-stream support","version":3,"mbox":"https://patchwork.libcamera.org/series/1077/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8586/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8586/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 78F4CC2E69\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Jul 2020 12:39:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3A10F60CBA;\n\tFri,  3 Jul 2020 14:39:30 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5948760C5F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Jul 2020 14:39:26 +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 E743F296;\n\tFri,  3 Jul 2020 14:39:25 +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=\"BGTTUla0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593779966;\n\tbh=xnbIs5VkNj6GWzGNYlUluZA8eoRrCVakgkVJxU2wTM0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=BGTTUla0dGEsidEOt+lROEl5pYId3CQuX8HXiYi4OLoCdM3aX0ib7hEXggWI+kI7L\n\tpDCwkRRRB3lbIWKejyCwwlrfq9AmhZqyGXJwJXWiBMhA14Qzobk6v7qAE1bdjgNPjI\n\tfqw2fsQ3O86on0zbg3ymIlnIyh5jWHx/zuiXozxo=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Fri,  3 Jul 2020 13:39:17 +0100","Message-Id":"<20200703123919.2223048-7-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20200703123919.2223048-1-kieran.bingham@ideasonboard.com>","References":"<20200703123919.2223048-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 6/8] android: camera_device: Maintain a\n\tvector of CameraStream","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":"Introduce a vector storing a CameraStream to track and maintain\nstate between an Android stream (camera3_stream_t) and a libcamera\nStream.\n\nOnly the index of the libcamera stream is stored, to facilitate identifying\nthe correct index for both the StreamConfiguration and Stream vectors.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/camera_device.cpp | 22 ++++++++++++++++++++--\n src/android/camera_device.h   | 10 ++++++++++\n 2 files changed, 30 insertions(+), 2 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 4e77a92dbea5..28334751a26e 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -952,6 +952,20 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\treturn -EINVAL;\n \t}\n \n+\t/*\n+\t * Clear and remove any existing configuration from previous calls, and\n+\t * ensure the required entries are available without further\n+\t * re-allcoation.\n+\t */\n+\tstreams_.clear();\n+\tstreams_.reserve(stream_list->num_streams);\n+\n+\t/*\n+\t * Track actually created streams, as there may not be a 1:1 mapping of\n+\t * camera3 streams to libcamera streams.\n+\t */\n+\tunsigned int streamIndex = 0;\n+\n \tfor (unsigned int i = 0; i < stream_list->num_streams; ++i) {\n \t\tcamera3_stream_t *stream = stream_list->streams[i];\n \n@@ -974,6 +988,9 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \t\tstreamConfiguration.pixelFormat = format;\n \n \t\tconfig_->addConfiguration(streamConfiguration);\n+\n+\t\t/* Maintain internal state of all stream mappings. */\n+\t\tstreams_[i].index = streamIndex++;\n \t}\n \n \tswitch (config_->validate()) {\n@@ -991,10 +1008,11 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n \n \tfor (unsigned int i = 0; i < stream_list->num_streams; ++i) {\n \t\tcamera3_stream_t *stream = stream_list->streams[i];\n-\t\tStreamConfiguration &streamConfiguration = config_->at(i);\n+\t\tCameraStream *cameraStream = &streams_[i];\n+\t\tStreamConfiguration &cfg = config_->at(cameraStream->index);\n \n \t\t/* Use the bufferCount confirmed by the validation process. */\n-\t\tstream->max_buffers = streamConfiguration.bufferCount;\n+\t\tstream->max_buffers = cfg.bufferCount;\n \t}\n \n \t/*\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex d7834d94f439..8e306c1f6d8b 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -25,6 +25,15 @@\n \n class CameraMetadata;\n \n+struct CameraStream {\n+\t/*\n+\t * The index represents the index for libcamera stream parameters. This\n+\t * will differ from any index of the halStream, particularly for HAL\n+\t * only streams such as MJPEG.\n+\t */\n+\tunsigned int index;\n+};\n+\n class CameraDevice : protected libcamera::Loggable\n {\n public:\n@@ -90,6 +99,7 @@ private:\n \n \tstd::vector<Camera3StreamConfiguration> streamConfigurations_;\n \tstd::map<int, libcamera::PixelFormat> formatsMap_;\n+\tstd::vector<CameraStream> streams_;\n \n \tint facing_;\n \tint orientation_;\n","prefixes":["libcamera-devel","v3","6/8"]}