diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-04-05 02:52:59 +0200 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-04-09 16:59:19 +0200 |
commit | b0c730e330281f38ac51cb64d9581ed278759048 (patch) | |
tree | dd7398671330775d1ca302fe7871222a435eba6a /test | |
parent | 9a7dc3ce7f4253578a0f7c0d58417425c8155cb3 (diff) |
libcamera: Switch to CameraConfiguration
Implement the camera configuration thru out the library, tests, cam and
qcam tools.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/camera/camera_test.cpp | 18 | ||||
-rw-r--r-- | test/camera/camera_test.h | 2 | ||||
-rw-r--r-- | test/camera/capture.cpp | 8 | ||||
-rw-r--r-- | test/camera/configuration_default.cpp | 12 | ||||
-rw-r--r-- | test/camera/configuration_set.cpp | 6 | ||||
-rw-r--r-- | test/camera/statemachine.cpp | 2 |
6 files changed, 11 insertions, 37 deletions
diff --git a/test/camera/camera_test.cpp b/test/camera/camera_test.cpp index 1609c4b0..24ff5fe0 100644 --- a/test/camera/camera_test.cpp +++ b/test/camera/camera_test.cpp @@ -45,21 +45,3 @@ void CameraTest::cleanup() cm_->stop(); }; - -bool CameraTest::configurationValid(const std::map<Stream *, StreamConfiguration> &config) const -{ - /* Test that the configuration is not empty. */ - if (config.empty()) - return false; - - /* Test that configuration is valid. */ - for (auto const &it : config) { - const StreamConfiguration &conf = it.second; - - if (conf.width == 0 || conf.height == 0 || - conf.pixelFormat == 0 || conf.bufferCount == 0) - return false; - } - - return true; -} diff --git a/test/camera/camera_test.h b/test/camera/camera_test.h index 5801fad3..ffc8a485 100644 --- a/test/camera/camera_test.h +++ b/test/camera/camera_test.h @@ -23,8 +23,6 @@ protected: int init(); void cleanup(); - bool configurationValid(const std::map<Stream *, StreamConfiguration> &config) const; - std::shared_ptr<Camera> camera_; private: diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp index b8dbdb62..4e75a75c 100644 --- a/test/camera/capture.cpp +++ b/test/camera/capture.cpp @@ -42,12 +42,12 @@ protected: int run() { - std::map<Stream *, StreamConfiguration> conf = + CameraConfiguration conf = camera_->streamConfiguration({ Stream::VideoRecording() }); - Stream *stream = conf.begin()->first; - StreamConfiguration *sconf = &conf.begin()->second; + Stream *stream = conf.front(); + StreamConfiguration *sconf = &conf[stream]; - if (!configurationValid(conf)) { + if (!conf.isValid()) { cout << "Failed to read default configuration" << endl; return TestFail; } diff --git a/test/camera/configuration_default.cpp b/test/camera/configuration_default.cpp index 09861716..dd510668 100644 --- a/test/camera/configuration_default.cpp +++ b/test/camera/configuration_default.cpp @@ -18,17 +18,11 @@ class ConfigurationDefault : public CameraTest protected: int run() { - std::map<Stream *, StreamConfiguration> conf; + CameraConfiguration conf; /* Test asking for configuration for a video stream. */ conf = camera_->streamConfiguration({ Stream::VideoRecording() }); - if (conf.empty()) { - cout << "Failed to retrieve configuration for video streams" - << endl; - return TestFail; - } - - if (!configurationValid(conf)) { + if (!conf.isValid()) { cout << "Default configuration invalid" << endl; return TestFail; } @@ -38,7 +32,7 @@ protected: * stream usages returns an empty list of configurations. */ conf = camera_->streamConfiguration({}); - if (!conf.empty()) { + if (conf.isValid()) { cout << "Failed to retrieve configuration for empty usage list" << endl; return TestFail; diff --git a/test/camera/configuration_set.cpp b/test/camera/configuration_set.cpp index 1bc01e66..5ac2a7a9 100644 --- a/test/camera/configuration_set.cpp +++ b/test/camera/configuration_set.cpp @@ -18,11 +18,11 @@ class ConfigurationSet : public CameraTest protected: int run() { - std::map<Stream *, StreamConfiguration> conf = + CameraConfiguration conf = camera_->streamConfiguration({ Stream::VideoRecording() }); - StreamConfiguration *sconf = &conf.begin()->second; + StreamConfiguration *sconf = &conf[conf.front()]; - if (!configurationValid(conf)) { + if (!conf.isValid()) { cout << "Failed to read default configuration" << endl; return TestFail; } diff --git a/test/camera/statemachine.cpp b/test/camera/statemachine.cpp index ab3c6fb5..8ae93bee 100644 --- a/test/camera/statemachine.cpp +++ b/test/camera/statemachine.cpp @@ -265,7 +265,7 @@ protected: return TestPass; } - std::map<Stream *, StreamConfiguration> defconf_; + CameraConfiguration defconf_; }; } /* namespace */ |