summaryrefslogtreecommitdiff
path: root/test/meson.build
AgeCommit message (Expand)Author
2024-05-07test: Don't add current build directory to include pathLaurent Pinchart
2024-01-25test: timer-thread: Move timer start from wrong thread to separate testLaurent Pinchart
2023-10-23test: Add unit test for Transform and OrientationJacopo Mondi
2022-12-24test: Drop pipeline testLaurent Pinchart
2022-12-24test: v4l2_compat: Enable test with ASanLaurent Pinchart
2022-10-07test: meson: Use dictionaries instead of arrays to store test informationLaurent Pinchart
2022-10-07test: Rename 't' to 'test' in meson.buildLaurent Pinchart
2022-10-05test: threads: Fix link failure due to missing dependencyLaurent Pinchart
2022-08-26test: Add a ColorSpace testLaurent Pinchart
2022-05-10py: Add unittests.pyTomi Valkeinen
2022-05-10test: Add YamlParser testHan-Lin Chen
2022-01-19test: Ensure CameraTest tests are not run in parallelKieran Bingham
2021-12-11test: fence: Add test for the Fence classJacopo Mondi
2021-12-04libcamera: base: Rename FileDescriptor to SharedFDLaurent Pinchart
2021-12-03test: Add UniqueFD testLaurent Pinchart
2021-08-14test: gstreamer: Add test for gstreamer single streamVedant Paranjape
2021-08-03test: Add tests for the Flags classLaurent Pinchart
2021-06-25test: Ensure LIBCAMERA_BASE_PRIVATE isn't publicKieran Bingham
2021-06-25libcamera: rename public libcamera dependencyKieran Bingham
2021-06-25libcamera/base: Validate internal headers as privateKieran Bingham
2021-03-28meson: Summarize which applications and adaptation layers are builtLaurent Pinchart
2021-03-12test: delayed_controls: Rename delayed_contols.cpp to delayed_controls.cppNaushir Patuck
2021-02-04test: Add unit tests for the BayerFormat classSebastian Fricke
2021-01-29test: delayed_controls: Add test case for DelayedControlsNiklas Söderlund
2020-12-30meson: test: Simplify top level mesonKieran Bingham
2020-08-06test: mapped-buffers: Provide MappedBuffer testKieran Bingham
2020-07-31tests: Add a test case for the Object::deleteLater() API, to verifyUmang Jain
2020-07-28test: Remove list-cameras testLaurent Pinchart
2020-07-10tests: v4l2_compat: Add test for v4l2_compatPaul Elder
2020-06-25libcamera: pixel_format: Replace hex with format namesKaaira Gupta
2020-06-17tests: Introduce hotplug hot-unplug unit testUmang Jain
2020-05-13licenses: License all meson files under CC0-1.0Laurent Pinchart
2020-04-14test: Add File class testsLaurent Pinchart
2020-03-06test: Add Span testLaurent Pinchart
2020-01-12test: file_descriptor: Add testNiklas Söderlund
2019-11-20test: Add control serialization testJacopo Mondi
2019-11-20test: Add ByteStreamBuffer testLaurent Pinchart
2019-10-15libcamera: utils: Add hex stream output helperLaurent Pinchart
2019-08-19test: Get event dispatcher from current threadLaurent Pinchart
2019-08-17test: Add Timer thread move testLaurent Pinchart
2019-08-17test: Add EventNotifier thread move testLaurent Pinchart
2019-08-17test: Add Object class thread affinity testLaurent Pinchart
2019-08-17test: Add Object::invokeMethod() testLaurent Pinchart
2019-07-17test: logging: move logging tests to a subdirectoryPaul Elder
2019-07-17test: logging: add logging process testPaul Elder
2019-07-12libcamera: Add Process and ProcessManager classesPaul Elder
2019-07-12test: add logging API testPaul Elder
2019-07-11test: Add test case for signal delivery across threadsLaurent Pinchart
2019-07-11test: Add Message test caseLaurent Pinchart
2019-07-11test: Add Thread test casesLaurent Pinchart
> m2m_->output()->bufferReady.connect(this, &SimpleConverter::outputBufferReady); m2m_->capture()->bufferReady.connect(this, &SimpleConverter::captureBufferReady); } SimpleConverter::~SimpleConverter() { delete m2m_; } int SimpleConverter::open() { if (!m2m_) return -ENODEV; return m2m_->open(); } void SimpleConverter::close() { if (m2m_) m2m_->close(); } std::vector<PixelFormat> SimpleConverter::formats(PixelFormat input) { if (!m2m_) return {}; /* * Set the format on the input side (V4L2 output) of the converter to * enumerate the conversion capabilities on its output (V4L2 capture). */ V4L2DeviceFormat format; format.fourcc = m2m_->output()->toV4L2PixelFormat(input); format.size = { 1, 1 }; int ret = m2m_->output()->setFormat(&format); if (ret < 0) { LOG(SimplePipeline, Error) << "Failed to set format: " << strerror(-ret); return {}; } std::vector<PixelFormat> pixelFormats; for (const auto &format : m2m_->capture()->formats()) { PixelFormat pixelFormat = format.first.toPixelFormat(); if (pixelFormat) pixelFormats.push_back(pixelFormat); } return pixelFormats; } SizeRange SimpleConverter::sizes(const Size &input) { if (!m2m_) return {}; /* * Set the size on the input side (V4L2 output) of the converter to * enumerate the scaling capabilities on its output (V4L2 capture). */ V4L2DeviceFormat format; format.fourcc = V4L2PixelFormat(); format.size = input; int ret = m2m_->output()->setFormat(&format); if (ret < 0) { LOG(SimplePipeline, Error) << "Failed to set format: " << strerror(-ret); return {}; } SizeRange sizes; format.size = { 1, 1 }; ret = m2m_->capture()->setFormat(&format); if (ret < 0) { LOG(SimplePipeline, Error) << "Failed to set format: " << strerror(-ret); return {}; } sizes.min = format.size; format.size = { UINT_MAX, UINT_MAX }; ret = m2m_->capture()->setFormat(&format); if (ret < 0) { LOG(SimplePipeline, Error) << "Failed to set format: " << strerror(-ret); return {}; } sizes.max = format.size; return sizes; } int SimpleConverter::configure(PixelFormat inputFormat, const Size &inputSize, StreamConfiguration *cfg) { V4L2DeviceFormat format; int ret; V4L2PixelFormat videoFormat = m2m_->output()->toV4L2PixelFormat(inputFormat); format.fourcc = videoFormat; format.size = inputSize; ret = m2m_->output()->setFormat(&format); if (ret < 0) { LOG(SimplePipeline, Error) << "Failed to set input format: " << strerror(-ret); return ret; } if (format.fourcc != videoFormat || format.size != inputSize) { LOG(SimplePipeline, Error) << "Input format not supported"; return -EINVAL; } /* Set the pixel format and size on the output. */ videoFormat = m2m_->capture()->toV4L2PixelFormat(cfg->pixelFormat); format.fourcc = videoFormat; format.size = cfg->size; ret = m2m_->capture()->setFormat(&format); if (ret < 0) { LOG(SimplePipeline, Error) << "Failed to set output format: " << strerror(-ret); return ret; } if (format.fourcc != videoFormat || format.size != cfg->size) { LOG(SimplePipeline, Error) << "Output format not supported"; return -EINVAL; } cfg->stride = format.planes[0].bpl; return 0; } int SimpleConverter::exportBuffers(unsigned int count, std::vector<std::unique_ptr<FrameBuffer>> *buffers) { return m2m_->capture()->exportBuffers(count, buffers); } int SimpleConverter::start(unsigned int count) { int ret = m2m_->output()->importBuffers(count); if (ret < 0) return ret; ret = m2m_->capture()->importBuffers(count); if (ret < 0) { stop(); return ret; } ret = m2m_->output()->streamOn(); if (ret < 0) { stop(); return ret; } ret = m2m_->capture()->streamOn(); if (ret < 0) { stop(); return ret; } return 0; } void SimpleConverter::stop() { m2m_->capture()->streamOff(); m2m_->output()->streamOff(); m2m_->capture()->releaseBuffers(); m2m_->output()->releaseBuffers(); } int SimpleConverter::queueBuffers(FrameBuffer *input, FrameBuffer *output) { int ret = m2m_->output()->queueBuffer(input); if (ret < 0) return ret; ret = m2m_->capture()->queueBuffer(output); if (ret < 0) return ret; return 0; } void SimpleConverter::captureBufferReady(FrameBuffer *buffer) { if (!outputDoneQueue_.empty()) { FrameBuffer *other = outputDoneQueue_.front(); outputDoneQueue_.pop(); bufferReady.emit(other, buffer); } else { captureDoneQueue_.push(buffer); } } void SimpleConverter::outputBufferReady(FrameBuffer *buffer) { if (!captureDoneQueue_.empty()) { FrameBuffer *other = captureDoneQueue_.front(); captureDoneQueue_.pop(); bufferReady.emit(buffer, other); } else { outputDoneQueue_.push(buffer); } } std::tuple<unsigned int, unsigned int> SimpleConverter::strideAndFrameSize(const Size &size, const PixelFormat &pixelFormat) { V4L2DeviceFormat format = {}; format.fourcc = m2m_->capture()->toV4L2PixelFormat(pixelFormat); format.size = size; int ret = m2m_->capture()->tryFormat(&format); if (ret < 0) return std::make_tuple(0, 0); return std::make_tuple(format.planes[0].bpl, format.planes[0].size); } } /* namespace libcamera */