diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/android/camera_device.cpp | 14 | ||||
-rw-r--r-- | src/android/camera_metadata.cpp | 14 | ||||
-rw-r--r-- | src/android/camera_metadata.h | 4 |
3 files changed, 31 insertions, 1 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index dc0c8f5f..7fc4ddb0 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1438,6 +1438,13 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() return nullptr; } + if (staticMetadata_->resized()) { + auto [entryCount, dataCount] = staticMetadata_->usage(); + LOG(HAL, Info) + << "Static metadata resized: " << entryCount + << " entries and " << dataCount << " bytes used"; + } + return staticMetadata_->get(); } @@ -2316,5 +2323,12 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons LOG(HAL, Error) << "Failed to construct result metadata"; } + if (resultMetadata->resized()) { + auto [entryCount, dataCount] = resultMetadata->usage(); + LOG(HAL, Info) + << "Result metadata resized: " << entryCount + << " entries and " << dataCount << " bytes used"; + } + return resultMetadata; } diff --git a/src/android/camera_metadata.cpp b/src/android/camera_metadata.cpp index ebe43ba4..c7298d62 100644 --- a/src/android/camera_metadata.cpp +++ b/src/android/camera_metadata.cpp @@ -14,17 +14,19 @@ using namespace libcamera; LOG_DEFINE_CATEGORY(CameraMetadata) CameraMetadata::CameraMetadata() - : metadata_(nullptr), valid_(false) + : metadata_(nullptr), valid_(false), resized_(false) { } CameraMetadata::CameraMetadata(size_t entryCapacity, size_t dataCapacity) + : resized_(false) { metadata_ = allocate_camera_metadata(entryCapacity, dataCapacity); valid_ = metadata_ != nullptr; } CameraMetadata::CameraMetadata(const camera_metadata_t *metadata) + : resized_(false) { metadata_ = clone_camera_metadata(metadata); valid_ = metadata_ != nullptr; @@ -55,6 +57,14 @@ CameraMetadata &CameraMetadata::operator=(const CameraMetadata &other) return *this; } +std::tuple<size_t, size_t> 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)) @@ -104,6 +114,8 @@ bool CameraMetadata::resize(size_t count, size_t size) append_camera_metadata(metadata_, oldMetadata); free_camera_metadata(oldMetadata); + + resized_ = true; } return true; diff --git a/src/android/camera_metadata.h b/src/android/camera_metadata.h index f8f2a0d2..3b7c9e24 100644 --- a/src/android/camera_metadata.h +++ b/src/android/camera_metadata.h @@ -23,6 +23,9 @@ public: CameraMetadata &operator=(const CameraMetadata &other); + std::tuple<size_t, size_t> usage() const; + bool resized() const { return resized_; } + bool isValid() const { return valid_; } bool getEntry(uint32_t tag, camera_metadata_ro_entry_t *entry) const; @@ -89,6 +92,7 @@ private: camera_metadata_t *metadata_; bool valid_; + bool resized_; }; #endif /* __ANDROID_CAMERA_METADATA_H__ */ |