summaryrefslogtreecommitdiff
path: root/src/qcam/main.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-07-13 16:51:19 +0200
committerJacopo Mondi <jacopo@jmondi.org>2019-07-17 04:49:38 +0200
commita5ebcea8c0080bea478514c6fa6dd83c28adb986 (patch)
treedf2ad6b86d40a8c12bdb339d8f9a460a6f26dda4 /src/qcam/main.cpp
parentfae053307dcc6807dd8ab127294c1fe5c5bb2d72 (diff)
libcamera: qcam: Allow specifying sizes on command line
Add a '-s|--size' option to qcam to allow selecting the stream resolution using a command line option. If the sizes are not supported by the camera, they get automatically adjusted and the user notified via an output message. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/qcam/main.cpp')
-rw-r--r--src/qcam/main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp
index 106b8a16..da942f3d 100644
--- a/src/qcam/main.cpp
+++ b/src/qcam/main.cpp
@@ -25,12 +25,20 @@ 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);
+
OptionsParser parser;
parser.addOption(OptCamera, OptionString,
"Specify which camera to operate on", "camera",
ArgumentRequired, "camera");
parser.addOption(OptHelp, OptionNone, "Display this help message",
"help");
+ parser.addOption(OptSize, &sizeParser, "Set the stream size",
+ "size", true);
OptionsParser::Options options = parser.parse(argc, argv);
if (options.isSet(OptHelp))