blob: c6074fc014973b9721489f3dc50b0c2b66250b91 [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};
39
40class CameraParameters
41{
42public:
43 CameraParameters();
44 CameraParameters(const String8 &params) { unflatten(params); }
45 ~CameraParameters();
46
47 String8 flatten() const;
48 void unflatten(const String8 &params);
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
57 void remove(const char *key);
58
59 void setPreviewSize(int width, int height);
60 void getPreviewSize(int *width, int *height) const;
61 void getSupportedPreviewSizes(Vector<Size> &sizes) const;
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;
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;
90
91 void setPreviewFrameRate(int fps);
92 int getPreviewFrameRate() const;
93 void getPreviewFpsRange(int *min_fps, int *max_fps) const;
94 void setPreviewFormat(const char *format);
95 const char *getPreviewFormat() const;
96 void setPictureSize(int width, int height);
97 void getPictureSize(int *width, int *height) const;
98 void getSupportedPictureSizes(Vector<Size> &sizes) const;
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
Ruben Brunkb2119af2014-05-09 19:57:56 -0700105 /**
106 * Returns a Vector containing the supported preview formats
107 * as enums given in graphics.h.
108 */
109 void getSupportedPreviewFormats(Vector<int>& formats) const;
110
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700111 // Parameter keys to communicate between camera application and driver.
112 // The access (read/write, read only, or write only) is viewed from the
113 // perspective of applications, not driver.
114
115 // Preview frame size in pixels (width x height).
116 // Example value: "480x320". Read/Write.
117 static const char KEY_PREVIEW_SIZE[];
118 // Supported preview frame sizes in pixels.
119 // Example value: "800x600,480x320". Read only.
120 static const char KEY_SUPPORTED_PREVIEW_SIZES[];
121 // The current minimum and maximum preview fps. This controls the rate of
122 // preview frames received (CAMERA_MSG_PREVIEW_FRAME). The minimum and
123 // maximum fps must be one of the elements from
124 // KEY_SUPPORTED_PREVIEW_FPS_RANGE parameter.
125 // Example value: "10500,26623"
126 static const char KEY_PREVIEW_FPS_RANGE[];
127 // The supported preview fps (frame-per-second) ranges. Each range contains
128 // a minimum fps and maximum fps. If minimum fps equals to maximum fps, the
129 // camera outputs frames in fixed frame rate. If not, the camera outputs
130 // frames in auto frame rate. The actual frame rate fluctuates between the
131 // minimum and the maximum. The list has at least one element. The list is
132 // sorted from small to large (first by maximum fps and then minimum fps).
133 // Example value: "(10500,26623),(15000,26623),(30000,30000)"
134 static const char KEY_SUPPORTED_PREVIEW_FPS_RANGE[];
135 // The image format for preview frames. See CAMERA_MSG_PREVIEW_FRAME in
136 // frameworks/av/include/camera/Camera.h. The default is
137 // PIXEL_FORMAT_YUV420SP. Example value: "yuv420sp" or PIXEL_FORMAT_XXX
138 // constants. Read/write.
139 static const char KEY_PREVIEW_FORMAT[];
140 // Supported image formats for preview frames.
141 // Example value: "yuv420sp,yuv422i-yuyv". Read only.
142 static const char KEY_SUPPORTED_PREVIEW_FORMATS[];
143 // Number of preview frames per second. This is the target frame rate. The
144 // actual frame rate depends on the driver.
145 // Example value: "15". Read/write.
146 static const char KEY_PREVIEW_FRAME_RATE[];
147 // Supported number of preview frames per second.
148 // Example value: "24,15,10". Read.
149 static const char KEY_SUPPORTED_PREVIEW_FRAME_RATES[];
150 // The dimensions for captured pictures in pixels (width x height).
151 // Example value: "1024x768". Read/write.
152 static const char KEY_PICTURE_SIZE[];
153 // Supported dimensions for captured pictures in pixels.
154 // Example value: "2048x1536,1024x768". Read only.
155 static const char KEY_SUPPORTED_PICTURE_SIZES[];
156 // The image format for captured pictures. See CAMERA_MSG_COMPRESSED_IMAGE
157 // in frameworks/base/include/camera/Camera.h.
158 // Example value: "jpeg" or PIXEL_FORMAT_XXX constants. Read/write.
159 static const char KEY_PICTURE_FORMAT[];
160 // Supported image formats for captured pictures.
161 // Example value: "jpeg,rgb565". Read only.
162 static const char KEY_SUPPORTED_PICTURE_FORMATS[];
163 // The width (in pixels) of EXIF thumbnail in Jpeg picture.
164 // Example value: "512". Read/write.
165 static const char KEY_JPEG_THUMBNAIL_WIDTH[];
166 // The height (in pixels) of EXIF thumbnail in Jpeg picture.
167 // Example value: "384". Read/write.
168 static const char KEY_JPEG_THUMBNAIL_HEIGHT[];
169 // Supported EXIF thumbnail sizes (width x height). 0x0 means not thumbnail
170 // in EXIF.
171 // Example value: "512x384,320x240,0x0". Read only.
172 static const char KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES[];
173 // The quality of the EXIF thumbnail in Jpeg picture. The range is 1 to 100,
174 // with 100 being the best.
175 // Example value: "90". Read/write.
176 static const char KEY_JPEG_THUMBNAIL_QUALITY[];
177 // Jpeg quality of captured picture. The range is 1 to 100, with 100 being
178 // the best.
179 // Example value: "90". Read/write.
180 static const char KEY_JPEG_QUALITY[];
181 // The rotation angle in degrees relative to the orientation of the camera.
182 // This affects the pictures returned from CAMERA_MSG_COMPRESSED_IMAGE. The
183 // camera driver may set orientation in the EXIF header without rotating the
184 // picture. Or the driver may rotate the picture and the EXIF thumbnail. If
185 // the Jpeg picture is rotated, the orientation in the EXIF header will be
186 // missing or 1 (row #0 is top and column #0 is left side).
187 //
188 // Note that the JPEG pictures of front-facing cameras are not mirrored
189 // as in preview display.
190 //
191 // For example, suppose the natural orientation of the device is portrait.
192 // The device is rotated 270 degrees clockwise, so the device orientation is
193 // 270. Suppose a back-facing camera sensor is mounted in landscape and the
194 // top side of the camera sensor is aligned with the right edge of the
195 // display in natural orientation. So the camera orientation is 90. The
196 // rotation should be set to 0 (270 + 90).
197 //
198 // Example value: "0" or "90" or "180" or "270". Write only.
199 static const char KEY_ROTATION[];
200 // GPS latitude coordinate. GPSLatitude and GPSLatitudeRef will be stored in
201 // JPEG EXIF header.
202 // Example value: "25.032146" or "-33.462809". Write only.
203 static const char KEY_GPS_LATITUDE[];
204 // GPS longitude coordinate. GPSLongitude and GPSLongitudeRef will be stored
205 // in JPEG EXIF header.
206 // Example value: "121.564448" or "-70.660286". Write only.
207 static const char KEY_GPS_LONGITUDE[];
208 // GPS altitude. GPSAltitude and GPSAltitudeRef will be stored in JPEG EXIF
209 // header.
210 // Example value: "21.0" or "-5". Write only.
211 static const char KEY_GPS_ALTITUDE[];
212 // GPS timestamp (UTC in seconds since January 1, 1970). This should be
213 // stored in JPEG EXIF header.
214 // Example value: "1251192757". Write only.
215 static const char KEY_GPS_TIMESTAMP[];
216 // GPS Processing Method
217 // Example value: "GPS" or "NETWORK". Write only.
218 static const char KEY_GPS_PROCESSING_METHOD[];
219 // Current white balance setting.
220 // Example value: "auto" or WHITE_BALANCE_XXX constants. Read/write.
221 static const char KEY_WHITE_BALANCE[];
222 // Supported white balance settings.
223 // Example value: "auto,incandescent,daylight". Read only.
224 static const char KEY_SUPPORTED_WHITE_BALANCE[];
225 // Current color effect setting.
226 // Example value: "none" or EFFECT_XXX constants. Read/write.
227 static const char KEY_EFFECT[];
228 // Supported color effect settings.
229 // Example value: "none,mono,sepia". Read only.
230 static const char KEY_SUPPORTED_EFFECTS[];
231 // Current antibanding setting.
232 // Example value: "auto" or ANTIBANDING_XXX constants. Read/write.
233 static const char KEY_ANTIBANDING[];
234 // Supported antibanding settings.
235 // Example value: "auto,50hz,60hz,off". Read only.
236 static const char KEY_SUPPORTED_ANTIBANDING[];
237 // Current scene mode.
238 // Example value: "auto" or SCENE_MODE_XXX constants. Read/write.
239 static const char KEY_SCENE_MODE[];
240 // Supported scene mode settings.
241 // Example value: "auto,night,fireworks". Read only.
242 static const char KEY_SUPPORTED_SCENE_MODES[];
243 // Current flash mode.
244 // Example value: "auto" or FLASH_MODE_XXX constants. Read/write.
245 static const char KEY_FLASH_MODE[];
246 // Supported flash modes.
247 // Example value: "auto,on,off". Read only.
248 static const char KEY_SUPPORTED_FLASH_MODES[];
249 // Current focus mode. This will not be empty. Applications should call
250 // CameraHardwareInterface.autoFocus to start the focus if focus mode is
251 // FOCUS_MODE_AUTO or FOCUS_MODE_MACRO.
252 // Example value: "auto" or FOCUS_MODE_XXX constants. Read/write.
253 static const char KEY_FOCUS_MODE[];
254 // Supported focus modes.
255 // Example value: "auto,macro,fixed". Read only.
256 static const char KEY_SUPPORTED_FOCUS_MODES[];
257 // The maximum number of focus areas supported. This is the maximum length
258 // of KEY_FOCUS_AREAS.
259 // Example value: "0" or "2". Read only.
260 static const char KEY_MAX_NUM_FOCUS_AREAS[];
261 // Current focus areas.
262 //
263 // Before accessing this parameter, apps should check
264 // KEY_MAX_NUM_FOCUS_AREAS first to know the maximum number of focus areas
265 // first. If the value is 0, focus area is not supported.
266 //
267 // Each focus area is a five-element int array. The first four elements are
268 // the rectangle of the area (left, top, right, bottom). The direction is
269 // relative to the sensor orientation, that is, what the sensor sees. The
270 // direction is not affected by the rotation or mirroring of
271 // CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates range from -1000 to 1000.
272 // (-1000,-1000) is the upper left point. (1000, 1000) is the lower right
273 // point. The width and height of focus areas cannot be 0 or negative.
274 //
275 // The fifth element is the weight. Values for weight must range from 1 to
276 // 1000. The weight should be interpreted as a per-pixel weight - all
277 // pixels in the area have the specified weight. This means a small area
278 // with the same weight as a larger area will have less influence on the
279 // focusing than the larger area. Focus areas can partially overlap and the
280 // driver will add the weights in the overlap region.
281 //
282 // A special case of single focus area (0,0,0,0,0) means driver to decide
283 // the focus area. For example, the driver may use more signals to decide
284 // focus areas and change them dynamically. Apps can set (0,0,0,0,0) if they
285 // want the driver to decide focus areas.
286 //
287 // Focus areas are relative to the current field of view (KEY_ZOOM). No
288 // matter what the zoom level is, (-1000,-1000) represents the top of the
289 // currently visible camera frame. The focus area cannot be set to be
290 // outside the current field of view, even when using zoom.
291 //
292 // Focus area only has effect if the current focus mode is FOCUS_MODE_AUTO,
293 // FOCUS_MODE_MACRO, FOCUS_MODE_CONTINUOUS_VIDEO, or
294 // FOCUS_MODE_CONTINUOUS_PICTURE.
295 // Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write.
296 static const char KEY_FOCUS_AREAS[];
297 // Focal length in millimeter.
298 // Example value: "4.31". Read only.
299 static const char KEY_FOCAL_LENGTH[];
300 // Horizontal angle of view in degrees.
301 // Example value: "54.8". Read only.
302 static const char KEY_HORIZONTAL_VIEW_ANGLE[];
303 // Vertical angle of view in degrees.
304 // Example value: "42.5". Read only.
305 static const char KEY_VERTICAL_VIEW_ANGLE[];
306 // Exposure compensation index. 0 means exposure is not adjusted.
James Paintere5382062012-09-05 18:02:32 -0700307 // Example value: "-5" or "5". Read/write.
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700308 static const char KEY_EXPOSURE_COMPENSATION[];
309 // The maximum exposure compensation index (>=0).
310 // Example value: "6". Read only.
311 static const char KEY_MAX_EXPOSURE_COMPENSATION[];
312 // The minimum exposure compensation index (<=0).
313 // Example value: "-6". Read only.
314 static const char KEY_MIN_EXPOSURE_COMPENSATION[];
315 // The exposure compensation step. Exposure compensation index multiply by
James Paintere5382062012-09-05 18:02:32 -0700316 // step eqals to EV. Ex: if exposure compensation index is -6 and step is
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700317 // 0.3333, EV is -2.
318 // Example value: "0.333333333" or "0.5". Read only.
319 static const char KEY_EXPOSURE_COMPENSATION_STEP[];
320 // The state of the auto-exposure lock. "true" means that
321 // auto-exposure is locked to its current value and will not
322 // change. "false" means the auto-exposure routine is free to
323 // change exposure values. If auto-exposure is already locked,
324 // setting this to true again has no effect (the driver will not
325 // recalculate exposure values). Changing exposure compensation
326 // settings will still affect the exposure settings while
327 // auto-exposure is locked. Stopping preview or taking a still
328 // image will not change the lock. In conjunction with
329 // exposure compensation, this allows for capturing multi-exposure
330 // brackets with known relative exposure values. Locking
331 // auto-exposure after open but before the first call to
332 // startPreview may result in severely over- or under-exposed
333 // images. The driver will not change the AE lock after
334 // auto-focus completes.
335 static const char KEY_AUTO_EXPOSURE_LOCK[];
336 // Whether locking the auto-exposure is supported. "true" means it is, and
337 // "false" or this key not existing means it is not supported.
338 static const char KEY_AUTO_EXPOSURE_LOCK_SUPPORTED[];
339 // The state of the auto-white balance lock. "true" means that
340 // auto-white balance is locked to its current value and will not
341 // change. "false" means the auto-white balance routine is free to
342 // change white balance values. If auto-white balance is already
343 // locked, setting this to true again has no effect (the driver
344 // will not recalculate white balance values). Stopping preview or
345 // taking a still image will not change the lock. In conjunction
346 // with exposure compensation, this allows for capturing
347 // multi-exposure brackets with fixed white balance. Locking
348 // auto-white balance after open but before the first call to
349 // startPreview may result in severely incorrect color. The
350 // driver will not change the AWB lock after auto-focus
351 // completes.
352 static const char KEY_AUTO_WHITEBALANCE_LOCK[];
353 // Whether locking the auto-white balance is supported. "true"
354 // means it is, and "false" or this key not existing means it is
355 // not supported.
356 static const char KEY_AUTO_WHITEBALANCE_LOCK_SUPPORTED[];
357
358 // The maximum number of metering areas supported. This is the maximum
359 // length of KEY_METERING_AREAS.
360 // Example value: "0" or "2". Read only.
361 static const char KEY_MAX_NUM_METERING_AREAS[];
362 // Current metering areas. Camera driver uses these areas to decide
363 // exposure.
364 //
365 // Before accessing this parameter, apps should check
366 // KEY_MAX_NUM_METERING_AREAS first to know the maximum number of metering
367 // areas first. If the value is 0, metering area is not supported.
368 //
369 // Each metering area is a rectangle with specified weight. The direction is
370 // relative to the sensor orientation, that is, what the sensor sees. The
371 // direction is not affected by the rotation or mirroring of
372 // CAMERA_CMD_SET_DISPLAY_ORIENTATION. Coordinates of the rectangle range
373 // from -1000 to 1000. (-1000, -1000) is the upper left point. (1000, 1000)
374 // is the lower right point. The width and height of metering areas cannot
375 // be 0 or negative.
376 //
377 // The fifth element is the weight. Values for weight must range from 1 to
378 // 1000. The weight should be interpreted as a per-pixel weight - all
379 // pixels in the area have the specified weight. This means a small area
380 // with the same weight as a larger area will have less influence on the
381 // metering than the larger area. Metering areas can partially overlap and
382 // the driver will add the weights in the overlap region.
383 //
384 // A special case of all-zero single metering area means driver to decide
385 // the metering area. For example, the driver may use more signals to decide
386 // metering areas and change them dynamically. Apps can set all-zero if they
387 // want the driver to decide metering areas.
388 //
389 // Metering areas are relative to the current field of view (KEY_ZOOM).
390 // No matter what the zoom level is, (-1000,-1000) represents the top of the
391 // currently visible camera frame. The metering area cannot be set to be
392 // outside the current field of view, even when using zoom.
393 //
394 // No matter what metering areas are, the final exposure are compensated
395 // by KEY_EXPOSURE_COMPENSATION.
396 // Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write.
397 static const char KEY_METERING_AREAS[];
398 // Current zoom value.
399 // Example value: "0" or "6". Read/write.
400 static const char KEY_ZOOM[];
401 // Maximum zoom value.
402 // Example value: "6". Read only.
403 static const char KEY_MAX_ZOOM[];
404 // The zoom ratios of all zoom values. The zoom ratio is in 1/100
405 // increments. Ex: a zoom of 3.2x is returned as 320. The number of list
406 // elements is KEY_MAX_ZOOM + 1. The first element is always 100. The last
407 // element is the zoom ratio of zoom value KEY_MAX_ZOOM.
408 // Example value: "100,150,200,250,300,350,400". Read only.
409 static const char KEY_ZOOM_RATIOS[];
410 // Whether zoom is supported. Zoom is supported if the value is "true". Zoom
411 // is not supported if the value is not "true" or the key does not exist.
412 // Example value: "true". Read only.
413 static const char KEY_ZOOM_SUPPORTED[];
414 // Whether if smooth zoom is supported. Smooth zoom is supported if the
415 // value is "true". It is not supported if the value is not "true" or the
416 // key does not exist.
417 // See CAMERA_CMD_START_SMOOTH_ZOOM, CAMERA_CMD_STOP_SMOOTH_ZOOM, and
418 // CAMERA_MSG_ZOOM in frameworks/base/include/camera/Camera.h.
419 // Example value: "true". Read only.
420 static const char KEY_SMOOTH_ZOOM_SUPPORTED[];
421
422 // The distances (in meters) from the camera to where an object appears to
423 // be in focus. The object is sharpest at the optimal focus distance. The
424 // depth of field is the far focus distance minus near focus distance.
425 //
426 // Focus distances may change after starting auto focus, canceling auto
427 // focus, or starting the preview. Applications can read this anytime to get
428 // the latest focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS,
429 // focus distances may change from time to time.
430 //
431 // This is intended to estimate the distance between the camera and the
432 // subject. After autofocus, the subject distance may be within near and far
433 // focus distance. However, the precision depends on the camera hardware,
434 // autofocus algorithm, the focus area, and the scene. The error can be
435 // large and it should be only used as a reference.
436 //
437 // Far focus distance > optimal focus distance > near focus distance. If
438 // the far focus distance is infinity, the value should be "Infinity" (case
439 // sensitive). The format is three float values separated by commas. The
440 // first is near focus distance. The second is optimal focus distance. The
441 // third is far focus distance.
442 // Example value: "0.95,1.9,Infinity" or "0.049,0.05,0.051". Read only.
443 static const char KEY_FOCUS_DISTANCES[];
444
445 // The current dimensions in pixels (width x height) for video frames.
446 // The width and height must be one of the supported sizes retrieved
447 // via KEY_SUPPORTED_VIDEO_SIZES.
448 // Example value: "1280x720". Read/write.
449 static const char KEY_VIDEO_SIZE[];
450 // A list of the supported dimensions in pixels (width x height)
451 // for video frames. See CAMERA_MSG_VIDEO_FRAME for details in
452 // frameworks/base/include/camera/Camera.h.
453 // Example: "176x144,1280x720". Read only.
454 static const char KEY_SUPPORTED_VIDEO_SIZES[];
455
456 // The maximum number of detected faces supported by hardware face
457 // detection. If the value is 0, hardware face detection is not supported.
458 // Example: "5". Read only
459 static const char KEY_MAX_NUM_DETECTED_FACES_HW[];
460
461 // The maximum number of detected faces supported by software face
462 // detection. If the value is 0, software face detection is not supported.
463 // Example: "5". Read only
464 static const char KEY_MAX_NUM_DETECTED_FACES_SW[];
465
466 // Preferred preview frame size in pixels for video recording.
467 // The width and height must be one of the supported sizes retrieved
468 // via KEY_SUPPORTED_PREVIEW_SIZES. This key can be used only when
469 // getSupportedVideoSizes() does not return an empty Vector of Size.
470 // Camcorder applications are recommended to set the preview size
471 // to a value that is not larger than the preferred preview size.
472 // In other words, the product of the width and height of the
473 // preview size should not be larger than that of the preferred
474 // preview size. In addition, we recommend to choos a preview size
475 // that has the same aspect ratio as the resolution of video to be
476 // recorded.
477 // Example value: "800x600". Read only.
478 static const char KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[];
479
480 // The image format for video frames. See CAMERA_MSG_VIDEO_FRAME in
481 // frameworks/base/include/camera/Camera.h.
482 // Example value: "yuv420sp" or PIXEL_FORMAT_XXX constants. Read only.
483 static const char KEY_VIDEO_FRAME_FORMAT[];
484
485 // Sets the hint of the recording mode. If this is true, MediaRecorder.start
486 // may be faster or has less glitches. This should be called before starting
487 // the preview for the best result. But it is allowed to change the hint
488 // while the preview is active. The default value is false.
489 //
490 // The apps can still call Camera.takePicture when the hint is true. The
491 // apps can call MediaRecorder.start when the hint is false. But the
492 // performance may be worse.
493 // Example value: "true" or "false". Read/write.
494 static const char KEY_RECORDING_HINT[];
495
496 // Returns true if video snapshot is supported. That is, applications
497 // can call Camera.takePicture during recording. Applications do not need to
498 // call Camera.startPreview after taking a picture. The preview will be
499 // still active. Other than that, taking a picture during recording is
500 // identical to taking a picture normally. All settings and methods related
501 // to takePicture work identically. Ex: KEY_PICTURE_SIZE,
502 // KEY_SUPPORTED_PICTURE_SIZES, KEY_JPEG_QUALITY, KEY_ROTATION, and etc.
503 // The picture will have an EXIF header. FLASH_MODE_AUTO and FLASH_MODE_ON
504 // also still work, but the video will record the flash.
505 //
506 // Applications can set shutter callback as null to avoid the shutter
507 // sound. It is also recommended to set raw picture and post view callbacks
508 // to null to avoid the interrupt of preview display.
509 //
510 // Field-of-view of the recorded video may be different from that of the
511 // captured pictures.
512 // Example value: "true" or "false". Read only.
513 static const char KEY_VIDEO_SNAPSHOT_SUPPORTED[];
514
515 // The state of the video stabilization. If set to true, both the
516 // preview stream and the recorded video stream are stabilized by
517 // the camera. Only valid to set if KEY_VIDEO_STABILIZATION_SUPPORTED is
518 // set to true.
519 //
520 // The value of this key can be changed any time the camera is
521 // open. If preview or recording is active, it is acceptable for
522 // there to be a slight video glitch when video stabilization is
523 // toggled on and off.
524 //
525 // This only stabilizes video streams (between-frames stabilization), and
526 // has no effect on still image capture.
527 static const char KEY_VIDEO_STABILIZATION[];
528
529 // Returns true if video stabilization is supported. That is, applications
530 // can set KEY_VIDEO_STABILIZATION to true and have a stabilized preview
531 // stream and record stabilized videos.
532 static const char KEY_VIDEO_STABILIZATION_SUPPORTED[];
533
James Paintere5382062012-09-05 18:02:32 -0700534 // Supported modes for special effects with light.
535 // Example values: "lowlight,hdr".
536 static const char KEY_LIGHTFX[];
537
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700538 // Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED.
539 static const char TRUE[];
540 static const char FALSE[];
541
542 // Value for KEY_FOCUS_DISTANCES.
543 static const char FOCUS_DISTANCE_INFINITY[];
544
545 // Values for white balance settings.
546 static const char WHITE_BALANCE_AUTO[];
547 static const char WHITE_BALANCE_INCANDESCENT[];
548 static const char WHITE_BALANCE_FLUORESCENT[];
549 static const char WHITE_BALANCE_WARM_FLUORESCENT[];
550 static const char WHITE_BALANCE_DAYLIGHT[];
551 static const char WHITE_BALANCE_CLOUDY_DAYLIGHT[];
552 static const char WHITE_BALANCE_TWILIGHT[];
553 static const char WHITE_BALANCE_SHADE[];
554
555 // Values for effect settings.
556 static const char EFFECT_NONE[];
557 static const char EFFECT_MONO[];
558 static const char EFFECT_NEGATIVE[];
559 static const char EFFECT_SOLARIZE[];
560 static const char EFFECT_SEPIA[];
561 static const char EFFECT_POSTERIZE[];
562 static const char EFFECT_WHITEBOARD[];
563 static const char EFFECT_BLACKBOARD[];
564 static const char EFFECT_AQUA[];
565
566 // Values for antibanding settings.
567 static const char ANTIBANDING_AUTO[];
568 static const char ANTIBANDING_50HZ[];
569 static const char ANTIBANDING_60HZ[];
570 static const char ANTIBANDING_OFF[];
571
572 // Values for flash mode settings.
573 // Flash will not be fired.
574 static const char FLASH_MODE_OFF[];
575 // Flash will be fired automatically when required. The flash may be fired
576 // during preview, auto-focus, or snapshot depending on the driver.
577 static const char FLASH_MODE_AUTO[];
578 // Flash will always be fired during snapshot. The flash may also be
579 // fired during preview or auto-focus depending on the driver.
580 static const char FLASH_MODE_ON[];
581 // Flash will be fired in red-eye reduction mode.
582 static const char FLASH_MODE_RED_EYE[];
583 // Constant emission of light during preview, auto-focus and snapshot.
584 // This can also be used for video recording.
585 static const char FLASH_MODE_TORCH[];
586
587 // Values for scene mode settings.
588 static const char SCENE_MODE_AUTO[];
589 static const char SCENE_MODE_ACTION[];
590 static const char SCENE_MODE_PORTRAIT[];
591 static const char SCENE_MODE_LANDSCAPE[];
592 static const char SCENE_MODE_NIGHT[];
593 static const char SCENE_MODE_NIGHT_PORTRAIT[];
594 static const char SCENE_MODE_THEATRE[];
595 static const char SCENE_MODE_BEACH[];
596 static const char SCENE_MODE_SNOW[];
597 static const char SCENE_MODE_SUNSET[];
598 static const char SCENE_MODE_STEADYPHOTO[];
599 static const char SCENE_MODE_FIREWORKS[];
600 static const char SCENE_MODE_SPORTS[];
601 static const char SCENE_MODE_PARTY[];
602 static const char SCENE_MODE_CANDLELIGHT[];
603 // Applications are looking for a barcode. Camera driver will be optimized
604 // for barcode reading.
605 static const char SCENE_MODE_BARCODE[];
Eino-Ville Talvalac61b2aa2012-09-10 11:59:12 -0700606 // A high-dynamic range mode. In this mode, the HAL module will use a
607 // capture strategy that extends the dynamic range of the captured
608 // image in some fashion. Only the final image is returned.
609 static const char SCENE_MODE_HDR[];
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700610
611 // Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT,
612 // and KEY_VIDEO_FRAME_FORMAT
613 static const char PIXEL_FORMAT_YUV422SP[];
614 static const char PIXEL_FORMAT_YUV420SP[]; // NV21
615 static const char PIXEL_FORMAT_YUV422I[]; // YUY2
616 static const char PIXEL_FORMAT_YUV420P[]; // YV12
617 static const char PIXEL_FORMAT_RGB565[];
618 static const char PIXEL_FORMAT_RGBA8888[];
619 static const char PIXEL_FORMAT_JPEG[];
620 // Raw bayer format used for images, which is 10 bit precision samples
621 // stored in 16 bit words. The filter pattern is RGGB.
622 static const char PIXEL_FORMAT_BAYER_RGGB[];
Eino-Ville Talvalaf6d96962012-07-18 17:50:46 -0700623 // Pixel format is not known to the framework
624 static const char PIXEL_FORMAT_ANDROID_OPAQUE[];
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700625
626 // Values for focus mode settings.
627 // Auto-focus mode. Applications should call
628 // CameraHardwareInterface.autoFocus to start the focus in this mode.
629 static const char FOCUS_MODE_AUTO[];
630 // Focus is set at infinity. Applications should not call
631 // CameraHardwareInterface.autoFocus in this mode.
632 static const char FOCUS_MODE_INFINITY[];
633 // Macro (close-up) focus mode. Applications should call
634 // CameraHardwareInterface.autoFocus to start the focus in this mode.
635 static const char FOCUS_MODE_MACRO[];
636 // Focus is fixed. The camera is always in this mode if the focus is not
637 // adjustable. If the camera has auto-focus, this mode can fix the
638 // focus, which is usually at hyperfocal distance. Applications should
639 // not call CameraHardwareInterface.autoFocus in this mode.
640 static const char FOCUS_MODE_FIXED[];
641 // Extended depth of field (EDOF). Focusing is done digitally and
642 // continuously. Applications should not call
643 // CameraHardwareInterface.autoFocus in this mode.
644 static const char FOCUS_MODE_EDOF[];
645 // Continuous auto focus mode intended for video recording. The camera
646 // continuously tries to focus. This is the best choice for video
647 // recording because the focus changes smoothly . Applications still can
648 // call CameraHardwareInterface.takePicture in this mode but the subject may
649 // not be in focus. Auto focus starts when the parameter is set.
650 //
651 // Applications can call CameraHardwareInterface.autoFocus in this mode. The
652 // focus callback will immediately return with a boolean that indicates
653 // whether the focus is sharp or not. The focus position is locked after
654 // autoFocus call. If applications want to resume the continuous focus,
655 // cancelAutoFocus must be called. Restarting the preview will not resume
656 // the continuous autofocus. To stop continuous focus, applications should
657 // change the focus mode to other modes.
658 static const char FOCUS_MODE_CONTINUOUS_VIDEO[];
659 // Continuous auto focus mode intended for taking pictures. The camera
660 // continuously tries to focus. The speed of focus change is more aggressive
661 // than FOCUS_MODE_CONTINUOUS_VIDEO. Auto focus starts when the parameter is
662 // set.
663 //
664 // Applications can call CameraHardwareInterface.autoFocus in this mode. If
665 // the autofocus is in the middle of scanning, the focus callback will
666 // return when it completes. If the autofocus is not scanning, focus
667 // callback will immediately return with a boolean that indicates whether
668 // the focus is sharp or not. The apps can then decide if they want to take
669 // a picture immediately or to change the focus mode to auto, and run a full
670 // autofocus cycle. The focus position is locked after autoFocus call. If
671 // applications want to resume the continuous focus, cancelAutoFocus must be
672 // called. Restarting the preview will not resume the continuous autofocus.
673 // To stop continuous focus, applications should change the focus mode to
674 // other modes.
675 static const char FOCUS_MODE_CONTINUOUS_PICTURE[];
676
James Paintere5382062012-09-05 18:02:32 -0700677 // Values for light special effects
678 // Low-light enhancement mode
679 static const char LIGHTFX_LOWLIGHT[];
680 // High-dynamic range mode
681 static const char LIGHTFX_HDR[];
682
Ruben Brunkb2119af2014-05-09 19:57:56 -0700683 /**
684 * Returns the the supported preview formats as an enum given in graphics.h
685 * corrsponding to the format given in the input string or -1 if no such
686 * conversion exists.
687 */
688 static int previewFormatToEnum(const char* format);
689
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700690private:
Eino-Ville Talvala1cebdb72014-03-26 18:10:09 +0000691 DefaultKeyedVector<String8,String8> mMap;
Eino-Ville Talvalac2d64272012-05-15 15:38:27 -0700692};
693
694}; // namespace android
695
696#endif