test: camera: Remove streams argument from configurationValid()
In preparation of reworking how a default configuration is retrieved from a camera remove the streams and validation using the stream when judging if a camera configuration is valid. This is needed as once stream usage hints are added applications will no longer fetch default configuration based on Stream IDs so using them to verify the returned format is not useful. 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
30fe5bde5f
commit
8f08880082
5 changed files with 12 additions and 22 deletions
|
@ -46,27 +46,18 @@ void CameraTest::cleanup()
|
||||||
cm_->stop();
|
cm_->stop();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool CameraTest::configurationValid(const std::set<Stream *> &streams,
|
bool CameraTest::configurationValid(const std::map<Stream *, StreamConfiguration> &config) const
|
||||||
const std::map<Stream *, StreamConfiguration> &conf) const
|
|
||||||
{
|
{
|
||||||
/* Test that the numbers of streams matches that of configuration. */
|
/* Test that the configuration is not empty. */
|
||||||
if (streams.size() != conf.size())
|
if (config.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/*
|
/* Test that configuration is valid. */
|
||||||
* Test that stream can be found in configuration and that the
|
for (auto const &it : config) {
|
||||||
* configuration is valid.
|
const StreamConfiguration &conf = it.second;
|
||||||
*/
|
|
||||||
for (Stream *stream : streams) {
|
|
||||||
std::map<Stream *, StreamConfiguration>::const_iterator it =
|
|
||||||
conf.find(stream);
|
|
||||||
|
|
||||||
if (it == conf.end())
|
if (conf.width == 0 || conf.height == 0 ||
|
||||||
return false;
|
conf.pixelFormat == 0 || conf.bufferCount == 0)
|
||||||
|
|
||||||
const StreamConfiguration *sconf = &it->second;
|
|
||||||
if (sconf->width == 0 || sconf->height == 0 ||
|
|
||||||
sconf->pixelFormat == 0 || sconf->bufferCount == 0)
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,7 @@ protected:
|
||||||
int init();
|
int init();
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
bool configurationValid(const std::set<Stream *> &streams,
|
bool configurationValid(const std::map<Stream *, StreamConfiguration> &config) const;
|
||||||
const std::map<Stream *, StreamConfiguration> &conf) const;
|
|
||||||
|
|
||||||
std::shared_ptr<Camera> camera_;
|
std::shared_ptr<Camera> camera_;
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ protected:
|
||||||
camera_->streamConfiguration(streams);
|
camera_->streamConfiguration(streams);
|
||||||
StreamConfiguration *sconf = &conf.begin()->second;
|
StreamConfiguration *sconf = &conf.begin()->second;
|
||||||
|
|
||||||
if (!configurationValid(streams, conf)) {
|
if (!configurationValid(conf)) {
|
||||||
cout << "Failed to read default configuration" << endl;
|
cout << "Failed to read default configuration" << endl;
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!configurationValid(streams, conf)) {
|
if (!configurationValid(conf)) {
|
||||||
cout << "Default configuration invalid" << endl;
|
cout << "Default configuration invalid" << endl;
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ protected:
|
||||||
camera_->streamConfiguration(streams);
|
camera_->streamConfiguration(streams);
|
||||||
StreamConfiguration *sconf = &conf.begin()->second;
|
StreamConfiguration *sconf = &conf.begin()->second;
|
||||||
|
|
||||||
if (!configurationValid(streams, conf)) {
|
if (!configurationValid(conf)) {
|
||||||
cout << "Failed to read default configuration" << endl;
|
cout << "Failed to read default configuration" << endl;
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue