Message ID | 20190517230621.24668-13-laurent.pinchart@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Niklas, Thank you for the patch. On Sat, May 18, 2019 at 02:06:21AM +0300, Laurent Pinchart wrote: > From: Niklas Söderlund <niklas.soderlund@ragnatech.se> > > Use CameraConfiguration::validate() to validate and possibly update the > stream formats before configuring a camera. > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > --- > src/cam/main.cpp | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/src/cam/main.cpp b/src/cam/main.cpp > index a962f94c8f59..91785b7fea31 100644 > --- a/src/cam/main.cpp > +++ b/src/cam/main.cpp > @@ -140,6 +140,18 @@ static CameraConfiguration *prepareCameraConfig() > cfg.pixelFormat = conf["pixelformat"]; > } > > + switch (config->validate()) { > + case CameraConfiguration::Valid: > + break; > + case CameraConfiguration::Adjusted: > + std::cout << "Adjusted request format" << std::endl; s/format/configuration/ as we support multiple streams ? And should we print what the configuration has been adjusted to ? > + break; > + case CameraConfiguration::Invalid: > + delete config; > + config = nullptr; > + break; > + } > + > return config; > } >
diff --git a/src/cam/main.cpp b/src/cam/main.cpp index a962f94c8f59..91785b7fea31 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -140,6 +140,18 @@ static CameraConfiguration *prepareCameraConfig() cfg.pixelFormat = conf["pixelformat"]; } + switch (config->validate()) { + case CameraConfiguration::Valid: + break; + case CameraConfiguration::Adjusted: + std::cout << "Adjusted request format" << std::endl; + break; + case CameraConfiguration::Invalid: + delete config; + config = nullptr; + break; + } + return config; }