Home | History | Annotate | Download | only in camera
      1 /*
      2 ** Copyright 2008, Google Inc.
      3 ** Copyright (c) 2009-2011, The Linux Foundation. All rights reserved.
      4 **
      5 ** Licensed under the Apache License, Version 2.0 (the "License");
      6 ** you may not use this file except in compliance with the License.
      7 ** You may obtain a copy of the License at
      8 **
      9 **     http://www.apache.org/licenses/LICENSE-2.0
     10 **
     11 ** Unless required by applicable law or agreed to in writing, software
     12 ** distributed under the License is distributed on an "AS IS" BASIS,
     13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 ** See the License for the specific language governing permissions and
     15 ** limitations under the License.
     16 */
     17 
     18 #ifndef ANDROID_HARDWARE_QUALCOMM_CAMERA_HARDWARE_H
     19 #define ANDROID_HARDWARE_QUALCOMM_CAMERA_HARDWARE_H
     20 
     21 #define ICS
     22 
     23 //#include <camera/CameraHardwareInterface.h>
     24 #include <utils/threads.h>
     25 #include <binder/MemoryBase.h>
     26 #include <binder/MemoryHeapBase.h>
     27 #include <stdint.h>
     28 #include <ui/egl/android_natives.h>
     29 #ifdef ICS
     30 #include <hardware/camera.h>
     31 #endif
     32 #include <camera/Camera.h>
     33 #include "QCameraParameters.h"
     34 #include <system/window.h>
     35 #include <system/camera.h>
     36 #include <hardware/camera.h>
     37 #include <gralloc_priv.h>
     38 #include <QComOMXMetadata.h>
     39 #include "QCamera_Intf.h"
     40 
     41 extern "C" {
     42 #include <linux/ion.h>
     43 #include <mm_camera_interface.h>
     44 }
     45 
     46 struct str_map {
     47     const char *const desc;
     48     int val;
     49 };
     50 
     51 struct buffer_map {
     52     msm_frame *frame;
     53     buffer_handle_t * buffer;
     54     int size;
     55     int lockState;
     56 };
     57 
     58 typedef enum {
     59     TARGET_MSM7625,
     60     TARGET_MSM7625A,
     61     TARGET_MSM7627,
     62     TARGET_MSM7627A,
     63     TARGET_QSD8250,
     64     TARGET_MSM7630,
     65     TARGET_MSM8660,
     66     TARGET_MAX
     67 }targetType;
     68 
     69 typedef enum {
     70     LIVESHOT_DONE,
     71     LIVESHOT_IN_PROGRESS,
     72     LIVESHOT_STOPPED
     73 }liveshotState;
     74 #define MIN_UNDEQUEUD_BUFFER_COUNT 2
     75 struct target_map {
     76     const char *targetStr;
     77     targetType targetEnum;
     78 };
     79 
     80 enum {
     81     BUFFER_UNLOCKED,
     82     BUFFER_LOCKED
     83 };
     84 
     85 struct board_property{
     86     targetType target;
     87     unsigned int previewSizeMask;
     88     bool hasSceneDetect;
     89     bool hasSelectableZoneAf;
     90     bool hasFaceDetect;
     91 };
     92 
     93 namespace android {
     94 
     95 class QualcommCameraHardware : public RefBase{
     96 public:
     97 
     98     //virtual sp<IMemoryHeap> getPreviewHeap() const;
     99     //virtual sp<IMemoryHeap> getRawHeap() const;
    100 
    101     void setCallbacks(camera_notify_callback notify_cb,
    102                             camera_data_callback data_cb,
    103                             camera_data_timestamp_callback data_cb_timestamp,
    104                             camera_request_memory get_memory,
    105                             void *user);
    106 
    107     virtual void enableMsgType(int32_t msgType);
    108     virtual void disableMsgType(int32_t msgType);
    109     virtual bool msgTypeEnabled(int32_t msgType);
    110 
    111     virtual status_t dump(int fd, const Vector<String16>& args) const;
    112     virtual status_t startPreview();
    113     virtual void stopPreview();
    114     virtual bool previewEnabled();
    115     virtual status_t startRecording();
    116     virtual void stopRecording();
    117     virtual bool recordingEnabled();
    118     virtual void releaseRecordingFrame(const void *opaque);
    119     virtual status_t autoFocus();
    120     virtual status_t cancelAutoFocus();
    121     virtual status_t takePicture();
    122     virtual status_t takeLiveSnapshot();
    123     virtual status_t takeLiveSnapshotInternal();
    124     void set_liveshot_exifinfo();
    125     virtual status_t cancelPicture();
    126     virtual status_t setParameters(const QCameraParameters& params);
    127     virtual QCameraParameters getParameters() const;
    128     virtual status_t sendCommand(int32_t command, int32_t arg1, int32_t arg2);
    129     virtual int32_t getNumberOfVideoBuffers();
    130     virtual sp<IMemory> getVideoBuffer(int32_t index);
    131     virtual status_t getBufferInfo( sp<IMemory>& Frame, size_t *alignedSize);
    132     virtual void encodeData( );
    133 #ifdef ICS
    134     virtual status_t set_PreviewWindow(void* param);
    135     virtual status_t setPreviewWindow(preview_stream_ops_t* window);
    136 #endif
    137     virtual status_t setPreviewWindow(const sp<ANativeWindow>& buf) {return NO_ERROR;};
    138     virtual void release();
    139 
    140     static QualcommCameraHardware* createInstance();
    141     static QualcommCameraHardware* getInstance();
    142 
    143     void receivePreviewFrame(struct msm_frame *frame);
    144     void receiveLiveSnapshot(uint32_t jpeg_size);
    145     void receiveCameraStats(camstats_type stype, camera_preview_histogram_info* histinfo);
    146     void receiveRecordingFrame(struct msm_frame *frame);
    147     void receiveJpegPicture(status_t status, mm_camera_buffer_t *encoded_buffer);
    148     void jpeg_set_location();
    149     void receiveJpegPictureFragment(uint8_t *buf, uint32_t size);
    150     void notifyShutter(bool mPlayShutterSoundOnly);
    151     void receive_camframe_error_timeout();
    152     static void getCameraInfo();
    153     void receiveRawPicture(status_t status,struct msm_frame *postviewframe, struct msm_frame *mainframe);
    154     int allocate_ion_memory(int *main_ion_fd, struct ion_allocation_data* alloc,
    155     struct ion_fd_data* ion_info_fd, int ion_type, int size, int *memfd);
    156     int deallocate_ion_memory(int *main_ion_fd, struct ion_fd_data* ion_info_fd);
    157     virtual ~QualcommCameraHardware();
    158     int storeMetaDataInBuffers(int enable);
    159 
    160 private:
    161     QualcommCameraHardware();
    162     status_t startPreviewInternal();
    163     status_t startRecordingInternal();
    164     status_t setHistogramOn();
    165     status_t setHistogramOff();
    166     status_t runFaceDetection();
    167     status_t setFaceDetection(const char *str);
    168 
    169     void stopPreviewInternal();
    170     friend void *auto_focus_thread(void *user);
    171     void runAutoFocus();
    172     status_t cancelAutoFocusInternal();
    173     bool native_set_dimension (int camfd);
    174     bool native_jpeg_encode (void);
    175     bool updatePictureDimension(const QCameraParameters& params, int& width, int& height);
    176     bool native_set_parms(camera_parm_type_t type, uint16_t length, void *value);
    177     bool native_set_parms(camera_parm_type_t type, uint16_t length, void *value, int *result);
    178     bool native_zoom_image(int fd, int srcOffset, int dstOffset, common_crop_t *crop);
    179 
    180     status_t startInitialPreview();
    181     void stopInitialPreview();
    182     status_t getBuffersAndStartPreview();
    183     void relinquishBuffers();
    184 
    185     QualcommCameraHardware * singleton;
    186 
    187     /* These constants reflect the number of buffers that libmmcamera requires
    188        for preview and raw, and need to be updated when libmmcamera
    189        changes.
    190     */
    191     static const int kPreviewBufferCount = NUM_PREVIEW_BUFFERS;
    192     static const int kRawBufferCount = 1;
    193     static const int kJpegBufferCount = 1;
    194     static const int kTotalPreviewBufferCount = kPreviewBufferCount + MIN_UNDEQUEUD_BUFFER_COUNT;
    195     int numCapture;
    196     int numJpegReceived;
    197     int jpegPadding;
    198 
    199     QCameraParameters mParameters;
    200     unsigned int frame_size;
    201     bool mCameraRunning;
    202     Mutex mCameraRunningLock;
    203     bool mPreviewInitialized;
    204 
    205 
    206     class MMCameraDL : public RefBase{
    207     private:
    208         static wp<MMCameraDL> instance;
    209         MMCameraDL();
    210         virtual ~MMCameraDL();
    211         void *libmmcamera;
    212         static Mutex singletonLock;
    213     public:
    214         static sp<MMCameraDL> getInstance();
    215         void * pointer();
    216     };
    217 
    218     // This class represents a heap which maintains several contiguous
    219     // buffers.  The heap may be backed by pmem (when pmem_pool contains
    220     // the name of a /dev/pmem* file), or by ashmem (when pmem_pool == NULL).
    221     struct MemPool : public RefBase {
    222         MemPool(int buffer_size, int num_buffers,
    223                 int frame_size,
    224                 const char *name);
    225 
    226         virtual ~MemPool()  ;// = 0;
    227 
    228         void completeInitialization();
    229         bool initialized() const {
    230             return mHeap != NULL && mHeap->base() != MAP_FAILED;
    231         }
    232 
    233         virtual status_t dump(int fd, const Vector<String16>& args) const;
    234 
    235         int mBufferSize;
    236         int mAlignedBufferSize;
    237         int mNumBuffers;
    238         int mFrameSize;
    239         sp<MemoryHeapBase> mHeap;
    240         sp<MemoryBase> *mBuffers;
    241 
    242         const char *mName;
    243     };
    244       struct DispMemPool : public MemPool {
    245           DispMemPool(int fd, int buffer_size,
    246           int num_buffers, int frame_size,
    247           const char *name);
    248           virtual ~DispMemPool();
    249           int mFD;
    250       };
    251       sp<DispMemPool> mPreviewHeap[kPreviewBufferCount + MIN_UNDEQUEUD_BUFFER_COUNT];
    252 
    253     struct AshmemPool : public MemPool {
    254         AshmemPool(int buffer_size, int num_buffers,
    255                    int frame_size,
    256                    const char *name);
    257     };
    258 
    259     struct PmemPool : public MemPool {
    260         PmemPool(const char *pmem_pool,
    261                  int flags, int pmem_type,
    262                  int buffer_size, int num_buffers,
    263                  int frame_size, int cbcr_offset,
    264                  int yoffset, const char *name);
    265         virtual ~PmemPool();
    266         int mFd;
    267         int mPmemType;
    268         int mCbCrOffset;
    269         int myOffset;
    270         int mCameraControlFd;
    271         uint32_t mAlignedSize;
    272         struct pmem_region mSize;
    273         sp<QualcommCameraHardware::MMCameraDL> mMMCameraDLRef;
    274     };
    275 //TODO
    276     struct IonPool : public MemPool {
    277         IonPool( int ion_heap_id, int flags, int ion_type,
    278              int buffer_size, int num_buffers,
    279              int frame_size, int cbcr_offset,
    280              int yoffset, const char *name);
    281     virtual ~IonPool();
    282     int mFd;
    283     int mIonType;
    284     int mCbCrOffset;
    285     int myOffset;
    286     int mCameraControlFd;
    287     uint32_t mAlignedSize;
    288     sp<QualcommCameraHardware::MMCameraDL> mMMCameraDLRef;
    289     static const char mIonDevName[];
    290     };
    291 #ifdef USE_ION
    292 //    sp<IonPool> mPreviewHeap;
    293     sp<IonPool> mYV12Heap;
    294     sp<IonPool> mRecordHeap;
    295     sp<IonPool> mThumbnailHeap;
    296     sp<IonPool> mRawHeap;
    297     sp<IonPool> mDisplayHeap;
    298     sp<AshmemPool> mJpegHeap;
    299     sp<AshmemPool> mStatHeap;
    300     sp<AshmemPool> mMetaDataHeap;
    301     sp<IonPool> mRawSnapShotPmemHeap;
    302     sp<IonPool> mLastPreviewFrameHeap;
    303     sp<IonPool> mPostviewHeap;
    304 #else
    305 //    sp<PmemPool> mPreviewHeap;
    306     sp<PmemPool> mYV12Heap;
    307     sp<PmemPool> mRecordHeap;
    308     sp<PmemPool> mThumbnailHeap;
    309     sp<PmemPool> mRawHeap;
    310     sp<PmemPool> mDisplayHeap;
    311     sp<AshmemPool> mJpegHeap;
    312     sp<AshmemPool> mStatHeap;
    313     sp<AshmemPool> mMetaDataHeap;
    314     sp<PmemPool> mRawSnapShotPmemHeap;
    315     sp<PmemPool> mLastPreviewFrameHeap;
    316     sp<PmemPool> mPostviewHeap;
    317 	sp<PmemPool> mPostViewHeap;
    318     sp<PmemPool> mInitialPreviewHeap;
    319 #endif
    320 
    321     sp<MMCameraDL> mMMCameraDLRef;
    322 
    323     bool startCamera();
    324     bool initPreview();
    325     bool initRecord();
    326     void deinitPreview();
    327     bool initRaw(bool initJpegHeap);
    328     bool initZslBuffers(bool initJpegHeap);
    329     bool deinitZslBuffers();
    330     bool initLiveSnapshot(int videowidth, int videoheight);
    331     bool initRawSnapshot();
    332     void deinitRaw();
    333     void deinitRawSnapshot();
    334     bool mPreviewThreadRunning;
    335     bool createSnapshotMemory (int numberOfRawBuffers, int numberOfJpegBuffers,
    336                                    bool initJpegHeap, int snapshotFormat = 1 /*PICTURE_FORMAT_JPEG*/);
    337     Mutex mPreviewThreadWaitLock;
    338     Condition mPreviewThreadWait;
    339     friend void *preview_thread(void *user);
    340     friend void *openCamera(void *data);
    341     void runPreviewThread(void *data);
    342     friend void *hfr_thread(void *user);
    343     void runHFRThread(void *data);
    344     bool mHFRThreadRunning;
    345 	int mapBuffer(msm_frame *frame);
    346 	int mapRawBuffer(msm_frame *frame);
    347 	int mapThumbnailBuffer(msm_frame *frame);
    348 	int mapJpegBuffer(mm_camera_buffer_t* buffer);
    349         int mapvideoBuffer( msm_frame *frame);
    350 	int mapFrame(buffer_handle_t *buffer);
    351     Mutex mHFRThreadWaitLock;
    352 
    353     class FrameQueue : public RefBase{
    354     private:
    355         Mutex mQueueLock;
    356         Condition mQueueWait;
    357         bool mInitialized;
    358 
    359         Vector<struct msm_frame *> mContainer;
    360     public:
    361         FrameQueue();
    362         virtual ~FrameQueue();
    363         bool add(struct msm_frame *element);
    364         void flush();
    365         struct msm_frame* get();
    366         void init();
    367         void deinit();
    368         bool isInitialized();
    369     };
    370 
    371     FrameQueue mPreviewBusyQueue;
    372 
    373     bool mFrameThreadRunning;
    374     Mutex mFrameThreadWaitLock;
    375     Condition mFrameThreadWait;
    376     friend void *frame_thread(void *user);
    377     void runFrameThread(void *data);
    378 
    379     //720p recording video thread
    380     bool mVideoThreadExit;
    381     bool mVideoThreadRunning;
    382     Mutex mVideoThreadWaitLock;
    383     Condition mVideoThreadWait;
    384     friend void *video_thread(void *user);
    385     void runVideoThread(void *data);
    386 
    387     // smooth zoom
    388     int mTargetSmoothZoom;
    389     bool mSmoothzoomThreadExit;
    390     bool mSmoothzoomThreadRunning;
    391     Mutex mSmoothzoomThreadWaitLock;
    392     Mutex mSmoothzoomThreadLock;
    393     Condition mSmoothzoomThreadWait;
    394     friend void *smoothzoom_thread(void *user);
    395     void runSmoothzoomThread(void* data);
    396 
    397     // For Histogram
    398     int mStatsOn;
    399     int mCurrent;
    400     bool mSendData;
    401     Mutex mStatsWaitLock;
    402     Condition mStatsWait;
    403 
    404     //For Face Detection
    405     int mFaceDetectOn;
    406     bool mSendMetaData;
    407     Mutex mMetaDataWaitLock;
    408 
    409     bool mShutterPending;
    410     Mutex mShutterLock;
    411 
    412     bool mSnapshotThreadRunning;
    413     Mutex mSnapshotThreadWaitLock;
    414     Condition mSnapshotThreadWait;
    415     friend void *snapshot_thread(void *user);
    416     void runSnapshotThread(void *data);
    417     Mutex mRawPictureHeapLock;
    418     bool mJpegThreadRunning;
    419     Mutex mJpegThreadWaitLock;
    420     Condition mJpegThreadWait;
    421     bool mInSnapshotMode;
    422     Mutex mInSnapshotModeWaitLock;
    423     Condition mInSnapshotModeWait;
    424     bool mEncodePending;
    425     Mutex mEncodePendingWaitLock;
    426     Condition mEncodePendingWait;
    427 	bool mBuffersInitialized;
    428 
    429     void debugShowPreviewFPS() const;
    430     void debugShowVideoFPS() const;
    431 
    432     int mSnapshotFormat;
    433     bool mFirstFrame;
    434     void hasAutoFocusSupport();
    435     void filterPictureSizes();
    436     void filterPreviewSizes();
    437     static void storeTargetType();
    438     bool supportsSceneDetection();
    439     bool supportsSelectableZoneAf();
    440     bool supportsFaceDetection();
    441 
    442     void initDefaultParameters();
    443     bool initImageEncodeParameters(int size);
    444     bool initZslParameter(void);
    445     status_t setCameraMode(const QCameraParameters& params);
    446     status_t setPreviewSize(const QCameraParameters& params);
    447     status_t setJpegThumbnailSize(const QCameraParameters& params);
    448     status_t setPreviewFpsRange(const QCameraParameters& params);
    449     status_t setPreviewFrameRate(const QCameraParameters& params);
    450     status_t setPreviewFrameRateMode(const QCameraParameters& params);
    451     status_t setRecordSize(const QCameraParameters& params);
    452     status_t setPictureSize(const QCameraParameters& params);
    453     status_t setJpegQuality(const QCameraParameters& params);
    454     status_t setAntibanding(const QCameraParameters& params);
    455     status_t setEffect(const QCameraParameters& params);
    456     status_t setRecordingHint(const QCameraParameters& params);
    457     status_t setExposureCompensation(const QCameraParameters &params);
    458     status_t setAutoExposure(const QCameraParameters& params);
    459     status_t setWhiteBalance(const QCameraParameters& params);
    460     status_t setFlash(const QCameraParameters& params);
    461     status_t setGpsLocation(const QCameraParameters& params);
    462     status_t setRotation(const QCameraParameters& params);
    463     status_t setZoom(const QCameraParameters& params);
    464     status_t setFocusMode(const QCameraParameters& params);
    465     status_t setFocusAreas(const QCameraParameters& params);
    466     status_t setMeteringAreas(const QCameraParameters& params);
    467     status_t setBrightness(const QCameraParameters& params);
    468     status_t setSkinToneEnhancement(const QCameraParameters& params);
    469     status_t setOrientation(const QCameraParameters& params);
    470     status_t setLensshadeValue(const QCameraParameters& params);
    471     status_t setMCEValue(const QCameraParameters& params);
    472     status_t setHDRImaging(const QCameraParameters& params);
    473     status_t setExpBracketing(const QCameraParameters& params);
    474     status_t setISOValue(const QCameraParameters& params);
    475     status_t setPictureFormat(const QCameraParameters& params);
    476     status_t setSharpness(const QCameraParameters& params);
    477     status_t setContrast(const QCameraParameters& params);
    478     status_t setSaturation(const QCameraParameters& params);
    479     status_t setSceneMode(const QCameraParameters& params);
    480     status_t setContinuousAf(const QCameraParameters& params);
    481     status_t setTouchAfAec(const QCameraParameters& params);
    482     status_t setSceneDetect(const QCameraParameters& params);
    483     status_t setStrTextures(const QCameraParameters& params);
    484     status_t setPreviewFormat(const QCameraParameters& params);
    485     status_t setSelectableZoneAf(const QCameraParameters& params);
    486     status_t setHighFrameRate(const QCameraParameters& params);
    487     bool register_record_buffers(bool register_buffer);
    488     status_t setRedeyeReduction(const QCameraParameters& params);
    489     status_t setDenoise(const QCameraParameters& params);
    490     status_t setZslParam(const QCameraParameters& params);
    491     status_t setSnapshotCount(const QCameraParameters& params);
    492     void setGpsParameters();
    493     bool storePreviewFrameForPostview();
    494     bool isValidDimension(int w, int h);
    495     status_t updateFocusDistances(const char *focusmode);
    496     int mStoreMetaDataInFrame;
    497 
    498     Mutex mLock;
    499 	Mutex mDisplayLock;
    500     Mutex mCamframeTimeoutLock;
    501     bool camframe_timeout_flag;
    502     bool mReleasedRecordingFrame;
    503 
    504     Mutex mParametersLock;
    505 
    506 
    507     Mutex mCallbackLock;
    508     Mutex mOverlayLock;
    509 	Mutex mRecordLock;
    510 	Mutex mRecordFrameLock;
    511 	Condition mRecordWait;
    512     Condition mStateWait;
    513 
    514     /* mJpegSize keeps track of the size of the accumulated JPEG.  We clear it
    515        when we are about to take a picture, so at any time it contains either
    516        zero, or the size of the last JPEG picture taken.
    517     */
    518     uint32_t mJpegSize;
    519     unsigned int        mPreviewFrameSize;
    520     unsigned int        mRecordFrameSize;
    521     int                 mRawSize;
    522     int                 mCbCrOffsetRaw;
    523     int                 mYOffset;
    524     int                 mJpegMaxSize;
    525     int32_t                 mStatSize;
    526 
    527 
    528     cam_ctrl_dimension_t mDimension;
    529     bool mAutoFocusThreadRunning;
    530     Mutex mAutoFocusThreadLock;
    531 
    532     Mutex mAfLock;
    533 
    534     pthread_t mFrameThread;
    535     pthread_t mVideoThread;
    536     pthread_t mPreviewThread;
    537     pthread_t mSnapshotThread;
    538     pthread_t mDeviceOpenThread;
    539     pthread_t mSmoothzoomThread;
    540     pthread_t mHFRThread;
    541 
    542     common_crop_t mCrop;
    543 
    544     bool mInitialized;
    545 
    546     int mBrightness;
    547     int mSkinToneEnhancement;
    548     int mHJR;
    549     unsigned int mThumbnailMapped[MAX_SNAPSHOT_BUFFERS];
    550     unsigned int mThumbnailLockState[MAX_SNAPSHOT_BUFFERS];
    551     int mRawfd[MAX_SNAPSHOT_BUFFERS];
    552     int mRawSnapshotfd;
    553     int mJpegfd[MAX_SNAPSHOT_BUFFERS];
    554     int mRecordfd[9];
    555     camera_memory_t *mPreviewMapped[kPreviewBufferCount + MIN_UNDEQUEUD_BUFFER_COUNT];
    556     camera_memory_t *mRawMapped[MAX_SNAPSHOT_BUFFERS];
    557     camera_memory_t *mJpegMapped[MAX_SNAPSHOT_BUFFERS];
    558     camera_memory_t *mRawSnapshotMapped;
    559     camera_memory_t *mStatsMapped[3];
    560     camera_memory_t *mRecordMapped[9];
    561     camera_memory_t *mJpegCopyMapped;
    562     camera_memory_t* metadata_memory[9];
    563     camera_memory_t *mJpegLiveSnapMapped;
    564     int raw_main_ion_fd[MAX_SNAPSHOT_BUFFERS];
    565     int raw_snapshot_main_ion_fd;
    566     int Jpeg_main_ion_fd[MAX_SNAPSHOT_BUFFERS];
    567     int record_main_ion_fd[9];
    568     struct ion_allocation_data raw_alloc[MAX_SNAPSHOT_BUFFERS];
    569     struct ion_allocation_data raw_snapshot_alloc;
    570     struct ion_allocation_data Jpeg_alloc[MAX_SNAPSHOT_BUFFERS];
    571     struct ion_allocation_data record_alloc[9];
    572     struct ion_fd_data raw_ion_info_fd[MAX_SNAPSHOT_BUFFERS];
    573     struct ion_fd_data raw_snapshot_ion_info_fd;
    574     struct ion_fd_data Jpeg_ion_info_fd[MAX_SNAPSHOT_BUFFERS];
    575     struct ion_fd_data record_ion_info_fd[9];
    576 
    577     struct msm_frame frames[kPreviewBufferCount + MIN_UNDEQUEUD_BUFFER_COUNT];
    578     struct buffer_map frame_buffer[kPreviewBufferCount + MIN_UNDEQUEUD_BUFFER_COUNT];
    579     struct msm_frame *recordframes;
    580     struct msm_frame *rawframes;
    581     bool *record_buffers_tracking_flag;
    582     bool mInPreviewCallback;
    583     preview_stream_ops_t* mPreviewWindow;
    584     android_native_buffer_t *mPostViewBuffer;
    585     buffer_handle_t *mThumbnailBuffer[MAX_SNAPSHOT_BUFFERS];
    586     bool mIs3DModeOn;
    587 
    588     int32_t mMsgEnabled;    // camera msg to be handled
    589     camera_notify_callback mNotifyCallback;
    590     camera_data_callback mDataCallback;
    591     camera_data_timestamp_callback mDataCallbackTimestamp;
    592     camera_request_memory mGetMemory;
    593     void *mCallbackCookie;  // same for all callbacks
    594     int mDebugFps;
    595     int kPreviewBufferCountActual;
    596     int previewWidth, previewHeight;
    597     int yv12framesize;
    598     bool mSnapshotDone;
    599     int maxSnapshotWidth;
    600     int maxSnapshotHeight;
    601     bool mHasAutoFocusSupport;
    602     int videoWidth, videoHeight;
    603 
    604     bool mDisEnabled;
    605     int mRotation;
    606     bool mResetWindowCrop;
    607     int mThumbnailWidth, mThumbnailHeight;
    608     status_t setVpeParameters();
    609     status_t setDIS();
    610     bool strTexturesOn;
    611     int mPictureWidth;
    612     int mPictureHeight;
    613     int mPostviewWidth;
    614     int mPostviewHeight;
    615 	int mTotalPreviewBufferCount;
    616     int mDenoiseValue;
    617     int mZslEnable;
    618     int mZslPanorama;
    619     bool mZslFlashEnable;
    620     cam_3d_frame_format_t mSnapshot3DFormat;
    621     bool mSnapshotCancel;
    622     bool mHFRMode;
    623     Mutex mSnapshotCancelLock;
    624     int mActualPictWidth;
    625     int mActualPictHeight;
    626     bool mUseJpegDownScaling;
    627     bool mPreviewStopping;
    628     bool mInHFRThread;
    629     Mutex mPmemWaitLock;
    630     Condition mPmemWait;
    631     bool mPrevHeapDeallocRunning;
    632     bool mHdrMode;
    633     bool mExpBracketMode;
    634 
    635     bool mMultiTouch;
    636 
    637     int mRecordingState;
    638 
    639     int mNumFDRcvd;
    640     int mFacesDetected;
    641     int mFaceArray[MAX_ROI * 4 + 1];
    642 
    643 };
    644 
    645 extern "C" int HAL_getNumberOfCameras();
    646 extern "C" void HAL_getCameraInfo(int cameraId, struct CameraInfo* cameraInfo);
    647 extern "C" QualcommCameraHardware* HAL_openCameraHardware(int cameraId);
    648 }; // namespace android
    649 
    650 #endif
    651