summaryrefslogtreecommitdiff
path: root/src/lc-compliance/capture_test.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-10-12 04:23:47 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-10-15 05:05:29 +0300
commit45662c4dd757cff33ebbf296c8f656c17c9022b5 (patch)
tree43814cfeacc211452ce15e58f593b13d5cf67d36 /src/lc-compliance/capture_test.cpp
parent90a17209266597eaf16162d4ff13d72007a25e67 (diff)
cam: Rename CameraSession::streamName_ to streamNames_
The streamName_ map contains names for all streams, rename it to streamNames_ to make this more explicit. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/lc-compliance/capture_test.cpp')
0 files changed, 0 insertions, 0 deletions
class="hl opt">::create(); if (!enumerator_) { cerr << "Failed to create device enumerator" << endl; return TestFail; } if (enumerator_->enumerate()) { cerr << "Failed to enumerate media devices" << endl; return TestFail; } DeviceMatch dm("vimc"); media_ = enumerator_->search(dm); if (!media_) { cerr << "Unable to find \'vimc\' media device node" << endl; return TestSkip; } MediaEntity *entity = media_->getEntityByName("Sensor A"); if (!entity) { cerr << "Unable to find media entity 'Sensor A'" << endl; return TestFail; } sensor_ = CameraSensorFactoryBase::create(entity); if (!sensor_) { cerr << "Unable to initialise camera sensor" << endl; return TestFail; } lens_ = sensor_->focusLens(); if (lens_) cout << "Found lens controller" << endl; return TestPass; } int run() { if (sensor_->model() != "Sensor A") { cerr << "Incorrect sensor model '" << sensor_->model() << "'" << endl; return TestFail; } const std::vector<unsigned int> &codes = sensor_->mbusCodes(); auto iter = std::find(codes.begin(), codes.end(), MEDIA_BUS_FMT_ARGB8888_1X32); if (iter == codes.end()) { cerr << "Sensor doesn't support ARGB8888_1X32" << endl; return TestFail; } const std::vector<Size> &sizes = sensor_->sizes(*iter); auto iter2 = std::find(sizes.begin(), sizes.end(), Size(4096, 2160)); if (iter2 == sizes.end()) { cerr << "Sensor doesn't support 4096x2160" << endl; return TestFail; } const Size &resolution = sensor_->resolution(); if (resolution != Size(4096, 2160)) { cerr << "Incorrect sensor resolution " << resolution << endl; return TestFail; } /* Use an invalid format and make sure it's not selected. */ V4L2SubdeviceFormat format = sensor_->getFormat({ 0xdeadbeef, MEDIA_BUS_FMT_SBGGR10_1X10, MEDIA_BUS_FMT_BGR888_1X24 }, Size(1024, 768)); if (format.code != MEDIA_BUS_FMT_SBGGR10_1X10 || format.size != Size(4096, 2160)) { cerr << "Failed to get a suitable format, expected 4096x2160-0x" << utils::hex(MEDIA_BUS_FMT_SBGGR10_1X10) << ", got " << format << endl; return TestFail; } if (lens_ && lens_->setFocusPosition(10)) { cerr << "Failed to set lens focus position" << endl; return TestFail; } return TestPass; } void cleanup() { } private: std::unique_ptr<DeviceEnumerator> enumerator_; std::shared_ptr<MediaDevice> media_; std::unique_ptr<CameraSensor> sensor_; CameraLens *lens_; }; TEST_REGISTER(CameraSensorTest)