Eino-Ville Talvala | 61ab9f9 | 2012-05-17 10:30:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_SERVERS_CAMERA_CAMERA2CLIENT_H |
| 18 | #define ANDROID_SERVERS_CAMERA_CAMERA2CLIENT_H |
| 19 | |
| 20 | #include "Camera2Device.h" |
| 21 | #include "CameraService.h" |
Eino-Ville Talvala | f69c70d | 2012-05-20 15:59:14 -0700 | [diff] [blame] | 22 | #include "camera/CameraParameters.h" |
Eino-Ville Talvala | d4bcfde | 2012-06-07 17:12:38 -0700 | [diff] [blame] | 23 | #include <binder/MemoryBase.h> |
| 24 | #include <binder/MemoryHeapBase.h> |
| 25 | #include <gui/CpuConsumer.h> |
Eino-Ville Talvala | 78822d7 | 2012-07-18 17:52:18 -0700 | [diff] [blame] | 26 | #include "MediaConsumer.h" |
Eino-Ville Talvala | 61ab9f9 | 2012-05-17 10:30:54 -0700 | [diff] [blame] | 27 | |
| 28 | namespace android { |
| 29 | |
| 30 | /** |
| 31 | * Implements the android.hardware.camera API on top of |
| 32 | * camera device HAL version 2. |
| 33 | */ |
| 34 | class Camera2Client : public CameraService::Client |
| 35 | { |
| 36 | public: |
| 37 | // ICamera interface (see ICamera for details) |
| 38 | virtual void disconnect(); |
| 39 | virtual status_t connect(const sp<ICameraClient>& client); |
| 40 | virtual status_t lock(); |
| 41 | virtual status_t unlock(); |
| 42 | virtual status_t setPreviewDisplay(const sp<Surface>& surface); |
Eino-Ville Talvala | 6db981c | 2012-05-21 18:54:30 -0700 | [diff] [blame] | 43 | virtual status_t setPreviewTexture( |
| 44 | const sp<ISurfaceTexture>& surfaceTexture); |
Eino-Ville Talvala | 61ab9f9 | 2012-05-17 10:30:54 -0700 | [diff] [blame] | 45 | virtual void setPreviewCallbackFlag(int flag); |
| 46 | virtual status_t startPreview(); |
| 47 | virtual void stopPreview(); |
| 48 | virtual bool previewEnabled(); |
| 49 | virtual status_t storeMetaDataInBuffers(bool enabled); |
| 50 | virtual status_t startRecording(); |
| 51 | virtual void stopRecording(); |
| 52 | virtual bool recordingEnabled(); |
| 53 | virtual void releaseRecordingFrame(const sp<IMemory>& mem); |
| 54 | virtual status_t autoFocus(); |
| 55 | virtual status_t cancelAutoFocus(); |
| 56 | virtual status_t takePicture(int msgType); |
| 57 | virtual status_t setParameters(const String8& params); |
| 58 | virtual String8 getParameters() const; |
| 59 | virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2); |
| 60 | |
| 61 | // Interface used by CameraService |
| 62 | Camera2Client(const sp<CameraService>& cameraService, |
| 63 | const sp<ICameraClient>& cameraClient, |
Eino-Ville Talvala | 61ab9f9 | 2012-05-17 10:30:54 -0700 | [diff] [blame] | 64 | int cameraId, |
| 65 | int cameraFacing, |
| 66 | int clientPid); |
| 67 | ~Camera2Client(); |
| 68 | |
Eino-Ville Talvala | f69c70d | 2012-05-20 15:59:14 -0700 | [diff] [blame] | 69 | status_t initialize(camera_module_t *module); |
| 70 | |
Eino-Ville Talvala | 61ab9f9 | 2012-05-17 10:30:54 -0700 | [diff] [blame] | 71 | virtual status_t dump(int fd, const Vector<String16>& args); |
| 72 | |
| 73 | private: |
Eino-Ville Talvala | 4ecfec3 | 2012-06-12 17:13:48 -0700 | [diff] [blame] | 74 | enum State { |
Eino-Ville Talvala | 3a60914 | 2012-07-31 14:36:26 -0700 | [diff] [blame] | 75 | DISCONNECTED, |
Eino-Ville Talvala | 6db981c | 2012-05-21 18:54:30 -0700 | [diff] [blame] | 76 | STOPPED, |
| 77 | WAITING_FOR_PREVIEW_WINDOW, |
Eino-Ville Talvala | 7f61084 | 2012-06-07 10:20:51 -0700 | [diff] [blame] | 78 | PREVIEW, |
| 79 | RECORD, |
Eino-Ville Talvala | d4bcfde | 2012-06-07 17:12:38 -0700 | [diff] [blame] | 80 | STILL_CAPTURE, |
| 81 | VIDEO_SNAPSHOT |
Eino-Ville Talvala | 6db981c | 2012-05-21 18:54:30 -0700 | [diff] [blame] | 82 | } mState; |
| 83 | |
Eino-Ville Talvala | 4ecfec3 | 2012-06-12 17:13:48 -0700 | [diff] [blame] | 84 | static const char *getStateName(State state); |
| 85 | |
Eino-Ville Talvala | 3cca136 | 2012-06-07 10:07:18 -0700 | [diff] [blame] | 86 | /** ICamera interface-related private members */ |
Eino-Ville Talvala | 61ab9f9 | 2012-05-17 10:30:54 -0700 | [diff] [blame] | 87 | |
Eino-Ville Talvala | ac45eb3 | 2012-06-07 10:24:51 -0700 | [diff] [blame] | 88 | // Mutex that must be locked by methods implementing the ICamera interface. |
Eino-Ville Talvala | 36cdfb1 | 2012-08-02 17:34:15 -0700 | [diff] [blame^] | 89 | // Ensures serialization between incoming ICamera calls. All methods below |
| 90 | // that append 'L' to the name assume that mICameraLock is locked when |
| 91 | // they're called |
Eino-Ville Talvala | ac45eb3 | 2012-06-07 10:24:51 -0700 | [diff] [blame] | 92 | mutable Mutex mICameraLock; |
| 93 | |
Eino-Ville Talvala | 36cdfb1 | 2012-08-02 17:34:15 -0700 | [diff] [blame^] | 94 | status_t setPreviewWindowL(const sp<IBinder>& binder, |
Eino-Ville Talvala | be0573b | 2012-06-15 12:42:30 -0700 | [diff] [blame] | 95 | sp<ANativeWindow> window); |
Eino-Ville Talvala | d4bcfde | 2012-06-07 17:12:38 -0700 | [diff] [blame] | 96 | |
Eino-Ville Talvala | 36cdfb1 | 2012-08-02 17:34:15 -0700 | [diff] [blame^] | 97 | void stopPreviewL(); |
| 98 | status_t startPreviewL(); |
| 99 | |
| 100 | // Individual commands for sendCommand() |
| 101 | status_t commandStartSmoothZoomL(); |
| 102 | status_t commandStopSmoothZoomL(); |
| 103 | status_t commandSetDisplayOrientationL(int degrees); |
| 104 | status_t commandEnableShutterSoundL(bool enable); |
| 105 | status_t commandPlayRecordingSoundL(); |
| 106 | status_t commandStartFaceDetectionL(int type); |
| 107 | status_t commandStopFaceDetectionL(); |
| 108 | status_t commandEnableFocusMoveMsgL(bool enable); |
| 109 | status_t commandPingL(); |
| 110 | status_t commandSetVideoBufferCountL(size_t count); |
Eino-Ville Talvala | d4bcfde | 2012-06-07 17:12:38 -0700 | [diff] [blame] | 111 | |
Eino-Ville Talvala | 3cca136 | 2012-06-07 10:07:18 -0700 | [diff] [blame] | 112 | // Current camera state; this is the contents of the CameraParameters object |
| 113 | // in a more-efficient format. The enum values are mostly based off the |
| 114 | // corresponding camera2 enums, not the camera1 strings. A few are defined |
| 115 | // here if they don't cleanly map to camera2 values. |
| 116 | struct Parameters { |
| 117 | int previewWidth, previewHeight; |
Eino-Ville Talvala | 11b7cde | 2012-06-15 12:37:35 -0700 | [diff] [blame] | 118 | int32_t previewFpsRange[2]; |
Eino-Ville Talvala | 3cca136 | 2012-06-07 10:07:18 -0700 | [diff] [blame] | 119 | int previewFps; // deprecated, here only for tracking changes |
| 120 | int previewFormat; |
| 121 | |
Eino-Ville Talvala | 11b7cde | 2012-06-15 12:37:35 -0700 | [diff] [blame] | 122 | int previewTransform; // set by CAMERA_CMD_SET_DISPLAY_ORIENTATION |
| 123 | |
Eino-Ville Talvala | 3cca136 | 2012-06-07 10:07:18 -0700 | [diff] [blame] | 124 | int pictureWidth, pictureHeight; |
| 125 | |
Eino-Ville Talvala | 11b7cde | 2012-06-15 12:37:35 -0700 | [diff] [blame] | 126 | int32_t jpegThumbSize[2]; |
| 127 | int32_t jpegQuality, jpegThumbQuality; |
| 128 | int32_t jpegRotation; |
Eino-Ville Talvala | 3cca136 | 2012-06-07 10:07:18 -0700 | [diff] [blame] | 129 | |
| 130 | bool gpsEnabled; |
Eino-Ville Talvala | 11b7cde | 2012-06-15 12:37:35 -0700 | [diff] [blame] | 131 | double gpsCoordinates[3]; |
Eino-Ville Talvala | 3cca136 | 2012-06-07 10:07:18 -0700 | [diff] [blame] | 132 | int64_t gpsTimestamp; |
| 133 | String8 gpsProcessingMethod; |
| 134 | |
| 135 | int wbMode; |
| 136 | int effectMode; |
| 137 | int antibandingMode; |
| 138 | int sceneMode; |
| 139 | |
| 140 | enum flashMode_t { |
| 141 | FLASH_MODE_OFF = 0, |
| 142 | FLASH_MODE_AUTO, |
| 143 | FLASH_MODE_ON, |
| 144 | FLASH_MODE_TORCH, |
| 145 | FLASH_MODE_RED_EYE = ANDROID_CONTROL_AE_ON_AUTO_FLASH_REDEYE, |
| 146 | FLASH_MODE_INVALID = -1 |
| 147 | } flashMode; |
| 148 | |
| 149 | enum focusMode_t { |
| 150 | FOCUS_MODE_AUTO = ANDROID_CONTROL_AF_AUTO, |
| 151 | FOCUS_MODE_MACRO = ANDROID_CONTROL_AF_MACRO, |
| 152 | FOCUS_MODE_CONTINUOUS_VIDEO = ANDROID_CONTROL_AF_CONTINUOUS_VIDEO, |
| 153 | FOCUS_MODE_CONTINUOUS_PICTURE = |
| 154 | ANDROID_CONTROL_AF_CONTINUOUS_PICTURE, |
| 155 | FOCUS_MODE_EDOF = ANDROID_CONTROL_AF_EDOF, |
| 156 | FOCUS_MODE_INFINITY, |
| 157 | FOCUS_MODE_FIXED, |
| 158 | FOCUS_MODE_INVALID = -1 |
| 159 | } focusMode; |
| 160 | |
| 161 | struct Area { |
| 162 | int left, top, right, bottom; |
| 163 | int weight; |
| 164 | Area() {} |
| 165 | Area(int left, int top, int right, int bottom, int weight): |
| 166 | left(left), top(top), right(right), bottom(bottom), |
| 167 | weight(weight) {} |
| 168 | }; |
| 169 | Vector<Area> focusingAreas; |
| 170 | |
Eino-Ville Talvala | 11b7cde | 2012-06-15 12:37:35 -0700 | [diff] [blame] | 171 | int32_t exposureCompensation; |
Eino-Ville Talvala | 3cca136 | 2012-06-07 10:07:18 -0700 | [diff] [blame] | 172 | bool autoExposureLock; |
| 173 | bool autoWhiteBalanceLock; |
| 174 | |
| 175 | Vector<Area> meteringAreas; |
| 176 | |
| 177 | int zoom; |
| 178 | |
| 179 | int videoWidth, videoHeight; |
| 180 | |
| 181 | bool recordingHint; |
| 182 | bool videoStabilization; |
Eino-Ville Talvala | 78822d7 | 2012-07-18 17:52:18 -0700 | [diff] [blame] | 183 | |
Eino-Ville Talvala | 836b81f | 2012-07-27 11:35:21 -0700 | [diff] [blame] | 184 | String8 paramsFlattened; |
Eino-Ville Talvala | 36cdfb1 | 2012-08-02 17:34:15 -0700 | [diff] [blame^] | 185 | |
| 186 | // These parameters are also part of the camera API-visible state, but not directly |
| 187 | // listed in Camera.Parameters |
| 188 | bool storeMetadataInBuffers; |
| 189 | bool playShutterSound; |
Eino-Ville Talvala | 836b81f | 2012-07-27 11:35:21 -0700 | [diff] [blame] | 190 | }; |
| 191 | |
| 192 | class LockedParameters { |
| 193 | public: |
| 194 | class Key { |
| 195 | public: |
| 196 | Key(LockedParameters &p): |
| 197 | mParameters(p.mParameters), |
| 198 | mLockedParameters(p) { |
| 199 | mLockedParameters.mLock.lock(); |
| 200 | } |
| 201 | |
| 202 | ~Key() { |
| 203 | mLockedParameters.mLock.unlock(); |
| 204 | } |
| 205 | Parameters &mParameters; |
| 206 | private: |
| 207 | // Disallow copying, default construction |
| 208 | Key(); |
| 209 | Key(const Key &); |
| 210 | Key &operator=(const Key &); |
| 211 | LockedParameters &mLockedParameters; |
| 212 | }; |
| 213 | class ReadKey { |
| 214 | public: |
| 215 | ReadKey(const LockedParameters &p): |
| 216 | mParameters(p.mParameters), |
| 217 | mLockedParameters(p) { |
| 218 | mLockedParameters.mLock.lock(); |
| 219 | } |
| 220 | |
| 221 | ~ReadKey() { |
| 222 | mLockedParameters.mLock.unlock(); |
| 223 | } |
| 224 | const Parameters &mParameters; |
| 225 | private: |
| 226 | // Disallow copying, default construction |
| 227 | ReadKey(); |
| 228 | ReadKey(const ReadKey &); |
| 229 | ReadKey &operator=(const ReadKey &); |
| 230 | const LockedParameters &mLockedParameters; |
| 231 | }; |
| 232 | |
| 233 | // Only use for dumping or other debugging |
| 234 | const Parameters &unsafeUnlock() { |
| 235 | return mParameters; |
| 236 | } |
| 237 | private: |
| 238 | Parameters mParameters; |
| 239 | mutable Mutex mLock; |
| 240 | |
Eino-Ville Talvala | 3cca136 | 2012-06-07 10:07:18 -0700 | [diff] [blame] | 241 | } mParameters; |
| 242 | |
| 243 | /** Camera device-related private members */ |
| 244 | |
Eino-Ville Talvala | 9cca4c6 | 2012-06-15 15:41:44 -0700 | [diff] [blame] | 245 | class Camera2Heap; |
| 246 | |
| 247 | // Number of zoom steps to simulate |
| 248 | static const unsigned int NUM_ZOOM_STEPS = 10; |
| 249 | // Used with stream IDs |
| 250 | static const int NO_STREAM = -1; |
| 251 | |
| 252 | /* Preview related members */ |
| 253 | |
| 254 | int mPreviewStreamId; |
| 255 | camera_metadata_t *mPreviewRequest; |
| 256 | sp<IBinder> mPreviewSurface; |
| 257 | sp<ANativeWindow> mPreviewWindow; |
Eino-Ville Talvala | 836b81f | 2012-07-27 11:35:21 -0700 | [diff] [blame] | 258 | |
| 259 | status_t updatePreviewRequest(const Parameters ¶ms); |
| 260 | status_t updatePreviewStream(const Parameters ¶ms); |
Eino-Ville Talvala | 9cca4c6 | 2012-06-15 15:41:44 -0700 | [diff] [blame] | 261 | |
| 262 | /* Still image capture related members */ |
| 263 | |
| 264 | int mCaptureStreamId; |
| 265 | sp<CpuConsumer> mCaptureConsumer; |
| 266 | sp<ANativeWindow> mCaptureWindow; |
Eino-Ville Talvala | d4bcfde | 2012-06-07 17:12:38 -0700 | [diff] [blame] | 267 | // Simple listener that forwards frame available notifications from |
| 268 | // a CPU consumer to the capture notification |
| 269 | class CaptureWaiter: public CpuConsumer::FrameAvailableListener { |
| 270 | public: |
| 271 | CaptureWaiter(Camera2Client *parent) : mParent(parent) {} |
| 272 | void onFrameAvailable() { mParent->onCaptureAvailable(); } |
| 273 | private: |
| 274 | Camera2Client *mParent; |
| 275 | }; |
Eino-Ville Talvala | d4bcfde | 2012-06-07 17:12:38 -0700 | [diff] [blame] | 276 | sp<CaptureWaiter> mCaptureWaiter; |
Eino-Ville Talvala | 3cca136 | 2012-06-07 10:07:18 -0700 | [diff] [blame] | 277 | camera_metadata_t *mCaptureRequest; |
Eino-Ville Talvala | 9cca4c6 | 2012-06-15 15:41:44 -0700 | [diff] [blame] | 278 | sp<Camera2Heap> mCaptureHeap; |
| 279 | // Handle captured image buffers |
| 280 | void onCaptureAvailable(); |
Eino-Ville Talvala | 836b81f | 2012-07-27 11:35:21 -0700 | [diff] [blame] | 281 | |
| 282 | status_t updateCaptureRequest(const Parameters ¶ms); |
| 283 | status_t updateCaptureStream(const Parameters ¶ms); |
Eino-Ville Talvala | 9cca4c6 | 2012-06-15 15:41:44 -0700 | [diff] [blame] | 284 | |
| 285 | /* Recording related members */ |
| 286 | |
| 287 | int mRecordingStreamId; |
Eino-Ville Talvala | 78822d7 | 2012-07-18 17:52:18 -0700 | [diff] [blame] | 288 | sp<MediaConsumer> mRecordingConsumer; |
Eino-Ville Talvala | 9cca4c6 | 2012-06-15 15:41:44 -0700 | [diff] [blame] | 289 | sp<ANativeWindow> mRecordingWindow; |
| 290 | // Simple listener that forwards frame available notifications from |
| 291 | // a CPU consumer to the recording notification |
Eino-Ville Talvala | 78822d7 | 2012-07-18 17:52:18 -0700 | [diff] [blame] | 292 | class RecordingWaiter: public MediaConsumer::FrameAvailableListener { |
Eino-Ville Talvala | 9cca4c6 | 2012-06-15 15:41:44 -0700 | [diff] [blame] | 293 | public: |
| 294 | RecordingWaiter(Camera2Client *parent) : mParent(parent) {} |
| 295 | void onFrameAvailable() { mParent->onRecordingFrameAvailable(); } |
| 296 | private: |
| 297 | Camera2Client *mParent; |
| 298 | }; |
| 299 | sp<RecordingWaiter> mRecordingWaiter; |
| 300 | camera_metadata_t *mRecordingRequest; |
| 301 | sp<Camera2Heap> mRecordingHeap; |
| 302 | |
| 303 | // TODO: This needs to be queried from somewhere, or the BufferQueue needs |
Eino-Ville Talvala | 803cbf6 | 2012-07-25 15:23:36 -0700 | [diff] [blame] | 304 | // to be passed all the way to stagefright. Right now, set to a large number |
| 305 | // to avoid starvation of the video encoders. |
James Dong | 983cf23 | 2012-08-01 16:39:55 -0700 | [diff] [blame] | 306 | static const size_t kDefaultRecordingHeapCount = 8; |
| 307 | size_t mRecordingHeapCount; |
Eino-Ville Talvala | 9cca4c6 | 2012-06-15 15:41:44 -0700 | [diff] [blame] | 308 | size_t mRecordingHeapHead, mRecordingHeapFree; |
| 309 | // Handle new recording image buffers |
| 310 | void onRecordingFrameAvailable(); |
Eino-Ville Talvala | 836b81f | 2012-07-27 11:35:21 -0700 | [diff] [blame] | 311 | |
| 312 | status_t updateRecordingRequest(const Parameters ¶ms); |
| 313 | status_t updateRecordingStream(const Parameters ¶ms); |
Eino-Ville Talvala | 9cca4c6 | 2012-06-15 15:41:44 -0700 | [diff] [blame] | 314 | |
| 315 | /** Camera2Device instance wrapping HAL2 entry */ |
Eino-Ville Talvala | 3cca136 | 2012-06-07 10:07:18 -0700 | [diff] [blame] | 316 | |
| 317 | sp<Camera2Device> mDevice; |
| 318 | |
Eino-Ville Talvala | 9cca4c6 | 2012-06-15 15:41:44 -0700 | [diff] [blame] | 319 | /** Utility members */ |
| 320 | |
Eino-Ville Talvala | 3a60914 | 2012-07-31 14:36:26 -0700 | [diff] [blame] | 321 | // Verify that caller is the owner of the camera |
| 322 | status_t checkPid(const char *checkLocation) const; |
| 323 | |
Eino-Ville Talvala | 9cca4c6 | 2012-06-15 15:41:44 -0700 | [diff] [blame] | 324 | // Utility class for managing a set of IMemory blocks |
| 325 | class Camera2Heap : public RefBase { |
| 326 | public: |
| 327 | Camera2Heap(size_t buf_size, uint_t num_buffers = 1, |
| 328 | const char *name = NULL) : |
| 329 | mBufSize(buf_size), |
| 330 | mNumBufs(num_buffers) { |
| 331 | mHeap = new MemoryHeapBase(buf_size * num_buffers, 0, name); |
| 332 | mBuffers = new sp<MemoryBase>[mNumBufs]; |
| 333 | for (uint_t i = 0; i < mNumBufs; i++) |
| 334 | mBuffers[i] = new MemoryBase(mHeap, |
| 335 | i * mBufSize, |
| 336 | mBufSize); |
| 337 | } |
| 338 | |
| 339 | virtual ~Camera2Heap() |
| 340 | { |
| 341 | delete [] mBuffers; |
| 342 | } |
| 343 | |
| 344 | size_t mBufSize; |
| 345 | uint_t mNumBufs; |
| 346 | sp<MemoryHeapBase> mHeap; |
| 347 | sp<MemoryBase> *mBuffers; |
| 348 | }; |
Eino-Ville Talvala | 3cca136 | 2012-06-07 10:07:18 -0700 | [diff] [blame] | 349 | |
| 350 | // Get values for static camera info entry. min/maxCount are used for error |
| 351 | // checking the number of values in the entry. 0 for max/minCount means to |
| 352 | // do no bounds check in that direction. In case of error, the entry data |
| 353 | // pointer is null and the count is 0. |
| 354 | camera_metadata_entry_t staticInfo(uint32_t tag, |
| 355 | size_t minCount=0, size_t maxCount=0); |
| 356 | |
Eino-Ville Talvala | f69c70d | 2012-05-20 15:59:14 -0700 | [diff] [blame] | 357 | // Convert static camera info from a camera2 device to the |
| 358 | // old API parameter map. |
| 359 | status_t buildDefaultParameters(); |
Eino-Ville Talvala | 61ab9f9 | 2012-05-17 10:30:54 -0700 | [diff] [blame] | 360 | |
Eino-Ville Talvala | be0573b | 2012-06-15 12:42:30 -0700 | [diff] [blame] | 361 | // Update parameters all requests use, based on mParameters |
Eino-Ville Talvala | 836b81f | 2012-07-27 11:35:21 -0700 | [diff] [blame] | 362 | status_t updateRequestCommon(camera_metadata_t *request, const Parameters ¶ms); |
Eino-Ville Talvala | be0573b | 2012-06-15 12:42:30 -0700 | [diff] [blame] | 363 | |
| 364 | // Update specific metadata entry with new values. Adds entry if it does not |
| 365 | // exist, which will invalidate sorting |
| 366 | static status_t updateEntry(camera_metadata_t *buffer, |
| 367 | uint32_t tag, const void *data, size_t data_count); |
| 368 | |
| 369 | // Remove metadata entry. Will invalidate sorting. If entry does not exist, |
| 370 | // does nothing. |
| 371 | static status_t deleteEntry(camera_metadata_t *buffer, |
| 372 | uint32_t tag); |
| 373 | |
Eino-Ville Talvala | 6861a4e | 2012-06-07 10:32:12 -0700 | [diff] [blame] | 374 | // Convert camera1 preview format string to camera2 enum |
| 375 | static int formatStringToEnum(const char *format); |
Eino-Ville Talvala | 3cca136 | 2012-06-07 10:07:18 -0700 | [diff] [blame] | 376 | static const char *formatEnumToString(int format); |
Eino-Ville Talvala | 6861a4e | 2012-06-07 10:32:12 -0700 | [diff] [blame] | 377 | |
| 378 | static int wbModeStringToEnum(const char *wbMode); |
| 379 | static int effectModeStringToEnum(const char *effectMode); |
| 380 | static int abModeStringToEnum(const char *abMode); |
| 381 | static int sceneModeStringToEnum(const char *sceneMode); |
| 382 | static Parameters::flashMode_t flashModeStringToEnum(const char *flashMode); |
| 383 | static Parameters::focusMode_t focusModeStringToEnum(const char *focusMode); |
| 384 | static status_t parseAreas(const char *areasCStr, |
| 385 | Vector<Parameters::Area> *areas); |
| 386 | static status_t validateAreas(const Vector<Parameters::Area> &areas, |
| 387 | size_t maxRegions); |
| 388 | static bool boolFromString(const char *boolStr); |
Eino-Ville Talvala | c94cd19 | 2012-06-15 12:47:42 -0700 | [diff] [blame] | 389 | |
| 390 | // Map from camera orientation + facing to gralloc transform enum |
| 391 | static int degToTransform(int degrees, bool mirror); |
Eino-Ville Talvala | 61ab9f9 | 2012-05-17 10:30:54 -0700 | [diff] [blame] | 392 | }; |
| 393 | |
| 394 | }; // namespace android |
| 395 | |
| 396 | #endif |