{"id":777,"url":"https://patchwork.libcamera.org/api/patches/777/?format=json","web_url":"https://patchwork.libcamera.org/patch/777/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20190320163055.22056-32-jacopo@jmondi.org>","date":"2019-03-20T16:30:55","name":"[libcamera-devel,v4,31/31] HACK: cam: Add options to select the stream to use","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"6fafcffd972cc12f63bd946758eb1a721e4a888d","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/777/mbox/","series":[{"id":214,"url":"https://patchwork.libcamera.org/api/series/214/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=214","date":"2019-03-20T16:30:24","name":"libcamera: ipu3: Add ImgU support + multiple streams","version":4,"mbox":"https://patchwork.libcamera.org/series/214/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/777/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/777/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 95AC4611A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Mar 2019 17:30:47 +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 relay12.mail.gandi.net (Postfix) with ESMTPSA id 2E3A9200003;\n\tWed, 20 Mar 2019 16:30:47 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 20 Mar 2019 17:30:55 +0100","Message-Id":"<20190320163055.22056-32-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190320163055.22056-1-jacopo@jmondi.org>","References":"<20190320163055.22056-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 31/31] HACK: cam: Add options to select\n\tthe stream to use","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Wed, 20 Mar 2019 16:30:47 -0000"},"content":"Add -o and -v options switches to the cam application to select which\nstreams to capture from.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/cam/main.cpp | 20 ++++++++++++++++----\n 1 file changed, 16 insertions(+), 4 deletions(-)","diff":"diff --git a/src/cam/main.cpp b/src/cam/main.cpp\nindex 28ea0b7d76b2..8c5d55d11bbe 100644\n--- a/src/cam/main.cpp\n+++ b/src/cam/main.cpp\n@@ -31,6 +31,8 @@ enum {\n \tOptFormat = 'f',\n \tOptHelp = 'h',\n \tOptList = 'l',\n+\tOptOutput = 'o',\n+\tOptViefinder = 'v',\n };\n \n void signalHandler(int signal)\n@@ -65,6 +67,12 @@ static int parseOptions(int argc, char *argv[])\n \tparser.addOption(OptHelp, OptionNone, \"Display this help message\",\n \t\t\t \"help\");\n \tparser.addOption(OptList, OptionNone, \"List all cameras\", \"list\");\n+\tparser.addOption(OptOutput, OptionNone, \"Use output stream\\n\"\n+\t\t\t \"If no '-o' or '-v' options are specified, use viewfinder stream only\",\n+\t\t\t \"list\");\n+\tparser.addOption(OptViefinder, OptionNone, \"Use viewfinder stream\\n\"\n+\t\t\t \"If no '-o' or '-v' options are specified, use viewfinder stream only\",\n+\t\t\t \"list\");\n \n \toptions = parser.parse(argc, argv);\n \tif (!options.valid() || options.isSet(OptHelp)) {\n@@ -103,11 +111,15 @@ static int configureStreams(Camera *camera, std::set<Stream *> &streams,\n \tdefaultConfig[viewfinder].height = 480;\n \n \t/*\n-\t * HACK: add output/viewfinder to 'config'\n-\t * to play with stream combinations.\n+\t * HACK: Select which stream to capture: use output if required,\n+\t * use viewfinder if required or if no option has been specified\n+\t * from the command line.\n \t */\n-\tconfig[output] = defaultConfig[output];\n-\tconfig[viewfinder] = defaultConfig[viewfinder];\n+\tif (options.isSet(OptOutput))\n+\t\tconfig[output] = defaultConfig[output];\n+\tif (options.isSet(OptViefinder) ||\n+\t    (!options.isSet(OptViefinder) && !options.isSet(OptOutput)))\n+\t\tconfig[viewfinder] = defaultConfig[viewfinder];\n \n \treturn camera->configureStreams(config);\n }\n","prefixes":["libcamera-devel","v4","31/31"]}