From patchwork Tue Apr 2 00:54:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 838 Return-Path: Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BDDEB610BF for ; Tue, 2 Apr 2019 02:54:33 +0200 (CEST) X-Halon-ID: e10d5c06-54e1-11e9-846a-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id e10d5c06-54e1-11e9-846a-005056917a89; Tue, 02 Apr 2019 02:54:33 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 2 Apr 2019 02:54:03 +0200 Message-Id: <20190402005406.25097-2-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190402005406.25097-1-niklas.soderlund@ragnatech.se> References: <20190402005406.25097-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/4] cam: Rename --format to --stream X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Apr 2019 00:54:34 -0000 More then format information needs to be configured for each stream to allow multiple streams to be configured. Rename the option and adapt all uses of it. There is no functional change except the rename. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/cam/main.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/cam/main.cpp b/src/cam/main.cpp index 0a248d042cfe772b..d3f1f341d44e7f98 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -28,9 +28,9 @@ enum { OptCamera = 'c', OptCapture = 'C', OptFile = 'F', - OptFormat = 'f', OptHelp = 'h', OptList = 'l', + OptStream = 's', }; void signalHandler(int signal) @@ -41,12 +41,12 @@ void signalHandler(int signal) static int parseOptions(int argc, char *argv[]) { - KeyValueParser formatKeyValue; - formatKeyValue.addOption("width", OptionInteger, "Width in pixels", + KeyValueParser streamKeyValue; + streamKeyValue.addOption("width", OptionInteger, "Width in pixels", ArgumentRequired); - formatKeyValue.addOption("height", OptionInteger, "Height in pixels", + streamKeyValue.addOption("height", OptionInteger, "Height in pixels", ArgumentRequired); - formatKeyValue.addOption("pixelformat", OptionInteger, "Pixel format", + streamKeyValue.addOption("pixelformat", OptionInteger, "Pixel format", ArgumentRequired); OptionsParser parser; @@ -60,8 +60,8 @@ static int parseOptions(int argc, char *argv[]) "The first '#' character in the file name is expanded to the frame sequence number.\n" "The default file name is 'frame-#.bin'.", "file", ArgumentOptional, "filename"); - parser.addOption(OptFormat, &formatKeyValue, - "Set format of the camera's first stream", "format"); + parser.addOption(OptStream, &streamKeyValue, + "Set configuration of the camera's streams", "stream"); parser.addOption(OptHelp, OptionNone, "Display this help message", "help"); parser.addOption(OptList, OptionNone, "List all cameras", "list"); @@ -84,18 +84,18 @@ static int prepare_camera_config(std::map *config *config = camera->streamConfiguration({ Video() }); Stream *stream = config->begin()->first; - if (options.isSet(OptFormat)) { - KeyValueParser::Options format = options[OptFormat]; + if (options.isSet(OptStream)) { + KeyValueParser::Options conf = options[OptStream]; - if (format.isSet("width")) - (*config)[stream].width = format["width"]; + if (conf.isSet("width")) + (*config)[stream].width = conf["width"]; - if (format.isSet("height")) - (*config)[stream].height = format["height"]; + if (conf.isSet("height")) + (*config)[stream].height = conf["height"]; /* TODO: Translate 4CC string to ID. */ - if (format.isSet("pixelformat")) - (*config)[stream].pixelFormat = format["pixelformat"]; + if (conf.isSet("pixelformat")) + (*config)[stream].pixelFormat = conf["pixelformat"]; } return 0;