import exynos 7570 bsp
[GitHub/LineageOS/android_hardware_samsung_slsi_exynos5.git] / include / ExynosCamera.h
1 /*
2 **
3 ** Copyright 2008, The Android Open Source Project
4 ** Copyright 2010, Samsung Electronics Co. LTD
5 **
6 ** Licensed under the Apache License, Version 2.0 (the "License");
7 ** you may not use this file except in compliance with the License.
8 ** You may obtain a copy of the License at
9 **
10 ** http://www.apache.org/licenses/LICENSE-2.0
11 **
12 ** Unless required by applicable law or agreed to in writing, software
13 ** distributed under the License is distributed toggle an "AS IS" BASIS,
14 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ** See the License for the specific language governing permissions and
16 ** limitations under the License.
17 */
18
19 /*!
20 * \file ExynosCamera.h
21 * \brief hearder file for CAMERA HAL MODULE
22 * \author thun.hwang(thun.hwang@samsung.com)
23 * \date 2010/06/03
24 *
25 * <b>Revision History: </b>
26 * - 2011/12/31 : thun.hwang(thun.hwang@samsung.com) \n
27 * Initial version
28 *
29 * - 2012/01/18 : Sangwoo, Park(sw5771.park@samsung.com) \n
30 * Adjust Doxygen Document
31 *
32 * - 2012/02/01 : Sangwoo, Park(sw5771.park@samsung.com) \n
33 * Adjust libv4l2
34 * Adjust struct ExynosCameraInfo
35 * External ISP feature
36 *
37 * - 2012/03/14 : sangwoo.park(sw5771.park@samsung.com) \n
38 * Change file, class name to ExynosXXX.
39 */
40
41 #ifndef EXYNOS_CAMERA_H__
42 #define EXYNOS_CAMERA_H__
43
44 #include <stdio.h>
45 #include <string.h>
46 #include <stdlib.h>
47
48 #include <fcntl.h>
49 #include <unistd.h>
50 #include <errno.h>
51 #include <signal.h>
52 #include <sys/mman.h>
53 #include <sys/time.h>
54 #include <sys/ioctl.h>
55 #include <sys/poll.h>
56 #include <sys/stat.h>
57 #include <sys/types.h>
58
59 #include <videodev2.h>
60 #include <videodev2_exynos_camera.h>
61 #include <linux/vt.h>
62
63 #include <utils/RefBase.h>
64 #include <utils/String8.h>
65 #include "cutils/properties.h"
66
67 #include "exynos_format.h"
68 #include "ExynosBuffer.h"
69 #include "ExynosRect.h"
70 #include "ExynosJpegEncoderForCamera.h"
71 #include "ExynosExif.h"
72 #include "exynos_v4l2.h"
73
74 #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
75 namespace android {
76
77 #define GAIA_FW_BETA 1
78 /* FIXME: This is for test. We remove this after test */
79 #define USE_DIGITAL_ZOOM
80
81 //! struct for Camera sensor information
82 /*!
83 * \ingroup Exynos
84 */
85 struct ExynosCameraInfo
86 {
87 public:
88 // Google Official API : Camera.Parameters
89 // http://developer.android.com/reference/android/hardware/Camera.Parameters.html
90 int previewW;
91 int previewH;
92 int previewColorFormat;
93 int videoW;
94 int videoH;
95 int videoColorFormat;
96 int pictureW;
97 int pictureH;
98 int pictureColorFormat;
99 int thumbnailW;
100 int thumbnailH;
101
102 int antiBandingList;
103 int antiBanding;
104
105 int effectList;
106 int effect;
107
108 int flashModeList;
109 int flashMode;
110
111 int focusModeList;
112 int focusMode;
113
114 int sceneModeList;
115 int sceneMode;
116
117 int whiteBalanceList;
118 int whiteBalance;
119 bool autoWhiteBalanceLockSupported;
120 bool autoWhiteBalanceLock;
121
122 int rotation;
123 int minExposure;
124 int maxExposure;
125 int exposure;
126
127 bool autoExposureLockSupported;
128 bool autoExposureLock;
129
130 int fps;
131 int focalLengthNum;
132 int focalLengthDen;
133 bool supportVideoStabilization;
134 bool applyVideoStabilization;
135 bool videoStabilization;
136 int maxNumMeteringAreas;
137 int maxNumDetectedFaces;
138 int maxNumFocusAreas;
139 int maxZoom;
140 bool hwZoomSupported;
141 int zoom;
142
143 long gpsLatitude;
144 long gpsLongitude;
145 long gpsAltitude;
146 long gpsTimestamp;
147
148 // Additional API.
149 int angle;
150 bool antiShake;
151 bool beautyShot;
152 int brightness;
153 int contrast;
154 bool gamma;
155 bool odc;
156 int hue;
157 int iso;
158 int metering;
159 bool objectTracking;
160 bool objectTrackingStart;
161
162 int saturation;
163 int sharpness;
164 int shotMode;
165 bool slowAE;
166 bool smartAuto;
167 bool touchAfStart;
168 bool wdr;
169 bool tdnr;
170
171 public:
172 ExynosCameraInfo();
173 };
174
175 struct ExynosCameraInfoM5M0 : public ExynosCameraInfo
176 {
177 public:
178 ExynosCameraInfoM5M0();
179 };
180
181 struct ExynosCameraInfoS5K6A3 : public ExynosCameraInfo
182 {
183 public:
184 ExynosCameraInfoS5K6A3();
185 };
186
187 struct ExynosCameraInfoS5K4E5 : public ExynosCameraInfo
188 {
189 public:
190 ExynosCameraInfoS5K4E5();
191 };
192
193 struct ExynosCameraInfoS5K3H7 : public ExynosCameraInfo
194 {
195 public:
196 ExynosCameraInfoS5K3H7();
197 };
198
199 //! ExynosCamera
200 /*!
201 * \ingroup Exynos
202 */
203 class ExynosCamera : public virtual RefBase {
204
205 ///////////////////////////////////////////////////
206 // Google Official API : Camera.Parameters
207 // http://developer.android.com/reference/android/hardware/Camera.Parameters.html
208 ///////////////////////////////////////////////////
209 public:
210 //! Camera ID
211 enum CAMERA_ID {
212 CAMERA_ID_BACK = 0, //!<
213 CAMERA_ID_FRONT = 1, //!<
214 };
215
216 //! Anti banding
217 enum {
218 ANTIBANDING_AUTO = (1 << 0), //!< \n
219 ANTIBANDING_50HZ = (1 << 1), //!< \n
220 ANTIBANDING_60HZ = (1 << 2), //!< \n
221 ANTIBANDING_OFF = (1 << 3), //!< \n
222 };
223
224 //! Effect
225 enum {
226 EFFECT_NONE = (1 << 0), //!< \n
227 EFFECT_MONO = (1 << 1), //!< \n
228 EFFECT_NEGATIVE = (1 << 2), //!< \n
229 EFFECT_SOLARIZE = (1 << 3), //!< \n
230 EFFECT_SEPIA = (1 << 4), //!< \n
231 EFFECT_POSTERIZE = (1 << 5), //!< \n
232 EFFECT_WHITEBOARD = (1 << 6), //!< \n
233 EFFECT_BLACKBOARD = (1 << 7), //!< \n
234 EFFECT_AQUA = (1 << 8), //!< \n
235 };
236
237 //! Flash mode
238 enum {
239 FLASH_MODE_OFF = (1 << 0), //!< \n
240 FLASH_MODE_AUTO = (1 << 1), //!< \n
241 FLASH_MODE_ON = (1 << 2), //!< \n
242 FLASH_MODE_RED_EYE = (1 << 3), //!< \n
243 FLASH_MODE_TORCH = (1 << 4), //!< \n
244 };
245
246 //! Focus mode
247 enum {
248 FOCUS_MODE_AUTO = (1 << 0), //!< \n
249 FOCUS_MODE_INFINITY = (1 << 1), //!< \n
250 FOCUS_MODE_MACRO = (1 << 2), //!< \n
251 FOCUS_MODE_FIXED = (1 << 3), //!< \n
252 FOCUS_MODE_EDOF = (1 << 4), //!< \n
253 FOCUS_MODE_CONTINUOUS_VIDEO = (1 << 5), //!< \n
254 FOCUS_MODE_CONTINUOUS_PICTURE = (1 << 6), //!< \n
255 FOCUS_MODE_TOUCH = (1 << 7), //!< \n
256 };
257
258 //! Scene mode
259 enum {
260 SCENE_MODE_AUTO = (1 << 0), //!< \n
261 SCENE_MODE_ACTION = (1 << 1), //!< \n
262 SCENE_MODE_PORTRAIT = (1 << 2), //!< \n
263 SCENE_MODE_LANDSCAPE = (1 << 3), //!< \n
264 SCENE_MODE_NIGHT = (1 << 4), //!< \n
265 SCENE_MODE_NIGHT_PORTRAIT = (1 << 5), //!< \n
266 SCENE_MODE_THEATRE = (1 << 6), //!< \n
267 SCENE_MODE_BEACH = (1 << 7), //!< \n
268 SCENE_MODE_SNOW = (1 << 8), //!< \n
269 SCENE_MODE_SUNSET = (1 << 9), //!< \n
270 SCENE_MODE_STEADYPHOTO = (1 << 10), //!< \n
271 SCENE_MODE_FIREWORKS = (1 << 11), //!< \n
272 SCENE_MODE_SPORTS = (1 << 12), //!< \n
273 SCENE_MODE_PARTY = (1 << 13), //!< \n
274 SCENE_MODE_CANDLELIGHT = (1 << 14), //!< \n
275 };
276
277 //! White balance
278 enum {
279 WHITE_BALANCE_AUTO = (1 << 0), //!< \n
280 WHITE_BALANCE_INCANDESCENT = (1 << 1), //!< \n
281 WHITE_BALANCE_FLUORESCENT = (1 << 2), //!< \n
282 WHITE_BALANCE_WARM_FLUORESCENT = (1 << 3), //!< \n
283 WHITE_BALANCE_DAYLIGHT = (1 << 4), //!< \n
284 WHITE_BALANCE_CLOUDY_DAYLIGHT = (1 << 5), //!< \n
285 WHITE_BALANCE_TWILIGHT = (1 << 6), //!< \n
286 WHITE_BALANCE_SHADE = (1 << 7), //!< \n
287 };
288
289 //! Jpeg Qualtiy
290 enum JPEG_QUALITY {
291 JPEG_QUALITY_MIN = 0, //!<
292 JPEG_QUALITY_ECONOMY = 70, //!<
293 JPEG_QUALITY_NORMAL = 80, //!<
294 JPEG_QUALITY_SUPERFINE = 90, //!<
295 JPEG_QUALITY_MAX = 100, //!<
296 };
297
298 private:
299 //! Constructor
300 ExynosCamera();
301 //! Destructor
302 virtual ~ExynosCamera();
303
304 public:
305 //! Gets the Camera instance
306 static ExynosCamera* createInstance(void)
307 {
308 static ExynosCamera singleton;
309 return &singleton;
310 }
311
312 //! Create the instance
313 bool create(int cameraId);
314 //! Destroy the instance
315 bool destroy(void);
316 //! Check if the instance was created
317 bool flagCreate(void);
318
319 //! Gets current camera_id
320 int getCameraId(void);
321 //! Gets camera sensor name
322 char *getCameraName(void);
323
324 //! Gets file descriptor by gotten open() for preview
325 int getPreviewFd(void);
326 //! Gets file descriptor by gotten open() for recording
327 int getVideoFd(void);
328 //! Gets file descriptor by gotten open() for snapshot
329 int getPictureFd(void);
330
331 //! Starts capturing and drawing preview frames to the screen.
332 bool startPreview(void);
333 //! Stop preview
334 bool stopPreview(void);
335 //! Check preview start
336 bool flagStartPreview(void);
337 //! Gets preview's max buffer
338 int getPreviewMaxBuf(void);
339 //! Sets preview's buffer
340 bool setPreviewBuf(ExynosBuffer *buf);
341 //! Gets preview's buffer
342 bool getPreviewBuf(ExynosBuffer *buf);
343 //! Put(dq) preview's buffer
344 bool putPreviewBuf(ExynosBuffer *buf);
345
346 //! Sets video's width, height
347 bool setVideoSize(int w, int h);
348 //! Gets video's width, height
349 bool getVideoSize(int *w, int *h);
350
351 //! Sets video's color format
352 bool setVideoFormat(int colorFormat);
353 //! Gets video's color format
354 int getVideoFormat(void);
355
356 //! Start video
357 bool startVideo(void);
358 //! Stop video
359 bool stopVideo(void);
360 //! Check video start
361 bool flagStartVideo(void);
362 //! Gets video's buffer
363 int getVideoMaxBuf(void);
364 //! Sets video's buffer
365 bool setVideoBuf(ExynosBuffer *buf);
366 //! Gets video's buffer
367 bool getVideoBuf(ExynosBuffer *buf);
368 //! Put(dq) video's buffer
369 bool putVideoBuf(ExynosBuffer *buf);
370
371 //! Start snapshot
372 bool startPicture(void);
373 //! Stop snapshot
374 bool stopPicture(void);
375 //! Check snapshot start
376 bool flagStartPicture(void);
377 //! Gets snapshot's buffer
378 int getPictureMaxBuf(void);
379 //! Sets snapshot's buffer
380 bool setPictureBuf(ExynosBuffer *buf);
381 //! Gets snapshot's buffer
382 bool getPictureBuf(ExynosBuffer *buf);
383 //! Put(dq) snapshot's buffer
384 bool putPictureBuf(ExynosBuffer *buf);
385
386 //! Encode JPEG from YUV
387 bool yuv2Jpeg(ExynosBuffer *yuvBuf, ExynosBuffer *jpegBuf, ExynosRect *rect);
388
389 //! Starts camera auto-focus and registers a callback function to run when the camera is focused.
390 bool autoFocus(void);
391 //! Cancel auto-focus operation
392 bool cancelAutoFocus(void);
393 //! Gets auto-focus result whether success or not
394 int getFucusModeResult(void);
395
396 //! Starts the face detection.
397 bool startFaceDetection(void);
398 //! Stop face detection
399 bool stopFaceDetection(void);
400 //! Gets the face detection started
401 bool flagStartFaceDetection(void);
402 //! Lock or unlock face detection operation
403 bool setFaceDetectLock(bool toggle);
404
405 //! Zooms to the requested value smoothly.
406 bool startSmoothZoom(int value);
407 //! Stop the face detection.
408 bool stopSmoothZoom(void);
409
410 //! Gets the current antibanding setting.
411 int getAntibanding(void);
412
413 //! Gets the state of the auto-exposure lock.
414 bool getAutoExposureLock(void);
415
416 //! Gets the state of the auto-white balance lock.
417 bool getAutoWhiteBalanceLock(void);
418
419 //! Gets the current color effect setting.
420 int getColorEffect(void);
421
422 //! Gets the detected faces areas.
423 int getDetectedFacesAreas(int num, int *id, int *score, ExynosRect *face, ExynosRect *leftEye, ExynosRect *rightEye, ExynosRect *mouth);
424
425 //! Gets the detected faces areas. (Using ExynosRect2)
426 int getDetectedFacesAreas(int num, int *id, int *score, ExynosRect2 *face, ExynosRect2 *leftEye, ExynosRect2 *rightEye, ExynosRect2 *mouth);
427
428 //! Gets the current exposure compensation index.
429 int getExposureCompensation(void);
430
431 //! Gets the exposure compensation step.
432 float getExposureCompensationStep(void);
433
434 //! Gets the current flash mode setting.
435 int getFlashMode(void);
436
437 //! Gets the focal length (in millimeter) of the camera.
438 bool getFocalLength(int *num, int *den);
439
440 //! Gets the current focus areas.
441 int getFocusAreas(ExynosRect *rects);
442
443 //! Gets the distances from the camera to where an object appears to be in focus.
444 int getFocusDistances(float *output);
445
446 //! Gets the current focus mode setting.
447 int getFocusMode(void);
448
449 //! Gets the horizontal angle of view in degrees.
450 float getHorizontalViewAngle(void);
451
452 //int getInt(String key);
453
454 //! Returns the quality setting for the JPEG picture.
455 int getJpegQuality(void);
456
457 //! Returns the quality setting for the EXIF thumbnail in Jpeg picture.
458 int getJpegThumbnailQuality(void);
459
460 //! Returns the dimensions for EXIF thumbnail in Jpeg picture.
461 bool getJpegThumbnailSize(int *w, int *h);
462
463 //! Gets the maximum exposure compensation index.
464 int getMaxExposureCompensation(void);
465
466 //! Gets the maximum number of detected faces supported.
467 int getMaxNumDetectedFaces(void);
468
469 //! Gets the maximum number of focus areas supported.
470 int getMaxNumFocusAreas(void);
471
472 //! Gets the maximum number of metering areas supported.
473 int getMaxNumMeteringAreas(void);
474
475 //! Gets the maximum zoom value allowed for snapshot.
476 int getMaxZoom(void);
477
478 //! Gets the current metering areas.
479 int getMeteringAreas(ExynosRect *rects);
480
481 //! Gets the minimum exposure compensation index.
482 int getMinExposureCompensation(void);
483
484 //! Returns the image format for pictures.
485 int getPictureFormat(void);
486
487 //! Returns the dimension setting for pictures.
488 bool getPictureSize(int *w, int *h);
489
490 //Camera.Size getPreferredPreviewSizeForVideo();
491
492 //! Returns the image format for preview frames got from Camera.PreviewCallback.
493 int getPreviewFormat(void);
494
495 //! Returns the current minimum and maximum preview fps.
496 bool getPreviewFpsRange(int *min, int *max);
497
498 //! This method is deprecated. replaced by getPreviewFpsRange(int[])
499 int getPreviewFrameRate(void);
500
501 //! Returns the dimensions setting for preview pictures.
502 bool getPreviewSize(int *w, int *h);
503
504 //! Gets scene mode
505 int getSceneMode(void);
506
507 //! Gets the supported antibanding values.
508 int getSupportedAntibanding(void);
509
510 //! Gets the supported color effects.
511 int getSupportedColorEffects(void);
512
513 //! Check whether the target support Flash
514 int getSupportedFlashModes(void);
515
516 //! Gets the supported focus modes.
517 int getSupportedFocusModes(void);
518
519 //! Gets the supported jpeg thumbnail sizes.
520 bool getSupportedJpegThumbnailSizes(int *w, int *h);
521
522 // List<Integer> getSupportedPictureFormats()
523
524 //! Gets the supported picture sizes.
525 bool getSupportedPictureSizes(int *w, int *h);
526
527 //List<Integer> getSupportedPreviewFormats()
528
529 //List<int[]> getSupportedPreviewFpsRange()
530
531 //List<Integer> getSupportedPreviewFrameRates()
532
533 //! Gets the supported preview sizes.
534 bool getSupportedPreviewSizes(int *w, int *h);
535
536 //! Gets the supported scene modes.
537 int getSupportedSceneModes(void);
538
539 //! Gets the supported video frame sizes that can be used by MediaRecorder.
540 bool getSupportedVideoSizes(int *w, int *h);
541
542 //! Gets the supported white balance.
543 int getSupportedWhiteBalance(void);
544
545 //! Gets the vertical angle of view in degrees.
546 float getVerticalViewAngle(void);
547
548 //! Gets the current state of video stabilization.
549 bool getVideoStabilization(void);
550
551 //! Gets the current white balance setting.
552 int getWhiteBalance(void);
553
554 //! Gets current zoom value.
555 int getZoom(void);
556
557 //List<Integer> getZoomRatios()
558 //! Gets max zoom ratio
559 int getMaxZoomRatio(void);
560
561 //! Returns true if auto-exposure locking is supported.
562 bool isAutoExposureLockSupported(void);
563
564 //! Returns true if auto-white balance locking is supported.
565 bool isAutoWhiteBalanceLockSupported(void);
566
567 //! Returns true if smooth zoom is supported.
568 bool isSmoothZoomSupported(void);
569
570 //! Returns true if video snapshot is supported.
571 bool isVideoSnapshotSupported(void);
572
573 //! Returns true if video stabilization is supported.
574 bool isVideoStabilizationSupported(void);
575
576 //! Returns true if zoom is supported.
577 bool isZoomSupported(void);
578
579 //void remove(String key)
580
581 //void removeGpsData()
582
583 //void set(String key, String value)
584
585 //void set(String key, int value)
586
587 //! Sets the antibanding.
588 bool setAntibanding(int value);
589
590 //! Sets the auto-exposure lock state.
591 bool setAutoExposureLock(bool toggle);
592
593 //! Sets the auto-white balance lock state.
594 bool setAutoWhiteBalanceLock(bool toggle);
595
596 //! Sets the current color effect setting.
597 bool setColorEffect(int value);
598
599 //! Sets the exposure compensation index.
600 bool setExposureCompensation(int value);
601
602 //! Sets the flash mode.
603 bool setFlashMode(int value);
604
605 //! Sets focus z.
606 bool setFocusAreas(int num, ExynosRect* rects, int *weights);
607
608 //! Sets focus areas. (Using ExynosRect2)
609 bool setFocusAreas(int num, ExynosRect2* rect2s, int *weights);
610
611 //! Sets the focus mode.
612 bool setFocusMode(int value);
613
614 //! Sets GPS altitude.
615 bool setGpsAltitude(const char *gpsAltitude);
616
617 //! Sets GPS latitude coordinate.
618 bool setGpsLatitude(const char *gpsLatitude);
619
620 //! Sets GPS longitude coordinate.
621 bool setGpsLongitude(const char *gpsLongitude);
622
623 //! Sets GPS processing method.
624 bool setGpsProcessingMethod(const char *gpsProcessingMethod);
625
626 //! Sets GPS timestamp.
627 bool setGpsTimeStamp(const char *gpsTimestamp);
628
629 //! Sets Jpeg quality of captured picture.
630 bool setJpegQuality(int quality);
631
632 //! Sets the quality of the EXIF thumbnail in Jpeg picture.
633 bool setJpegThumbnailQuality(int quality);
634
635 //! Sets the dimensions for EXIF thumbnail in Jpeg picture.
636 bool setJpegThumbnailSize(int w, int h);
637
638 //! Sets metering areas.
639 bool setMeteringAreas(int num, ExynosRect *rects, int *weights);
640
641 //! Sets metering areas.(Using ExynosRect2)
642 bool setMeteringAreas(int num, ExynosRect2 *rect2s, int *weights);
643
644 //! Cancel metering areas.
645 bool cancelMeteringAreas();
646
647 //! Sets the image format for pictures.
648 bool setPictureFormat(int colorFormat);
649
650 //! Sets the dimensions for pictures.
651 bool setPictureSize(int w, int h);
652
653 //! Sets the image format for preview pictures.
654 bool setPreviewFormat(int colorFormat);
655
656 //void setPreviewFpsRange(int min, int max)
657
658 // ! This method is deprecated. replaced by setPreviewFpsRange(int, int)
659 bool setPreviewFrameRate(int fps);
660
661 //! Sets the dimensions for preview pictures.
662 bool setPreviewSize(int w, int h);
663
664 //! Sets recording mode hint.
665 bool setRecordingHint(bool hint);
666
667 //! Sets the rotation angle in degrees relative to the orientation of the camera.
668 bool setRotation(int rotation);
669
670 //! Gets the rotation angle in degrees relative to the orientation of the camera.
671 int getRotation(void);
672
673 //! Sets the scene mode.
674 bool setSceneMode(int value);
675
676 //! Enables and disables video stabilization.
677 bool setVideoStabilization(bool toggle);
678
679 //! Sets the white balance.
680 bool setWhiteBalance(int value);
681
682 //! Sets current zoom value.
683 bool setZoom(int value);
684
685 //void unflatten(String flattened)
686
687 private:
688 enum MODE
689 {
690 PREVIEW_MODE = 0,
691 VIDEO_MODE,
692 PICTURE_MODE,
693 };
694
695 struct devInfo {
696 int fd;
697 pollfd events;
698 bool flagStart;
699 };
700
701 bool m_flagCreate;
702
703 int m_cameraId;
704
705 ExynosCameraInfo *m_defaultCameraInfo;
706 ExynosCameraInfo *m_curCameraInfo;
707
708 int m_jpegQuality;
709 int m_jpegThumbnailQuality;
710
711 int m_currentZoom;
712 bool m_recordingHint;
713
714 // v4l2 sub-dev file description
715 devInfo m_sensorDev;
716 devInfo m_mipiDev;
717 devInfo m_fliteDev;
718 devInfo m_gscPreviewDev;
719 devInfo m_gscVideoDev;
720 devInfo m_gscPictureDev;
721
722 #ifdef USE_DIGITAL_ZOOM
723 devInfo m_gscBayerDev;
724 devInfo *m_bayerDev;
725 #endif
726
727 devInfo *m_previewDev;
728 devInfo *m_videoDev;
729 devInfo *m_pictureDev;
730
731 bool m_tryPreviewStop;
732 bool m_tryVideoStop;
733 bool m_tryPictureStop;
734
735 bool m_flagStartFaceDetection;
736 bool m_flagAutoFocusRunning;
737
738 char m_cameraName[32];
739 bool m_internalISP;
740 bool m_touchAFMode;
741 bool m_isTouchMetering;
742
743 bool m_focusIdle;
744
745 // media controller variable
746 struct media_device *m_media;
747 struct media_entity *m_sensorEntity;
748 struct media_entity *m_mipiEntity;
749 struct media_entity *m_fliteSdEntity;
750 struct media_entity *m_fliteVdEntity;
751 struct media_entity *m_gscSdEntity;
752 struct media_entity *m_gscVdEntity;
753 struct media_entity *m_ispSensorEntity;
754 struct media_entity *m_ispFrontEntity;
755 struct media_entity *m_ispBackEntity;
756 struct media_entity *m_ispBayerEntity;
757 struct media_entity *m_ispScalercEntity;
758 struct media_entity *m_ispScalerpEntity;
759 struct media_entity *m_isp3dnrEntity;
760
761 bool m_validPreviewBuf[VIDEO_MAX_FRAME];
762 bool m_validVideoBuf[VIDEO_MAX_FRAME];
763 bool m_validPictureBuf[VIDEO_MAX_FRAME];
764
765 struct ExynosBuffer m_previewBuf[VIDEO_MAX_FRAME];
766 struct ExynosBuffer m_videoBuf[VIDEO_MAX_FRAME];
767 struct ExynosBuffer m_pictureBuf[VIDEO_MAX_FRAME];
768
769 exif_attribute_t mExifInfo;
770
771 private:
772 bool m_setWidthHeight(int mode,
773 int fd,
774 struct pollfd *event,
775 int w,
776 int h,
777 int colorFormat,
778 struct ExynosBuffer *buf,
779 bool *validBuf);
780 bool m_setZoom(int fd, int zoom, int w, int h);
781 bool m_setCrop(int fd, int w, int h, int zoom);
782 bool m_getCropRect(unsigned int src_w, unsigned int src_h,
783 unsigned int dst_w, unsigned int dst_h,
784 unsigned int *crop_x, unsigned int *crop_y,
785 unsigned int *crop_w, unsigned int *crop_h,
786 int zoom);
787
788 void m_setExifFixedAttribute(void);
789 void m_setExifChangedAttribute(exif_attribute_t *exifInfo, ExynosRect *rect);
790 void m_secRect2SecRect2(ExynosRect *rect, ExynosRect2 *rect2);
791 void m_secRect22SecRect(ExynosRect2 *rect2, ExynosRect *rect);
792 void m_printFormat(int colorFormat, const char *arg);
793
794 ///////////////////////////////////////////////////
795 // Additional API.
796 ///////////////////////////////////////////////////
797 public:
798 //! Focus mode
799 enum {
800 FOCUS_MODE_CONTINUOUS_PICTURE_MACRO = (1 << 8), //!< \n
801 };
802
803 //! Metering
804 enum {
805 METERING_MODE_AVERAGE = (1 << 0), //!< \n
806 METERING_MODE_CENTER = (1 << 1), //!< \n
807 METERING_MODE_MATRIX = (1 << 2), //!< \n
808 METERING_MODE_SPOT = (1 << 3), //!< \n
809 };
810
811 //! Contrast
812 enum {
813 CONTRAST_AUTO = (1 << 0), //!< \n
814 CONTRAST_MINUS_2 = (1 << 1), //!< \n
815 CONTRAST_MINUS_1 = (1 << 2), //!< \n
816 CONTRAST_DEFAULT = (1 << 3), //!< \n
817 CONTRAST_PLUS_1 = (1 << 4), //!< \n
818 CONTRAST_PLUS_2 = (1 << 5), //!< \n
819 };
820 //! Camera Shot mode
821 enum SHOT_MODE {
822 SHOT_MODE_SINGLE = 0, //!<
823 SHOT_MODE_CONTINUOUS = 1, //!<
824 SHOT_MODE_PANORAMA = 2, //!<
825 SHOT_MODE_SMILE = 3, //!<
826 SHOT_MODE_SELF = 6, //!<
827 };
828
829 //! Sets camera angle
830 bool setAngle(int angle);
831
832 //! Gets camera angle
833 int getAngle(void);
834
835 //! Sets metering areas.
836 bool setMeteringMode(int value);
837 //! Gets metering
838 int getMeteringMode(void);
839
840 //! Sets Top-down mirror
841 bool setTopDownMirror(void);
842 //! Sets Left-right mirror
843 bool setLRMirror(void);
844
845 //! Sets brightness
846 bool setBrightness(int brightness);
847 //! Gets brightness
848 int getBrightness(void);
849
850 //! Sets ISO
851 bool setISO(int iso);
852 //! Gets ISO
853 int getISO(void);
854
855 //! Sets Contrast
856 bool setContrast(int value);
857 //! Gets Contrast
858 int getContrast(void);
859
860 //! Sets Saturation
861 bool setSaturation(int saturation);
862 //! Gets Saturation
863 int getSaturation(void);
864
865 //! Sets Sharpness
866 bool setSharpness(int sharpness);
867 //! Gets Sharpness
868 int getSharpness(void);
869
870 // ! Sets Hue
871 bool setHue(int hue);
872 // ! Gets Hue
873 int getHue(void);
874
875 //! Sets WDR
876 bool setWDR(bool toggle);
877 //! Gets WDR
878 bool getWDR(void);
879
880 //! Sets anti shake
881 bool setAntiShake(bool toggle);
882 //! Gets anti shake
883 bool getAntiShake(void);
884
885 //! Sets object tracking
886 bool setObjectTracking(bool toggle);
887 //! Gets object tracking
888 bool getObjectTracking(void);
889 //! Start or stop object tracking operation
890 bool setObjectTrackingStart(bool toggle);
891 //! Gets status of object tracking operation
892 int getObjectTrackingStatus(void);
893 //! Sets x, y position for object tracking operation
894 bool setObjectPosition(int x, int y);
895
896 //! Sets smart auto
897 bool setSmartAuto(bool toggle);
898 //! Gets smart auto
899 bool getSmartAuto(void);
900 //! Gets the status of smart auto operation
901 int getSmartAutoStatus(void);
902
903 //! Sets beauty shot
904 bool setBeautyShot(bool toggle);
905 //! Gets beauty shot
906 bool getBeautyShot(void);
907
908 //! Start or stop the touch auto focus operation
909 bool setTouchAFStart(bool toggle);
910
911 //! Sets gamma
912 bool setGamma(bool toggle);
913 //! Gets gamma
914 bool getGamma(void);
915
916 //! Sets ODC
917 bool setODC(bool toggle);
918 //! Gets ODC
919 bool getODC(void);
920
921 //! Sets Slow AE
922 bool setSlowAE(bool toggle);
923 //! Gets Slow AE
924 bool getSlowAE(void);
925
926 //! Sets Shot mode
927 bool setShotMode(int shotMode);
928 //! Gets Shot mode
929 int getShotMode(void);
930
931 //! Sets 3DNR
932 bool set3DNR(bool toggle);
933 //! Gets 3DNR
934 bool get3DNR(void);
935 };
936
937 }; // namespace android
938
939 #endif // EXYNOS_CAMERA_H__