diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2012-08-24 11:29:22 -0700 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2012-08-27 09:14:50 -0700 |
commit | cab96a4a7a2900fa991ab77ae45ba8d4be97e054 (patch) | |
tree | 3622d5ac476753b4771d63dbd80a15e26f419dea /services/camera/libcameraservice/Camera2Client.h | |
parent | 690921927f289da73556ea71c28981194af8ffcd (diff) | |
download | frameworks_av-cab96a4a7a2900fa991ab77ae45ba8d4be97e054.zip frameworks_av-cab96a4a7a2900fa991ab77ae45ba8d4be97e054.tar.gz frameworks_av-cab96a4a7a2900fa991ab77ae45ba8d4be97e054.tar.bz2 |
Camera2: Use CameraMetadata wrapper class.
Wrap the use of the camera_metadata library inside a CameraMetadata
class to avoid memory leaks, improve code clarity, and increase type
safety.
Bug: 6243944
Change-Id: I90ca592b5875e27e4c58ea1ca680582dc3c3b56a
Diffstat (limited to 'services/camera/libcameraservice/Camera2Client.h')
-rw-r--r-- | services/camera/libcameraservice/Camera2Client.h | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/services/camera/libcameraservice/Camera2Client.h b/services/camera/libcameraservice/Camera2Client.h index 028d458..e03aaba 100644 --- a/services/camera/libcameraservice/Camera2Client.h +++ b/services/camera/libcameraservice/Camera2Client.h @@ -84,6 +84,7 @@ public: virtual void notifyAutoWhitebalance(uint8_t newState, int triggerId); virtual void onNewFrameAvailable(); + private: enum State { DISCONNECTED, @@ -153,10 +154,10 @@ private: int64_t gpsTimestamp; String8 gpsProcessingMethod; - int wbMode; - int effectMode; - int antibandingMode; - int sceneMode; + uint8_t wbMode; + uint8_t effectMode; + uint8_t antibandingMode; + uint8_t sceneMode; enum flashMode_t { FLASH_MODE_OFF = 0, @@ -300,12 +301,12 @@ private: /* Output frame metadata processing methods */ - status_t processFrameFaceDetect(camera_metadata_t *frame); + status_t processFrameFaceDetect(const CameraMetadata &frame); /* Preview related members */ int mPreviewStreamId; - camera_metadata_t *mPreviewRequest; + CameraMetadata mPreviewRequest; sp<IBinder> mPreviewSurface; sp<ANativeWindow> mPreviewWindow; @@ -351,7 +352,7 @@ private: Camera2Client *mParent; }; sp<CaptureWaiter> mCaptureWaiter; - camera_metadata_t *mCaptureRequest; + CameraMetadata mCaptureRequest; sp<Camera2Heap> mCaptureHeap; // Handle captured image buffers void onCaptureAvailable(); @@ -375,7 +376,7 @@ private: Camera2Client *mParent; }; sp<RecordingWaiter> mRecordingWaiter; - camera_metadata_t *mRecordingRequest; + CameraMetadata mRecordingRequest; sp<Camera2Heap> mRecordingHeap; static const size_t kDefaultRecordingHeapCount = 8; @@ -431,8 +432,8 @@ private: // checking the number of values in the entry. 0 for max/minCount means to // do no bounds check in that direction. In case of error, the entry data // pointer is null and the count is 0. - camera_metadata_entry_t staticInfo(uint32_t tag, - size_t minCount=0, size_t maxCount=0); + camera_metadata_ro_entry_t staticInfo(uint32_t tag, + size_t minCount=0, size_t maxCount=0) const; // Extract frequently-used camera static information into mDeviceInfo status_t buildDeviceInfo(); @@ -441,7 +442,7 @@ private: status_t buildDefaultParameters(); // Update parameters all requests use, based on mParameters - status_t updateRequestCommon(camera_metadata_t *request, const Parameters ¶ms); + status_t updateRequestCommon(CameraMetadata *request, const Parameters ¶ms); // Map from sensor active array pixel coordinates to normalized camera // parameter coordinates. The former are (0,0)-(array width - 1, array height @@ -449,16 +450,6 @@ private: int arrayXToNormalized(int width) const; int arrayYToNormalized(int height) const; - // Update specific metadata entry with new values. Adds entry if it does not - // exist, which will invalidate sorting - static status_t updateEntry(camera_metadata_t *buffer, - uint32_t tag, const void *data, size_t data_count); - - // Remove metadata entry. Will invalidate sorting. If entry does not exist, - // does nothing. - static status_t deleteEntry(camera_metadata_t *buffer, - uint32_t tag); - // Convert camera1 preview format string to camera2 enum static int formatStringToEnum(const char *format); static const char *formatEnumToString(int format); |