Message ID | 20190403011235.12782-2-niklas.soderlund@ragnatech.se |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Niklas On Wed, Apr 03, 2019 at 03:12:32AM +0200, Niklas Söderlund wrote: > More than format information needs to be configured for each stream to More than one to be supplied (you use configured below) > allow multiple streams to be configured. Rename the option and adapt all > uses of it. There is no functional change except the rename. s/uses/usages Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Thanks j > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/cam/main.cpp | 30 +++++++++++++++--------------- > 1 file changed, 15 insertions(+), 15 deletions(-) > > diff --git a/src/cam/main.cpp b/src/cam/main.cpp > index 030003f081bdddda..6bf5e5926704d6e9 100644 > --- a/src/cam/main.cpp > +++ b/src/cam/main.cpp > @@ -28,9 +28,9 @@ enum { > OptCamera = 'c', > OptCapture = 'C', > OptFile = 'F', > - OptFormat = 'f', > OptHelp = 'h', > OptList = 'l', > + OptStream = 's', > }; > > void signalHandler(int signal) > @@ -41,12 +41,12 @@ void signalHandler(int signal) > > static int parseOptions(int argc, char *argv[]) > { > - KeyValueParser formatKeyValue; > - formatKeyValue.addOption("width", OptionInteger, "Width in pixels", > + KeyValueParser streamKeyValue; > + streamKeyValue.addOption("width", OptionInteger, "Width in pixels", > ArgumentRequired); > - formatKeyValue.addOption("height", OptionInteger, "Height in pixels", > + streamKeyValue.addOption("height", OptionInteger, "Height in pixels", > ArgumentRequired); > - formatKeyValue.addOption("pixelformat", OptionInteger, "Pixel format", > + streamKeyValue.addOption("pixelformat", OptionInteger, "Pixel format", > ArgumentRequired); > > 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 default file name is 'frame-#.bin'.", > "file", ArgumentOptional, "filename"); > - parser.addOption(OptFormat, &formatKeyValue, > - "Set format of the camera's first stream", "format"); > + parser.addOption(OptStream, &streamKeyValue, > + "Set configuration of a camera stream", "stream"); > parser.addOption(OptHelp, OptionNone, "Display this help message", > "help"); > parser.addOption(OptList, OptionNone, "List all cameras", "list"); > @@ -84,18 +84,18 @@ static int prepareCameraConfig(std::map<Stream *, StreamConfiguration> *config) > *config = camera->streamConfiguration({ Stream::VideoRecording() }); > Stream *stream = config->begin()->first; > > - if (options.isSet(OptFormat)) { > - KeyValueParser::Options format = options[OptFormat]; > + if (options.isSet(OptStream)) { > + KeyValueParser::Options conf = options[OptStream]; > > - if (format.isSet("width")) > - (*config)[stream].width = format["width"]; > + if (conf.isSet("width")) > + (*config)[stream].width = conf["width"]; > > - if (format.isSet("height")) > - (*config)[stream].height = format["height"]; > + if (conf.isSet("height")) > + (*config)[stream].height = conf["height"]; > > /* TODO: Translate 4CC string to ID. */ > - if (format.isSet("pixelformat")) > - (*config)[stream].pixelFormat = format["pixelformat"]; > + if (conf.isSet("pixelformat")) > + (*config)[stream].pixelFormat = conf["pixelformat"]; > } > > return 0; > -- > 2.21.0 > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
diff --git a/src/cam/main.cpp b/src/cam/main.cpp index 030003f081bdddda..6bf5e5926704d6e9 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -28,9 +28,9 @@ enum { OptCamera = 'c', OptCapture = 'C', OptFile = 'F', - OptFormat = 'f', OptHelp = 'h', OptList = 'l', + OptStream = 's', }; void signalHandler(int signal) @@ -41,12 +41,12 @@ void signalHandler(int signal) static int parseOptions(int argc, char *argv[]) { - KeyValueParser formatKeyValue; - formatKeyValue.addOption("width", OptionInteger, "Width in pixels", + KeyValueParser streamKeyValue; + streamKeyValue.addOption("width", OptionInteger, "Width in pixels", ArgumentRequired); - formatKeyValue.addOption("height", OptionInteger, "Height in pixels", + streamKeyValue.addOption("height", OptionInteger, "Height in pixels", ArgumentRequired); - formatKeyValue.addOption("pixelformat", OptionInteger, "Pixel format", + streamKeyValue.addOption("pixelformat", OptionInteger, "Pixel format", ArgumentRequired); 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 default file name is 'frame-#.bin'.", "file", ArgumentOptional, "filename"); - parser.addOption(OptFormat, &formatKeyValue, - "Set format of the camera's first stream", "format"); + parser.addOption(OptStream, &streamKeyValue, + "Set configuration of a camera stream", "stream"); parser.addOption(OptHelp, OptionNone, "Display this help message", "help"); parser.addOption(OptList, OptionNone, "List all cameras", "list"); @@ -84,18 +84,18 @@ static int prepareCameraConfig(std::map<Stream *, StreamConfiguration> *config) *config = camera->streamConfiguration({ Stream::VideoRecording() }); Stream *stream = config->begin()->first; - if (options.isSet(OptFormat)) { - KeyValueParser::Options format = options[OptFormat]; + if (options.isSet(OptStream)) { + KeyValueParser::Options conf = options[OptStream]; - if (format.isSet("width")) - (*config)[stream].width = format["width"]; + if (conf.isSet("width")) + (*config)[stream].width = conf["width"]; - if (format.isSet("height")) - (*config)[stream].height = format["height"]; + if (conf.isSet("height")) + (*config)[stream].height = conf["height"]; /* TODO: Translate 4CC string to ID. */ - if (format.isSet("pixelformat")) - (*config)[stream].pixelFormat = format["pixelformat"]; + if (conf.isSet("pixelformat")) + (*config)[stream].pixelFormat = conf["pixelformat"]; } return 0;