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