summaryrefslogtreecommitdiff
path: root/src/cam/capture.cpp
AgeCommit message (Expand)Author
2020-01-12libcamera: camera: Remove the prepared stateNiklas Söderlund
2020-01-12cam: Cache buffer memory mappingNiklas Söderlund
2020-01-12libcamera: Switch to FrameBuffer interfaceNiklas Söderlund
2020-01-12libcamera: buffer: Move captured metadata to FrameMetadataNiklas Söderlund
2020-01-12libcamera: request: In addBuffer() do not fetch stream from BufferNiklas Söderlund
2019-12-16libcamera: Remove buffer index from loggingNiklas Söderlund
2019-11-20cam: Store camera as shared pointer everywhereNiklas Söderlund
2019-11-19libcamera: camera: Remove explicit stream to buffer map in requestCompleted s...Niklas Söderlund
2019-10-26cam: capture: remove unused local variablePaul Elder
2019-10-23libcamera: Standardise on C compatibility headersLaurent Pinchart
2019-09-14libcamera: Switch to the std::chrono APILaurent Pinchart
2019-07-14libcamera: buffer: Add an accessor to the BufferMemoryLaurent Pinchart
2019-07-14libcamera: stream: Shorten access to the bufferPoolJacopo Mondi
2019-07-14libcamera: Stop using Stream::bufferPool to get the number of buffersLaurent Pinchart
2019-07-14libcamera: buffer: Split memory information to BufferMemoryLaurent Pinchart
2019-06-25cam: capture: Stop stream when queueRequest() failsHelen Koike
2019-06-19cam: Move camera configuration preparation to CamAppNiklas Söderlund
2019-05-25cam: capture: Break out capture to a new classNiklas Söderlund
kwb">int init() { enumerator_ = DeviceEnumerator::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_ = new CameraSensor(entity); if (sensor_->init() < 0) { cerr << "Unable to initialise camera sensor" << endl; return TestFail; } 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(); 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.toString() << 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.mbus_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.toString() << endl; return TestFail; } return TestPass; } void cleanup() { delete sensor_; } private: std::unique_ptr<DeviceEnumerator> enumerator_; std::shared_ptr<MediaDevice> media_; CameraSensor *sensor_; }; TEST_REGISTER(CameraSensorTest)