{"id":12983,"url":"https://patchwork.libcamera.org/api/1.1/patches/12983/?format=json","web_url":"https://patchwork.libcamera.org/patch/12983/","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":"<20210715211459.19373-13-laurent.pinchart@ideasonboard.com>","date":"2021-07-15T21:14:38","name":"[libcamera-devel,v3,12/33] cam: stream_options: Use OptionValue::empty() to test if option is set","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"80d67222f5b5b47fdd0cbdd7329b3e5c2da0d212","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12983/mbox/","series":[{"id":2242,"url":"https://patchwork.libcamera.org/api/1.1/series/2242/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2242","date":"2021-07-15T21:14:26","name":"Multi-camera support in the cam application","version":3,"mbox":"https://patchwork.libcamera.org/series/2242/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12983/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12983/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 7D56DC3226\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 Jul 2021 21:15:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F0F206854A;\n\tThu, 15 Jul 2021 23:15:17 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 929E868539\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 Jul 2021 23:15:08 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 282BC340\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 Jul 2021 23:15:08 +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=\"hihWU3iS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1626383708;\n\tbh=Vkh0ETeAXWiugU82j7iAZryFOaWpBSN7HlI/fPLcuZY=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=hihWU3iSMu4lb2rllS2ccSwXot8EBty6/iBRlxQd6mKXQjgmM9HrvqI78Zv2OX5U2\n\tVCLIIR/FGVJ8Bn2mcQ1IFi85ffSENKXUn+AJ7QU2ETtOPJdnX9GWkZhgbjTsYDbfj9\n\tOmb6eVVxbmexAySukcCp2HsuxV5KFBlilBFhKTD0=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 16 Jul 2021 00:14:38 +0300","Message-Id":"<20210715211459.19373-13-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210715211459.19373-1-laurent.pinchart@ideasonboard.com>","References":"<20210715211459.19373-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 12/33] cam: stream_options: Use\n\tOptionValue::empty() to test if option is set","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The roles() and updateConfiguration() functions check if the OptStream\nOptionValue they receive is empty by first casting it to an array. To\nprepare for the toArray() function not allowing such a cast when the\noption value is empty, test if the option value is empty instead.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/cam/stream_options.cpp | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)","diff":"diff --git a/src/cam/stream_options.cpp b/src/cam/stream_options.cpp\nindex b90dbb97f087..150bd27caecf 100644\n--- a/src/cam/stream_options.cpp\n+++ b/src/cam/stream_options.cpp\n@@ -40,12 +40,12 @@ KeyValueParser::Options StreamKeyValueParser::parse(const char *arguments)\n \n StreamRoles StreamKeyValueParser::roles(const OptionValue &values)\n {\n-\tconst std::vector<OptionValue> &streamParameters = values.toArray();\n-\n \t/* If no configuration values to examine default to viewfinder. */\n-\tif (streamParameters.empty())\n+\tif (values.empty())\n \t\treturn { StreamRole::Viewfinder };\n \n+\tconst std::vector<OptionValue> &streamParameters = values.toArray();\n+\n \tStreamRoles roles;\n \tfor (auto const &value : streamParameters) {\n \t\tStreamRole role;\n@@ -63,17 +63,17 @@ StreamRoles StreamKeyValueParser::roles(const OptionValue &values)\n int StreamKeyValueParser::updateConfiguration(CameraConfiguration *config,\n \t\t\t\t\t      const OptionValue &values)\n {\n-\tconst std::vector<OptionValue> &streamParameters = values.toArray();\n-\n \tif (!config) {\n \t\tstd::cerr << \"No configuration provided\" << std::endl;\n \t\treturn -EINVAL;\n \t}\n \n \t/* If no configuration values nothing to do. */\n-\tif (!streamParameters.size())\n+\tif (values.empty())\n \t\treturn 0;\n \n+\tconst std::vector<OptionValue> &streamParameters = values.toArray();\n+\n \tif (config->size() != streamParameters.size()) {\n \t\tstd::cerr\n \t\t\t<< \"Number of streams in configuration \"\n","prefixes":["libcamera-devel","v3","12/33"]}