summaryrefslogtreecommitdiff
path: root/src/android/camera_metadata.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/android/camera_metadata.h')
-rw-r--r--src/android/camera_metadata.h52
1 files changed, 50 insertions, 2 deletions
diff --git a/src/android/camera_metadata.h b/src/android/camera_metadata.h
index d653e2f0..07afd4b2 100644
--- a/src/android/camera_metadata.h
+++ b/src/android/camera_metadata.h
@@ -8,6 +8,7 @@
#define __ANDROID_CAMERA_METADATA_H__
#include <stdint.h>
+#include <vector>
#include <system/camera_metadata.h>
@@ -23,9 +24,56 @@ public:
CameraMetadata &operator=(const CameraMetadata &other);
bool isValid() const { return valid_; }
+ bool resize(size_t count, size_t size);
bool getEntry(uint32_t tag, camera_metadata_ro_entry_t *entry) const;
- bool addEntry(uint32_t tag, const void *data, size_t data_count);
- bool updateEntry(uint32_t tag, const void *data, size_t data_count);
+
+ template<typename T,
+ std::enable_if_t<std::is_arithmetic_v<T>> * = nullptr>
+ bool addEntry(uint32_t tag, const T &data)
+ {
+ return addEntry(tag, &data, 1, sizeof(T));
+ }
+
+ template<typename T, size_t size>
+ bool addEntry(uint32_t tag, const T (&data)[size])
+ {
+ return addEntry(tag, data, size, sizeof(T));
+ }
+
+ template<typename S,
+ typename T = typename S::value_type>
+ bool addEntry(uint32_t tag, S &data)
+ {
+ return addEntry(tag, data.data(), data.size(), sizeof(T));
+ }
+
+ template<typename T>
+ bool addEntry(uint32_t tag, const T *data, size_t count)
+ {
+ return addEntry(tag, data, count, sizeof(T));
+ }
+
+ template<typename T>
+ bool updateEntry(uint32_t tag, const T &data)
+ {
+ return updateEntry(tag, &data, 1);
+ }
+
+ template<typename T, size_t size>
+ bool updateEntry(uint32_t tag, const T (&data)[size])
+ {
+ return updateEntry(tag, data, size, sizeof(T));
+ }
+
+ template<typename S,
+ typename T = typename S::value_type>
+ bool updateEntry(uint32_t tag, S &data)
+ {
+ return updateEntry(tag, data.data(), data.size());
+ }
+
+ bool addEntry(uint32_t tag, const void *data, size_t count, size_t sizeofT);
+ bool updateEntry(uint32_t tag, const void *data, size_t count);
camera_metadata_t *get();
const camera_metadata_t *get() const;