@@ -31,6 +31,8 @@ enum {
OptFormat = 'f',
OptHelp = 'h',
OptList = 'l',
+ OptOutput = 'o',
+ OptViefinder = 'v',
};
void signalHandler(int signal)
@@ -65,6 +67,12 @@ static int parseOptions(int argc, char *argv[])
parser.addOption(OptHelp, OptionNone, "Display this help message",
"help");
parser.addOption(OptList, OptionNone, "List all cameras", "list");
+ parser.addOption(OptOutput, OptionNone, "Use output stream\n"
+ "If no '-o' or '-v' options are specified, use viewfinder stream only",
+ "list");
+ parser.addOption(OptViefinder, OptionNone, "Use viewfinder stream\n"
+ "If no '-o' or '-v' options are specified, use viewfinder stream only",
+ "list");
options = parser.parse(argc, argv);
if (!options.valid() || options.isSet(OptHelp)) {
@@ -103,11 +111,15 @@ static int configureStreams(Camera *camera, std::set<Stream *> &streams,
defaultConfig[viewfinder].height = 480;
/*
- * HACK: add output/viewfinder to 'config'
- * to play with stream combinations.
+ * HACK: Select which stream to capture: use output if required,
+ * use viewfinder if required or if no option has been specified
+ * from the command line.
*/
- config[output] = defaultConfig[output];
- config[viewfinder] = defaultConfig[viewfinder];
+ if (options.isSet(OptOutput))
+ config[output] = defaultConfig[output];
+ if (options.isSet(OptViefinder) ||
+ (!options.isSet(OptViefinder) && !options.isSet(OptOutput)))
+ config[viewfinder] = defaultConfig[viewfinder];
return camera->configureStreams(config);
}
Add -o and -v options switches to the cam application to select which streams to capture from. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- src/cam/main.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)