OMXCameraAdapter.h revision edd46f9fca8856c26bb367ba2d7a29a7002ed9af
1c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev/*
2c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev * Copyright (C) Texas Instruments - http://www.ti.com/
3c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev *
4c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev * Licensed under the Apache License, Version 2.0 (the "License");
5c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev * you may not use this file except in compliance with the License.
6c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev * You may obtain a copy of the License at
7c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev *
8c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev *      http://www.apache.org/licenses/LICENSE-2.0
9c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev *
10c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev * Unless required by applicable law or agreed to in writing, software
11c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev * distributed under the License is distributed on an "AS IS" BASIS,
12c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev * See the License for the specific language governing permissions and
14c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev * limitations under the License.
15c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev */
16c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
17c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
18c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
19c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#ifndef OMX_CAMERA_ADAPTER_H
20c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_ADAPTER_H
21c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
22c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "CameraHal.h"
23c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "OMX_Types.h"
24c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "OMX_Core.h"
25c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "OMX_CoreExt.h"
26c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "OMX_IVCommon.h"
27c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "OMX_Component.h"
28c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "OMX_Index.h"
29c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "OMX_IndexExt.h"
30c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "OMX_TI_Index.h"
31c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "OMX_TI_IVCommon.h"
32c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "OMX_TI_Common.h"
33c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "OMX_TI_Image.h"
34c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "General3A_Settings.h"
35c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
36c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "BaseCameraAdapter.h"
37c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "DebugUtils.h"
38c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
39c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
40c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevextern "C"
41c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev{
42c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "timm_osal_error.h"
43c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "timm_osal_events.h"
44c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "timm_osal_trace.h"
45c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#include "timm_osal_semaphores.h"
46c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev}
47c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
48c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevnamespace android {
49c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
50c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define Q16_OFFSET                  16
51c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
52c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CMD_TIMEOUT             3000000  //3 sec.
53c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define AF_CALLBACK_TIMEOUT         10000000 //10 seconds timeout
54c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAPTURE_TIMEOUT         5000000  //5 sec.
55c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
56c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define FOCUS_THRESHOLD             5 //[s.]
57c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
58c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define MIN_JPEG_QUALITY            1
59c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define MAX_JPEG_QUALITY            100
60c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define EXP_BRACKET_RANGE           10
61c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
62c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define FOCUS_DIST_SIZE             100
63c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define FOCUS_DIST_BUFFER_SIZE      500
64c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
65c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define TOUCH_DATA_SIZE             200
66c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define DEFAULT_THUMB_WIDTH         160
67c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define DEFAULT_THUMB_HEIGHT        120
68c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define FRAME_RATE_FULL_HD          27
69a38ea5631d139c3d5ffd4e181df2216dbce1b10cSundar Raman#define ZOOM_STAGES                 31
70c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
71c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define FACE_DETECTION_BUFFER_SIZE  0x1000
72c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
73c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define EXIF_MODEL_SIZE             100
74c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define EXIF_MAKE_SIZE              100
75c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define EXIF_DATE_TIME_SIZE         20
76c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
77bea7955fe043c646d21243e9889afbfe1d671ad9Tyler Luu#define GPS_MIN_DIV                 60
78bea7955fe043c646d21243e9889afbfe1d671ad9Tyler Luu#define GPS_SEC_DIV                 60
79bea7955fe043c646d21243e9889afbfe1d671ad9Tyler Luu#define GPS_SEC_ACCURACY            1000
80c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define GPS_TIMESTAMP_SIZE          6
81c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define GPS_DATESTAMP_SIZE          11
82c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define GPS_REF_SIZE                2
83c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define GPS_MAPDATUM_SIZE           100
84c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define GPS_PROCESSING_SIZE         100
85c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define GPS_VERSION_SIZE            4
86c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define GPS_NORTH_REF               "N"
87c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define GPS_SOUTH_REF               "S"
88c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define GPS_EAST_REF                "E"
89c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define GPS_WEST_REF                "W"
90c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
91c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev/* Default portstartnumber of Camera component */
92c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_DEFAULT_START_PORT_NUM 0
93c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
94c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev/* Define number of ports for differt domains */
95c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_OTHER_NUM 1
96c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_VIDEO_NUM 4
97c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_IMAGE_NUM 1
98c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_AUDIO_NUM 0
99c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_NUM_PORTS (OMX_CAMERA_PORT_OTHER_NUM + OMX_CAMERA_PORT_VIDEO_NUM + OMX_CAMERA_PORT_IMAGE_NUM + OMX_CAMERA_PORT_AUDIO_NUM)
100c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
101c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev/* Define start port number for differt domains */
102c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_OTHER_START OMX_CAMERA_DEFAULT_START_PORT_NUM
103c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_VIDEO_START (OMX_CAMERA_PORT_OTHER_START + OMX_CAMERA_PORT_OTHER_NUM)
104c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_IMAGE_START (OMX_CAMERA_PORT_VIDEO_START + OMX_CAMERA_PORT_VIDEO_NUM)
105c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_AUDIO_START (OMX_CAMERA_PORT_IMAGE_START + OMX_CAMERA_PORT_IMAGE_NUM)
106c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
107c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev/* Port index for camera component */
108c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_OTHER_IN (OMX_CAMERA_PORT_OTHER_START + 0)
109c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_VIDEO_IN_VIDEO (OMX_CAMERA_PORT_VIDEO_START + 0)
110c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_VIDEO_OUT_PREVIEW (OMX_CAMERA_PORT_VIDEO_START + 1)
111c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_VIDEO_OUT_VIDEO (OMX_CAMERA_PORT_VIDEO_START + 2)
112c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_VIDEO_OUT_MEASUREMENT (OMX_CAMERA_PORT_VIDEO_START + 3)
113c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_CAMERA_PORT_IMAGE_OUT_IMAGE (OMX_CAMERA_PORT_IMAGE_START + 0)
114c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
115c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
116c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_INIT_STRUCT(_s_, _name_)	\
117c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    memset(&(_s_), 0x0, sizeof(_name_));	\
118c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    (_s_).nSize = sizeof(_name_);		\
119c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    (_s_).nVersion.s.nVersionMajor = 0x1;	\
120c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    (_s_).nVersion.s.nVersionMinor = 0x1;	\
121c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    (_s_).nVersion.s.nRevision = 0x0;		\
122c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    (_s_).nVersion.s.nStep = 0x0
123c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
124c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define OMX_INIT_STRUCT_PTR(_s_, _name_)   \
125c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    memset((_s_), 0x0, sizeof(_name_));         \
126c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    (_s_)->nSize = sizeof(_name_);              \
127c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    (_s_)->nVersion.s.nVersionMajor = 0x1;      \
128c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    (_s_)->nVersion.s.nVersionMinor = 0x1;      \
129c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    (_s_)->nVersion.s.nRevision = 0x0;          \
130c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    (_s_)->nVersion.s.nStep = 0x0
131c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
132c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#define GOTO_EXIT_IF(_CONDITION,_ERROR) {                                       \
133c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    if ((_CONDITION)) {                                                         \
134c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        eError = (_ERROR);                                                      \
135c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        goto EXIT;                                                              \
136c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    }                                                                           \
137c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev}
138c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
139c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev///OMX Specific Functions
140c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevstatic OMX_ERRORTYPE OMXCameraAdapterEventHandler(OMX_IN OMX_HANDLETYPE hComponent,
141c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                        OMX_IN OMX_PTR pAppData,
142c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                        OMX_IN OMX_EVENTTYPE eEvent,
143c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                        OMX_IN OMX_U32 nData1,
144c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                        OMX_IN OMX_U32 nData2,
145c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                        OMX_IN OMX_PTR pEventData);
146c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
147c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevstatic OMX_ERRORTYPE OMXCameraAdapterEmptyBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
148c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                        OMX_IN OMX_PTR pAppData,
149c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                        OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
150c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
151c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevstatic OMX_ERRORTYPE OMXCameraAdapterFillBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
152c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                        OMX_IN OMX_PTR pAppData,
153c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                        OMX_IN OMX_BUFFERHEADERTYPE* pBuffHeader);
154c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
155c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevstruct CapResolution {
156c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    size_t width, height;
157c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    const char *param;
158c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev};
159c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
160c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevstruct CapPixelformat {
161c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    OMX_COLOR_FORMATTYPE pixelformat;
162c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    const char *param;
163c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev};
164c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
165c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevstruct CapU32 {
166c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    OMX_U32 num;
167c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    const char *param;
168c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev};
169c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
170f26e751771c0794008e466cd8f86601cf55fe572Tyler Luustruct CapU32Pair {
171f26e751771c0794008e466cd8f86601cf55fe572Tyler Luu    OMX_U32 num1, num2;
172f26e751771c0794008e466cd8f86601cf55fe572Tyler Luu    const char *param;
173f26e751771c0794008e466cd8f86601cf55fe572Tyler Luu};
174c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevstruct CapS32 {
175c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    OMX_S32 num;
176c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    const char *param;
177c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev};
178c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
179c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevtypedef CapU32 CapFramerate;
180c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevtypedef CapU32 CapISO;
181c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevtypedef CapU32 CapSensorName;
182c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevtypedef CapS32 CapZoom;
183c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevtypedef CapS32 CapEVComp;
184c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
185c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev/**
186c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev  * Class which completely abstracts the camera hardware interaction from camera hal
187c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev  * TODO: Need to list down here, all the message types that will be supported by this class
188c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                Need to implement BufferProvider interface to use AllocateBuffer of OMX if needed
189c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev  */
190c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevclass OMXCameraAdapter : public BaseCameraAdapter
191c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev{
192c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevpublic:
193c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
194c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    /*--------------------Constant declarations----------------------------------------*/
195c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const int32_t MAX_NO_BUFFERS = 20;
196c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
197c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    ///@remarks OMX Camera has six ports - buffer input, time input, preview, image, video, and meta data
198c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const int MAX_NO_PORTS = 6;
199c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
200c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    ///Five second timeout
201c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const int CAMERA_ADAPTER_TIMEOUT = 5000*1000;
202c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
203c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //EXIF ASCII prefix
204c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char EXIFASCIIPrefix[];
205c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
206c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    enum OMXCameraEvents
207c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        {
208c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        CAMERA_PORT_ENABLE  = 0x1,
209c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        CAMERA_PORT_FLUSH   = 0x2,
210c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        CAMERA_PORT_DISABLE = 0x4,
211c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        };
212c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
213c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    enum CaptureMode
214c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        {
215c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        HIGH_SPEED = 1,
216c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        HIGH_QUALITY = 2,
217c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        VIDEO_MODE = 3,
218c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        HIGH_QUALITY_ZSL = 4,
219c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        };
220c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
221c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    enum IPPMode
222c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        {
223024e97a1213041f9d266ee09f7148a0c9b007260Tyler Luu        IPP_NULL = -1,
224c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        IPP_NONE = 0,
225c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        IPP_NSF,
226c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        IPP_LDC,
227c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        IPP_LDCNSF,
228c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        };
229c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
230c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    enum CodingMode
231c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        {
232c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        CodingNone = 0,
233c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        CodingJPS,
234c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        CodingMPO,
235c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        CodingRAWJPEG,
236c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        CodingRAWMPO,
237c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        };
238c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
239c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    enum Algorithm3A
240c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        {
241c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        WHITE_BALANCE_ALGO = 0x1,
242c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        EXPOSURE_ALGO = 0x2,
243c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        FOCUS_ALGO = 0x4,
244c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        };
245c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
246c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    enum AlgoPriority
247c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        {
248c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        FACE_PRIORITY = 0,
249c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        REGION_PRIORITY,
250c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        };
251c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
252c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    enum BrightnessMode
253c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        {
254c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        BRIGHTNESS_OFF = 0,
255c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        BRIGHTNESS_ON,
256c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        BRIGHTNESS_AUTO,
257c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        };
258c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
259c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    class GPSData
260c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    {
261c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        public:
262bea7955fe043c646d21243e9889afbfe1d671ad9Tyler Luu                int mLongDeg, mLongMin, mLongSec, mLongSecDiv;
263c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                char mLongRef[GPS_REF_SIZE];
264c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                bool mLongValid;
265bea7955fe043c646d21243e9889afbfe1d671ad9Tyler Luu                int mLatDeg, mLatMin, mLatSec, mLatSecDiv;
266c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                char mLatRef[GPS_REF_SIZE];
267c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                bool mLatValid;
268c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                int mAltitude;
269c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                unsigned char mAltitudeRef;
270c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                bool mAltitudeValid;
271c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                char mMapDatum[GPS_MAPDATUM_SIZE];
272c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                bool mMapDatumValid;
273c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                char mVersionId[GPS_VERSION_SIZE];
274c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                bool mVersionIdValid;
275c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                char mProcMethod[GPS_PROCESSING_SIZE];
276c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                bool mProcMethodValid;
277c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                char mDatestamp[GPS_DATESTAMP_SIZE];
278c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                bool mDatestampValid;
279c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                uint32_t mTimeStampHour;
280c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                uint32_t mTimeStampMin;
281c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                uint32_t mTimeStampSec;
282c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                bool mTimeStampValid;
283c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    };
284c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
285c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    class EXIFData
286c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    {
287c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        public:
288c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            GPSData mGPSData;
289c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            bool mMakeValid;
290c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            bool mModelValid;
291c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    };
292c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
293c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    ///Parameters specific to any port of the OMX Camera component
294c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    class OMXCameraPortParameters
295c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    {
296c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        public:
297c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U32                         mHostBufaddr[MAX_NO_BUFFERS];
298c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_BUFFERHEADERTYPE           *mBufferHeader[MAX_NO_BUFFERS];
299c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U32                         mWidth;
300c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U32                         mHeight;
301c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U32                         mStride;
302c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U8                          mNumBufs;
303c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
304c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            // defines maximum number of buffers our of mNumBufs
305c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            // queueable at given moment
306c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U8                          mMaxQueueable;
307c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
308c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U32                         mBufSize;
309c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_COLOR_FORMATTYPE            mColorFormat;
310c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_PARAM_VIDEONOISEFILTERTYPE  mVNFMode;
311c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_PARAM_VIDEOYUVRANGETYPE     mYUVRange;
312c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_CONFIG_BOOLEANTYPE          mVidStabParam;
313c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_CONFIG_FRAMESTABTYPE        mVidStabConfig;
314c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U32                         mCapFrame;
315c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U32                         mFrameRate;
316c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_S32                         mMinFrameRate;
317c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_S32                         mMaxFrameRate;
318c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            CameraFrame::FrameType mImageType;
319c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    };
320c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
321c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    ///Context of the OMX Camera component
322c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    class OMXCameraAdapterComponentContext
323c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    {
324c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        public:
325c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_HANDLETYPE              mHandleComp;
326c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U32                     mNumPorts;
327c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_STATETYPE               mState ;
328c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U32                     mVideoPortIndex;
329c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U32                     mPrevPortIndex;
330c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U32                     mImagePortIndex;
331c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMX_U32                     mMeasurementPortIndex;
332c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMXCameraPortParameters     mCameraPortParams[MAX_NO_PORTS];
333c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    };
334c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
335c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevpublic:
336c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
337c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    OMXCameraAdapter();
338c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    ~OMXCameraAdapter();
339c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
340c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    ///Initialzes the camera adapter creates any resources required
341c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t initialize(CameraProperties::Properties*, int sensor_index=0);
342c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
343c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //APIs to configure Camera adapter and get the current parameter set
344c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t setParameters(const CameraParameters& params);
345c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual void getParameters(CameraParameters& params);
346c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
347c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    // API
348c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t UseBuffersPreview(void* bufArr, int num);
349c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
350c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //API to flush the buffers for preview
351c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t flushBuffers();
352c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
353c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    // API
354c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t setFormat(OMX_U32 port, OMXCameraPortParameters &cap);
355c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
356c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    // Function to get and populate caps from handle
357c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t getCaps(CameraProperties::Properties* props, OMX_HANDLETYPE handle);
358c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char* getLUTvalue_OMXtoHAL(int OMXValue, LUTtype LUT);
359c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static int getLUTvalue_HALtoOMX(const char * HalValue, LUTtype LUT);
360c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
361c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev OMX_ERRORTYPE OMXCameraAdapterEventHandler(OMX_IN OMX_HANDLETYPE hComponent,
362c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                    OMX_IN OMX_EVENTTYPE eEvent,
363c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                    OMX_IN OMX_U32 nData1,
364c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                    OMX_IN OMX_U32 nData2,
365c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                    OMX_IN OMX_PTR pEventData);
366c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
367c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev OMX_ERRORTYPE OMXCameraAdapterEmptyBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
368c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                    OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
369c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
370c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev OMX_ERRORTYPE OMXCameraAdapterFillBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
371c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                    OMX_IN OMX_BUFFERHEADERTYPE* pBuffHeader);
372c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevprotected:
373c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
374c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Parent class method implementation
375c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t takePicture();
376c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t stopImageCapture();
377c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t startBracketing(int range);
378c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t stopBracketing();
379c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t autoFocus();
380c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t cancelAutoFocus();
381c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t startSmoothZoom(int targetIdx);
382c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t stopSmoothZoom();
383c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t startVideoCapture();
384c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t stopVideoCapture();
385c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t startPreview();
386c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t stopPreview();
387c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t useBuffers(CameraMode mode, void* bufArr, int num, size_t length, unsigned int queueable);
388c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t fillThisBuffer(void* frameBuf, CameraFrame::FrameType frameType);
389c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t getFrameSize(size_t &width, size_t &height);
390c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t getPictureBufferSize(size_t &length, size_t bufferCount);
391c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t getFrameDataSize(size_t &dataFrameSize, size_t bufferCount);
392c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t startFaceDetection();
393c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual status_t stopFaceDetection();
394c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    virtual void onOrientationEvent(uint32_t orientation, uint32_t tilt);
395c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
396c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevprivate:
397c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
398c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t switchToLoaded();
399c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
400c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    OMXCameraPortParameters *getPortParams(CameraFrame::FrameType frameType);
401c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
402c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    OMX_ERRORTYPE SignalEvent(OMX_IN OMX_HANDLETYPE hComponent,
403c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                                  OMX_IN OMX_EVENTTYPE eEvent,
404c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                                  OMX_IN OMX_U32 nData1,
405c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                                  OMX_IN OMX_U32 nData2,
406c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                                  OMX_IN OMX_PTR pEventData);
4079b981b1785b6758b2dc8b147587188e5cf0d893dAkwasi Boateng    OMX_ERRORTYPE RemoveEvent(OMX_IN OMX_HANDLETYPE hComponent,
4089b981b1785b6758b2dc8b147587188e5cf0d893dAkwasi Boateng                              OMX_IN OMX_EVENTTYPE eEvent,
4099b981b1785b6758b2dc8b147587188e5cf0d893dAkwasi Boateng                              OMX_IN OMX_U32 nData1,
4109b981b1785b6758b2dc8b147587188e5cf0d893dAkwasi Boateng                              OMX_IN OMX_U32 nData2,
4119b981b1785b6758b2dc8b147587188e5cf0d893dAkwasi Boateng                              OMX_IN OMX_PTR pEventData);
412c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
413c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t RegisterForEvent(OMX_IN OMX_HANDLETYPE hComponent,
414c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                          OMX_IN OMX_EVENTTYPE eEvent,
415c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                          OMX_IN OMX_U32 nData1,
416c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                          OMX_IN OMX_U32 nData2,
417c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                          OMX_IN Semaphore &semaphore);
418c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
419c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setPictureRotation(unsigned int degree);
420c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setSensorOrientation(unsigned int degree);
421c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setImageQuality(unsigned int quality);
422c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setThumbnailParams(unsigned int width, unsigned int height, unsigned int quality);
423c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
424c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //EXIF
425c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setParametersEXIF(const CameraParameters &params,
426c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                               BaseCameraAdapter::AdapterState state);
427bea7955fe043c646d21243e9889afbfe1d671ad9Tyler Luu    status_t convertGPSCoord(double coord, int &deg, int &min, int &sec, int &secDivisor);
428c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setupEXIF();
429c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
430c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Focus functionality
431c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t doAutoFocus();
432c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t stopAutoFocus();
433c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t checkFocus(OMX_PARAM_FOCUSSTATUSTYPE *eFocusStatus);
434c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t returnFocusStatus(bool timeoutReached);
43585c859b69b3c003b8db810371e24fe41599fc7deSundar Raman    status_t getFocusMode(OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE &focusMode);
43685c859b69b3c003b8db810371e24fe41599fc7deSundar Raman
437c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
438c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Focus distances
439c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setParametersFocus(const CameraParameters &params,
440c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                BaseCameraAdapter::AdapterState state);
441c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t addFocusDistances(OMX_U32 &near,
442c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                               OMX_U32 &optimal,
443c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                               OMX_U32 &far,
444c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                               CameraParameters& params);
445c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t encodeFocusDistance(OMX_U32 dist, char *buffer, size_t length);
446c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t getFocusDistances(OMX_U32 &near,OMX_U32 &optimal, OMX_U32 &far);
447c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
448c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //VSTAB and VNF Functionality
449c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t enableVideoNoiseFilter(bool enable);
450c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t enableVideoStabilization(bool enable);
451c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
452c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Digital zoom
453c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setParametersZoom(const CameraParameters &params,
454c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                               BaseCameraAdapter::AdapterState state);
455c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t doZoom(int index);
456c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t advanceZoom();
457c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
458c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //3A related parameters
459c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setParameters3A(const CameraParameters &params,
460c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                             BaseCameraAdapter::AdapterState state);
461c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setScene(Gen3A_settings& Gen3A);
462c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
463c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Flash modes
464c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setFlashMode(Gen3A_settings& Gen3A);
465c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setFocusMode(Gen3A_settings& Gen3A);
466c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
467c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Exposure Modes
468c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setExposureMode(Gen3A_settings& Gen3A);
469c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setEVCompensation(Gen3A_settings& Gen3A);
470c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setWBMode(Gen3A_settings& Gen3A);
471c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setFlicker(Gen3A_settings& Gen3A);
472c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setBrightness(Gen3A_settings& Gen3A);
473c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setContrast(Gen3A_settings& Gen3A);
474c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setSharpness(Gen3A_settings& Gen3A);
475c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setSaturation(Gen3A_settings& Gen3A);
476c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setISO(Gen3A_settings& Gen3A);
477c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setEffect(Gen3A_settings& Gen3A);
478c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
479c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setExposureLock(Gen3A_settings& Gen3A);
480c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setWhiteBalanceLock(Gen3A_settings& Gen3A);
48180c50ac56bfa97be0cf04332ec1d314637c8770fSundar Raman    status_t set3ALock(OMX_BOOL toggle);
482708ed7306c85286aa50d05ba15e0c33106e52ed0Iliyan Malchev    status_t setMeteringAreas(Gen3A_settings& Gen3A);
483c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
484c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //API to set FrameRate using VFR interface
485c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setVFramerate(OMX_U32 minFrameRate,OMX_U32 maxFrameRate);
486c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
487c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setParametersAlgo(const CameraParameters &params,
488c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                               BaseCameraAdapter::AdapterState state);
489c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
490c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Noise filtering
491c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setNSF(OMXCameraAdapter::IPPMode mode);
492c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
493c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //LDC
494c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setLDC(OMXCameraAdapter::IPPMode mode);
495c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
496c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //GLBCE
497c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setGLBCE(OMXCameraAdapter::BrightnessMode mode);
498c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
499c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //GBCE
500c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setGBCE(OMXCameraAdapter::BrightnessMode mode);
501c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
502c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t printComponentVersion(OMX_HANDLETYPE handle);
503c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
504c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Touch AF
505708ed7306c85286aa50d05ba15e0c33106e52ed0Iliyan Malchev    status_t setTouchFocus();
506c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
507c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Face detection
508c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setParametersFD(const CameraParameters &params,
509c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                             BaseCameraAdapter::AdapterState state);
510c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t updateFocusDistances(CameraParameters &params);
511c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setFaceDetection(bool enable, OMX_U32 orientation);
512c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t detectFaces(OMX_BUFFERHEADERTYPE* pBuffHeader,
513c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                         sp<CameraFDResult> &result,
514c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                         size_t previewWidth,
515c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                         size_t previewHeight);
516c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t encodeFaceCoordinates(const OMX_FACEDETECTIONTYPE *faceData,
517c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                   camera_frame_metadata_t **pFaces,
518c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                   size_t previewWidth,
519c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                   size_t previewHeight);
520aa6e62e279cb54ae76c55ba9f8d02da230ce34e7Tyler Luu    void pauseFaceDetection(bool pause);
521c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
522c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //3A Algorithms priority configuration
523c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setAlgoPriority(AlgoPriority priority, Algorithm3A algo, bool enable);
524c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
525c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Sensor overclocking
526c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setSensorOverclock(bool enable);
527c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
528c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    // Utility methods for OMX Capabilities
529c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertCapabilities(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
530c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t encodeSizeCap(OMX_TI_CAPRESTYPE&, const CapResolution *, size_t, char *, size_t);
531c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t encodeISOCap(OMX_U32, const CapISO*, size_t, char*, size_t);
532c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static size_t encodeZoomCap(OMX_S32, const CapZoom*, size_t, char*, size_t);
533c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t encodeFramerateCap(OMX_U32, OMX_U32, const CapFramerate*, size_t, char*, size_t);
534f26e751771c0794008e466cd8f86601cf55fe572Tyler Luu    static status_t encodeVFramerateCap(OMX_TI_CAPTYPE&, const CapU32Pair*, size_t, char*, char*, size_t);
535c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t encodePixelformatCap(OMX_COLOR_FORMATTYPE,
536c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                         const CapPixelformat*,
537c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                         size_t,
538c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                         char*,
539c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                         size_t);
540c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertImageSizes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
541c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertPreviewSizes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
542c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertThumbSizes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
543c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertZoomStages(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
544c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertImageFormats(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
545c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertPreviewFormats(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
546c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertFramerates(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
547c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertVFramerates(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
548c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertEVs(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
549c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertISOModes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
550c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertIPPModes(CameraProperties::Properties*, OMX_TI_CAPTYPE &);
551c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertWBModes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
552c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertEffects(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
553c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertExpModes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
554c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertSceneModes(CameraProperties::Properties*, OMX_TI_CAPTYPE &);
555c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertFocusModes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
556c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertFlickerModes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
557c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertFlashModes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
558c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertSenMount(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
559c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertDefaults(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
560c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static status_t insertLocks(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
561708ed7306c85286aa50d05ba15e0c33106e52ed0Iliyan Malchev    static status_t insertAreas(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
562c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
563c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setParametersCapture(const CameraParameters &params,
564c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                                  BaseCameraAdapter::AdapterState state);
565c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
566c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Exposure Bracketing
567c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setExposureBracketing(int *evValues, size_t evCount, size_t frameCount);
568c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t parseExpRange(const char *rangeStr, int * expRange, size_t count, size_t &validEntries);
569c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
570c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Temporal Bracketing
571c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t doBracketing(OMX_BUFFERHEADERTYPE *pBuffHeader, CameraFrame::FrameType typeOfFrame);
572c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t sendBracketFrames();
573c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
574c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    // Image Capture Service
575c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t startImageCapture();
576c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
577c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Shutter callback notifications
578c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setShutterCallback(bool enabled);
579c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
580c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Sets eithter HQ or HS mode and the frame count
581c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setCaptureMode(OMXCameraAdapter::CaptureMode mode);
582c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t UseBuffersCapture(void* bufArr, int num);
583c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t UseBuffersPreviewData(void* bufArr, int num);
584c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
585c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Used for calculation of the average frame rate during preview
586c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t recalculateFPS();
587c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
588c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Helper method for initializing a CameFrame object
589c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t initCameraFrame(CameraFrame &frame, OMX_IN OMX_BUFFERHEADERTYPE *pBuffHeader, int typeOfFrame, OMXCameraPortParameters *port);
590c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
591c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Sends the incoming OMX buffer header to subscribers
592c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t sendFrame(CameraFrame &frame);
593c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
594c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t apply3Asettings( Gen3A_settings& Gen3A );
595024e97a1213041f9d266ee09f7148a0c9b007260Tyler Luu    status_t apply3ADefaults(Gen3A_settings &Gen3A);
596c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
597c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    // AutoConvergence
598c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setAutoConvergence(OMX_TI_AUTOCONVERGENCEMODETYPE pACMode, OMX_S32 pManualConverence);
599c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t getAutoConvergence(OMX_TI_AUTOCONVERGENCEMODETYPE *pACMode, OMX_S32 *pManualConverence);
600c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
601c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    class CommandHandler : public Thread {
602c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        public:
603c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            CommandHandler(OMXCameraAdapter* ca)
604782a084e5fec691d3985b31c3ab7be1584d879b3Iliyan Malchev                : Thread(false), mCameraAdapter(ca) { }
605c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
606c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            virtual bool threadLoop() {
607c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                bool ret;
608c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                ret = Handler();
609c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                return ret;
610c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            }
611c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
612c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            status_t put(TIUTILS::Message* msg){
613c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                return mCommandMsgQ.put(msg);
614c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            }
615c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
616c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            enum {
617c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                COMMAND_EXIT = -1,
618c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                CAMERA_START_IMAGE_CAPTURE = 0,
619c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev                CAMERA_PERFORM_AUTOFOCUS
620c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            };
621c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
622c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        private:
623c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            bool Handler();
624c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            TIUTILS::MessageQueue mCommandMsgQ;
625c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            OMXCameraAdapter* mCameraAdapter;
626c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    };
627c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    sp<CommandHandler> mCommandHandler;
628c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
629c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevpublic:
630c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
631c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    class OMXCallbackHandler : public Thread {
632c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        public:
633c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        OMXCallbackHandler(OMXCameraAdapter* ca)
634c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            : Thread(false), mCameraAdapter(ca) { }
635c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
636c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        virtual bool threadLoop() {
637c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            bool ret;
638c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            ret = Handler();
639c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            return ret;
640c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        }
641c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
642c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        status_t put(TIUTILS::Message* msg){
643c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            return mCommandMsgQ.put(msg);
644c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        }
645c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
646c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        enum {
647c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            COMMAND_EXIT = -1,
648c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev            CAMERA_FILL_BUFFER_DONE,
649c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        };
650c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
651c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    private:
652c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        bool Handler();
653c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        TIUTILS::MessageQueue mCommandMsgQ;
654c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev        OMXCameraAdapter* mCameraAdapter;
655c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    };
656c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
657c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    sp<OMXCallbackHandler> mOMXCallbackHandler;
658c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
659c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchevprivate:
660c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
661c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //AF callback
662c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    status_t setFocusCallback(bool enabled);
663c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
664c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //OMX Capabilities data
665c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const CapResolution mImageCapRes [];
666c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const CapResolution mPreviewRes [];
667c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const CapResolution mThumbRes [];
668c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const CapPixelformat mPixelformats [];
669c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const CapFramerate mFramerates [];
670c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const CapU32 mSensorNames[] ;
671c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const CapZoom mZoomStages [];
672c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const CapEVComp mEVCompRanges [];
673c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const CapISO mISOStages [];
674f26e751771c0794008e466cd8f86601cf55fe572Tyler Luu    static const CapU32Pair mVarFramerates [];
675c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
676c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    // OMX Camera defaults
677c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_ANTIBANDING[];
678c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_BRIGHTNESS[];
679c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_CONTRAST[];
680c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_EFFECT[];
681c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_EV_COMPENSATION[];
682c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_EV_STEP[];
683c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_EXPOSURE_MODE[];
684c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_FLASH_MODE[];
685edd46f9fca8856c26bb367ba2d7a29a7002ed9afSundar Raman    static const char DEFAULT_FOCUS_MODE_PREFERRED[];
686c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_FOCUS_MODE[];
687c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_FRAMERATE_RANGE[];
688c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_IPP[];
689d054c26243e4cf49e5fe04789e4437e5e0f3f574Sundar Raman    static const char DEFAULT_GBCE[];
690c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_ISO_MODE[];
691c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_JPEG_QUALITY[];
692c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_THUMBNAIL_QUALITY[];
693c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_THUMBNAIL_SIZE[];
694c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_PICTURE_FORMAT[];
695c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_PICTURE_SIZE[];
696c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_PREVIEW_FORMAT[];
697c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_FRAMERATE[];
698c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_PREVIEW_SIZE[];
699c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_NUM_PREV_BUFS[];
700c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_NUM_PIC_BUFS[];
701c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_MAX_FOCUS_AREAS[];
702c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_SATURATION[];
703c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_SCENE_MODE[];
704c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_SHARPNESS[];
705c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_VSTAB[];
706c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_WB[];
707c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_ZOOM[];
708c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_MAX_FD_HW_FACES[];
709c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_MAX_FD_SW_FACES[];
710c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_AE_LOCK[];
711c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_AWB_LOCK[];
712c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_MAX_NUM_METERING_AREAS[];
713c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_LOCK_SUPPORTED[];
714c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const char DEFAULT_LOCK_UNSUPPORTED[];
7154b85b17296d877e53a5197b2c0c8306c63839a12Sundar Raman    static const char DEFAULT_FOCAL_LENGTH[];
7164b85b17296d877e53a5197b2c0c8306c63839a12Sundar Raman    static const char DEFAULT_HOR_ANGLE[];
7174b85b17296d877e53a5197b2c0c8306c63839a12Sundar Raman    static const char DEFAULT_VER_ANGLE[];
7189919dafce4d57f0b9b9aedafc95b756464685009Tyler Luu    static const char DEFAULT_VIDEO_SNAPSHOT_SUPPORTED[];
7199919dafce4d57f0b9b9aedafc95b756464685009Tyler Luu    static const size_t MAX_FOCUS_AREAS;
720c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
721c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    OMX_VERSIONTYPE mCompRevision;
722c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
723c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //OMX Component UUID
724c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    OMX_UUIDTYPE mCompUUID;
725c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
726c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Current Focus distances
727c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    char mFocusDistNear[FOCUS_DIST_SIZE];
728c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    char mFocusDistOptimal[FOCUS_DIST_SIZE];
729c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    char mFocusDistFar[FOCUS_DIST_SIZE];
730c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    char mFocusDistBuffer[FOCUS_DIST_BUFFER_SIZE];
731c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
732c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    // Current Focus areas
733c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Vector< sp<CameraArea> > mFocusAreas;
734d55379a7e975f992db1d10bba425f456447d14a8Tyler Luu    mutable Mutex mFocusAreasLock;
735c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
736708ed7306c85286aa50d05ba15e0c33106e52ed0Iliyan Malchev    // Current Metering areas
737708ed7306c85286aa50d05ba15e0c33106e52ed0Iliyan Malchev    Vector< sp<CameraArea> > mMeteringAreas;
738708ed7306c85286aa50d05ba15e0c33106e52ed0Iliyan Malchev
739c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    CaptureMode mCapMode;
740c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    size_t mBurstFrames;
741c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    size_t mCapturedFrames;
742c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
743c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool mMeasurementEnabled;
744c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
745c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Exposure Bracketing
746c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    int mExposureBracketingValues[EXP_BRACKET_RANGE];
747c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    size_t mExposureBracketingValidEntries;
748c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
749c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    mutable Mutex mFaceDetectionLock;
750c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Face detection status
751c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool mFaceDetectionRunning;
752aa6e62e279cb54ae76c55ba9f8d02da230ce34e7Tyler Luu    bool mFaceDetectionPaused;
753c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
754c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Geo-tagging
755c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    EXIFData mEXIFData;
756c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
757c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Image post-processing
758c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    IPPMode mIPP;
759c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
760c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //jpeg Picture Quality
761c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    unsigned int mPictureQuality;
762c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
763c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //thumbnail resolution
764c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    unsigned int mThumbWidth, mThumbHeight;
765c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
766c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //thumbnail quality
767c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    unsigned int mThumbQuality;
768c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
769c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //variables holding the estimated framerate
770c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    float mFPS, mLastFPS;
771c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
772c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //automatically disable AF after a given amount of frames
773c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    unsigned int mFocusThreshold;
774c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
775c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //This is needed for the CTS tests. They falsely assume, that during
776c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //smooth zoom the current zoom stage will not change within the
777c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //zoom callback scope, which in a real world situation is not always the
778c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //case. This variable will "simulate" the expected behavior
779c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    unsigned int mZoomParameterIdx;
780c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
781c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //current zoom
782c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Mutex mZoomLock;
783c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    unsigned int mCurrentZoomIdx, mTargetZoomIdx;
784c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    int mZoomInc;
785c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool mReturnZoomStatus;
786c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    static const int32_t ZOOM_STEPS [];
787c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
788c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev     //local copy
789c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    OMX_VERSIONTYPE mLocalVersionParam;
790c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
791c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    unsigned int mPending3Asettings;
792c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Gen3A_settings mParameters3A;
793c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
79400479a8f1d791824870513b8b0b9edd67d2560ffSundar Raman    OMX_TI_CONFIG_3A_FACE_PRIORITY mFacePriority;
79500479a8f1d791824870513b8b0b9edd67d2560ffSundar Raman    OMX_TI_CONFIG_3A_REGION_PRIORITY mRegionPriority;
79600479a8f1d791824870513b8b0b9edd67d2560ffSundar Raman
797c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    CameraParameters mParams;
798c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    CameraProperties::Properties* mCapabilities;
799c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    unsigned int mPictureRotation;
800c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool mWaitingForSnapshot;
801c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    int mSnapshotCount;
802c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool mCaptureConfigured;
803c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
804c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Temporal bracketing management data
805c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    mutable Mutex mBracketingLock;
806c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool *mBracketingBuffersQueued;
807c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    int mBracketingBuffersQueuedCount;
808c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    int mLastBracetingBufferIdx;
809c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool mBracketingEnabled;
810c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    int mBracketingRange;
811c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
812c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    CameraParameters mParameters;
813c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    OMXCameraAdapterComponentContext mCameraAdapterParameters;
814c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool mFirstTimeInit;
815c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
816c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    ///Semaphores used internally
817c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Semaphore mDoAFSem;
818c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Semaphore mInitSem;
819c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Semaphore mFlushSem;
820c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Semaphore mUsePreviewDataSem;
821c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Semaphore mUsePreviewSem;
822c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Semaphore mUseCaptureSem;
823c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Semaphore mStartPreviewSem;
824c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Semaphore mStopPreviewSem;
825c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Semaphore mStartCaptureSem;
826c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Semaphore mStopCaptureSem;
827c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Semaphore mSwitchToLoadedSem;
828c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
829c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Vector<struct TIUTILS::Message *> mEventSignalQ;
830c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Mutex mEventLock;
831c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
832c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    OMX_STATETYPE mComponentState;
833c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
834c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool mVnfEnabled;
835c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool mVstabEnabled;
836c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
837c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    int mSensorOrientation;
838c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    int mDeviceOrientation;
839c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool mSensorOverclock;
840c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
841c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //Indicates if we should leave
842c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //OMX_Executing state during
843c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    //stop-/startPreview
844c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool mOMXStateSwitch;
845c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
846c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    int mFrameCount;
847c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    int mLastFrameCount;
848c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    unsigned int mIter;
849c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    nsecs_t mLastFPSTime;
850c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
851c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    int mSensorIndex;
852c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    CodingMode mCodingMode;
853c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
854c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    // Time source delta of ducati & system time
855c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    OMX_TICKS mTimeSourceDelta;
856c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool onlyOnce;
857c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
858c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    Semaphore mCaptureSem;
859c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev    bool mCaptureSignalled;
860c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
861c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev};
862c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev}; //// namespace
863c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev#endif //OMX_CAMERA_ADAPTER_H
864c322989ae6ff6769490828de1b5eda12b749cce9Iliyan Malchev
865