blob: bd9efc2cc655ae64f6ca8bafc87445493e2f840c [file] [log] [blame]
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -07001/*
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
23namespace android {
24
25struct 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};
Ankit Premrajka140a9ac2011-11-21 19:25:02 -080039#ifdef QCOM_HARDWARE
40struct FPSRange{
41 int minFPS;
42 int maxFPS;
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -070043
Ankit Premrajka140a9ac2011-11-21 19:25:02 -080044 FPSRange(){
45 minFPS=0;
46 maxFPS=0;
47 };
48 FPSRange(int min,int max){
49 minFPS=min;
50 maxFPS=max;
51 };
52};
53#endif
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -070054class CameraParameters
55{
56public:
57 CameraParameters();
58 CameraParameters(const String8 &params) { unflatten(params); }
59 ~CameraParameters();
60
61 String8 flatten() const;
62 void unflatten(const String8 &params);
63
64 void set(const char *key, const char *value);
65 void set(const char *key, int value);
66 void setFloat(const char *key, float value);
67 const char *get(const char *key) const;
68 int getInt(const char *key) const;
69 float getFloat(const char *key) const;
70
71 void remove(const char *key);
72
73 void setPreviewSize(int width, int height);
74 void getPreviewSize(int *width, int *height) const;
75 void getSupportedPreviewSizes(Vector<Size> &sizes) const;
76
77 // Set the dimensions in pixels to the given width and height
78 // for video frames. The given width and height must be one
79 // of the supported dimensions returned from
80 // getSupportedVideoSizes(). Must not be called if
81 // getSupportedVideoSizes() returns an empty Vector of Size.
82 void setVideoSize(int width, int height);
83 // Retrieve the current dimensions (width and height)
84 // in pixels for video frames, which must be one of the
85 // supported dimensions returned from getSupportedVideoSizes().
86 // Must not be called if getSupportedVideoSizes() returns an
87 // empty Vector of Size.
88 void getVideoSize(int *width, int *height) const;
89 // Retrieve a Vector of supported dimensions (width and height)
90 // in pixels for video frames. If sizes returned from the method
91 // is empty, the camera does not support calls to setVideoSize()
92 // or getVideoSize(). In adddition, it also indicates that
93 // the camera only has a single output, and does not have
94 // separate output for video frames and preview frame.
95 void getSupportedVideoSizes(Vector<Size> &sizes) const;
96 // Retrieve the preferred preview size (width and height) in pixels
97 // for video recording. The given width and height must be one of
98 // supported preview sizes returned from getSupportedPreviewSizes().
99 // Must not be called if getSupportedVideoSizes() returns an empty
100 // Vector of Size. If getSupportedVideoSizes() returns an empty
101 // Vector of Size, the width and height returned from this method
102 // is invalid, and is "-1x-1".
103 void getPreferredPreviewSizeForVideo(int *width, int *height) const;
104
105 void setPreviewFrameRate(int fps);
106 int getPreviewFrameRate() const;
107 void getPreviewFpsRange(int *min_fps, int *max_fps) const;
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800108#ifdef QCOM_HARDWARE
109 void setPreviewFrameRateMode(const char *mode);
110 const char *getPreviewFrameRateMode() const;
111#endif
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700112 void setPreviewFormat(const char *format);
113 const char *getPreviewFormat() const;
114 void setPictureSize(int width, int height);
115 void getPictureSize(int *width, int *height) const;
116 void getSupportedPictureSizes(Vector<Size> &sizes) const;
117 void setPictureFormat(const char *format);
118 const char *getPictureFormat() const;
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800119#ifdef QCOM_HARDWARE
120 void setTouchIndexAec(int x, int y);
121 void getTouchIndexAec(int *x, int *y) const;
122 void setTouchIndexAf(int x, int y);
123 void getTouchIndexAf(int *x, int *y) const;
124#endif
125
126 void getMeteringAreaCenter(int * x, int *y) const;
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700127
128 void dump() const;
129 status_t dump(int fd, const Vector<String16>& args) const;
130
131 // Parameter keys to communicate between camera application and driver.
132 // The access (read/write, read only, or write only) is viewed from the
133 // perspective of applications, not driver.
134
135 // Preview frame size in pixels (width x height).
136 // Example value: "480x320". Read/Write.
137 static const char KEY_PREVIEW_SIZE[];
138 // Supported preview frame sizes in pixels.
139 // Example value: "800x600,480x320". Read only.
140 static const char KEY_SUPPORTED_PREVIEW_SIZES[];
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800141#ifdef QCOM_HARDWARE
142 // Supported PREVIEW/RECORDING SIZES IN HIGH FRAME RATE recording, sizes in pixels.
143 // Example value: "800x480,432x320". Read only.
144 static const char KEY_SUPPORTED_HFR_SIZES[];
145#endif
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700146 // The current minimum and maximum preview fps. This controls the rate of
147 // preview frames received (CAMERA_MSG_PREVIEW_FRAME). The minimum and
148 // maximum fps must be one of the elements from
149 // KEY_SUPPORTED_PREVIEW_FPS_RANGE parameter.
150 // Example value: "10500,26623"
151 static const char KEY_PREVIEW_FPS_RANGE[];
152 // The supported preview fps (frame-per-second) ranges. Each range contains
153 // a minimum fps and maximum fps. If minimum fps equals to maximum fps, the
154 // camera outputs frames in fixed frame rate. If not, the camera outputs
155 // frames in auto frame rate. The actual frame rate fluctuates between the
156 // minimum and the maximum. The list has at least one element. The list is
157 // sorted from small to large (first by maximum fps and then minimum fps).
158 // Example value: "(10500,26623),(15000,26623),(30000,30000)"
159 static const char KEY_SUPPORTED_PREVIEW_FPS_RANGE[];
160 // The image format for preview frames. See CAMERA_MSG_PREVIEW_FRAME in
161 // frameworks/av/include/camera/Camera.h. The default is
162 // PIXEL_FORMAT_YUV420SP. Example value: "yuv420sp" or PIXEL_FORMAT_XXX
163 // constants. Read/write.
164 static const char KEY_PREVIEW_FORMAT[];
165 // Supported image formats for preview frames.
166 // Example value: "yuv420sp,yuv422i-yuyv". Read only.
167 static const char KEY_SUPPORTED_PREVIEW_FORMATS[];
168 // Number of preview frames per second. This is the target frame rate. The
169 // actual frame rate depends on the driver.
170 // Example value: "15". Read/write.
171 static const char KEY_PREVIEW_FRAME_RATE[];
172 // Supported number of preview frames per second.
173 // Example value: "24,15,10". Read.
174 static const char KEY_SUPPORTED_PREVIEW_FRAME_RATES[];
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800175#ifdef QCOM_HARDWARE
176 // The mode of preview frame rate.
177 // Example value: "frame-rate-auto, frame-rate-fixed".
178 static const char KEY_PREVIEW_FRAME_RATE_MODE[];
179 static const char KEY_SUPPORTED_PREVIEW_FRAME_RATE_MODES[];
180 static const char KEY_PREVIEW_FRAME_RATE_AUTO_MODE[];
181 static const char KEY_PREVIEW_FRAME_RATE_FIXED_MODE[];
182#endif
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700183 // The dimensions for captured pictures in pixels (width x height).
184 // Example value: "1024x768". Read/write.
185 static const char KEY_PICTURE_SIZE[];
186 // Supported dimensions for captured pictures in pixels.
187 // Example value: "2048x1536,1024x768". Read only.
188 static const char KEY_SUPPORTED_PICTURE_SIZES[];
189 // The image format for captured pictures. See CAMERA_MSG_COMPRESSED_IMAGE
190 // in frameworks/base/include/camera/Camera.h.
191 // Example value: "jpeg" or PIXEL_FORMAT_XXX constants. Read/write.
192 static const char KEY_PICTURE_FORMAT[];
193 // Supported image formats for captured pictures.
194 // Example value: "jpeg,rgb565". Read only.
195 static const char KEY_SUPPORTED_PICTURE_FORMATS[];
196 // The width (in pixels) of EXIF thumbnail in Jpeg picture.
197 // Example value: "512". Read/write.
198 static const char KEY_JPEG_THUMBNAIL_WIDTH[];
199 // The height (in pixels) of EXIF thumbnail in Jpeg picture.
200 // Example value: "384". Read/write.
201 static const char KEY_JPEG_THUMBNAIL_HEIGHT[];
202 // Supported EXIF thumbnail sizes (width x height). 0x0 means not thumbnail
203 // in EXIF.
204 // Example value: "512x384,320x240,0x0". Read only.
205 static const char KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES[];
206 // The quality of the EXIF thumbnail in Jpeg picture. The range is 1 to 100,
207 // with 100 being the best.
208 // Example value: "90". Read/write.
209 static const char KEY_JPEG_THUMBNAIL_QUALITY[];
210 // Jpeg quality of captured picture. The range is 1 to 100, with 100 being
211 // the best.
212 // Example value: "90". Read/write.
213 static const char KEY_JPEG_QUALITY[];
214 // The rotation angle in degrees relative to the orientation of the camera.
215 // This affects the pictures returned from CAMERA_MSG_COMPRESSED_IMAGE. The
216 // camera driver may set orientation in the EXIF header without rotating the
217 // picture. Or the driver may rotate the picture and the EXIF thumbnail. If
218 // the Jpeg picture is rotated, the orientation in the EXIF header will be
219 // missing or 1 (row #0 is top and column #0 is left side).
220 //
221 // Note that the JPEG pictures of front-facing cameras are not mirrored
222 // as in preview display.
223 //
224 // For example, suppose the natural orientation of the device is portrait.
225 // The device is rotated 270 degrees clockwise, so the device orientation is
226 // 270. Suppose a back-facing camera sensor is mounted in landscape and the
227 // top side of the camera sensor is aligned with the right edge of the
228 // display in natural orientation. So the camera orientation is 90. The
229 // rotation should be set to 0 (270 + 90).
230 //
231 // Example value: "0" or "90" or "180" or "270". Write only.
232 static const char KEY_ROTATION[];
233 // GPS latitude coordinate. GPSLatitude and GPSLatitudeRef will be stored in
234 // JPEG EXIF header.
235 // Example value: "25.032146" or "-33.462809". Write only.
236 static const char KEY_GPS_LATITUDE[];
237 // GPS longitude coordinate. GPSLongitude and GPSLongitudeRef will be stored
238 // in JPEG EXIF header.
239 // Example value: "121.564448" or "-70.660286". Write only.
240 static const char KEY_GPS_LONGITUDE[];
241 // GPS altitude. GPSAltitude and GPSAltitudeRef will be stored in JPEG EXIF
242 // header.
243 // Example value: "21.0" or "-5". Write only.
244 static const char KEY_GPS_ALTITUDE[];
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800245
246#ifdef QCOM_HARDWARE
247 static const char KEY_SKIN_TONE_ENHANCEMENT[] ;
248 static const char KEY_SUPPORTED_SKIN_TONE_ENHANCEMENT_MODES[] ;
249#endif
250
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700251 // GPS timestamp (UTC in seconds since January 1, 1970). This should be
252 // stored in JPEG EXIF header.
253 // Example value: "1251192757". Write only.
254 static const char KEY_GPS_TIMESTAMP[];
255 // GPS Processing Method
256 // Example value: "GPS" or "NETWORK". Write only.
257 static const char KEY_GPS_PROCESSING_METHOD[];
258 // Current white balance setting.
259 // Example value: "auto" or WHITE_BALANCE_XXX constants. Read/write.
260 static const char KEY_WHITE_BALANCE[];
261 // Supported white balance settings.
262 // Example value: "auto,incandescent,daylight". Read only.
263 static const char KEY_SUPPORTED_WHITE_BALANCE[];
264 // Current color effect setting.
265 // Example value: "none" or EFFECT_XXX constants. Read/write.
266 static const char KEY_EFFECT[];
267 // Supported color effect settings.
268 // Example value: "none,mono,sepia". Read only.
269 static const char KEY_SUPPORTED_EFFECTS[];
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800270#ifdef QCOM_HARDWARE
271 //Touch Af/AEC settings.
272 static const char KEY_TOUCH_AF_AEC[];
273 static const char KEY_SUPPORTED_TOUCH_AF_AEC[];
274 //Touch Index for AEC.
275 static const char KEY_TOUCH_INDEX_AEC[];
276 //Touch Index for AF.
277 static const char KEY_TOUCH_INDEX_AF[];
278#endif
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700279 // Current antibanding setting.
280 // Example value: "auto" or ANTIBANDING_XXX constants. Read/write.
281 static const char KEY_ANTIBANDING[];
282 // Supported antibanding settings.
283 // Example value: "auto,50hz,60hz,off". Read only.
284 static const char KEY_SUPPORTED_ANTIBANDING[];
285 // Current scene mode.
286 // Example value: "auto" or SCENE_MODE_XXX constants. Read/write.
287 static const char KEY_SCENE_MODE[];
288 // Supported scene mode settings.
289 // Example value: "auto,night,fireworks". Read only.
290 static const char KEY_SUPPORTED_SCENE_MODES[];
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800291#ifdef QCOM_HARDWARE
292 // Current auto scene detection mode.
293 // Example value: "off" or SCENE_DETECT_XXX constants. Read/write.
294 static const char KEY_SCENE_DETECT[];
295 // Supported auto scene detection settings.
296 // Example value: "off,backlight,snow/cloudy". Read only.
297 static const char KEY_SUPPORTED_SCENE_DETECT[];
298#endif
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700299 // Current flash mode.
300 // Example value: "auto" or FLASH_MODE_XXX constants. Read/write.
301 static const char KEY_FLASH_MODE[];
302 // Supported flash modes.
303 // Example value: "auto,on,off". Read only.
304 static const char KEY_SUPPORTED_FLASH_MODES[];
305 // Current focus mode. This will not be empty. Applications should call
306 // CameraHardwareInterface.autoFocus to start the focus if focus mode is
307 // FOCUS_MODE_AUTO or FOCUS_MODE_MACRO.
308 // Example value: "auto" or FOCUS_MODE_XXX constants. Read/write.
309 static const char KEY_FOCUS_MODE[];
310 // Supported focus modes.
311 // Example value: "auto,macro,fixed". Read only.
312 static const char KEY_SUPPORTED_FOCUS_MODES[];
313 // The maximum number of focus areas supported. This is the maximum length
314 // of KEY_FOCUS_AREAS.
315 // Example value: "0" or "2". Read only.
316 static const char KEY_MAX_NUM_FOCUS_AREAS[];
317 // Current focus areas.
318 //
319 // Before accessing this parameter, apps should check
320 // KEY_MAX_NUM_FOCUS_AREAS first to know the maximum number of focus areas
321 // first. If the value is 0, focus area is not supported.
322 //
323 // Each focus area is a five-element int array. The first four elements are
324 // the rectangle of the area (left, top, right, bottom). The direction is
325 // relative to the sensor orientation, that is, what the sensor sees. The
326 // direction is not affected by the rotation or mirroring of
327 // CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates range from -1000 to 1000.
328 // (-1000,-1000) is the upper left point. (1000, 1000) is the lower right
329 // point. The width and height of focus areas cannot be 0 or negative.
330 //
331 // The fifth element is the weight. Values for weight must range from 1 to
332 // 1000. The weight should be interpreted as a per-pixel weight - all
333 // pixels in the area have the specified weight. This means a small area
334 // with the same weight as a larger area will have less influence on the
335 // focusing than the larger area. Focus areas can partially overlap and the
336 // driver will add the weights in the overlap region.
337 //
338 // A special case of single focus area (0,0,0,0,0) means driver to decide
339 // the focus area. For example, the driver may use more signals to decide
340 // focus areas and change them dynamically. Apps can set (0,0,0,0,0) if they
341 // want the driver to decide focus areas.
342 //
343 // Focus areas are relative to the current field of view (KEY_ZOOM). No
344 // matter what the zoom level is, (-1000,-1000) represents the top of the
345 // currently visible camera frame. The focus area cannot be set to be
346 // outside the current field of view, even when using zoom.
347 //
348 // Focus area only has effect if the current focus mode is FOCUS_MODE_AUTO,
349 // FOCUS_MODE_MACRO, FOCUS_MODE_CONTINUOUS_VIDEO, or
350 // FOCUS_MODE_CONTINUOUS_PICTURE.
351 // Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write.
352 static const char KEY_FOCUS_AREAS[];
353 // Focal length in millimeter.
354 // Example value: "4.31". Read only.
355 static const char KEY_FOCAL_LENGTH[];
356 // Horizontal angle of view in degrees.
357 // Example value: "54.8". Read only.
358 static const char KEY_HORIZONTAL_VIEW_ANGLE[];
359 // Vertical angle of view in degrees.
360 // Example value: "42.5". Read only.
361 static const char KEY_VERTICAL_VIEW_ANGLE[];
362 // Exposure compensation index. 0 means exposure is not adjusted.
James Paintere5382062012-09-05 18:02:32 -0700363 // Example value: "-5" or "5". Read/write.
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700364 static const char KEY_EXPOSURE_COMPENSATION[];
365 // The maximum exposure compensation index (>=0).
366 // Example value: "6". Read only.
367 static const char KEY_MAX_EXPOSURE_COMPENSATION[];
368 // The minimum exposure compensation index (<=0).
369 // Example value: "-6". Read only.
370 static const char KEY_MIN_EXPOSURE_COMPENSATION[];
371 // The exposure compensation step. Exposure compensation index multiply by
James Paintere5382062012-09-05 18:02:32 -0700372 // step eqals to EV. Ex: if exposure compensation index is -6 and step is
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700373 // 0.3333, EV is -2.
374 // Example value: "0.333333333" or "0.5". Read only.
375 static const char KEY_EXPOSURE_COMPENSATION_STEP[];
376 // The state of the auto-exposure lock. "true" means that
377 // auto-exposure is locked to its current value and will not
378 // change. "false" means the auto-exposure routine is free to
379 // change exposure values. If auto-exposure is already locked,
380 // setting this to true again has no effect (the driver will not
381 // recalculate exposure values). Changing exposure compensation
382 // settings will still affect the exposure settings while
383 // auto-exposure is locked. Stopping preview or taking a still
384 // image will not change the lock. In conjunction with
385 // exposure compensation, this allows for capturing multi-exposure
386 // brackets with known relative exposure values. Locking
387 // auto-exposure after open but before the first call to
388 // startPreview may result in severely over- or under-exposed
389 // images. The driver will not change the AE lock after
390 // auto-focus completes.
391 static const char KEY_AUTO_EXPOSURE_LOCK[];
392 // Whether locking the auto-exposure is supported. "true" means it is, and
393 // "false" or this key not existing means it is not supported.
394 static const char KEY_AUTO_EXPOSURE_LOCK_SUPPORTED[];
395 // The state of the auto-white balance lock. "true" means that
396 // auto-white balance is locked to its current value and will not
397 // change. "false" means the auto-white balance routine is free to
398 // change white balance values. If auto-white balance is already
399 // locked, setting this to true again has no effect (the driver
400 // will not recalculate white balance values). Stopping preview or
401 // taking a still image will not change the lock. In conjunction
402 // with exposure compensation, this allows for capturing
403 // multi-exposure brackets with fixed white balance. Locking
404 // auto-white balance after open but before the first call to
405 // startPreview may result in severely incorrect color. The
406 // driver will not change the AWB lock after auto-focus
407 // completes.
408 static const char KEY_AUTO_WHITEBALANCE_LOCK[];
409 // Whether locking the auto-white balance is supported. "true"
410 // means it is, and "false" or this key not existing means it is
411 // not supported.
412 static const char KEY_AUTO_WHITEBALANCE_LOCK_SUPPORTED[];
413
414 // The maximum number of metering areas supported. This is the maximum
415 // length of KEY_METERING_AREAS.
416 // Example value: "0" or "2". Read only.
417 static const char KEY_MAX_NUM_METERING_AREAS[];
418 // Current metering areas. Camera driver uses these areas to decide
419 // exposure.
420 //
421 // Before accessing this parameter, apps should check
422 // KEY_MAX_NUM_METERING_AREAS first to know the maximum number of metering
423 // areas first. If the value is 0, metering area is not supported.
424 //
425 // Each metering area is a rectangle with specified weight. The direction is
426 // relative to the sensor orientation, that is, what the sensor sees. The
427 // direction is not affected by the rotation or mirroring of
428 // CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates of the rectangle range
429 // from -1000 to 1000. (-1000, -1000) is the upper left point. (1000, 1000)
430 // is the lower right point. The width and height of metering areas cannot
431 // be 0 or negative.
432 //
433 // The fifth element is the weight. Values for weight must range from 1 to
434 // 1000. The weight should be interpreted as a per-pixel weight - all
435 // pixels in the area have the specified weight. This means a small area
436 // with the same weight as a larger area will have less influence on the
437 // metering than the larger area. Metering areas can partially overlap and
438 // the driver will add the weights in the overlap region.
439 //
440 // A special case of all-zero single metering area means driver to decide
441 // the metering area. For example, the driver may use more signals to decide
442 // metering areas and change them dynamically. Apps can set all-zero if they
443 // want the driver to decide metering areas.
444 //
445 // Metering areas are relative to the current field of view (KEY_ZOOM).
446 // No matter what the zoom level is, (-1000,-1000) represents the top of the
447 // currently visible camera frame. The metering area cannot be set to be
448 // outside the current field of view, even when using zoom.
449 //
450 // No matter what metering areas are, the final exposure are compensated
451 // by KEY_EXPOSURE_COMPENSATION.
452 // Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write.
453 static const char KEY_METERING_AREAS[];
454 // Current zoom value.
455 // Example value: "0" or "6". Read/write.
456 static const char KEY_ZOOM[];
457 // Maximum zoom value.
458 // Example value: "6". Read only.
459 static const char KEY_MAX_ZOOM[];
460 // The zoom ratios of all zoom values. The zoom ratio is in 1/100
461 // increments. Ex: a zoom of 3.2x is returned as 320. The number of list
462 // elements is KEY_MAX_ZOOM + 1. The first element is always 100. The last
463 // element is the zoom ratio of zoom value KEY_MAX_ZOOM.
464 // Example value: "100,150,200,250,300,350,400". Read only.
465 static const char KEY_ZOOM_RATIOS[];
466 // Whether zoom is supported. Zoom is supported if the value is "true". Zoom
467 // is not supported if the value is not "true" or the key does not exist.
468 // Example value: "true". Read only.
469 static const char KEY_ZOOM_SUPPORTED[];
470 // Whether if smooth zoom is supported. Smooth zoom is supported if the
471 // value is "true". It is not supported if the value is not "true" or the
472 // key does not exist.
473 // See CAMERA_CMD_START_SMOOTH_ZOOM, CAMERA_CMD_STOP_SMOOTH_ZOOM, and
474 // CAMERA_MSG_ZOOM in frameworks/base/include/camera/Camera.h.
475 // Example value: "true". Read only.
476 static const char KEY_SMOOTH_ZOOM_SUPPORTED[];
477
478 // The distances (in meters) from the camera to where an object appears to
479 // be in focus. The object is sharpest at the optimal focus distance. The
480 // depth of field is the far focus distance minus near focus distance.
481 //
482 // Focus distances may change after starting auto focus, canceling auto
483 // focus, or starting the preview. Applications can read this anytime to get
484 // the latest focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS,
485 // focus distances may change from time to time.
486 //
487 // This is intended to estimate the distance between the camera and the
488 // subject. After autofocus, the subject distance may be within near and far
489 // focus distance. However, the precision depends on the camera hardware,
490 // autofocus algorithm, the focus area, and the scene. The error can be
491 // large and it should be only used as a reference.
492 //
493 // Far focus distance > optimal focus distance > near focus distance. If
494 // the far focus distance is infinity, the value should be "Infinity" (case
495 // sensitive). The format is three float values separated by commas. The
496 // first is near focus distance. The second is optimal focus distance. The
497 // third is far focus distance.
498 // Example value: "0.95,1.9,Infinity" or "0.049,0.05,0.051". Read only.
499 static const char KEY_FOCUS_DISTANCES[];
500
501 // The current dimensions in pixels (width x height) for video frames.
502 // The width and height must be one of the supported sizes retrieved
503 // via KEY_SUPPORTED_VIDEO_SIZES.
504 // Example value: "1280x720". Read/write.
505 static const char KEY_VIDEO_SIZE[];
506 // A list of the supported dimensions in pixels (width x height)
507 // for video frames. See CAMERA_MSG_VIDEO_FRAME for details in
508 // frameworks/base/include/camera/Camera.h.
509 // Example: "176x144,1280x720". Read only.
510 static const char KEY_SUPPORTED_VIDEO_SIZES[];
511
512 // The maximum number of detected faces supported by hardware face
513 // detection. If the value is 0, hardware face detection is not supported.
514 // Example: "5". Read only
515 static const char KEY_MAX_NUM_DETECTED_FACES_HW[];
516
517 // The maximum number of detected faces supported by software face
518 // detection. If the value is 0, software face detection is not supported.
519 // Example: "5". Read only
520 static const char KEY_MAX_NUM_DETECTED_FACES_SW[];
521
522 // Preferred preview frame size in pixels for video recording.
523 // The width and height must be one of the supported sizes retrieved
524 // via KEY_SUPPORTED_PREVIEW_SIZES. This key can be used only when
525 // getSupportedVideoSizes() does not return an empty Vector of Size.
526 // Camcorder applications are recommended to set the preview size
527 // to a value that is not larger than the preferred preview size.
528 // In other words, the product of the width and height of the
529 // preview size should not be larger than that of the preferred
530 // preview size. In addition, we recommend to choos a preview size
531 // that has the same aspect ratio as the resolution of video to be
532 // recorded.
533 // Example value: "800x600". Read only.
534 static const char KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[];
535
536 // The image format for video frames. See CAMERA_MSG_VIDEO_FRAME in
537 // frameworks/base/include/camera/Camera.h.
538 // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read only.
539 static const char KEY_VIDEO_FRAME_FORMAT[];
540
541 // Sets the hint of the recording mode. If this is true, MediaRecorder.start
542 // may be faster or has less glitches. This should be called before starting
543 // the preview for the best result. But it is allowed to change the hint
544 // while the preview is active. The default value is false.
545 //
546 // The apps can still call Camera.takePicture when the hint is true. The
547 // apps can call MediaRecorder.start when the hint is false. But the
548 // performance may be worse.
549 // Example value: "true" or "false". Read/write.
550 static const char KEY_RECORDING_HINT[];
551
552 // Returns true if video snapshot is supported. That is, applications
553 // can call Camera.takePicture during recording. Applications do not need to
554 // call Camera.startPreview after taking a picture. The preview will be
555 // still active. Other than that, taking a picture during recording is
556 // identical to taking a picture normally. All settings and methods related
557 // to takePicture work identically. Ex: KEY_PICTURE_SIZE,
558 // KEY_SUPPORTED_PICTURE_SIZES, KEY_JPEG_QUALITY, KEY_ROTATION, and etc.
559 // The picture will have an EXIF header. FLASH_MODE_AUTO and FLASH_MODE_ON
560 // also still work, but the video will record the flash.
561 //
562 // Applications can set shutter callback as null to avoid the shutter
563 // sound. It is also recommended to set raw picture and post view callbacks
564 // to null to avoid the interrupt of preview display.
565 //
566 // Field-of-view of the recorded video may be different from that of the
567 // captured pictures.
568 // Example value: "true" or "false". Read only.
569 static const char KEY_VIDEO_SNAPSHOT_SUPPORTED[];
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800570 static const char KEY_FULL_VIDEO_SNAP_SUPPORTED[];
571
572#ifdef QCOM_HARDWARE
573 static const char KEY_ISO_MODE[];
574 static const char KEY_SUPPORTED_ISO_MODES[];
575 static const char KEY_LENSSHADE[] ;
576 static const char KEY_SUPPORTED_LENSSHADE_MODES[] ;
577
578 static const char KEY_AUTO_EXPOSURE[];
579 static const char KEY_SUPPORTED_AUTO_EXPOSURE[];
580
581 static const char KEY_GPS_LATITUDE_REF[];
582 static const char KEY_GPS_LONGITUDE_REF[];
583 static const char KEY_GPS_ALTITUDE_REF[];
584 static const char KEY_GPS_STATUS[];
585 static const char KEY_EXIF_DATETIME[];
586#endif
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700587
588 // The state of the video stabilization. If set to true, both the
589 // preview stream and the recorded video stream are stabilized by
590 // the camera. Only valid to set if KEY_VIDEO_STABILIZATION_SUPPORTED is
591 // set to true.
592 //
593 // The value of this key can be changed any time the camera is
594 // open. If preview or recording is active, it is acceptable for
595 // there to be a slight video glitch when video stabilization is
596 // toggled on and off.
597 //
598 // This only stabilizes video streams (between-frames stabilization), and
599 // has no effect on still image capture.
600 static const char KEY_VIDEO_STABILIZATION[];
601
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800602#ifdef QCOM_HARDWARE
603 static const char KEY_MEMORY_COLOR_ENHANCEMENT[];
604 static const char KEY_SUPPORTED_MEM_COLOR_ENHANCE_MODES[];
605
606 static const char KEY_ZSL[];
607 static const char KEY_SUPPORTED_ZSL_MODES[];
608
609 static const char KEY_CAMERA_MODE[];
610
611 static const char KEY_VIDEO_HIGH_FRAME_RATE[];
612 static const char KEY_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[];
613 static const char KEY_HIGH_DYNAMIC_RANGE_IMAGING[];
614 static const char KEY_SUPPORTED_HDR_IMAGING_MODES[];
615#endif
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700616 // Returns true if video stabilization is supported. That is, applications
617 // can set KEY_VIDEO_STABILIZATION to true and have a stabilized preview
618 // stream and record stabilized videos.
619 static const char KEY_VIDEO_STABILIZATION_SUPPORTED[];
620
codeworkx612842e2012-11-27 01:30:33 +0100621#ifdef HAVE_ISO
622 static const char KEY_SUPPORTED_ISO_MODES[];
623 static const char KEY_ISO_MODE[];
624#endif
625
codeworkxf68caed2012-11-27 01:22:13 +0100626#ifdef SAMSUNG_CAMERA_HARDWARE
627 static const char KEY_ANTI_SHAKE_MODE[];
628 static const char KEY_METERING[];
629 static const char KEY_WDR[];
630 static const char KEY_WEATHER[];
631#endif
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800632 static const char KEY_AE_BRACKET_HDR[];
codeworkxf68caed2012-11-27 01:22:13 +0100633
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700634 // Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED.
635 static const char TRUE[];
636 static const char FALSE[];
637
638 // Value for KEY_FOCUS_DISTANCES.
639 static const char FOCUS_DISTANCE_INFINITY[];
640
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800641#ifdef QCOM_HARDWARE
642 // DENOISE
643 static const char KEY_DENOISE[];
644 static const char KEY_SUPPORTED_DENOISE[];
645
646 //Selectable zone AF.
647 static const char KEY_SELECTABLE_ZONE_AF[];
648 static const char KEY_SUPPORTED_SELECTABLE_ZONE_AF[];
649
650 //Face Detection
651 static const char KEY_FACE_DETECTION[];
652 static const char KEY_SUPPORTED_FACE_DETECTION[];
653
654 //Redeye Reduction
655 static const char KEY_REDEYE_REDUCTION[];
656 static const char KEY_SUPPORTED_REDEYE_REDUCTION[];
657#endif
658
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700659 // Values for white balance settings.
660 static const char WHITE_BALANCE_AUTO[];
661 static const char WHITE_BALANCE_INCANDESCENT[];
662 static const char WHITE_BALANCE_FLUORESCENT[];
663 static const char WHITE_BALANCE_WARM_FLUORESCENT[];
664 static const char WHITE_BALANCE_DAYLIGHT[];
665 static const char WHITE_BALANCE_CLOUDY_DAYLIGHT[];
666 static const char WHITE_BALANCE_TWILIGHT[];
667 static const char WHITE_BALANCE_SHADE[];
668
669 // Values for effect settings.
670 static const char EFFECT_NONE[];
671 static const char EFFECT_MONO[];
672 static const char EFFECT_NEGATIVE[];
673 static const char EFFECT_SOLARIZE[];
674 static const char EFFECT_SEPIA[];
675 static const char EFFECT_POSTERIZE[];
676 static const char EFFECT_WHITEBOARD[];
677 static const char EFFECT_BLACKBOARD[];
678 static const char EFFECT_AQUA[];
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800679#ifdef QCOM_HARDWARE
680 static const char EFFECT_EMBOSS[];
681 static const char EFFECT_SKETCH[];
682 static const char EFFECT_NEON[];
683
684 // Values for Touch AF/AEC
685 static const char TOUCH_AF_AEC_OFF[] ;
686 static const char TOUCH_AF_AEC_ON[] ;
687#endif
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700688
689 // Values for antibanding settings.
690 static const char ANTIBANDING_AUTO[];
691 static const char ANTIBANDING_50HZ[];
692 static const char ANTIBANDING_60HZ[];
693 static const char ANTIBANDING_OFF[];
694
695 // Values for flash mode settings.
696 // Flash will not be fired.
697 static const char FLASH_MODE_OFF[];
698 // Flash will be fired automatically when required. The flash may be fired
699 // during preview, auto-focus, or snapshot depending on the driver.
700 static const char FLASH_MODE_AUTO[];
701 // Flash will always be fired during snapshot. The flash may also be
702 // fired during preview or auto-focus depending on the driver.
703 static const char FLASH_MODE_ON[];
704 // Flash will be fired in red-eye reduction mode.
705 static const char FLASH_MODE_RED_EYE[];
706 // Constant emission of light during preview, auto-focus and snapshot.
707 // This can also be used for video recording.
708 static const char FLASH_MODE_TORCH[];
709
710 // Values for scene mode settings.
711 static const char SCENE_MODE_AUTO[];
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800712 static const char SCENE_MODE_ASD[];
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700713 static const char SCENE_MODE_ACTION[];
714 static const char SCENE_MODE_PORTRAIT[];
715 static const char SCENE_MODE_LANDSCAPE[];
716 static const char SCENE_MODE_NIGHT[];
717 static const char SCENE_MODE_NIGHT_PORTRAIT[];
718 static const char SCENE_MODE_THEATRE[];
719 static const char SCENE_MODE_BEACH[];
720 static const char SCENE_MODE_SNOW[];
721 static const char SCENE_MODE_SUNSET[];
722 static const char SCENE_MODE_STEADYPHOTO[];
723 static const char SCENE_MODE_FIREWORKS[];
724 static const char SCENE_MODE_SPORTS[];
725 static const char SCENE_MODE_PARTY[];
726 static const char SCENE_MODE_CANDLELIGHT[];
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800727#ifdef QCOM_HARDWARE
728 static const char SCENE_MODE_BACKLIGHT[];
729 static const char SCENE_MODE_FLOWERS[];
730 static const char SCENE_MODE_AR[];
731#endif
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700732 // Applications are looking for a barcode. Camera driver will be optimized
733 // for barcode reading.
734 static const char SCENE_MODE_BARCODE[];
Eino-Ville Talvalac61b2aa2012-09-10 11:59:12 -0700735 // A high-dynamic range mode. In this mode, the HAL module will use a
736 // capture strategy that extends the dynamic range of the captured
737 // image in some fashion. Only the final image is returned.
738 static const char SCENE_MODE_HDR[];
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700739
740 // Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT,
741 // and KEY_VIDEO_FRAME_FORMAT
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800742#ifdef QCOM_HARDWARE
743 static const char SCENE_DETECT_OFF[];
744 static const char SCENE_DETECT_ON[];
745#endif
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700746 static const char PIXEL_FORMAT_YUV422SP[];
747 static const char PIXEL_FORMAT_YUV420SP[]; // NV21
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800748#ifdef QCOM_HARDWARE
749 static const char PIXEL_FORMAT_YUV420SP_ADRENO[]; // ADRENO
750#endif
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700751 static const char PIXEL_FORMAT_YUV422I[]; // YUY2
752 static const char PIXEL_FORMAT_YUV420P[]; // YV12
753 static const char PIXEL_FORMAT_RGB565[];
754 static const char PIXEL_FORMAT_RGBA8888[];
755 static const char PIXEL_FORMAT_JPEG[];
756 // Raw bayer format used for images, which is 10 bit precision samples
757 // stored in 16 bit words. The filter pattern is RGGB.
758 static const char PIXEL_FORMAT_BAYER_RGGB[];
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800759
Eino-Ville Talvalaf6d96962012-07-18 17:50:46 -0700760 // Pixel format is not known to the framework
761 static const char PIXEL_FORMAT_ANDROID_OPAQUE[];
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700762
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800763#ifdef QCOM_HARDWARE
764 static const char PIXEL_FORMAT_RAW[];
765 static const char PIXEL_FORMAT_YV12[]; // NV21
766 static const char PIXEL_FORMAT_NV12[]; //NV12
767#endif
768
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700769 // Values for focus mode settings.
770 // Auto-focus mode. Applications should call
771 // CameraHardwareInterface.autoFocus to start the focus in this mode.
772 static const char FOCUS_MODE_AUTO[];
773 // Focus is set at infinity. Applications should not call
774 // CameraHardwareInterface.autoFocus in this mode.
775 static const char FOCUS_MODE_INFINITY[];
776 // Macro (close-up) focus mode. Applications should call
777 // CameraHardwareInterface.autoFocus to start the focus in this mode.
778 static const char FOCUS_MODE_MACRO[];
779 // Focus is fixed. The camera is always in this mode if the focus is not
780 // adjustable. If the camera has auto-focus, this mode can fix the
781 // focus, which is usually at hyperfocal distance. Applications should
782 // not call CameraHardwareInterface.autoFocus in this mode.
783 static const char FOCUS_MODE_FIXED[];
784 // Extended depth of field (EDOF). Focusing is done digitally and
785 // continuously. Applications should not call
786 // CameraHardwareInterface.autoFocus in this mode.
787 static const char FOCUS_MODE_EDOF[];
788 // Continuous auto focus mode intended for video recording. The camera
789 // continuously tries to focus. This is the best choice for video
790 // recording because the focus changes smoothly . Applications still can
791 // call CameraHardwareInterface.takePicture in this mode but the subject may
792 // not be in focus. Auto focus starts when the parameter is set.
793 //
794 // Applications can call CameraHardwareInterface.autoFocus in this mode. The
795 // focus callback will immediately return with a boolean that indicates
796 // whether the focus is sharp or not. The focus position is locked after
797 // autoFocus call. If applications want to resume the continuous focus,
798 // cancelAutoFocus must be called. Restarting the preview will not resume
799 // the continuous autofocus. To stop continuous focus, applications should
800 // change the focus mode to other modes.
801 static const char FOCUS_MODE_CONTINUOUS_VIDEO[];
802 // Continuous auto focus mode intended for taking pictures. The camera
803 // continuously tries to focus. The speed of focus change is more aggressive
804 // than FOCUS_MODE_CONTINUOUS_VIDEO. Auto focus starts when the parameter is
805 // set.
806 //
807 // Applications can call CameraHardwareInterface.autoFocus in this mode. If
808 // the autofocus is in the middle of scanning, the focus callback will
809 // return when it completes. If the autofocus is not scanning, focus
810 // callback will immediately return with a boolean that indicates whether
811 // the focus is sharp or not. The apps can then decide if they want to take
812 // a picture immediately or to change the focus mode to auto, and run a full
813 // autofocus cycle. The focus position is locked after autoFocus call. If
814 // applications want to resume the continuous focus, cancelAutoFocus must be
815 // called. Restarting the preview will not resume the continuous autofocus.
816 // To stop continuous focus, applications should change the focus mode to
817 // other modes.
818 static const char FOCUS_MODE_CONTINUOUS_PICTURE[];
819
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800820#ifdef QCOM_HARDWARE
821 // Normal focus mode. Applications should call
822 // CameraHardwareInterface.autoFocus to start the focus in this mode.
823 static const char FOCUS_MODE_NORMAL[];
824 static const char ISO_AUTO[];
825 static const char ISO_HJR[] ;
826 static const char ISO_100[];
827 static const char ISO_200[] ;
828 static const char ISO_400[];
829 static const char ISO_800[];
830 static const char ISO_1600[];
Emerson Pinter4eec1382012-11-27 09:13:34 -0200831 static const char ISO_3200[];
832 static const char ISO_6400[];
Ankit Premrajka140a9ac2011-11-21 19:25:02 -0800833 // Values for Lens Shading
834 static const char LENSSHADE_ENABLE[] ;
835 static const char LENSSHADE_DISABLE[] ;
836
837 // Values for auto exposure settings.
838 static const char AUTO_EXPOSURE_FRAME_AVG[];
839 static const char AUTO_EXPOSURE_CENTER_WEIGHTED[];
840 static const char AUTO_EXPOSURE_SPOT_METERING[];
841
842 static const char KEY_SHARPNESS[];
843 static const char KEY_MAX_SHARPNESS[];
844 static const char KEY_CONTRAST[];
845 static const char KEY_MAX_CONTRAST[];
846 static const char KEY_SATURATION[];
847 static const char KEY_MAX_SATURATION[];
848
849 static const char KEY_HISTOGRAM[] ;
850 static const char KEY_SUPPORTED_HISTOGRAM_MODES[] ;
851 // Values for HISTOGRAM
852 static const char HISTOGRAM_ENABLE[] ;
853 static const char HISTOGRAM_DISABLE[] ;
854
855 // Values for SKIN TONE ENHANCEMENT
856 static const char SKIN_TONE_ENHANCEMENT_ENABLE[] ;
857 static const char SKIN_TONE_ENHANCEMENT_DISABLE[] ;
858
859 // Values for Denoise
860 static const char DENOISE_OFF[] ;
861 static const char DENOISE_ON[] ;
862
863 // Values for auto exposure settings.
864 static const char SELECTABLE_ZONE_AF_AUTO[];
865 static const char SELECTABLE_ZONE_AF_SPOT_METERING[];
866 static const char SELECTABLE_ZONE_AF_CENTER_WEIGHTED[];
867 static const char SELECTABLE_ZONE_AF_FRAME_AVERAGE[];
868
869 // Values for Face Detection settings.
870 static const char FACE_DETECTION_OFF[];
871 static const char FACE_DETECTION_ON[];
872
873 // Values for MCE settings.
874 static const char MCE_ENABLE[];
875 static const char MCE_DISABLE[];
876
877 // Values for ZSL settings.
878 static const char ZSL_OFF[];
879 static const char ZSL_ON[];
880
881 // Values for HDR Bracketing settings.
882 static const char AE_BRACKET_HDR_OFF[];
883 static const char AE_BRACKET_HDR[];
884 static const char AE_BRACKET[];
885
886 // Values for HFR settings.
887 static const char VIDEO_HFR_OFF[];
888 static const char VIDEO_HFR_2X[];
889 static const char VIDEO_HFR_3X[];
890 static const char VIDEO_HFR_4X[];
891
892 // Values for Redeye Reduction settings.
893 static const char REDEYE_REDUCTION_ENABLE[];
894 static const char REDEYE_REDUCTION_DISABLE[];
895 // Values for HDR settings.
896 static const char HDR_ENABLE[];
897 static const char HDR_DISABLE[];
898
899 // Values for Redeye Reduction settings.
900 // static const char REDEYE_REDUCTION_ENABLE[];
901 // static const char REDEYE_REDUCTION_DISABLE[];
902 // Values for HDR settings.
903 // static const char HDR_ENABLE[];
904 // static const char HDR_DISABLE[];
905
906 enum {
907 CAMERA_ORIENTATION_UNKNOWN = 0,
908 CAMERA_ORIENTATION_PORTRAIT = 1,
909 CAMERA_ORIENTATION_LANDSCAPE = 2,
910 };
911 int getOrientation() const;
912 void setOrientation(int orientation);
913 void setPreviewFpsRange(int minFPS,int maxFPS);
914 void getSupportedHfrSizes(Vector<Size> &sizes) const;
915#endif
916
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700917private:
918 DefaultKeyedVector<String8,String8> mMap;
919};
920
921}; // namespace android
922
923#endif