summaryrefslogtreecommitdiff
path: root/src/qcam/main.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-04-27 23:51:44 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-05-01 12:24:07 +0200
commitd29c32135709b18f430b75b8f9fc2592a5915149 (patch)
tree1262532a102f9e596afc6db40d1058740d3d6abd /src/qcam/main.cpp
parent18cfea19dc593f47bf78f7abf108b0c6033ccf33 (diff)
qcam: Make use of StreamKeyValueParser
Use the StreamKeyValueParser helper to parse stream configuration from the command line. This extends qcam to accept role hints and pixel format in addition to a size. Currently only one viewfinder stream is supported, add a check to keep this behavior. Going forward this restriction will be lifted to support more then one stream. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/qcam/main.cpp')
-rw-r--r--src/qcam/main.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp
index 862d714f..b3468cbf 100644
--- a/src/qcam/main.cpp
+++ b/src/qcam/main.cpp
@@ -13,8 +13,9 @@
#include <libcamera/camera_manager.h>
-#include "main_window.h"
#include "../cam/options.h"
+#include "../cam/stream_options.h"
+#include "main_window.h"
void signalHandler(int signal)
{
@@ -24,11 +25,7 @@ void signalHandler(int signal)
OptionsParser::Options parseOptions(int argc, char *argv[])
{
- KeyValueParser sizeParser;
- sizeParser.addOption("width", OptionInteger, "Width in pixels",
- ArgumentRequired);
- sizeParser.addOption("height", OptionInteger, "Height in pixels",
- ArgumentRequired);
+ StreamKeyValueParser streamKeyValue;
OptionsParser parser;
parser.addOption(OptCamera, OptionString,
@@ -36,8 +33,8 @@ OptionsParser::Options parseOptions(int argc, char *argv[])
ArgumentRequired, "camera");
parser.addOption(OptHelp, OptionNone, "Display this help message",
"help");
- parser.addOption(OptSize, &sizeParser, "Set the stream size",
- "size", true);
+ parser.addOption(OptStream, &streamKeyValue,
+ "Set configuration of a camera stream", "stream", true);
OptionsParser::Options options = parser.parse(argc, argv);
if (options.isSet(OptHelp))