summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Expand)Author
2024-01-25test: object-delete: Test deferred delete just before thread stopsLaurent Pinchart
2024-01-25libcamera: signal: Replace object.h inclusion with forward declatationLaurent Pinchart
2024-01-23test: gstreamer: Use env instead of registry editNicolas Dufresne
2023-12-07test: gstreamer: Remove videoconvert element from pipelineLaurent Pinchart
2023-12-07test: ipc: unixsocket: Increase process exit timeoutLaurent Pinchart
2023-12-07test: log: log_process: Increase process exit timeoutLaurent Pinchart
2023-12-07test: log: log_process: Improve debugging on process exit failuresLaurent Pinchart
2023-12-07test: log: log_process: Fix uninitialized variable on process exit failureLaurent Pinchart
2023-12-07test: log: log_process: Log an error when failing due to incorrect messageLaurent Pinchart
2023-12-06test: gstreamer: Fix indentation in commentsLaurent Pinchart
2023-10-23test: Add unit test for Transform and OrientationJacopo Mondi
2023-07-11tests: gstreamer: Fix compiler error with gcc 8.4.0Laurent Pinchart
2023-07-07meson: Fix space around colon issuesLaurent Pinchart
2023-07-06tests: gstreamer: Test cameras' enumeration from GstDeviceProviderUmang Jain
2023-06-04py: unittests.py: Fix type checker warningsTomi Valkeinen
2023-05-30py: unittests.py: Add weakref helpers and use delTomi Valkeinen
2023-05-30py: Use exceptions instead of returning error codesTomi Valkeinen
2023-05-30py: Fix CameraManager.version propertyTomi Valkeinen
2023-04-20test: controls: control_info_map: Test default constructorMattijs Korpershoek
2022-12-24test: Drop pipeline testLaurent Pinchart
2022-12-24test: py: Fix test failure when ASan is enabledLaurent Pinchart
2022-12-24test: v4l2_compat: Enable test with ASanLaurent Pinchart
2022-12-24test: v4l2_compat: Reduce indentationLaurent Pinchart
2022-12-16test: controls: control_info: Test default def() valuesLaurent Pinchart
2022-11-24libcamera: Test sensor's ability to discover ancillary devicesYunke Cao
2022-11-08test: camera_reconfigure: Qualify move() with std:: namespaceLaurent Pinchart
2022-10-18ipa: vimc: Add Flags to parametersPaul Elder
2022-10-18ipa: vimc: Add IPAOperationCode to init() parameter listPaul Elder
2022-10-18test: generated_serializer: Test Flags that is struct memberPaul Elder
2022-10-18test: generated_serializer: Test enum that is struct memberPaul Elder
2022-10-10libcamera: base: utils: Drop defoptLaurent Pinchart
2022-10-07libcamera: pipeline_handler: Implement factories through class templatesLaurent Pinchart
2022-10-07libcamera: pipeline_handler: Return unique_ptr from createInstanceLaurent 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-10-04test: threads: Test thread cleanup upon abnormal terminationLaurent Pinchart
2022-10-04test: v4l2_m2mdevice: Test control enumerationLaurent Pinchart
2022-09-12test: gstreamer: gstreamer_test: Remove redundant wordRishikesh Donadkar
2022-09-12test: gstreamer: Fix failure of gstreamer_multistream_testVedant Paranjape
2022-09-12libcamera: controls: initialise control info to ControlTypeNone by defaultChristian Rauch
2022-09-01tests: stream: Add a colorspace adjustment testUmang Jain
2022-08-30test: camera: Remove redundant call of std::string::c_str()Marvin Schmidt
2022-08-26test: Add a ColorSpace testLaurent Pinchart
2022-08-26utils: Satisfy LegacyInputIterator with StringSplitter::iteratorLaurent Pinchart
2022-08-21libcamera: yaml_parser: Enable YamlObject::get() for int8_t and uint8_tLaurent Pinchart
2022-08-21test: yaml-parser: Test out-of-range checks on integer parsingLaurent Pinchart
2022-08-21test: yaml-parser: Centralize integer parse checksLaurent Pinchart
2022-08-21test: yaml-parser: Simplify code by centralizing parse error checksLaurent Pinchart
2022-08-21libcamera: Remove unused headersChristian Rauch
pan class="hl kwc">CameraMetadata::usage() const { size_t currentEntryCount = get_camera_metadata_entry_count(metadata_); size_t currentDataCount = get_camera_metadata_data_count(metadata_); return { currentEntryCount, currentDataCount }; } bool CameraMetadata::getEntry(uint32_t tag, camera_metadata_ro_entry_t *entry) const { if (find_camera_metadata_ro_entry(metadata_, tag, entry)) return false; return true; } /* * \brief Resize the metadata container, if necessary * \param[in] count Number of entries to add to the container * \param[in] size Total size of entries to add, in bytes * \return True if resize was successful or unnecessary, false otherwise */ bool CameraMetadata::resize(size_t count, size_t size) { if (!valid_) return false; if (!count && !size) return true; size_t currentEntryCount = get_camera_metadata_entry_count(metadata_); size_t currentEntryCapacity = get_camera_metadata_entry_capacity(metadata_); size_t newEntryCapacity = currentEntryCapacity < currentEntryCount + count ? currentEntryCapacity * 2 : currentEntryCapacity; size_t currentDataCount = get_camera_metadata_data_count(metadata_); size_t currentDataCapacity = get_camera_metadata_data_capacity(metadata_); size_t newDataCapacity = currentDataCapacity < currentDataCount + size ? currentDataCapacity * 2 : currentDataCapacity; if (newEntryCapacity > currentEntryCapacity || newDataCapacity > currentDataCapacity) { camera_metadata_t *oldMetadata = metadata_; metadata_ = allocate_camera_metadata(newEntryCapacity, newDataCapacity); if (!metadata_) { metadata_ = oldMetadata; return false; } LOG(CameraMetadata, Info) << "Resized: old entry capacity " << currentEntryCapacity << ", old data capacity " << currentDataCapacity << ", new entry capacity " << newEntryCapacity << ", new data capacity " << newDataCapacity; append_camera_metadata(metadata_, oldMetadata); free_camera_metadata(oldMetadata); resized_ = true; } return true; } template<> bool CameraMetadata::entryContains(uint32_t tag, uint8_t value) const { camera_metadata_ro_entry_t entry; if (!getEntry(tag, &entry)) return false; for (unsigned int i = 0; i < entry.count; i++) { if (entry.data.u8[i] == value) return true; } return false; } bool CameraMetadata::hasEntry(uint32_t tag) const { camera_metadata_ro_entry_t entry; return getEntry(tag, &entry); } bool CameraMetadata::addEntry(uint32_t tag, const void *data, size_t count, size_t elementSize) { if (!valid_) return false; if (!resize(1, count * elementSize)) { LOG(CameraMetadata, Error) << "Failed to resize"; valid_ = false; return false; } if (!add_camera_metadata_entry(metadata_, tag, data, count)) return true; const char *name = get_camera_metadata_tag_name(tag); if (name) LOG(CameraMetadata, Error) << "Failed to add tag " << name; else LOG(CameraMetadata, Error) << "Failed to add unknown tag " << tag; valid_ = false; return false; } bool CameraMetadata::updateEntry(uint32_t tag, const void *data, size_t count, size_t elementSize) { if (!valid_) return false; camera_metadata_entry_t entry; int ret = find_camera_metadata_entry(metadata_, tag, &entry); if (ret) { const char *name = get_camera_metadata_tag_name(tag); LOG(CameraMetadata, Error) << "Failed to update tag " << (name ? name : "<unknown>") << ": not present"; return false; } if (camera_metadata_type_size[entry.type] != elementSize) { const char *name = get_camera_metadata_tag_name(tag); LOG(CameraMetadata, Fatal) << "Invalid element size for tag " << (name ? name : "<unknown>"); return false; } size_t oldSize = calculate_camera_metadata_entry_data_size(entry.type, entry.count); size_t newSize = calculate_camera_metadata_entry_data_size(entry.type, count); size_t sizeIncrement = newSize - oldSize > 0 ? newSize - oldSize : 0; if (!resize(0, sizeIncrement)) { LOG(CameraMetadata, Error) << "Failed to resize"; valid_ = false; return false; } ret = update_camera_metadata_entry(metadata_, entry.index, data, count, nullptr); if (!ret) return true; const char *name = get_camera_metadata_tag_name(tag); LOG(CameraMetadata, Error) << "Failed to update tag " << (name ? name : "<unknown>"); valid_ = false; return false; } camera_metadata_t *CameraMetadata::getMetadata() { return valid_ ? metadata_ : nullptr; } const camera_metadata_t *CameraMetadata::getMetadata() const { return valid_ ? metadata_ : nullptr; }