13d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
23d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *
33d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * Redistribution and use in source and binary forms, with or without
43d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * modification, are permitted provided that the following conditions are
53d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * met:
63d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *     * Redistributions of source code must retain the above copyright
73d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *       notice, this list of conditions and the following disclaimer.
83d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *     * Redistributions in binary form must reproduce the above
93d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *       copyright notice, this list of conditions and the following
103d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *       disclaimer in the documentation and/or other materials provided
113d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *       with the distribution.
123d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *     * Neither the name of The Linux Foundation nor the names of its
133d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *       contributors may be used to endorse or promote products derived
143d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *       from this software without specific prior written permission.
153d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *
163d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
173d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
183d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
193d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
203d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
213d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
223d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
233d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
243d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
253d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
263d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
273d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel *
283d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel */
293d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
303d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#ifndef __QCAMERA2HARDWAREINTERFACE_H__
313d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define __QCAMERA2HARDWAREINTERFACE_H__
323d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
333d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// System dependencies
343d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include <utils/Mutex.h>
353d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include <utils/Condition.h>
363d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
373d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel// Camera dependencies
383d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "camera.h"
393d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraAllocator.h"
403d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraChannel.h"
413d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraCmdThread.h"
4273e915617b67d794a7c4b8b9c180229a2226ab3aThierry Strudel#if 0 // Temporary removing the dependency on libgui
433d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraDisplay.h"
4473e915617b67d794a7c4b8b9c180229a2226ab3aThierry Strudel#endif
453d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraMem.h"
463d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraParameters.h"
473d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraParametersIntf.h"
483d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraPerf.h"
493d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraPostProc.h"
503d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraQueue.h"
513d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraStream.h"
523d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraStateMachine.h"
533d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraThermalAdapter.h"
54c2ee3304e16253ceab19f9be91c5da84233940f3Thierry Strudel#include "QCameraFOVControl.h"
5554dc9783295b20e33ec11e132d98a1b8efbf254cThierry Strudel#include "QCameraDualCamSettings.h"
563d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
573d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#ifdef TARGET_TS_MAKEUP
583d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "ts_makeup_engine.h"
593d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "ts_detectface_engine.h"
603d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#endif
613d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelextern "C" {
623d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "mm_camera_interface.h"
633d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "mm_jpeg_interface.h"
643d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel}
653d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
663d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#include "QCameraTrace.h"
673d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
683d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelnamespace qcamera {
693d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
703d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#ifndef TRUE
713d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define TRUE 1
723d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#endif
733d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
743d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#ifndef FALSE
753d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define FALSE 0
763d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#endif
773d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
783d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudeltypedef enum {
793d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_CH_TYPE_ZSL,
803d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_CH_TYPE_CAPTURE,
813d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_CH_TYPE_PREVIEW,
823d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_CH_TYPE_VIDEO,
833d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_CH_TYPE_SNAPSHOT,
843d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_CH_TYPE_RAW,
853d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_CH_TYPE_METADATA,
863d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_CH_TYPE_ANALYSIS,
873d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_CH_TYPE_CALLBACK,
88cca4d9c3be40fe18502f3237f7993b41175ef3a7Thierry Strudel    QCAMERA_CH_TYPE_REPROCESSING,
893d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_CH_TYPE_MAX
903d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel} qcamera_ch_type_enum_t;
913d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
923d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudeltypedef struct {
933d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t msg_type;
943d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t ext1;
953d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t ext2;
963d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel} qcamera_evt_argm_t;
973d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
983d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define QCAMERA_DUMP_FRM_PREVIEW             1
993d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define QCAMERA_DUMP_FRM_VIDEO               (1<<1)
100cca4d9c3be40fe18502f3237f7993b41175ef3a7Thierry Strudel#define QCAMERA_DUMP_FRM_INPUT_JPEG          (1<<2)
1013d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define QCAMERA_DUMP_FRM_THUMBNAIL           (1<<3)
1023d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define QCAMERA_DUMP_FRM_RAW                 (1<<4)
103cca4d9c3be40fe18502f3237f7993b41175ef3a7Thierry Strudel#define QCAMERA_DUMP_FRM_OUTPUT_JPEG         (1<<5)
1043d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define QCAMERA_DUMP_FRM_INPUT_REPROCESS     (1<<6)
1053d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
1063d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define QCAMERA_DUMP_FRM_MASK_ALL    0x000000ff
1073d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
1083d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define QCAMERA_ION_USE_CACHE   true
1093d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define QCAMERA_ION_USE_NOCACHE false
1103d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MAX_ONGOING_JOBS 25
1113d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
1123d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define MAX(a, b) ((a) > (b) ? (a) : (b))
1133d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
1143d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#define EXIF_ASCII_PREFIX_SIZE           8   //(sizeof(ExifAsciiPrefix))
1153d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
1163d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudeltypedef enum {
1173d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_NOTIFY_CALLBACK,
1183d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_DATA_CALLBACK,
1193d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_DATA_TIMESTAMP_CALLBACK,
1203d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCAMERA_DATA_SNAPSHOT_CALLBACK
1213d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel} qcamera_callback_type_m;
1223d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
1239ec39c64004dda78086849a21087cb217d0bf6acThierry Strudel/* meta data type and value in CameraMetaDataCallback */
1249ec39c64004dda78086849a21087cb217d0bf6acThierry Strudeltypedef enum {
1259ec39c64004dda78086849a21087cb217d0bf6acThierry Strudel    QCAMERA_METADATA_ASD = 0x001,
1269ec39c64004dda78086849a21087cb217d0bf6acThierry Strudel    QCAMERA_METADATA_FD,
1279ec39c64004dda78086849a21087cb217d0bf6acThierry Strudel    QCAMERA_METADATA_HDR,
1289ec39c64004dda78086849a21087cb217d0bf6acThierry Strudel    QCAMERA_METADATA_LED_CALIB
1299ec39c64004dda78086849a21087cb217d0bf6acThierry Strudel} cam_manual_capture_type;
1309ec39c64004dda78086849a21087cb217d0bf6acThierry Strudel
1313d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudeltypedef void (*camera_release_callback)(void *user_data,
1323d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                        void *cookie,
1333d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                        int32_t cb_status);
1343d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudeltypedef void (*jpeg_data_callback)(int32_t msg_type,
1353d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        const camera_memory_t *data, unsigned int index,
1363d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        camera_frame_metadata_t *metadata, void *user,
1373d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        uint32_t frame_idx, camera_release_callback release_cb,
1383d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        void *release_cookie, void *release_data);
1393d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
1403d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudeltypedef struct {
1413d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    qcamera_callback_type_m  cb_type;    // event type
1423d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t                  msg_type;   // msg type
1433d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t                  ext1;       // extended parameter
1443d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t                  ext2;       // extended parameter
1453d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    camera_memory_t *        data;       // ptr to data memory struct
1463d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    unsigned int             index;      // index of the buf in the whole buffer
1473d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int64_t                  timestamp;  // buffer timestamp
1483d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    camera_frame_metadata_t *metadata;   // meta data
1493d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void                    *user_data;  // any data needs to be released after callback
1503d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void                    *cookie;     // release callback cookie
1513d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    camera_release_callback  release_cb; // release callback
1523d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t                 frame_index;  // frame index for the buffer
1533d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel} qcamera_callback_argm_t;
1543d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
1553d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelclass QCameraCbNotifier {
1563d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelpublic:
1573d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraCbNotifier(QCamera2HardwareInterface *parent) :
1583d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                          mNotifyCb (NULL),
1593d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                          mDataCb (NULL),
1603d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                          mDataCbTimestamp (NULL),
1613d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                          mCallbackCookie (NULL),
1623d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                          mJpegCb(NULL),
1633d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                          mJpegCallbackCookie(NULL),
1643d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                          mParent (parent),
1653d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                          mDataQ(releaseNotifications, this),
1663d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                          mActive(false){}
1673d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
1683d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual ~QCameraCbNotifier();
1693d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
1703d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual int32_t notifyCallback(qcamera_callback_argm_t &cbArgs);
1713d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual void setCallbacks(camera_notify_callback notifyCb,
1723d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                              camera_data_callback dataCb,
1733d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                              camera_data_timestamp_callback dataCbTimestamp,
1743d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                              void *callbackCookie);
1753d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual void setJpegCallBacks(
1763d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            jpeg_data_callback jpegCb, void *callbackCookie);
1773d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual int32_t startSnapshots();
1783d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual void stopSnapshots();
1793d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual void exit();
1803d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void * cbNotifyRoutine(void * data);
1813d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void releaseNotifications(void *data, void *user_data);
1823d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static bool matchSnapshotNotifications(void *data, void *user_data);
1833d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static bool matchPreviewNotifications(void *data, void *user_data);
1843d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static bool matchTimestampNotifications(void *data, void *user_data);
1853d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual int32_t flushPreviewNotifications();
1863d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual int32_t flushVideoNotifications();
1873d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelprivate:
1883d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
1893d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    camera_notify_callback         mNotifyCb;
1903d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    camera_data_callback           mDataCb;
1913d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    camera_data_timestamp_callback mDataCbTimestamp;
1923d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void                          *mCallbackCookie;
1933d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    jpeg_data_callback             mJpegCb;
1943d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void                          *mJpegCallbackCookie;
1953d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCamera2HardwareInterface     *mParent;
1963d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
1973d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraQueue     mDataQ;
1983d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraCmdThread mProcTh;
1993d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool             mActive;
2003d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel};
2013d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelclass QCamera2HardwareInterface : public QCameraAllocator,
2023d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        public QCameraThermalCallback, public QCameraAdjustFPS
2033d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel{
2043d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelpublic:
2053d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    /* static variable and functions accessed by camera service */
2063d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static camera_device_ops_t mCameraOps;
2073d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int set_preview_window(struct camera_device *,
2083d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        struct preview_stream_ops *window);
2093d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void set_CallBacks(struct camera_device *,
2103d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        camera_notify_callback notify_cb,
2113d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        camera_data_callback data_cb,
2123d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        camera_data_timestamp_callback data_cb_timestamp,
2133d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        camera_request_memory get_memory,
2143d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        void *user);
2153d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void enable_msg_type(struct camera_device *, int32_t msg_type);
2163d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void disable_msg_type(struct camera_device *, int32_t msg_type);
2173d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int msg_type_enabled(struct camera_device *, int32_t msg_type);
2183d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int start_preview(struct camera_device *);
2193d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void stop_preview(struct camera_device *);
2203d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int preview_enabled(struct camera_device *);
2213d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int store_meta_data_in_buffers(struct camera_device *, int enable);
2223d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int restart_start_preview(struct camera_device *);
2233d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int restart_stop_preview(struct camera_device *);
2243d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int pre_start_recording(struct camera_device *);
2253d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int start_recording(struct camera_device *);
2263d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void stop_recording(struct camera_device *);
2273d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int recording_enabled(struct camera_device *);
2283d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void release_recording_frame(struct camera_device *, const void *opaque);
2293d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int auto_focus(struct camera_device *);
2303d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int cancel_auto_focus(struct camera_device *);
2313d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int pre_take_picture(struct camera_device *);
2323d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int take_picture(struct camera_device *);
2333d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int takeLiveSnapshot_internal();
2343d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int cancelLiveSnapshot_internal();
2353d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int takeBackendPic_internal(bool *JpegMemOpt, char *raw_format);
2363d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void clearIntPendingEvents();
2373d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void checkIntPicPending(bool JpegMemOpt, char *raw_format);
2383d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int cancel_picture(struct camera_device *);
2393d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int set_parameters(struct camera_device *, const char *parms);
2403d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int stop_after_set_params(struct camera_device *);
2413d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int commit_params(struct camera_device *);
2423d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int restart_after_set_params(struct camera_device *);
2433d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static char* get_parameters(struct camera_device *);
2443d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void put_parameters(struct camera_device *, char *);
2453d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int send_command(struct camera_device *,
2463d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel              int32_t cmd, int32_t arg1, int32_t arg2);
2473d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int send_command_restart(struct camera_device *,
2483d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            int32_t cmd, int32_t arg1, int32_t arg2);
2493d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void release(struct camera_device *);
2503d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int dump(struct camera_device *, int fd);
2513d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int close_camera_device(hw_device_t *);
2523d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
2533d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int register_face_image(struct camera_device *,
2543d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                   void *img_ptr,
2553d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                   cam_pp_offline_src_config_t *config);
2563d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int prepare_preview(struct camera_device *);
2573d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int prepare_snapshot(struct camera_device *device);
2583d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
2593d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelpublic:
2603d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCamera2HardwareInterface(uint32_t cameraId);
2613d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual ~QCamera2HardwareInterface();
2623d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int openCamera(struct hw_device_t **hw_device);
2633d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
2643d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    // Dual camera specific oprations
265295a0ca3b68291081f46052e545d5b0dec308710Thierry Strudel    int bundleRelatedCameras(bool syncOn);
2663d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int getCameraSessionId(uint32_t* session_id);
2673d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    const cam_sync_related_sensors_event_info_t* getRelatedCamSyncInfo(
2683d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            void);
2693d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t setRelatedCamSyncInfo(
2703d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            cam_sync_related_sensors_event_info_t* info);
2713d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isFrameSyncEnabled(void);
2723d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t setFrameSyncEnabled(bool enable);
2733d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t setMpoComposition(bool enable);
2743d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool getMpoComposition(void);
2753d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool getRecordingHintValue(void);
2763d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t setRecordingHintValue(int32_t value);
2773d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isPreviewRestartNeeded(void) { return mPreviewRestartNeeded; };
2783d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int getCapabilities(uint32_t cameraId,
2793d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            struct camera_info *info, cam_sync_type_t *cam_type);
2803d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static int initCapabilities(uint32_t cameraId, mm_camera_vtbl_t *cameraHandle);
281cca4d9c3be40fe18502f3237f7993b41175ef3a7Thierry Strudel    static cam_capability_t *getCapabilities(mm_camera_ops_t *ops,
282cca4d9c3be40fe18502f3237f7993b41175ef3a7Thierry Strudel            uint32_t cam_handle);
2833d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    cam_capability_t *getCamHalCapabilities();
2843d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
2853d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    // Implementation of QCameraAllocator
2863d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual QCameraMemory *allocateStreamBuf(cam_stream_type_t stream_type,
2873d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            size_t size, int stride, int scanline, uint8_t &bufferCnt);
2883d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual int32_t allocateMoreStreamBuf(QCameraMemory *mem_obj,
2893d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            size_t size, uint8_t &bufferCnt);
290cca4d9c3be40fe18502f3237f7993b41175ef3a7Thierry Strudel    virtual QCameraHeapMemory *allocateStreamInfoBuf(
2912896d129511c499aef15b8162df05fa299860f59Thierry Strudel            cam_stream_type_t stream_type, uint8_t bufCount = 1,
2922896d129511c499aef15b8162df05fa299860f59Thierry Strudel            uint32_t cam_type = MM_CAMERA_TYPE_MAIN);
2933d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual QCameraHeapMemory *allocateMiscBuf(cam_stream_info_t *streamInfo);
2943d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual QCameraMemory *allocateStreamUserBuf(cam_stream_info_t *streamInfo);
2953d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual void waitForDeferredAlloc(cam_stream_type_t stream_type);
2963d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
2973d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    // Implementation of QCameraThermalCallback
2983d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual int thermalEvtHandle(qcamera_thermal_level_enum_t *level,
2993d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            void *userdata, void *data);
3003d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
3013d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual int recalcFPSRange(int &minFPS, int &maxFPS,
3023d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            const float &minVideoFPS, const float &maxVideoFPS,
303c2ee3304e16253ceab19f9be91c5da84233940f3Thierry Strudel            cam_fps_range_t &adjustedRange, bool bRecordingHint);
3043d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
3053d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    friend class QCameraStateMachine;
3063d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    friend class QCameraPostProcessor;
3073d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    friend class QCameraCbNotifier;
3083d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    friend class QCameraMuxer;
3093d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
310cca4d9c3be40fe18502f3237f7993b41175ef3a7Thierry Strudel    int32_t initStreamInfoBuf(cam_stream_type_t stream_type,
3112896d129511c499aef15b8162df05fa299860f59Thierry Strudel            cam_stream_info_t *streamInfo, uint32_t cam_type = MM_CAMERA_TYPE_MAIN);
3123d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void setJpegCallBacks(jpeg_data_callback jpegCb,
3133d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            void *callbackCookie);
3143d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t initJpegHandle();
3153d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t deinitJpegHandle();
3163d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t setJpegHandleInfo(mm_jpeg_ops_t *ops,
3173d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            mm_jpeg_mpo_ops_t *mpo_ops, uint32_t pJpegClientHandle);
3183d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t getJpegHandleInfo(mm_jpeg_ops_t *ops,
3193d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            mm_jpeg_mpo_ops_t *mpo_ops, uint32_t *pJpegClientHandle);
3203d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t getCameraId() { return mCameraId; };
3213d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool bLiveSnapshot;
3223d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelprivate:
3233d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int setPreviewWindow(struct preview_stream_ops *window);
3243d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int setCallBacks(
3253d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        camera_notify_callback notify_cb,
3263d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        camera_data_callback data_cb,
3273d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        camera_data_timestamp_callback data_cb_timestamp,
3283d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        camera_request_memory get_memory,
3293d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        void *user);
3303d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int enableMsgType(int32_t msg_type);
3313d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int disableMsgType(int32_t msg_type);
3323d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int msgTypeEnabled(int32_t msg_type);
3333d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int msgTypeEnabledWithLock(int32_t msg_type);
3343d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int startPreview();
3353d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int stopPreview();
3363d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int storeMetaDataInBuffers(int enable);
3373d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int preStartRecording();
3383d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int startRecording();
3393d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int stopRecording();
3403d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int releaseRecordingFrame(const void *opaque);
3413d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int autoFocus();
3423d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int cancelAutoFocus();
3433d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int preTakePicture();
3443d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int takePicture();
3453d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int stopCaptureChannel(bool destroy);
3463d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int cancelPicture();
3473d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int takeLiveSnapshot();
3483d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int takePictureInternal();
3493d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int cancelLiveSnapshot();
3503d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    char* getParameters() {return mParameters.getParameters(); }
3513d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int putParameters(char *);
3523d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int sendCommand(int32_t cmd, int32_t &arg1, int32_t &arg2);
3533d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int release();
3543d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int dump(int fd);
3553d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int registerFaceImage(void *img_ptr,
3563d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                          cam_pp_offline_src_config_t *config,
3573d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                          int32_t &faceID);
3583d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t longShot();
3593d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
3603d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t deferPPInit();
3613d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int openCamera();
3623d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int closeCamera();
3633d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
3643d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int processAPI(qcamera_sm_evt_enum_t api, void *api_payload);
3653d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int processEvt(qcamera_sm_evt_enum_t evt, void *evt_payload);
3663d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int processSyncEvt(qcamera_sm_evt_enum_t evt, void *evt_payload);
3673d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void lockAPI();
3683d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void waitAPIResult(qcamera_sm_evt_enum_t api_evt, qcamera_api_result_t *apiResult);
3693d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void unlockAPI();
3703d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void signalAPIResult(qcamera_api_result_t *result);
3713d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void signalEvtResult(qcamera_api_result_t *result);
3723d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
3733d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int calcThermalLevel(qcamera_thermal_level_enum_t level,
3743d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            const int minFPSi, const int maxFPSi,
3753d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            const float &minVideoFPS, const float &maxVideoFPS,
3763d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            cam_fps_range_t &adjustedRange,
377c2ee3304e16253ceab19f9be91c5da84233940f3Thierry Strudel            enum msm_vfe_frame_skip_pattern &skipPattern,
378c2ee3304e16253ceab19f9be91c5da84233940f3Thierry Strudel            bool bRecordingHint);
3793d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int updateThermalLevel(void *level);
3803d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
3813d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    // update entris to set parameters and check if restart is needed
3823d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int updateParameters(const char *parms, bool &needRestart);
3833d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    // send request to server to set parameters
3843d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int commitParameterChanges();
3853d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
3863d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isCaptureShutterEnabled();
3873d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool needDebugFps();
3883d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isRegularCapture();
389cca4d9c3be40fe18502f3237f7993b41175ef3a7Thierry Strudel    bool needOfflineReprocessing();
3903d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isCACEnabled();
3913d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool is4k2kResolution(cam_dimension_t* resolution);
3923d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isPreviewRestartEnabled();
3933d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool needReprocess();
39454dc9783295b20e33ec11e132d98a1b8efbf254cThierry Strudel    bool needHALPP() {return m_bNeedHalPP;}
3953d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool needRotationReprocess();
3963d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void debugShowVideoFPS();
3973d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void debugShowPreviewFPS();
3983d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void dumpJpegToFile(const void *data, size_t size, uint32_t index);
3993d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void dumpFrameToFile(QCameraStream *stream,
4003d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            mm_camera_buf_def_t *frame, uint32_t dump_type, const char *misc = NULL);
4013d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void dumpMetadataToFile(QCameraStream *stream,
4023d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                            mm_camera_buf_def_t *frame,char *type);
4033d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void releaseSuperBuf(mm_camera_super_buf_t *super_buf);
4043d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void playShutter();
4053d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void getThumbnailSize(cam_dimension_t &dim);
4063d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t getJpegQuality();
4073d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraExif *getExifData();
4083d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    cam_sensor_t getSensorType();
4093d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isLowPowerMode();
4103d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    nsecs_t getBootToMonoTimeOffset();
4113d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
4123d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t processAutoFocusEvent(cam_auto_focus_data_t &focus_data);
4133d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t processZoomEvent(cam_crop_data_t &crop_info);
4143d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t processPrepSnapshotDoneEvent(cam_prep_snapshot_state_t prep_snapshot_state);
4153d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t processASDUpdate(cam_asd_decision_t asd_decision);
4163d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t processJpegNotify(qcamera_jpeg_evt_payload_t *jpeg_job);
4173d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t processHDRData(cam_asd_hdr_scene_data_t hdr_scene);
4189ec39c64004dda78086849a21087cb217d0bf6acThierry Strudel    int32_t processLEDCalibration(int32_t value);
4193d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t processRetroAECUnlock();
4203d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t processZSLCaptureDone();
4213d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t processSceneData(cam_scene_mode_type scene);
4223d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t transAwbMetaToParams(cam_awb_params_t &awb_params);
4233d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t processFocusPositionInfo(cam_focus_pos_info_t &cur_pos_info);
4243d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t processAEInfo(cam_3a_params_t &ae_params);
425c2ee3304e16253ceab19f9be91c5da84233940f3Thierry Strudel    void    processDualCamFovControl();
4263d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
4273d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t sendEvtNotify(int32_t msg_type, int32_t ext1, int32_t ext2);
4283d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t sendDataNotify(int32_t msg_type,
4293d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            camera_memory_t *data,
4303d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            uint8_t index,
4313d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            camera_frame_metadata_t *metadata,
4323d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            uint32_t frame_idx);
4333d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
4343d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t sendPreviewCallback(QCameraStream *stream,
4353d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            QCameraMemory *memory, uint32_t idx);
4363d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t selectScene(QCameraChannel *pChannel,
4373d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            mm_camera_super_buf_t *recvd_frame);
4383d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
4393d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t addChannel(qcamera_ch_type_enum_t ch_type);
4403d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t startChannel(qcamera_ch_type_enum_t ch_type);
4413d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t stopChannel(qcamera_ch_type_enum_t ch_type);
4423d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t delChannel(qcamera_ch_type_enum_t ch_type, bool destroy = true);
4433d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t addPreviewChannel();
4443d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t addSnapshotChannel();
4453d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t addVideoChannel();
4463d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t addZSLChannel();
4473d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t addCaptureChannel();
4483d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t addRawChannel();
4493d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t addMetaDataChannel();
4503d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t addAnalysisChannel();
4513d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraReprocessChannel *addReprocChannel(QCameraChannel *pInputChannel,
4523d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            int8_t cur_channel_index = 0);
4533d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraReprocessChannel *addOfflineReprocChannel(
4543d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                                cam_pp_offline_src_config_t &img_config,
4553d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                                cam_pp_feature_config_t &pp_feature,
4563d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                                stream_cb_routine stream_cb,
4573d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                                void *userdata);
4583d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t addCallbackChannel();
4593d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
4603d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t addStreamToChannel(QCameraChannel *pChannel,
4613d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                               cam_stream_type_t streamType,
4623d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                               stream_cb_routine streamCB,
4633d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                               void *userData);
4643d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t preparePreview();
4653d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void unpreparePreview();
4663d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t prepareRawStream(QCameraChannel *pChannel);
4673d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraChannel *getChannelByHandle(uint32_t channelHandle);
4683d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    mm_camera_buf_def_t *getSnapshotFrame(mm_camera_super_buf_t *recvd_frame);
4693d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t processFaceDetectionResult(cam_faces_data_t *fd_data);
4703d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool needPreviewFDCallback(uint8_t num_faces);
4713d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t processHistogramStats(cam_hist_stats_t &stats_data);
4723d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t setHistogram(bool histogram_en);
4733d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t setFaceDetection(bool enabled);
4743d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t prepareHardwareForSnapshot(int32_t afNeeded);
4753d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool needProcessPreviewFrame(uint32_t frameID);
4763d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool needSendPreviewCallback();
4773d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isNoDisplayMode() {return mParameters.isNoDisplayMode();};
4783d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isZSLMode() {return mParameters.isZSLMode();};
4793d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isRdiMode() {return mParameters.isRdiMode();};
4803d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint8_t numOfSnapshotsExpected() {
4813d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        return mParameters.getNumOfSnapshots();};
4823d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isSecureMode() {return mParameters.isSecureMode();};
4833d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isLongshotEnabled() { return mLongshotEnabled; };
4843d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isHFRMode() {return mParameters.isHfrMode();};
4853d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isLiveSnapshot() {return m_stateMachine.isRecording();};
4863d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void setRetroPicture(bool enable) { bRetroPicture = enable; };
4873d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isRetroPicture() {return bRetroPicture; };
4883d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isHDRMode() {return mParameters.isHDREnabled();};
4893d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint8_t getBufNumRequired(cam_stream_type_t stream_type);
490cca4d9c3be40fe18502f3237f7993b41175ef3a7Thierry Strudel    uint8_t getBufNumForAux(cam_stream_type_t stream_type);
4913d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool needFDMetadata(qcamera_ch_type_enum_t channel_type);
4922896d129511c499aef15b8162df05fa299860f59Thierry Strudel    int32_t getPaddingInfo(cam_stream_type_t streamType,
4932896d129511c499aef15b8162df05fa299860f59Thierry Strudel            cam_padding_info_t *padding_info);
4943d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t configureOnlineRotation(QCameraChannel &ch);
4953d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t declareSnapshotStreams();
4963d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t unconfigureAdvancedCapture();
4973d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t configureAdvancedCapture();
4983d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t configureAFBracketing(bool enable = true);
4993d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t configureHDRBracketing();
50054dc9783295b20e33ec11e132d98a1b8efbf254cThierry Strudel    int32_t configureHalPostProcess();
5013d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t stopAdvancedCapture(QCameraPicChannel *pChannel);
5023d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t startAdvancedCapture(QCameraPicChannel *pChannel);
5033d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t configureOptiZoom();
5043d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t configureStillMore();
5053d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t configureAEBracketing();
5063d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t updatePostPreviewParameters();
5073d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    inline void setOutputImageCount(uint32_t aCount) {mOutputCount = aCount;}
5083d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    inline uint32_t getOutputImageCount() {return mOutputCount;}
5093d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool processUFDumps(qcamera_jpeg_evt_payload_t *evt);
5103d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void captureDone();
5113d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t updateMetadata(metadata_buffer_t *pMetaData);
5123d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void fillFacesData(cam_faces_data_t &faces_data, metadata_buffer_t *metadata);
5133d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
5143d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t getPPConfig(cam_pp_feature_config_t &pp_config,
5153d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            int8_t curIndex = 0, bool multipass = FALSE);
5163d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual uint32_t scheduleBackgroundTask(BackgroundTask* bgTask);
5173d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    virtual int32_t waitForBackgroundTask(uint32_t &taskId);
5183d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool needDeferred(cam_stream_type_t stream_type);
5193d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void camEvtHandle(uint32_t camera_handle,
5203d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                          mm_camera_event_t *evt,
5213d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                          void *user_data);
5223d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void jpegEvtHandle(jpeg_job_status_t status,
5233d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                              uint32_t client_hdl,
5243d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                              uint32_t jobId,
5253d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                              mm_jpeg_output_t *p_buf,
5263d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                              void *userdata);
5273d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
5283d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void *evtNotifyRoutine(void *data);
5293d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
5303d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    // functions for different data notify cb
5313d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void zsl_channel_cb(mm_camera_super_buf_t *recvd_frame, void *userdata);
5323d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void capture_channel_cb_routine(mm_camera_super_buf_t *recvd_frame,
5333d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                           void *userdata);
5343d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void postproc_channel_cb_routine(mm_camera_super_buf_t *recvd_frame,
5353d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                            void *userdata);
5363d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void rdi_mode_stream_cb_routine(mm_camera_super_buf_t *frame,
5373d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                              QCameraStream *stream,
5383d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                              void *userdata);
5393d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void nodisplay_preview_stream_cb_routine(mm_camera_super_buf_t *frame,
5403d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                                    QCameraStream *stream,
5413d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                                    void *userdata);
5423d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void preview_stream_cb_routine(mm_camera_super_buf_t *frame,
5433d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                          QCameraStream *stream,
5443d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                          void *userdata);
5453d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void synchronous_stream_cb_routine(mm_camera_super_buf_t *frame,
5463d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            QCameraStream *stream, void *userdata);
5473d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void postview_stream_cb_routine(mm_camera_super_buf_t *frame,
5483d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                           QCameraStream *stream,
5493d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                           void *userdata);
5503d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void video_stream_cb_routine(mm_camera_super_buf_t *frame,
5513d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                        QCameraStream *stream,
5523d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                        void *userdata);
5533d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void snapshot_channel_cb_routine(mm_camera_super_buf_t *frame,
5543d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel           void *userdata);
5553d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void raw_channel_cb_routine(mm_camera_super_buf_t *frame,
5563d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            void *userdata);
5573d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void raw_stream_cb_routine(mm_camera_super_buf_t *frame,
5583d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                      QCameraStream *stream,
5593d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                      void *userdata);
5603d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void preview_raw_stream_cb_routine(mm_camera_super_buf_t * super_frame,
5613d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                              QCameraStream * stream,
5623d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                              void * userdata);
5633d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void snapshot_raw_stream_cb_routine(mm_camera_super_buf_t * super_frame,
5643d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                               QCameraStream * stream,
5653d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                               void * userdata);
5663d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void metadata_stream_cb_routine(mm_camera_super_buf_t *frame,
5673d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                           QCameraStream *stream,
5683d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                           void *userdata);
5693d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void callback_stream_cb_routine(mm_camera_super_buf_t *frame,
5703d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            QCameraStream *stream, void *userdata);
5713d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void reprocess_stream_cb_routine(mm_camera_super_buf_t *frame,
5723d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                            QCameraStream *stream,
5733d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                            void *userdata);
5749ec39c64004dda78086849a21087cb217d0bf6acThierry Strudel    static void secure_stream_cb_routine(mm_camera_super_buf_t *frame,
5759ec39c64004dda78086849a21087cb217d0bf6acThierry Strudel            QCameraStream *stream, void *userdata);
5763d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void releaseCameraMemory(void *data,
5773d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                    void *cookie,
5783d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                    int32_t cbStatus);
5793d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void returnStreamBuffer(void *data,
5803d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                   void *cookie,
5813d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                                   int32_t cbStatus);
5823d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void getLogLevel();
5833d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
5843d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t startRAWChannel(QCameraChannel *pChannel);
5853d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t stopRAWChannel();
5863d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
5873d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    inline bool getNeedRestart() {return m_bNeedRestart;}
5883d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    inline void setNeedRestart(bool needRestart) {m_bNeedRestart = needRestart;}
5893d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
5903d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    /*Start display skip. Skip starts after
5913d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    skipCnt number of frames from current frame*/
5923d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void setDisplaySkip(bool enabled, uint8_t skipCnt = 0);
5933d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    /*Caller can specify range frameID to skip.
5943d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    if end is 0, all the frames after start will be skipped*/
5953d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void setDisplayFrameSkip(uint32_t start = 0, uint32_t end = 0);
5963d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    /*Verifies if frameId is valid to skip*/
5973d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool isDisplayFrameToSkip(uint32_t frameId);
598cca4d9c3be40fe18502f3237f7993b41175ef3a7Thierry Strudel    bool isDualCamera() { return mDualCamera; };
599cca4d9c3be40fe18502f3237f7993b41175ef3a7Thierry Strudel    void fillDualCameraFOVControl();
6002896d129511c499aef15b8162df05fa299860f59Thierry Strudel    uint8_t getStreamRefCount(cam_stream_type_t stream_type,
6012896d129511c499aef15b8162df05fa299860f59Thierry Strudel            uint32_t cam_type = MM_CAMERA_TYPE_MAIN);
602cca4d9c3be40fe18502f3237f7993b41175ef3a7Thierry Strudel    uint32_t getCamHandleForChannel(qcamera_ch_type_enum_t ch_type);
6032896d129511c499aef15b8162df05fa299860f59Thierry Strudel    int32_t switchCameraCb(uint32_t camMaster);
6042896d129511c499aef15b8162df05fa299860f59Thierry Strudel    int32_t processCameraControl(uint32_t camState, bool bundledSnapshot);
605c2ee3304e16253ceab19f9be91c5da84233940f3Thierry Strudel    bool needSyncCB(cam_stream_type_t stream_type);
6062896d129511c499aef15b8162df05fa299860f59Thierry Strudel    uint32_t getSnapshotHandle();
6073d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudelprivate:
6083d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    camera_device_t   mCameraDevice;
6093d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t          mCameraId;
6103d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    mm_camera_vtbl_t *mCameraHandle;
6112896d129511c499aef15b8162df05fa299860f59Thierry Strudel    uint32_t mActiveCameras;
612c2ee3304e16253ceab19f9be91c5da84233940f3Thierry Strudel    uint32_t mMasterCamera;
61354dc9783295b20e33ec11e132d98a1b8efbf254cThierry Strudel    bool mBundledSnapshot;
6143d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool mCameraOpened;
615cca4d9c3be40fe18502f3237f7993b41175ef3a7Thierry Strudel    bool mDualCamera;
616c2ee3304e16253ceab19f9be91c5da84233940f3Thierry Strudel    QCameraFOVControl *m_pFovControl;
6173d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
6183d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    cam_jpeg_metadata_t mJpegMetadata;
6193d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool m_bRelCamCalibValid;
6203d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
6213d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    preview_stream_ops_t *mPreviewWindow;
6223d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraParametersIntf mParameters;
6233d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t               mMsgEnabled;
6243d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int                   mStoreMetaDataInFrame;
6253d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
6263d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    camera_notify_callback         mNotifyCb;
6273d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    camera_data_callback           mDataCb;
6283d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    camera_data_timestamp_callback mDataCbTimestamp;
6293d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    camera_request_memory          mGetMemory;
6303d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    jpeg_data_callback             mJpegCb;
6313d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void                          *mCallbackCookie;
6323d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void                          *mJpegCallbackCookie;
6333d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool                           m_bMpoEnabled;
6343d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
6353d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraStateMachine m_stateMachine;   // state machine
6363d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool m_smThreadActive;
6373d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraPostProcessor m_postprocessor; // post processor
6383d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraThermalAdapter &m_thermalAdapter;
6393d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraCbNotifier m_cbNotifier;
640c2ee3304e16253ceab19f9be91c5da84233940f3Thierry Strudel    QCameraPerfLockMgr m_perfLockMgr;
6413d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    pthread_mutex_t m_lock;
6423d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    pthread_cond_t m_cond;
6433d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    api_result_list *m_apiResultList;
6443d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraMemoryPool m_memoryPool;
6453d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
6463d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    pthread_mutex_t m_evtLock;
6473d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    pthread_cond_t m_evtCond;
6483d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    qcamera_api_result_t m_evtResult;
6493d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
6503d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
6513d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraChannel *m_channels[QCAMERA_CH_TYPE_MAX]; // array holding channel ptr
6523d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
6533d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool m_bPreviewStarted;             //flag indicates first preview frame callback is received
6543d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool m_bRecordStarted;             //flag indicates Recording is started for first time
6553d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
6563d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    // Signifies if ZSL Retro Snapshots are enabled
6573d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool bRetroPicture;
6583d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    // Signifies AEC locked during zsl snapshots
6593d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool m_bLedAfAecLock;
6603d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    cam_af_state_t m_currentFocusState;
6613d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
6623d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mDumpFrmCnt;  // frame dump count
6633d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mDumpSkipCnt; // frame skip count
6643d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    mm_jpeg_exif_params_t mExifParams;
6653d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    qcamera_thermal_level_enum_t mThermalLevel;
6663d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool mActiveAF;
6673d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool m_HDRSceneEnabled;
6683d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool mLongshotEnabled;
6693d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
6703d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    pthread_t mLiveSnapshotThread;
6713d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    pthread_t mIntPicThread;
6723d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool mFlashNeeded;
6739e74aae7331f3227542b3e646a0dd658d3467a31Thierry Strudel    bool mFlashConfigured;
6743d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mDeviceRotation;
6753d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mCaptureRotation;
6763d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mJpegExifRotation;
6773d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool mUseJpegExifRotation;
6783d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool mIs3ALocked;
6793d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool mPrepSnapRun;
6803d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t mZoomLevel;
6813d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    // Flag to indicate whether preview restart needed (for dual camera mode)
6823d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool mPreviewRestartNeeded;
6833d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
6843d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int mVFrameCount;
6853d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int mVLastFrameCount;
6863d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    nsecs_t mVLastFpsTime;
6873d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    double mVFps;
6883d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int mPFrameCount;
6893d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int mPLastFrameCount;
6903d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    nsecs_t mPLastFpsTime;
6913d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    double mPFps;
69204e026fe14f98a83811cd3a2c04b60b3b501b80cThierry Strudel    bool mLowLightConfigured;
6933d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint8_t mInstantAecFrameCount;
6943d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
6953d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    //eztune variables for communication with eztune server at backend
6963d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool m_bIntJpegEvtPending;
6973d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool m_bIntRawEvtPending;
6983d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    char m_BackendFileName[QCAMERA_MAX_FILEPATH_LENGTH];
6993d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    size_t mBackendFileSize;
7003d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    pthread_mutex_t m_int_lock;
7013d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    pthread_cond_t m_int_cond;
7023d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7033d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    enum DeferredWorkCmd {
7043d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        CMD_DEF_ALLOCATE_BUFF,
7053d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        CMD_DEF_PPROC_START,
7063d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        CMD_DEF_PPROC_INIT,
7073d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        CMD_DEF_METADATA_ALLOC,
7083d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        CMD_DEF_CREATE_JPEG_SESSION,
7093d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        CMD_DEF_PARAM_ALLOC,
7103d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        CMD_DEF_PARAM_INIT,
7113d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        CMD_DEF_GENERIC,
7123d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        CMD_DEF_MAX
7133d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    };
7143d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7153d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    typedef struct {
7163d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        QCameraChannel *ch;
7173d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        cam_stream_type_t type;
7183d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    } DeferAllocBuffArgs;
7193d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7203d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    typedef struct {
7213d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        uint8_t bufferCnt;
7223d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        size_t size;
7233d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    } DeferMetadataAllocArgs;
7243d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7253d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    typedef struct {
7263d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        jpeg_encode_callback_t jpeg_cb;
7273d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        void *user_data;
7283d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    } DeferPProcInitArgs;
7293d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7303d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    typedef union {
7313d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        DeferAllocBuffArgs allocArgs;
7323d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        QCameraChannel *pprocArgs;
7333d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        DeferMetadataAllocArgs metadataAllocArgs;
7343d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        DeferPProcInitArgs pprocInitArgs;
7353d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        BackgroundTask *genericArgs;
7363d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    } DeferWorkArgs;
7373d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7383d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    typedef struct {
7393d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        uint32_t mDefJobId;
7403d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7413d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        //Job status is needed to check job was successful or failed
7423d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        //Error code when job was not sucessful and there is error
7433d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        //0 when is initialized.
7443d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        //for sucessfull job, do not need to maintain job status
7453d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        int32_t mDefJobStatus;
7463d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    } DefOngoingJob;
7473d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7483d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    DefOngoingJob mDefOngoingJobs[MAX_ONGOING_JOBS];
7493d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7503d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    struct DefWork
7513d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    {
7523d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        DefWork(DeferredWorkCmd cmd_,
7533d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                 uint32_t id_,
7543d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                 DeferWorkArgs args_)
7553d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel            : cmd(cmd_),
7563d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel              id(id_),
7573d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel              args(args_){};
7583d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7593d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        DeferredWorkCmd cmd;
7603d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        uint32_t id;
7613d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel        DeferWorkArgs args;
7623d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    };
7633d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7643d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraCmdThread      mDeferredWorkThread;
7653d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraQueue          mCmdQueue;
7663d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7673d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    Mutex                 mDefLock;
7683d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    Condition             mDefCond;
7693d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7703d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t queueDeferredWork(DeferredWorkCmd cmd,
7713d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel                               DeferWorkArgs args);
7723d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t dequeueDeferredWork(DefWork* dw, int32_t jobStatus);
7733d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t waitDeferredWork(uint32_t &job_id);
7743d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static void *deferredWorkRoutine(void *obj);
7753d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool checkDeferredWork(uint32_t &job_id);
7763d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t getDefJobStatus(uint32_t &job_id);
7773d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
7783d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mReprocJob;
7793d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mJpegJob;
7803d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mMetadataAllocJob;
7813d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mInitPProcJob;
7823d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mParamAllocJob;
7833d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mParamInitJob;
7843d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mOutputCount;
7853d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mInputCount;
7863d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool mAdvancedCaptureConfigured;
7873d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool mHDRBracketingEnabled;
7883d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int32_t mNumPreviewFaces;
7893d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    // Jpeg Handle shared between HWI instances
7903d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    mm_jpeg_ops_t         mJpegHandle;
7913d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    // MPO handle shared between HWI instances
7923d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    // this is needed for MPO composition of related
7933d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    // cam images
7943d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    mm_jpeg_mpo_ops_t     mJpegMpoHandle;
7953d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t              mJpegClientHandle;
7963d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool                  mJpegHandleOwner;
7973d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel   //ts add for makeup
7983d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#ifdef TARGET_TS_MAKEUP
7993d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    TSRect mFaceRect;
8003d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool TsMakeupProcess_Preview(mm_camera_buf_def_t *pFrame,QCameraStream * pStream);
8013d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool TsMakeupProcess_Snapshot(mm_camera_buf_def_t *pFrame,QCameraStream * pStream);
8023d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool TsMakeupProcess(mm_camera_buf_def_t *frame,QCameraStream * stream,TSRect& faceRect);
8033d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#endif
8043d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraMemory *mMetadataMem;
8053d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
8063d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    static uint32_t sNextJobId;
8073d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
8083d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    //Gralloc memory details
8093d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    pthread_mutex_t mGrallocLock;
8103d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint8_t mEnqueuedBuffers;
8113d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool mCACDoneReceived;
8123d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
8133d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    //GPU library to read buffer padding details.
8143d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    void *lib_surface_utils;
8153d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    int (*LINK_get_surface_pixel_alignment)();
8163d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mSurfaceStridePadding;
8173d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
8183d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    //QCamera Display Object
81973e915617b67d794a7c4b8b9c180229a2226ab3aThierry Strudel#if 0 // Temporary removing the dependency on libgui
8203d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    QCameraDisplay mCameraDisplay;
82173e915617b67d794a7c4b8b9c180229a2226ab3aThierry Strudel#endif
8223d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    bool m_bNeedRestart;
8233d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    Mutex mMapLock;
8243d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    Condition mMapCond;
8253d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
8263d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    //Used to decide the next frameID to be skipped
8273d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mLastPreviewFrameID;
8283d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    //FrameID to start frame skip.
8293d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mFrameSkipStart;
8303d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    /*FrameID to stop frameskip. If this is not set,
8313d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    all frames are skipped till we set this*/
8323d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    uint32_t mFrameSkipEnd;
8333d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    //The offset between BOOTTIME and MONOTONIC timestamps
8343d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel    nsecs_t mBootToMonoTimestampOffset;
83504e026fe14f98a83811cd3a2c04b60b3b501b80cThierry Strudel    bool bDepthAFCallbacks;
836295a0ca3b68291081f46052e545d5b0dec308710Thierry Strudel    bool m_bOptimizeCacheOps;
83754dc9783295b20e33ec11e132d98a1b8efbf254cThierry Strudel    bool m_bNeedHalPP;
8383d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel};
8393d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
8403d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel}; // namespace qcamera
8413d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel
8423d63919a23d7e7954e160c48c36713267106c3c2Thierry Strudel#endif /* __QCAMERA2HARDWAREINTERFACE_H__ */
843