Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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_HARDWARE_CAMERA_PARAMETERS_H |
| 18 | #define ANDROID_HARDWARE_CAMERA_PARAMETERS_H |
| 19 | |
| 20 | #include <utils/KeyedVector.h> |
| 21 | #include <utils/String8.h> |
| 22 | |
| 23 | namespace android { |
| 24 | |
Nipun Kwatra | 34c91a3 | 2010-07-30 13:40:14 -0700 | [diff] [blame] | 25 | struct Size { |
| 26 | int width; |
| 27 | int height; |
| 28 | |
| 29 | Size() { |
| 30 | width = 0; |
| 31 | height = 0; |
| 32 | } |
| 33 | |
| 34 | Size(int w, int h) { |
| 35 | width = w; |
| 36 | height = h; |
| 37 | } |
| 38 | }; |
| 39 | |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 40 | class CameraParameters |
| 41 | { |
| 42 | public: |
| 43 | CameraParameters(); |
| 44 | CameraParameters(const String8 ¶ms) { unflatten(params); } |
| 45 | ~CameraParameters(); |
| 46 | |
| 47 | String8 flatten() const; |
| 48 | void unflatten(const String8 ¶ms); |
| 49 | |
| 50 | void set(const char *key, const char *value); |
| 51 | void set(const char *key, int value); |
| 52 | void setFloat(const char *key, float value); |
| 53 | const char *get(const char *key) const; |
| 54 | int getInt(const char *key) const; |
| 55 | float getFloat(const char *key) const; |
| 56 | |
Wu-cheng Li | adbda96 | 2010-05-11 12:11:56 +0800 | [diff] [blame] | 57 | void remove(const char *key); |
| 58 | |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 59 | void setPreviewSize(int width, int height); |
| 60 | void getPreviewSize(int *width, int *height) const; |
Nipun Kwatra | e44607e | 2010-08-04 14:04:07 -0700 | [diff] [blame] | 61 | void getSupportedPreviewSizes(Vector<Size> &sizes) const; |
James Dong | 0d14c25 | 2010-09-30 10:50:51 -0700 | [diff] [blame] | 62 | |
| 63 | // Set the dimensions in pixels to the given width and height |
| 64 | // for video frames. The given width and height must be one |
| 65 | // of the supported dimensions returned from |
| 66 | // getSupportedVideoSizes(). Must not be called if |
| 67 | // getSupportedVideoSizes() returns an empty Vector of Size. |
| 68 | void setVideoSize(int width, int height); |
| 69 | // Retrieve the current dimensions (width and height) |
| 70 | // in pixels for video frames, which must be one of the |
| 71 | // supported dimensions returned from getSupportedVideoSizes(). |
| 72 | // Must not be called if getSupportedVideoSizes() returns an |
| 73 | // empty Vector of Size. |
| 74 | void getVideoSize(int *width, int *height) const; |
| 75 | // Retrieve a Vector of supported dimensions (width and height) |
| 76 | // in pixels for video frames. If sizes returned from the method |
| 77 | // is empty, the camera does not support calls to setVideoSize() |
| 78 | // or getVideoSize(). In adddition, it also indicates that |
| 79 | // the camera only has a single output, and does not have |
| 80 | // separate output for video frames and preview frame. |
| 81 | void getSupportedVideoSizes(Vector<Size> &sizes) const; |
James Dong | 0f5a6f9 | 2010-11-29 16:51:55 -0800 | [diff] [blame] | 82 | // Retrieve the preferred preview size (width and height) in pixels |
| 83 | // for video recording. The given width and height must be one of |
| 84 | // supported preview sizes returned from getSupportedPreviewSizes(). |
| 85 | // Must not be called if getSupportedVideoSizes() returns an empty |
| 86 | // Vector of Size. If getSupportedVideoSizes() returns an empty |
| 87 | // Vector of Size, the width and height returned from this method |
| 88 | // is invalid, and is "-1x-1". |
| 89 | void getPreferredPreviewSizeForVideo(int *width, int *height) const; |
James Dong | 0d14c25 | 2010-09-30 10:50:51 -0700 | [diff] [blame] | 90 | |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 91 | void setPreviewFrameRate(int fps); |
| 92 | int getPreviewFrameRate() const; |
Wu-cheng Li | 04379fa | 2010-08-11 16:48:05 -0700 | [diff] [blame] | 93 | void getPreviewFpsRange(int *min_fps, int *max_fps) const; |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 94 | void setPreviewFormat(const char *format); |
| 95 | const char *getPreviewFormat() const; |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 96 | void setPictureSize(int width, int height); |
| 97 | void getPictureSize(int *width, int *height) const; |
Nipun Kwatra | 34c91a3 | 2010-07-30 13:40:14 -0700 | [diff] [blame] | 98 | void getSupportedPictureSizes(Vector<Size> &sizes) const; |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 99 | void setPictureFormat(const char *format); |
| 100 | const char *getPictureFormat() const; |
| 101 | |
| 102 | void dump() const; |
| 103 | status_t dump(int fd, const Vector<String16>& args) const; |
| 104 | |
| 105 | // Parameter keys to communicate between camera application and driver. |
| 106 | // The access (read/write, read only, or write only) is viewed from the |
| 107 | // perspective of applications, not driver. |
| 108 | |
| 109 | // Preview frame size in pixels (width x height). |
| 110 | // Example value: "480x320". Read/Write. |
| 111 | static const char KEY_PREVIEW_SIZE[]; |
| 112 | // Supported preview frame sizes in pixels. |
| 113 | // Example value: "800x600,480x320". Read only. |
| 114 | static const char KEY_SUPPORTED_PREVIEW_SIZES[]; |
Wu-cheng Li | 04379fa | 2010-08-11 16:48:05 -0700 | [diff] [blame] | 115 | // The current minimum and maximum preview fps. This controls the rate of |
| 116 | // preview frames received (CAMERA_MSG_PREVIEW_FRAME). The minimum and |
| 117 | // maximum fps must be one of the elements from |
| 118 | // KEY_SUPPORTED_PREVIEW_FPS_RANGE parameter. |
| 119 | // Example value: "10500,26623" |
| 120 | static const char KEY_PREVIEW_FPS_RANGE[]; |
| 121 | // The supported preview fps (frame-per-second) ranges. Each range contains |
| 122 | // a minimum fps and maximum fps. If minimum fps equals to maximum fps, the |
| 123 | // camera outputs frames in fixed frame rate. If not, the camera outputs |
| 124 | // frames in auto frame rate. The actual frame rate fluctuates between the |
| 125 | // minimum and the maximum. The list has at least one element. The list is |
| 126 | // sorted from small to large (first by maximum fps and then minimum fps). |
| 127 | // Example value: "(10500,26623),(15000,26623),(30000,30000)" |
| 128 | static const char KEY_SUPPORTED_PREVIEW_FPS_RANGE[]; |
Wu-cheng Li | 0b0279e | 2010-05-28 17:32:41 +0800 | [diff] [blame] | 129 | // The image format for preview frames. See CAMERA_MSG_PREVIEW_FRAME in |
| 130 | // frameworks/base/include/camera/Camera.h. |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 131 | // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read/write. |
| 132 | static const char KEY_PREVIEW_FORMAT[]; |
| 133 | // Supported image formats for preview frames. |
| 134 | // Example value: "yuv420sp,yuv422i-yuyv". Read only. |
| 135 | static const char KEY_SUPPORTED_PREVIEW_FORMATS[]; |
Wu-cheng Li | 0b0279e | 2010-05-28 17:32:41 +0800 | [diff] [blame] | 136 | // Number of preview frames per second. This is the target frame rate. The |
| 137 | // actual frame rate depends on the driver. |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 138 | // Example value: "15". Read/write. |
| 139 | static const char KEY_PREVIEW_FRAME_RATE[]; |
| 140 | // Supported number of preview frames per second. |
| 141 | // Example value: "24,15,10". Read. |
| 142 | static const char KEY_SUPPORTED_PREVIEW_FRAME_RATES[]; |
| 143 | // The dimensions for captured pictures in pixels (width x height). |
| 144 | // Example value: "1024x768". Read/write. |
| 145 | static const char KEY_PICTURE_SIZE[]; |
| 146 | // Supported dimensions for captured pictures in pixels. |
| 147 | // Example value: "2048x1536,1024x768". Read only. |
| 148 | static const char KEY_SUPPORTED_PICTURE_SIZES[]; |
Wu-cheng Li | 0b0279e | 2010-05-28 17:32:41 +0800 | [diff] [blame] | 149 | // The image format for captured pictures. See CAMERA_MSG_COMPRESSED_IMAGE |
| 150 | // in frameworks/base/include/camera/Camera.h. |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 151 | // Example value: "jpeg" or PIXEL_FORMAT_XXX constants. Read/write. |
| 152 | static const char KEY_PICTURE_FORMAT[]; |
| 153 | // Supported image formats for captured pictures. |
| 154 | // Example value: "jpeg,rgb565". Read only. |
| 155 | static const char KEY_SUPPORTED_PICTURE_FORMATS[]; |
| 156 | // The width (in pixels) of EXIF thumbnail in Jpeg picture. |
| 157 | // Example value: "512". Read/write. |
| 158 | static const char KEY_JPEG_THUMBNAIL_WIDTH[]; |
| 159 | // The height (in pixels) of EXIF thumbnail in Jpeg picture. |
| 160 | // Example value: "384". Read/write. |
| 161 | static const char KEY_JPEG_THUMBNAIL_HEIGHT[]; |
| 162 | // Supported EXIF thumbnail sizes (width x height). 0x0 means not thumbnail |
| 163 | // in EXIF. |
| 164 | // Example value: "512x384,320x240,0x0". Read only. |
| 165 | static const char KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES[]; |
| 166 | // The quality of the EXIF thumbnail in Jpeg picture. The range is 1 to 100, |
| 167 | // with 100 being the best. |
| 168 | // Example value: "90". Read/write. |
| 169 | static const char KEY_JPEG_THUMBNAIL_QUALITY[]; |
| 170 | // Jpeg quality of captured picture. The range is 1 to 100, with 100 being |
| 171 | // the best. |
| 172 | // Example value: "90". Read/write. |
| 173 | static const char KEY_JPEG_QUALITY[]; |
Wu-cheng Li | c2c8868 | 2010-11-19 15:56:16 +0800 | [diff] [blame] | 174 | // The rotation angle in degrees relative to the orientation of the camera. |
| 175 | // This affects the pictures returned from CAMERA_MSG_COMPRESSED_IMAGE. The |
| 176 | // camera driver may set orientation in the EXIF header without rotating the |
| 177 | // picture. Or the driver may rotate the picture and the EXIF thumbnail. If |
| 178 | // the Jpeg picture is rotated, the orientation in the EXIF header will be |
| 179 | // missing or 1 (row #0 is top and column #0 is left side). |
| 180 | // |
| 181 | // Note that the JPEG pictures of front-facing cameras are not mirrored |
| 182 | // as in preview display. |
| 183 | // |
| 184 | // For example, suppose the natural orientation of the device is portrait. |
| 185 | // The device is rotated 270 degrees clockwise, so the device orientation is |
| 186 | // 270. Suppose a back-facing camera sensor is mounted in landscape and the |
| 187 | // top side of the camera sensor is aligned with the right edge of the |
| 188 | // display in natural orientation. So the camera orientation is 90. The |
| 189 | // rotation should be set to 0 (270 + 90). |
| 190 | // |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 191 | // Example value: "0" or "90" or "180" or "270". Write only. |
| 192 | static const char KEY_ROTATION[]; |
Wu-cheng Li | 6b19fac | 2010-05-21 17:52:42 +0800 | [diff] [blame] | 193 | // GPS latitude coordinate. GPSLatitude and GPSLatitudeRef will be stored in |
| 194 | // JPEG EXIF header. |
| 195 | // Example value: "25.032146" or "-33.462809". Write only. |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 196 | static const char KEY_GPS_LATITUDE[]; |
Wu-cheng Li | 6b19fac | 2010-05-21 17:52:42 +0800 | [diff] [blame] | 197 | // GPS longitude coordinate. GPSLongitude and GPSLongitudeRef will be stored |
| 198 | // in JPEG EXIF header. |
| 199 | // Example value: "121.564448" or "-70.660286". Write only. |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 200 | static const char KEY_GPS_LONGITUDE[]; |
Wu-cheng Li | 6b19fac | 2010-05-21 17:52:42 +0800 | [diff] [blame] | 201 | // GPS altitude. GPSAltitude and GPSAltitudeRef will be stored in JPEG EXIF |
| 202 | // header. |
| 203 | // Example value: "21.0" or "-5". Write only. |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 204 | static const char KEY_GPS_ALTITUDE[]; |
| 205 | // GPS timestamp (UTC in seconds since January 1, 1970). This should be |
| 206 | // stored in JPEG EXIF header. |
| 207 | // Example value: "1251192757". Write only. |
| 208 | static const char KEY_GPS_TIMESTAMP[]; |
Ray Chen | c0170bc | 2010-02-23 10:45:42 +0800 | [diff] [blame] | 209 | // GPS Processing Method |
| 210 | // Example value: "GPS" or "NETWORK". Write only. |
| 211 | static const char KEY_GPS_PROCESSING_METHOD[]; |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 212 | // Current white balance setting. |
| 213 | // Example value: "auto" or WHITE_BALANCE_XXX constants. Read/write. |
| 214 | static const char KEY_WHITE_BALANCE[]; |
| 215 | // Supported white balance settings. |
| 216 | // Example value: "auto,incandescent,daylight". Read only. |
| 217 | static const char KEY_SUPPORTED_WHITE_BALANCE[]; |
| 218 | // Current color effect setting. |
| 219 | // Example value: "none" or EFFECT_XXX constants. Read/write. |
| 220 | static const char KEY_EFFECT[]; |
| 221 | // Supported color effect settings. |
| 222 | // Example value: "none,mono,sepia". Read only. |
| 223 | static const char KEY_SUPPORTED_EFFECTS[]; |
| 224 | // Current antibanding setting. |
| 225 | // Example value: "auto" or ANTIBANDING_XXX constants. Read/write. |
| 226 | static const char KEY_ANTIBANDING[]; |
| 227 | // Supported antibanding settings. |
| 228 | // Example value: "auto,50hz,60hz,off". Read only. |
| 229 | static const char KEY_SUPPORTED_ANTIBANDING[]; |
| 230 | // Current scene mode. |
| 231 | // Example value: "auto" or SCENE_MODE_XXX constants. Read/write. |
| 232 | static const char KEY_SCENE_MODE[]; |
| 233 | // Supported scene mode settings. |
| 234 | // Example value: "auto,night,fireworks". Read only. |
| 235 | static const char KEY_SUPPORTED_SCENE_MODES[]; |
| 236 | // Current flash mode. |
| 237 | // Example value: "auto" or FLASH_MODE_XXX constants. Read/write. |
| 238 | static const char KEY_FLASH_MODE[]; |
| 239 | // Supported flash modes. |
| 240 | // Example value: "auto,on,off". Read only. |
| 241 | static const char KEY_SUPPORTED_FLASH_MODES[]; |
Wu-cheng Li | c6e88fd | 2010-08-05 11:50:25 -0700 | [diff] [blame] | 242 | // Current focus mode. This will not be empty. Applications should call |
| 243 | // CameraHardwareInterface.autoFocus to start the focus if focus mode is |
| 244 | // FOCUS_MODE_AUTO or FOCUS_MODE_MACRO. |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 245 | // Example value: "auto" or FOCUS_MODE_XXX constants. Read/write. |
| 246 | static const char KEY_FOCUS_MODE[]; |
| 247 | // Supported focus modes. |
| 248 | // Example value: "auto,macro,fixed". Read only. |
| 249 | static const char KEY_SUPPORTED_FOCUS_MODES[]; |
Wu-cheng Li | a1c3d37 | 2011-04-02 06:19:46 +0800 | [diff] [blame] | 250 | // The maximum number of focus areas supported. This is the maximum length |
| 251 | // of KEY_FOCUS_AREAS. |
| 252 | // Example value: "0" or "2". Read only. |
| 253 | static const char KEY_MAX_NUM_FOCUS_AREAS[]; |
| 254 | // Current focus areas. |
| 255 | // |
| 256 | // Before accessing this parameter, apps should check |
| 257 | // KEY_MAX_NUM_FOCUS_AREAS first to know the maximum number of focus areas |
| 258 | // first. If the value is 0, focus area is not supported. |
| 259 | // |
| 260 | // Each focus area is a five-element int array. The first four elements are |
| 261 | // the rectangle of the area (left, top, right, bottom). The direction is |
| 262 | // relative to the sensor orientation, that is, what the sensor sees. The |
| 263 | // direction is not affected by the rotation or mirroring of |
| 264 | // CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates range from -1000 to 1000. |
| 265 | // (-1000,-1000) is the upper left point. (1000, 1000) is the lower right |
Wu-cheng Li | 0c08325 | 2011-06-07 18:23:14 +0800 | [diff] [blame^] | 266 | // point. The width and height of focus areas cannot be 0 or negative. |
Wu-cheng Li | a1c3d37 | 2011-04-02 06:19:46 +0800 | [diff] [blame] | 267 | // |
Eino-Ville Talvala | 44ada65 | 2011-04-21 09:23:15 -0700 | [diff] [blame] | 268 | // The fifth element is the weight. Values for weight must range from 1 to |
| 269 | // 1000. The weight should be interpreted as a per-pixel weight - all |
| 270 | // pixels in the area have the specified weight. This means a small area |
| 271 | // with the same weight as a larger area will have less influence on the |
| 272 | // focusing than the larger area. Focus areas can partially overlap and the |
| 273 | // driver will add the weights in the overlap region. |
Wu-cheng Li | a1c3d37 | 2011-04-02 06:19:46 +0800 | [diff] [blame] | 274 | // |
| 275 | // A special case of single focus area (0,0,0,0,0) means driver to decide |
| 276 | // the focus area. For example, the driver may use more signals to decide |
| 277 | // focus areas and change them dynamically. Apps can set (0,0,0,0,0) if they |
| 278 | // want the driver to decide focus areas. |
| 279 | // |
| 280 | // Focus areas are relative to the current field of view (KEY_ZOOM). No |
| 281 | // matter what the zoom level is, (-1000,-1000) represents the top of the |
| 282 | // currently visible camera frame. The focus area cannot be set to be |
| 283 | // outside the current field of view, even when using zoom. |
| 284 | // |
| 285 | // Focus area only has effect if the current focus mode is FOCUS_MODE_AUTO, |
| 286 | // FOCUS_MODE_MACRO, or FOCUS_MODE_CONTINOUS_VIDEO. |
| 287 | // Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write. |
| 288 | static const char KEY_FOCUS_AREAS[]; |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 289 | // Focal length in millimeter. |
| 290 | // Example value: "4.31". Read only. |
| 291 | static const char KEY_FOCAL_LENGTH[]; |
| 292 | // Horizontal angle of view in degrees. |
| 293 | // Example value: "54.8". Read only. |
| 294 | static const char KEY_HORIZONTAL_VIEW_ANGLE[]; |
| 295 | // Vertical angle of view in degrees. |
| 296 | // Example value: "42.5". Read only. |
| 297 | static const char KEY_VERTICAL_VIEW_ANGLE[]; |
Wu-cheng Li | 4f1bff9 | 2010-02-20 17:47:04 +0800 | [diff] [blame] | 298 | // Exposure compensation index. 0 means exposure is not adjusted. |
| 299 | // Example value: "0" or "5". Read/write. |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 300 | static const char KEY_EXPOSURE_COMPENSATION[]; |
Wu-cheng Li | 4f1bff9 | 2010-02-20 17:47:04 +0800 | [diff] [blame] | 301 | // The maximum exposure compensation index (>=0). |
| 302 | // Example value: "6". Read only. |
| 303 | static const char KEY_MAX_EXPOSURE_COMPENSATION[]; |
| 304 | // The minimum exposure compensation index (<=0). |
| 305 | // Example value: "-6". Read only. |
| 306 | static const char KEY_MIN_EXPOSURE_COMPENSATION[]; |
| 307 | // The exposure compensation step. Exposure compensation index multiply by |
| 308 | // step eqals to EV. Ex: if exposure compensation index is 6 and step is |
| 309 | // 0.3333, EV is -2. |
| 310 | // Example value: "0.333333333" or "0.5". Read only. |
| 311 | static const char KEY_EXPOSURE_COMPENSATION_STEP[]; |
Eino-Ville Talvala | fd99e1d | 2011-05-13 10:19:59 -0700 | [diff] [blame] | 312 | // The state of the auto-exposure lock. "true" means that |
| 313 | // auto-exposure is locked to its current value and will not |
| 314 | // change. "false" means the auto-exposure routine is free to |
| 315 | // change exposure values. If auto-exposure is already locked, |
| 316 | // setting this to true again has no effect (the driver will not |
| 317 | // recalculate exposure values). Changing exposure compensation |
| 318 | // settings will still affect the exposure settings while |
| 319 | // auto-exposure is locked. Stopping preview or taking a still |
| 320 | // image will release the lock. However, the lock can be |
| 321 | // re-enabled prior to preview being re-started, to keep the |
| 322 | // exposure values from the previous lock. In conjunction with |
| 323 | // exposure compensation, this allows for capturing multi-exposure |
| 324 | // brackets with known relative exposure values. Locking |
| 325 | // auto-exposure after open but before the first call to |
| 326 | // startPreview may result in severely over- or under-exposed |
| 327 | // images. The driver may independently enable the AE lock after |
| 328 | // auto-focus completes. If it does so, this key must have its |
| 329 | // value updated to reflect the lock's existence. Applications are |
| 330 | // free to release such a lock, to re-enable AE without restarting |
| 331 | // preview. |
Eino-Ville Talvala | 95fbf2c | 2011-04-15 13:51:42 -0700 | [diff] [blame] | 332 | static const char KEY_AUTO_EXPOSURE_LOCK[]; |
| 333 | // Whether locking the auto-exposure is supported. "true" means it is, and |
| 334 | // "false" or this key not existing means it is not supported. |
| 335 | static const char KEY_AUTO_EXPOSURE_LOCK_SUPPORTED[]; |
Eino-Ville Talvala | fd99e1d | 2011-05-13 10:19:59 -0700 | [diff] [blame] | 336 | // The state of the auto-white balance lock. "true" means that |
| 337 | // auto-white balance is locked to its current value and will not |
| 338 | // change. "false" means the auto-white balance routine is free to |
| 339 | // change white balance values. If auto-white balance is already |
| 340 | // locked, setting this to true again has no effect (the driver |
| 341 | // will not recalculate white balance values). Stopping preview or |
| 342 | // taking a still image will release the lock. However, the lock |
| 343 | // can be re-enabled prior to preview being re-started, to keep |
| 344 | // the white balance values from the previous lock. In conjunction |
| 345 | // with exposure compensation, this allows for capturing |
| 346 | // multi-exposure brackets with fixed white balance. Locking |
| 347 | // auto-white balance after open but before the first call to |
| 348 | // startPreview may result in severely incorrect color. The |
| 349 | // driver may independently enable the AWB lock after auto-focus |
| 350 | // completes. If it does so, this key must have its value updated |
| 351 | // to reflect the lock's existence. Applications are free to |
| 352 | // release such a lock, to re-enable AWB without restarting |
| 353 | // preview. |
| 354 | static const char KEY_AUTO_WHITEBALANCE_LOCK[]; |
| 355 | // Whether locking the auto-white balance is supported. "true" |
| 356 | // means it is, and "false" or this key not existing means it is |
| 357 | // not supported. |
| 358 | static const char KEY_AUTO_WHITEBALANCE_LOCK_SUPPORTED[]; |
| 359 | |
Wu-cheng Li | 38ecadb | 2011-04-12 19:34:29 +0800 | [diff] [blame] | 360 | // The maximum number of metering areas supported. This is the maximum |
| 361 | // length of KEY_METERING_AREAS. |
| 362 | // Example value: "0" or "2". Read only. |
| 363 | static const char KEY_MAX_NUM_METERING_AREAS[]; |
| 364 | // Current metering areas. Camera driver uses these areas to decide |
| 365 | // exposure. |
| 366 | // |
| 367 | // Before accessing this parameter, apps should check |
| 368 | // KEY_MAX_NUM_METERING_AREAS first to know the maximum number of metering |
| 369 | // areas first. If the value is 0, metering area is not supported. |
| 370 | // |
| 371 | // Each metering area is a rectangle with specified weight. The direction is |
| 372 | // relative to the sensor orientation, that is, what the sensor sees. The |
| 373 | // direction is not affected by the rotation or mirroring of |
| 374 | // CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates of the rectangle range |
| 375 | // from -1000 to 1000. (-1000, -1000) is the upper left point. (1000, 1000) |
Wu-cheng Li | 0c08325 | 2011-06-07 18:23:14 +0800 | [diff] [blame^] | 376 | // is the lower right point. The width and height of metering areas cannot |
Wu-cheng Li | 38ecadb | 2011-04-12 19:34:29 +0800 | [diff] [blame] | 377 | // be 0 or negative. |
| 378 | // |
Eino-Ville Talvala | 44ada65 | 2011-04-21 09:23:15 -0700 | [diff] [blame] | 379 | // The fifth element is the weight. Values for weight must range from 1 to |
| 380 | // 1000. The weight should be interpreted as a per-pixel weight - all |
| 381 | // pixels in the area have the specified weight. This means a small area |
| 382 | // with the same weight as a larger area will have less influence on the |
| 383 | // metering than the larger area. Metering areas can partially overlap and |
| 384 | // the driver will add the weights in the overlap region. |
Wu-cheng Li | 38ecadb | 2011-04-12 19:34:29 +0800 | [diff] [blame] | 385 | // |
| 386 | // A special case of all-zero single metering area means driver to decide |
| 387 | // the metering area. For example, the driver may use more signals to decide |
| 388 | // metering areas and change them dynamically. Apps can set all-zero if they |
| 389 | // want the driver to decide metering areas. |
| 390 | // |
| 391 | // Metering areas are relative to the current field of view (KEY_ZOOM). |
| 392 | // No matter what the zoom level is, (-1000,-1000) represents the top of the |
| 393 | // currently visible camera frame. The metering area cannot be set to be |
| 394 | // outside the current field of view, even when using zoom. |
| 395 | // |
| 396 | // No matter what metering areas are, the final exposure are compensated |
| 397 | // by KEY_EXPOSURE_COMPENSATION. |
| 398 | // Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write. |
| 399 | static const char KEY_METERING_AREAS[]; |
Wu-cheng Li | 949c503 | 2010-02-28 23:19:55 -0800 | [diff] [blame] | 400 | // Current zoom value. |
| 401 | // Example value: "0" or "6". Read/write. |
| 402 | static const char KEY_ZOOM[]; |
| 403 | // Maximum zoom value. |
| 404 | // Example value: "6". Read only. |
| 405 | static const char KEY_MAX_ZOOM[]; |
| 406 | // The zoom ratios of all zoom values. The zoom ratio is in 1/100 |
| 407 | // increments. Ex: a zoom of 3.2x is returned as 320. The number of list |
| 408 | // elements is KEY_MAX_ZOOM + 1. The first element is always 100. The last |
| 409 | // element is the zoom ratio of zoom value KEY_MAX_ZOOM. |
| 410 | // Example value: "100,150,200,250,300,350,400". Read only. |
| 411 | static const char KEY_ZOOM_RATIOS[]; |
| 412 | // Whether zoom is supported. Zoom is supported if the value is "true". Zoom |
| 413 | // is not supported if the value is not "true" or the key does not exist. |
| 414 | // Example value: "true". Read only. |
| 415 | static const char KEY_ZOOM_SUPPORTED[]; |
| 416 | // Whether if smooth zoom is supported. Smooth zoom is supported if the |
| 417 | // value is "true". It is not supported if the value is not "true" or the |
| 418 | // key does not exist. |
| 419 | // See CAMERA_CMD_START_SMOOTH_ZOOM, CAMERA_CMD_STOP_SMOOTH_ZOOM, and |
| 420 | // CAMERA_MSG_ZOOM in frameworks/base/include/camera/Camera.h. |
| 421 | // Example value: "true". Read only. |
| 422 | static const char KEY_SMOOTH_ZOOM_SUPPORTED[]; |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 423 | |
Wu-cheng Li | 09a2ab9 | 2010-05-13 19:31:02 +0800 | [diff] [blame] | 424 | // The distances (in meters) from the camera to where an object appears to |
| 425 | // be in focus. The object is sharpest at the optimal focus distance. The |
| 426 | // depth of field is the far focus distance minus near focus distance. |
| 427 | // |
Wu-cheng Li | c6e88fd | 2010-08-05 11:50:25 -0700 | [diff] [blame] | 428 | // Focus distances may change after starting auto focus, canceling auto |
| 429 | // focus, or starting the preview. Applications can read this anytime to get |
| 430 | // the latest focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS, |
| 431 | // focus distances may change from time to time. |
| 432 | // |
| 433 | // This is intended to estimate the distance between the camera and the |
| 434 | // subject. After autofocus, the subject distance may be within near and far |
| 435 | // focus distance. However, the precision depends on the camera hardware, |
| 436 | // autofocus algorithm, the focus area, and the scene. The error can be |
| 437 | // large and it should be only used as a reference. |
Wu-cheng Li | 09a2ab9 | 2010-05-13 19:31:02 +0800 | [diff] [blame] | 438 | // |
| 439 | // Far focus distance > optimal focus distance > near focus distance. If |
| 440 | // the far focus distance is infinity, the value should be "Infinity" (case |
| 441 | // sensitive). The format is three float values separated by commas. The |
| 442 | // first is near focus distance. The second is optimal focus distance. The |
| 443 | // third is far focus distance. |
| 444 | // Example value: "0.95,1.9,Infinity" or "0.049,0.05,0.051". Read only. |
| 445 | static const char KEY_FOCUS_DISTANCES[]; |
| 446 | |
James Dong | 0d14c25 | 2010-09-30 10:50:51 -0700 | [diff] [blame] | 447 | // The current dimensions in pixels (width x height) for video frames. |
| 448 | // The width and height must be one of the supported sizes retrieved |
| 449 | // via KEY_SUPPORTED_VIDEO_SIZES. |
| 450 | // Example value: "1280x720". Read/write. |
| 451 | static const char KEY_VIDEO_SIZE[]; |
| 452 | // A list of the supported dimensions in pixels (width x height) |
| 453 | // for video frames. See CAMERA_MSG_VIDEO_FRAME for details in |
| 454 | // frameworks/base/include/camera/Camera.h. |
| 455 | // Example: "176x144,1280x720". Read only. |
| 456 | static const char KEY_SUPPORTED_VIDEO_SIZES[]; |
James Dong | 0f5a6f9 | 2010-11-29 16:51:55 -0800 | [diff] [blame] | 457 | |
| 458 | // Preferred preview frame size in pixels for video recording. |
| 459 | // The width and height must be one of the supported sizes retrieved |
| 460 | // via KEY_SUPPORTED_PREVIEW_SIZES. This key can be used only when |
| 461 | // getSupportedVideoSizes() does not return an empty Vector of Size. |
| 462 | // Camcorder applications are recommended to set the preview size |
| 463 | // to a value that is not larger than the preferred preview size. |
| 464 | // In other words, the product of the width and height of the |
| 465 | // preview size should not be larger than that of the preferred |
| 466 | // preview size. In addition, we recommend to choos a preview size |
| 467 | // that has the same aspect ratio as the resolution of video to be |
| 468 | // recorded. |
| 469 | // Example value: "800x600". Read only. |
| 470 | static const char KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[]; |
| 471 | |
Wu-cheng Li | 0b0279e | 2010-05-28 17:32:41 +0800 | [diff] [blame] | 472 | // The image format for video frames. See CAMERA_MSG_VIDEO_FRAME in |
| 473 | // frameworks/base/include/camera/Camera.h. |
| 474 | // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read only. |
| 475 | static const char KEY_VIDEO_FRAME_FORMAT[]; |
| 476 | |
Wu-cheng Li | d8d888e | 2010-03-08 15:28:48 -0800 | [diff] [blame] | 477 | // Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED. |
| 478 | static const char TRUE[]; |
Eino-Ville Talvala | 95fbf2c | 2011-04-15 13:51:42 -0700 | [diff] [blame] | 479 | static const char FALSE[]; |
Wu-cheng Li | d8d888e | 2010-03-08 15:28:48 -0800 | [diff] [blame] | 480 | |
Wu-cheng Li | 09a2ab9 | 2010-05-13 19:31:02 +0800 | [diff] [blame] | 481 | // Value for KEY_FOCUS_DISTANCES. |
Wu-cheng Li | ae77ffa | 2010-05-15 13:05:04 +0800 | [diff] [blame] | 482 | static const char FOCUS_DISTANCE_INFINITY[]; |
Wu-cheng Li | 09a2ab9 | 2010-05-13 19:31:02 +0800 | [diff] [blame] | 483 | |
Wu-cheng Li | 4f1bff9 | 2010-02-20 17:47:04 +0800 | [diff] [blame] | 484 | // Values for white balance settings. |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 485 | static const char WHITE_BALANCE_AUTO[]; |
| 486 | static const char WHITE_BALANCE_INCANDESCENT[]; |
| 487 | static const char WHITE_BALANCE_FLUORESCENT[]; |
| 488 | static const char WHITE_BALANCE_WARM_FLUORESCENT[]; |
| 489 | static const char WHITE_BALANCE_DAYLIGHT[]; |
| 490 | static const char WHITE_BALANCE_CLOUDY_DAYLIGHT[]; |
| 491 | static const char WHITE_BALANCE_TWILIGHT[]; |
| 492 | static const char WHITE_BALANCE_SHADE[]; |
| 493 | |
| 494 | // Values for effect settings. |
| 495 | static const char EFFECT_NONE[]; |
| 496 | static const char EFFECT_MONO[]; |
| 497 | static const char EFFECT_NEGATIVE[]; |
| 498 | static const char EFFECT_SOLARIZE[]; |
| 499 | static const char EFFECT_SEPIA[]; |
| 500 | static const char EFFECT_POSTERIZE[]; |
| 501 | static const char EFFECT_WHITEBOARD[]; |
| 502 | static const char EFFECT_BLACKBOARD[]; |
| 503 | static const char EFFECT_AQUA[]; |
| 504 | |
| 505 | // Values for antibanding settings. |
| 506 | static const char ANTIBANDING_AUTO[]; |
| 507 | static const char ANTIBANDING_50HZ[]; |
| 508 | static const char ANTIBANDING_60HZ[]; |
| 509 | static const char ANTIBANDING_OFF[]; |
| 510 | |
| 511 | // Values for flash mode settings. |
| 512 | // Flash will not be fired. |
| 513 | static const char FLASH_MODE_OFF[]; |
| 514 | // Flash will be fired automatically when required. The flash may be fired |
| 515 | // during preview, auto-focus, or snapshot depending on the driver. |
| 516 | static const char FLASH_MODE_AUTO[]; |
| 517 | // Flash will always be fired during snapshot. The flash may also be |
| 518 | // fired during preview or auto-focus depending on the driver. |
| 519 | static const char FLASH_MODE_ON[]; |
| 520 | // Flash will be fired in red-eye reduction mode. |
| 521 | static const char FLASH_MODE_RED_EYE[]; |
| 522 | // Constant emission of light during preview, auto-focus and snapshot. |
| 523 | // This can also be used for video recording. |
| 524 | static const char FLASH_MODE_TORCH[]; |
| 525 | |
| 526 | // Values for scene mode settings. |
| 527 | static const char SCENE_MODE_AUTO[]; |
| 528 | static const char SCENE_MODE_ACTION[]; |
| 529 | static const char SCENE_MODE_PORTRAIT[]; |
| 530 | static const char SCENE_MODE_LANDSCAPE[]; |
| 531 | static const char SCENE_MODE_NIGHT[]; |
| 532 | static const char SCENE_MODE_NIGHT_PORTRAIT[]; |
| 533 | static const char SCENE_MODE_THEATRE[]; |
| 534 | static const char SCENE_MODE_BEACH[]; |
| 535 | static const char SCENE_MODE_SNOW[]; |
| 536 | static const char SCENE_MODE_SUNSET[]; |
| 537 | static const char SCENE_MODE_STEADYPHOTO[]; |
| 538 | static const char SCENE_MODE_FIREWORKS[]; |
| 539 | static const char SCENE_MODE_SPORTS[]; |
| 540 | static const char SCENE_MODE_PARTY[]; |
| 541 | static const char SCENE_MODE_CANDLELIGHT[]; |
Wu-cheng Li | 465d5a7 | 2010-03-29 17:21:28 +0800 | [diff] [blame] | 542 | // Applications are looking for a barcode. Camera driver will be optimized |
| 543 | // for barcode reading. |
| 544 | static const char SCENE_MODE_BARCODE[]; |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 545 | |
James Dong | e2d8ba8 | 2010-09-15 16:52:51 -0700 | [diff] [blame] | 546 | // Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT, |
| 547 | // and KEY_VIDEO_FRAME_FORMAT |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 548 | static const char PIXEL_FORMAT_YUV422SP[]; |
| 549 | static const char PIXEL_FORMAT_YUV420SP[]; // NV21 |
| 550 | static const char PIXEL_FORMAT_YUV422I[]; // YUY2 |
Wu-cheng Li | d42c6e8 | 2011-02-22 15:49:25 +0800 | [diff] [blame] | 551 | static const char PIXEL_FORMAT_YUV420P[]; // YV12 |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 552 | static const char PIXEL_FORMAT_RGB565[]; |
| 553 | static const char PIXEL_FORMAT_JPEG[]; |
| 554 | |
| 555 | // Values for focus mode settings. |
Wu-cheng Li | 85b6e16 | 2010-08-17 13:44:35 -0700 | [diff] [blame] | 556 | // Auto-focus mode. Applications should call |
| 557 | // CameraHardwareInterface.autoFocus to start the focus in this mode. |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 558 | static const char FOCUS_MODE_AUTO[]; |
| 559 | // Focus is set at infinity. Applications should not call |
| 560 | // CameraHardwareInterface.autoFocus in this mode. |
| 561 | static const char FOCUS_MODE_INFINITY[]; |
Wu-cheng Li | 85b6e16 | 2010-08-17 13:44:35 -0700 | [diff] [blame] | 562 | // Macro (close-up) focus mode. Applications should call |
| 563 | // CameraHardwareInterface.autoFocus to start the focus in this mode. |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 564 | static const char FOCUS_MODE_MACRO[]; |
| 565 | // Focus is fixed. The camera is always in this mode if the focus is not |
| 566 | // adjustable. If the camera has auto-focus, this mode can fix the |
| 567 | // focus, which is usually at hyperfocal distance. Applications should |
| 568 | // not call CameraHardwareInterface.autoFocus in this mode. |
| 569 | static const char FOCUS_MODE_FIXED[]; |
Wu-cheng Li | 465d5a7 | 2010-03-29 17:21:28 +0800 | [diff] [blame] | 570 | // Extended depth of field (EDOF). Focusing is done digitally and |
| 571 | // continuously. Applications should not call |
| 572 | // CameraHardwareInterface.autoFocus in this mode. |
| 573 | static const char FOCUS_MODE_EDOF[]; |
Wu-cheng Li | ac4205c | 2010-09-20 16:15:32 -0700 | [diff] [blame] | 574 | // Continuous auto focus mode intended for video recording. The camera |
| 575 | // continuously tries to focus. This is ideal for shooting video. |
| 576 | // Applications still can call CameraHardwareInterface.takePicture in this |
| 577 | // mode but the subject may not be in focus. Auto focus starts when the |
| 578 | // parameter is set. Applications should not call |
| 579 | // CameraHardwareInterface.autoFocus in this mode. To stop continuous focus, |
| 580 | // applications should change the focus mode to other modes. |
| 581 | static const char FOCUS_MODE_CONTINUOUS_VIDEO[]; |
Wu-cheng Li | 4bf7ace | 2010-05-06 16:47:30 +0800 | [diff] [blame] | 582 | |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 583 | private: |
| 584 | DefaultKeyedVector<String8,String8> mMap; |
| 585 | }; |
| 586 | |
| 587 | }; // namespace android |
| 588 | |
| 589 | #endif |