cam: Rename --format to --stream
More than format information needs to be supplied for each stream to allow multiple streams to be configured. Rename the option and adapt all usages of it. There is no functional change except the rename. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
b0c730e330
commit
ea34d1a574
1 changed files with 15 additions and 15 deletions
|
@ -28,9 +28,9 @@ enum {
|
||||||
OptCamera = 'c',
|
OptCamera = 'c',
|
||||||
OptCapture = 'C',
|
OptCapture = 'C',
|
||||||
OptFile = 'F',
|
OptFile = 'F',
|
||||||
OptFormat = 'f',
|
|
||||||
OptHelp = 'h',
|
OptHelp = 'h',
|
||||||
OptList = 'l',
|
OptList = 'l',
|
||||||
|
OptStream = 's',
|
||||||
};
|
};
|
||||||
|
|
||||||
void signalHandler(int signal)
|
void signalHandler(int signal)
|
||||||
|
@ -41,12 +41,12 @@ void signalHandler(int signal)
|
||||||
|
|
||||||
static int parseOptions(int argc, char *argv[])
|
static int parseOptions(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
KeyValueParser formatKeyValue;
|
KeyValueParser streamKeyValue;
|
||||||
formatKeyValue.addOption("width", OptionInteger, "Width in pixels",
|
streamKeyValue.addOption("width", OptionInteger, "Width in pixels",
|
||||||
ArgumentRequired);
|
ArgumentRequired);
|
||||||
formatKeyValue.addOption("height", OptionInteger, "Height in pixels",
|
streamKeyValue.addOption("height", OptionInteger, "Height in pixels",
|
||||||
ArgumentRequired);
|
ArgumentRequired);
|
||||||
formatKeyValue.addOption("pixelformat", OptionInteger, "Pixel format",
|
streamKeyValue.addOption("pixelformat", OptionInteger, "Pixel format",
|
||||||
ArgumentRequired);
|
ArgumentRequired);
|
||||||
|
|
||||||
OptionsParser parser;
|
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 first '#' character in the file name is expanded to the frame sequence number.\n"
|
||||||
"The default file name is 'frame-#.bin'.",
|
"The default file name is 'frame-#.bin'.",
|
||||||
"file", ArgumentOptional, "filename");
|
"file", ArgumentOptional, "filename");
|
||||||
parser.addOption(OptFormat, &formatKeyValue,
|
parser.addOption(OptStream, &streamKeyValue,
|
||||||
"Set format of the camera's first stream", "format");
|
"Set configuration of a camera stream", "stream");
|
||||||
parser.addOption(OptHelp, OptionNone, "Display this help message",
|
parser.addOption(OptHelp, OptionNone, "Display this help message",
|
||||||
"help");
|
"help");
|
||||||
parser.addOption(OptList, OptionNone, "List all cameras", "list");
|
parser.addOption(OptList, OptionNone, "List all cameras", "list");
|
||||||
|
@ -83,18 +83,18 @@ static int prepareCameraConfig(CameraConfiguration *config)
|
||||||
*config = camera->streamConfiguration({ Stream::VideoRecording() });
|
*config = camera->streamConfiguration({ Stream::VideoRecording() });
|
||||||
Stream *stream = config->front();
|
Stream *stream = config->front();
|
||||||
|
|
||||||
if (options.isSet(OptFormat)) {
|
if (options.isSet(OptStream)) {
|
||||||
KeyValueParser::Options format = options[OptFormat];
|
KeyValueParser::Options conf = options[OptStream];
|
||||||
|
|
||||||
if (format.isSet("width"))
|
if (conf.isSet("width"))
|
||||||
(*config)[stream].width = format["width"];
|
(*config)[stream].width = conf["width"];
|
||||||
|
|
||||||
if (format.isSet("height"))
|
if (conf.isSet("height"))
|
||||||
(*config)[stream].height = format["height"];
|
(*config)[stream].height = conf["height"];
|
||||||
|
|
||||||
/* TODO: Translate 4CC string to ID. */
|
/* TODO: Translate 4CC string to ID. */
|
||||||
if (format.isSet("pixelformat"))
|
if (conf.isSet("pixelformat"))
|
||||||
(*config)[stream].pixelFormat = format["pixelformat"];
|
(*config)[stream].pixelFormat = conf["pixelformat"];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue